From 2fc721843608bec6ed9a7e5e71e65bdff906dd28 Mon Sep 17 00:00:00 2001 From: Sam Johnson Date: Wed, 21 Jun 2023 18:13:50 -0400 Subject: [PATCH] suppress unused warning in kitchensink example (#14417) * suppress unused warning in kitchensink example * Adds test * ".git/.scripts/commands/fmt/fmt.sh" --------- Co-authored-by: Nikhil Gupta <17176722+gupnik@users.noreply.github.com> Co-authored-by: command-bot <> --- frame/examples/kitchensink/src/tests.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/frame/examples/kitchensink/src/tests.rs b/frame/examples/kitchensink/src/tests.rs index a8645bedcb7e1..9f1cdda9ea228 100644 --- a/frame/examples/kitchensink/src/tests.rs +++ b/frame/examples/kitchensink/src/tests.rs @@ -18,7 +18,7 @@ //! Tests for pallet-example-kitchensink. use crate::*; -use frame_support::{derive_impl, parameter_types, traits::ConstU64}; +use frame_support::{assert_ok, derive_impl, parameter_types, traits::ConstU64}; use sp_runtime::BuildStorage; // Reexport crate as its pallet name for construct_runtime. use crate as pallet_example_kitchensink; @@ -100,3 +100,14 @@ pub fn new_test_ext() -> sp_io::TestExternalities { .unwrap(); t.into() } + +#[test] +fn set_foo_works() { + new_test_ext().execute_with(|| { + assert_eq!(Foo::::get(), Some(24)); // From genesis config. + + let val1 = 42; + assert_ok!(Kitchensink::set_foo(RuntimeOrigin::root(), val1, 2)); + assert_eq!(Foo::::get(), Some(val1)); + }); +}