Skip to content

Commit 9adaebd

Browse files
committed
fix redact: canonicalize on unix only, JSON-escape on Windows
1 parent 4e1fd17 commit 9adaebd

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

  • crates/bough-cli-tests/src

crates/bough-cli-tests/src/lib.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,14 @@ fn strip_ansi(s: &str) -> String {
3636

3737
fn redact(s: &str, fixture: &Fixture) -> String {
3838
let stripped = strip_ansi(s);
39-
let fixture_path = fixture.path().to_string_lossy().into_owned();
39+
// On macOS, /var is a symlink to /private/var — canonicalize to match bough output.
40+
// On Windows, canonicalize expands 8.3 short names (RUNNER~1 → runneradmin) which
41+
// diverges from what bough sees via current_dir(), so we skip it.
42+
#[cfg(unix)]
43+
let base = fixture.path().canonicalize().unwrap_or_else(|_| fixture.path().to_path_buf());
44+
#[cfg(not(unix))]
45+
let base = fixture.path().to_path_buf();
46+
let fixture_path = base.to_string_lossy().into_owned();
4047
// Generate variants to handle OS path separator differences in output
4148
let tmp_json = fixture_path.replace('\\', "\\\\");
4249
let tmp_fwd = fixture_path.replace('\\', "/");

0 commit comments

Comments
 (0)