1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

tests: fix tests that were failing on OS X

This commit is contained in:
Arcterus 2016-01-10 00:09:05 -08:00
parent 27c77db122
commit d9ad0b185a
6 changed files with 20 additions and 13 deletions

View file

@ -53,6 +53,16 @@ pub struct CmdResult {
pub stderr: String,
}
#[cfg(target_os = "macos")]
pub fn trim_private(input: &str) -> &str {
input.trim_left_matches("/private")
}
#[cfg(not(target_os = "macos"))]
pub fn trim_private(input: &str) -> &str {
input
}
pub fn log_info<T: AsRef<str>, U: AsRef<str>>(msg: T, par: U) {
println!("{}: {}", msg.as_ref(), par.as_ref());
}

View file

@ -12,5 +12,5 @@ fn test_default() {
let out = ucmd.run().stdout;
let expected = at.root_dir();
assert_eq!(out.trim_right(), expected);
assert_eq!(trim_private(out.trim_right()), expected);
}

View file

@ -16,7 +16,7 @@ fn test_canonicalize() {
.run()
.stdout;
assert_eq!(out.trim_right(), at.root_dir());
assert_eq!(trim_private(out.trim_right()), at.root_dir());
}
#[test]
@ -27,7 +27,7 @@ fn test_canonicalize_existing() {
.run()
.stdout;
assert_eq!(out.trim_right(), at.root_dir());
assert_eq!(trim_private(out.trim_right()), at.root_dir());
}
#[test]
@ -42,7 +42,7 @@ fn test_canonicalize_missing() {
.run()
.stdout;
assert_eq!(out.trim_right(), expected);
assert_eq!(trim_private(out.trim_right()), expected);
}
#[test]
@ -56,7 +56,7 @@ fn test_long_redirection_to_current_dir() {
.run()
.stdout;
assert_eq!(out, at.root_dir());
assert_eq!(trim_private(&out), at.root_dir());
}
#[test]

View file

@ -10,7 +10,7 @@ fn test_current_directory() {
let (at, mut ucmd) = testing(UTIL_NAME);
let out = ucmd.arg(".").run().stdout;
assert_eq!(out.trim_right(), at.root_dir());
assert_eq!(trim_private(out.trim_right()), at.root_dir());
}
#[test]
@ -20,7 +20,7 @@ fn test_long_redirection_to_current_dir() {
let dir = repeat_str("./", 128);
let out = ucmd.arg(dir).run().stdout;
assert_eq!(out.trim_right(), at.root_dir());
assert_eq!(trim_private(out.trim_right()), at.root_dir());
}
#[test]