Skip to content

Commit

Permalink
test(bump): add test to test semver sorting for auto bump
Browse files Browse the repository at this point in the history
This is a failing test to reproduce issue 83.

#83
  • Loading branch information
pjvds authored and oknozor committed Jan 19, 2021
1 parent b0ef1ef commit 9685924
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/cog_bump_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,32 @@ fn auto_bump_patch_from_latest_tag() -> Result<()> {
Ok(std::env::set_current_dir(current_dir)?)
}

#[test]
#[cfg(not(tarpaulin))]
fn auto_bump_respect_semver_sorting() -> Result<()> {
let current_dir = std::env::current_dir()?;
let mut command = Command::cargo_bin("cog")?;
command.arg("bump").arg("--auto");

let temp_dir = TempDir::default();
std::env::set_current_dir(&temp_dir)?;
helper::git_init(".")?;
helper::git_commit("chore: init")?;
helper::git_commit("feat(taef): feature")?;
helper::git_commit("fix: bug fix")?;
helper::git_tag("0.9.1")?;
helper::git_commit("feat(the_fix): feature")?;
helper::git_tag("0.10.0")?;
helper::git_commit("fix: fix 1")?;
helper::git_commit("fix: fix 2")?;

command.assert().success();
assert!(temp_dir.join("CHANGELOG.md").exists());
helper::assert_tag("0.10.1")?;

Ok(std::env::set_current_dir(current_dir)?)
}

#[test]
#[cfg(not(tarpaulin))]
fn minor_bump() -> Result<()> {
Expand Down

0 comments on commit 9685924

Please sign in to comment.