Skip to content

Commit

Permalink
Added test for specifying git command
Browse files Browse the repository at this point in the history
  • Loading branch information
CraZySacX committed Mar 28, 2023
1 parent c92dd28 commit 95e5e55
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions vergen/tests/git_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -572,4 +572,22 @@ cargo:rerun-if-env-changed=SOURCE_DATE_EPOCH
env::remove_var("VERGEN_GIT_SHA");
Ok(())
}

#[cfg(feature = "gitcl")]
#[test]
#[serial_test::serial]
fn git_cmd_override_works() -> Result<()> {
let mut stdout_buf = vec![];
let failed = EmitBuilder::builder()
.all_git()
.git_cmd(Some("git -v"))
.emit_to(&mut stdout_buf)?;
let output = String::from_utf8_lossy(&stdout_buf);
if repo_exists().is_ok() && !failed {
assert!(GIT_REGEX_INST.is_match(&output));
} else {
assert_eq!(ALL_IDEM_OUTPUT, output);
}
Ok(())
}
}

0 comments on commit 95e5e55

Please sign in to comment.