diff --git a/git-cliff-core/src/config.rs b/git-cliff-core/src/config.rs index 0b1da5ae22..15abb5281e 100644 --- a/git-cliff-core/src/config.rs +++ b/git-cliff-core/src/config.rs @@ -166,9 +166,29 @@ mod test { .to_path_buf() .join("config") .join(crate::DEFAULT_CONFIG); - env::set_var("CLIFF_GIT__CHANGELOG__FOOTER", "test"); + + const FOOTER_VALUE: &str = "test"; + const TAG_PATTERN_VALUE: &str = "*[0-9]*"; + const IGNORE_TAGS_VALUE: &str = "v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+"; + + env::set_var("CLIFF_GIT__CHANGELOG__FOOTER", FOOTER_VALUE); + env::set_var("CLIFF_GIT__GIT__TAG_PATTERN", TAG_PATTERN_VALUE); + env::set_var("CLIFF_GIT__GIT__IGNORE_TAGS", IGNORE_TAGS_VALUE); + let config = Config::parse(&path)?; - assert_eq!(Some(String::from("test")), config.changelog.footer); + + assert_eq!(Some(String::from(FOOTER_VALUE)), config.changelog.footer); + assert_eq!( + Some(String::from(TAG_PATTERN_VALUE)), + config.git.tag_pattern + ); + assert_eq!( + Some(String::from(IGNORE_TAGS_VALUE)), + config + .git + .ignore_tags + .map(|ignore_tags| ignore_tags.to_string()) + ); Ok(()) } }