1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 19:17:43 +00:00

tests ~ fix CICD 'linux' test variations (whitespace variations)

This commit is contained in:
Roy Ivy III 2020-01-01 23:07:25 +00:00
parent bcc1cc0326
commit 6adddcf9e9
2 changed files with 32 additions and 6 deletions

View file

@ -36,14 +36,32 @@ fn test_long_format() {
#[cfg(target_os = "linux")]
#[test]
fn test_short_format() {
let scene = TestScenario::new(util_name!());
fn test_short_format_i() {
// allow whitespace variation
// * minor whitespace differences occur between platform built-in outputs; specifically, the number of trailing TABs may be variant
let args = ["-i"];
scene.ucmd().args(&args).run().stdout_is(expected_result(&args));
let actual = TestScenario::new(util_name!()).ucmd().args(&args).run().stdout;
let expect = expected_result(&args);
println!("actual: {:?}", actual);
println!("expect: {:?}", expect);
let v_actual: Vec<&str> = actual.split_whitespace().collect();
let v_expect: Vec<&str> = expect.split_whitespace().collect();
assert_eq!(v_actual, v_expect);
}
#[cfg(target_os = "linux")]
#[test]
fn test_short_format_q() {
// allow whitespace variation
// * minor whitespace differences occur between platform built-in outputs; specifically, the number of trailing TABs may be variant
let args = ["-q"];
scene.ucmd().args(&args).run().stdout_is(expected_result(&args));
let actual = TestScenario::new(util_name!()).ucmd().args(&args).run().stdout;
let expect = expected_result(&args);
println!("actual: {:?}", actual);
println!("expect: {:?}", expect);
let v_actual: Vec<&str> = actual.split_whitespace().collect();
let v_expect: Vec<&str> = expect.split_whitespace().collect();
assert_eq!(v_actual, v_expect);
}
#[cfg(target_os = "linux")]

View file

@ -22,7 +22,15 @@ fn test_boot() {
#[test]
fn test_heading() {
for opt in vec!["-H"] {
new_ucmd!().arg(opt).run().stdout_is(expected_result(opt));
// allow whitespace variation
// * minor whitespace differences occur between platform built-in outputs; specfically number of TABs between "TIME" and "COMMENT" may be variant
let actual = new_ucmd!().arg(opt).run().stdout;
let expect = expected_result(opt);
println!("actual: {:?}", actual);
println!("expect: {:?}", expect);
let v_actual: Vec<&str> = actual.split_whitespace().collect();
let v_expect: Vec<&str> = expect.split_whitespace().collect();
assert_eq!(v_actual, v_expect);
}
}