refactor: extract inline module tests::template
Some checks failed
Test / build (map[name:nightly]) (push) Successful in 2m6s
Test / build (map[name:stable]) (push) Successful in 2m10s
Release Please / Release-plz (push) Failing after 20s

This commit is contained in:
Paul Campbell 2024-12-14 19:50:45 +00:00
parent 9db75b81c0
commit d48ba1c090
2 changed files with 15 additions and 17 deletions

View file

@ -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::*;

14
src/tests/template.rs Normal file
View file

@ -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");
}