refactor: extract inline module tests::template
This commit is contained in:
parent
9db75b81c0
commit
d48ba1c090
2 changed files with 15 additions and 17 deletions
|
@ -11,23 +11,7 @@ use crate::{
|
||||||
|
|
||||||
mod config;
|
mod config;
|
||||||
mod init;
|
mod init;
|
||||||
|
mod template;
|
||||||
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");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) mod given {
|
pub(crate) mod given {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
14
src/tests/template.rs
Normal file
14
src/tests/template.rs
Normal 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");
|
||||||
|
}
|
Loading…
Reference in a new issue