Skip to content

Commit

Permalink
test(config): add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
orhun committed Jul 9, 2021
1 parent 9984abf commit 11a7a7e
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions git-cliff-core/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,26 @@ impl Config {
Ok(config.try_into()?)
}
}

#[cfg(test)]
mod test {
use super::*;
use pretty_assertions::assert_eq;
use std::env;
use std::path::PathBuf;
#[test]
fn parse_config() -> Result<()> {
let file_name = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.parent()
.unwrap()
.to_path_buf()
.join("cliff.toml")
.to_str()
.unwrap()
.to_string();
env::set_var("CLIFF_CHANGELOG_FOOTER", "test");
let config = Config::parse(file_name)?;
assert_eq!("test", config.changelog.footer.unwrap());
Ok(())
}
}

0 comments on commit 11a7a7e

Please sign in to comment.