Skip to content

Commit

Permalink
test(git): update repository tests about getting the latest tag
Browse files Browse the repository at this point in the history
  • Loading branch information
orhun committed Jul 9, 2021
1 parent 11a7a7e commit 9cf9ac1
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions git-cliff-core/src/repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,19 @@ mod test {
.to_string())
}

fn get_last_tag() -> Result<String> {
Ok(str::from_utf8(
Command::new("git")
.args(&["describe", "--abbrev=0"])
.output()?
.stdout
.as_ref(),
)
.unwrap()
.trim()
.to_string())
}

#[test]
fn git_log() -> Result<()> {
let repository = Repository::init(
Expand All @@ -125,6 +138,8 @@ mod test {
}
}
}
let tags = repository.tags(&None)?;
assert_eq!(&get_last_tag()?, tags.last().unwrap().1);
Ok(())
}
}

0 comments on commit 9cf9ac1

Please sign in to comment.