From d48ba1c09057976547a78d279d5598be8e93b892 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 14 Dec 2024 19:50:45 +0000 Subject: [PATCH] refactor: extract inline module tests::template --- src/tests/mod.rs | 18 +----------------- src/tests/template.rs | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 17 deletions(-) create mode 100644 src/tests/template.rs diff --git a/src/tests/mod.rs b/src/tests/mod.rs index e0557e4..8cb4175 100644 --- a/src/tests/mod.rs +++ b/src/tests/mod.rs @@ -11,23 +11,7 @@ use crate::{ mod config; mod init; - -mod template { - use super::*; - - #[test] - fn expand_should_substitute_values() { - //given - let template = "pre{param1}mid{param2}post"; - let params = HashMap::from([("param1", "-v1-"), ("param2", "-v2-")]); - - //when - let result = crate::template::expand(template, params); - - //then - assert_eq!(result, "pre-v1-mid-v2-post"); - } -} +mod template; pub(crate) mod given { use super::*; diff --git a/src/tests/template.rs b/src/tests/template.rs new file mode 100644 index 0000000..74f3519 --- /dev/null +++ b/src/tests/template.rs @@ -0,0 +1,14 @@ +use super::*; + +#[test] +fn expand_should_substitute_values() { + //given + let template = "pre{param1}mid{param2}post"; + let params = HashMap::from([("param1", "-v1-"), ("param2", "-v2-")]); + + //when + let result = crate::template::expand(template, params); + + //then + assert_eq!(result, "pre-v1-mid-v2-post"); +}