Tests: the CLI render-out test compares canonical temp paths
macOS's /var is a symlink to /private/var: the CLI resolves its working directory through current_dir(), which is canonical, so the recorded output path was /private/var/... while the test expected /var/.... Canonicalise the test's temp directory so the comparison holds on macOS.
This commit is contained in:
@@ -28,7 +28,9 @@ fn ok_json(args: &[&str]) -> Value {
|
|||||||
fn tmp(name: &str) -> PathBuf {
|
fn tmp(name: &str) -> PathBuf {
|
||||||
let d = std::env::temp_dir().join(format!("ec-cli-test-{}", std::process::id()));
|
let d = std::env::temp_dir().join(format!("ec-cli-test-{}", std::process::id()));
|
||||||
std::fs::create_dir_all(&d).unwrap();
|
std::fs::create_dir_all(&d).unwrap();
|
||||||
d.join(name)
|
// macOS's `/var` is a symlink to `/private/var`: a child process resolves its working
|
||||||
|
// directory through `current_dir()`, which is canonical, so compare canonical paths.
|
||||||
|
std::fs::canonicalize(&d).unwrap_or(d).join(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
Reference in New Issue
Block a user