From 0851355d6a71aa8394e904b3e3b07948eea562bf Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Fri, 3 May 2024 12:50:20 +0200 Subject: [PATCH] Add execute template --- docs-test-gen/src/main.rs | 1 + docs-test-gen/templates/execute.tpl | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 docs-test-gen/templates/execute.tpl diff --git a/docs-test-gen/src/main.rs b/docs-test-gen/src/main.rs index df62bc82..8f99a2c6 100644 --- a/docs-test-gen/src/main.rs +++ b/docs-test-gen/src/main.rs @@ -7,6 +7,7 @@ use strum::{EnumIter, IntoEnumIterator}; static TEMPLATES: phf::Map<&'static str, &'static str> = phf_map! { "core" => include_str!("../templates/core.tpl"), + "execute" => include_str!("../templates/execute.tpl"), }; fn is_goey(fence: &str) -> bool { diff --git a/docs-test-gen/templates/execute.tpl b/docs-test-gen/templates/execute.tpl new file mode 100644 index 00000000..b6059bd0 --- /dev/null +++ b/docs-test-gen/templates/execute.tpl @@ -0,0 +1,22 @@ +use cosmwasm_std::*; +use cosmwasm_schema::cw_serde; + +#[cw_serde] +struct ExecuteMsg {} + +#[entry_point] +pub fn execute(deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg) -> StdResult { + {{code}} +} + +#[test] +fn doctest() { + use cosmwasm_std::testing::*; + + let mut deps = mock_dependencies(); + let env = mock_env(); + let info = mock_info("sender", &[]); + let msg = ExecuteMsg {}; + + let res = execute(deps.as_mut(), env, info, msg).unwrap(); +}