Skip to content

Commit

Permalink
Fixed broken tests (#389)
Browse files Browse the repository at this point in the history
  • Loading branch information
CraZySacX authored Dec 4, 2024
1 parent 063bd1f commit e242196
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 13 deletions.
6 changes: 4 additions & 2 deletions vergen-git2/tests/git_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,10 @@ cargo:rerun-if-env-changed=SOURCE_DATE_EPOCH";
}

#[cfg(any(target_os = "linux", target_os = "macos"))]
fn check_local_result(result: Result<bool>, _stdout_buf: &[u8]) {
assert!(result.is_err());
fn check_local_result(result: Result<bool>, stdout_buf: &[u8]) {
assert!(result.is_ok());
let output = String::from_utf8_lossy(stdout_buf);
assert!(GIT_REGEX_SHORT_INST.is_match(&output));
}

#[test]
Expand Down
6 changes: 4 additions & 2 deletions vergen-gitcl/tests/git_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,10 @@ cargo:rerun-if-env-changed=SOURCE_DATE_EPOCH";
}

#[cfg(any(target_os = "linux", target_os = "macos"))]
fn check_local_result(result: Result<bool>, _stdout_buf: &[u8]) {
assert!(result.is_err());
fn check_local_result(result: Result<bool>, stdout_buf: &[u8]) {
assert!(result.is_ok());
let output = String::from_utf8_lossy(stdout_buf);
assert!(GIT_REGEX_SHORT_INST.is_match(&output));
}

#[test]
Expand Down
9 changes: 6 additions & 3 deletions vergen-gix/src/gix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -818,10 +818,13 @@ mod test {
.commit_date(true)
.use_local(true)
.build()?;
assert!(Emitter::default()
let emitter = Emitter::default()
.fail_on_error()
.add_instructions(&gix)
.is_err());
.add_instructions(&gix)?
.test_emit();
assert_eq!(1, emitter.cargo_rustc_env_map().len());
assert_eq!(0, count_idempotent(emitter.cargo_rustc_env_map()));
assert_eq!(0, emitter.cargo_warning().len());
Ok(())
}

Expand Down
6 changes: 4 additions & 2 deletions vergen-gix/tests/git_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,10 @@ cargo:rerun-if-env-changed=SOURCE_DATE_EPOCH";
}

#[cfg(any(target_os = "linux", target_os = "macos"))]
fn check_local_result(result: Result<bool>, _stdout_buf: &[u8]) {
assert!(result.is_err());
fn check_local_result(result: Result<bool>, stdout_buf: &[u8]) {
assert!(result.is_ok());
let output = String::from_utf8_lossy(stdout_buf);
assert!(GIT_REGEX_SHORT_INST.is_match(&output));
}

#[test]
Expand Down
8 changes: 4 additions & 4 deletions vergen/src/feature/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,8 @@ mod test {
.build()?;
let emitter = Emitter::new().add_instructions(&build)?.test_emit();
assert_eq!(1, emitter.cargo_rustc_env_map().len());
assert_eq!(1, count_idempotent(emitter.cargo_rustc_env_map()));
assert_eq!(1, emitter.cargo_warning().len());
assert_eq!(0, count_idempotent(emitter.cargo_rustc_env_map()));
assert_eq!(0, emitter.cargo_warning().len());
Ok(())
}

Expand Down Expand Up @@ -438,8 +438,8 @@ mod test {
.build()?;
let emitter = Emitter::new().add_instructions(&build)?.test_emit();
assert_eq!(1, emitter.cargo_rustc_env_map().len());
assert_eq!(1, count_idempotent(emitter.cargo_rustc_env_map()));
assert_eq!(1, emitter.cargo_warning().len());
assert_eq!(0, count_idempotent(emitter.cargo_rustc_env_map()));
assert_eq!(0, emitter.cargo_warning().len());
Ok(())
}

Expand Down

0 comments on commit e242196

Please sign in to comment.