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

Merge pull request #1991 from Mikadore/od_test

od: refactor tests for #1982
This commit is contained in:
Sylvestre Ledru 2021-04-01 09:50:25 +02:00 committed by GitHub
commit cc9c846032
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -21,6 +21,7 @@ static ALPHA_OUT: &'static str = "
// Test that od can read one file and dump with default format // Test that od can read one file and dump with default format
#[test] #[test]
fn test_file() { fn test_file() {
// TODO: Can this be replaced by AtPath?
use std::env; use std::env;
let temp = env::temp_dir(); let temp = env::temp_dir();
let tmpdir = Path::new(&temp); let tmpdir = Path::new(&temp);
@ -33,15 +34,12 @@ fn test_file() {
} }
} }
let result = new_ucmd!() new_ucmd!()
.arg("--endian=little") .arg("--endian=little")
.arg(file.as_os_str()) .arg(file.as_os_str())
.run(); .succeeds()
.no_stderr()
assert_empty_stderr!(result); .stdout_is(unindent(ALPHA_OUT));
assert!(result.success);
assert_eq!(result.stdout, unindent(ALPHA_OUT));
let _ = remove_file(file); let _ = remove_file(file);
} }
@ -64,16 +62,14 @@ fn test_2files() {
} }
} }
let result = new_ucmd!() new_ucmd!()
.arg("--endian=little") .arg("--endian=little")
.arg(file1.as_os_str()) .arg(file1.as_os_str())
.arg(file2.as_os_str()) .arg(file2.as_os_str())
.run(); .succeeds()
.no_stderr()
assert_empty_stderr!(result); .stdout_is(unindent(ALPHA_OUT));
assert!(result.success); // TODO: Handle errors?
assert_eq!(result.stdout, unindent(ALPHA_OUT));
let _ = remove_file(file1); let _ = remove_file(file1);
let _ = remove_file(file2); let _ = remove_file(file2);
} }
@ -85,22 +81,19 @@ fn test_no_file() {
let tmpdir = Path::new(&temp); let tmpdir = Path::new(&temp);
let file = tmpdir.join("}surely'none'would'thus'a'file'name"); let file = tmpdir.join("}surely'none'would'thus'a'file'name");
let result = new_ucmd!().arg(file.as_os_str()).run(); new_ucmd!().arg(file.as_os_str()).fails();
assert!(!result.success);
} }
// Test that od reads from stdin instead of a file // Test that od reads from stdin instead of a file
#[test] #[test]
fn test_from_stdin() { fn test_from_stdin() {
let input = "abcdefghijklmnopqrstuvwxyz\n"; let input = "abcdefghijklmnopqrstuvwxyz\n";
let result = new_ucmd!() new_ucmd!()
.arg("--endian=little") .arg("--endian=little")
.run_piped_stdin(input.as_bytes()); .run_piped_stdin(input.as_bytes())
.success()
assert_empty_stderr!(result); .no_stderr()
assert!(result.success); .stdout_is(unindent(ALPHA_OUT));
assert_eq!(result.stdout, unindent(ALPHA_OUT));
} }
// Test that od reads from stdin and also from files // Test that od reads from stdin and also from files
@ -119,40 +112,35 @@ fn test_from_mixed() {
} }
} }
let result = new_ucmd!() new_ucmd!()
.arg("--endian=little") .arg("--endian=little")
.arg(file1.as_os_str()) .arg(file1.as_os_str())
.arg("-") .arg("-")
.arg(file3.as_os_str()) .arg(file3.as_os_str())
.run_piped_stdin(data2.as_bytes()); .run_piped_stdin(data2.as_bytes())
.success()
assert_empty_stderr!(result); .no_stderr()
assert!(result.success); .stdout_is(unindent(ALPHA_OUT));
assert_eq!(result.stdout, unindent(ALPHA_OUT));
} }
#[test] #[test]
fn test_multiple_formats() { fn test_multiple_formats() {
let input = "abcdefghijklmnopqrstuvwxyz\n"; let input = "abcdefghijklmnopqrstuvwxyz\n";
let result = new_ucmd!() new_ucmd!()
.arg("-c") .arg("-c")
.arg("-b") .arg("-b")
.run_piped_stdin(input.as_bytes()); .run_piped_stdin(input.as_bytes())
.success()
assert_empty_stderr!(result); .no_stderr()
assert!(result.success); .stdout_is(unindent(
assert_eq!(
result.stdout,
unindent(
" "
0000000 a b c d e f g h i j k l m n o p 0000000 a b c d e f g h i j k l m n o p
141 142 143 144 145 146 147 150 151 152 153 154 155 156 157 160 141 142 143 144 145 146 147 150 151 152 153 154 155 156 157 160
0000020 q r s t u v w x y z \\n 0000020 q r s t u v w x y z \\n
161 162 163 164 165 166 167 170 171 172 012 161 162 163 164 165 166 167 170 171 172 012
0000033 0000033
" ",
) ));
);
} }
#[test] #[test]
@ -166,14 +154,13 @@ fn test_dec() {
0000016 0000016
", ",
); );
let result = new_ucmd!() new_ucmd!()
.arg("--endian=little") .arg("--endian=little")
.arg("-s") .arg("-s")
.run_piped_stdin(&input[..]); .run_piped_stdin(&input[..])
.success()
assert_empty_stderr!(result); .no_stderr()
assert!(result.success); .stdout_is(expected_output);
assert_eq!(result.stdout, expected_output);
} }
#[test] #[test]
@ -185,14 +172,13 @@ fn test_hex16() {
0000011 0000011
", ",
); );
let result = new_ucmd!() new_ucmd!()
.arg("--endian=little") .arg("--endian=little")
.arg("-x") .arg("-x")
.run_piped_stdin(&input[..]); .run_piped_stdin(&input[..])
.success()
assert_empty_stderr!(result); .no_stderr()
assert!(result.success); .stdout_is(expected_output);
assert_eq!(result.stdout, expected_output);
} }
#[test] #[test]
@ -204,14 +190,13 @@ fn test_hex32() {
0000011 0000011
", ",
); );
let result = new_ucmd!() new_ucmd!()
.arg("--endian=little") .arg("--endian=little")
.arg("-X") .arg("-X")
.run_piped_stdin(&input[..]); .run_piped_stdin(&input[..])
.success()
assert_empty_stderr!(result); .no_stderr()
assert!(result.success); .stdout_is(expected_output);
assert_eq!(result.stdout, expected_output);
} }
#[test] #[test]
@ -232,15 +217,14 @@ fn test_f16() {
0000016 0000016
", ",
); );
let result = new_ucmd!() new_ucmd!()
.arg("--endian=little") .arg("--endian=little")
.arg("-tf2") .arg("-tf2")
.arg("-w8") .arg("-w8")
.run_piped_stdin(&input[..]); .run_piped_stdin(&input[..])
.success()
assert_empty_stderr!(result); .no_stderr()
assert!(result.success); .stdout_is(expected_output);
assert_eq!(result.stdout, expected_output);
} }
#[test] #[test]
@ -261,14 +245,13 @@ fn test_f32() {
0000034 0000034
", ",
); );
let result = new_ucmd!() new_ucmd!()
.arg("--endian=little") .arg("--endian=little")
.arg("-f") .arg("-f")
.run_piped_stdin(&input[..]); .run_piped_stdin(&input[..])
.success()
assert_empty_stderr!(result); .no_stderr()
assert!(result.success); .stdout_is(expected_output);
assert_eq!(result.stdout, expected_output);
} }
#[test] #[test]
@ -291,36 +274,31 @@ fn test_f64() {
0000050 0000050
", ",
); );
let result = new_ucmd!() new_ucmd!()
.arg("--endian=little") .arg("--endian=little")
.arg("-F") .arg("-F")
.run_piped_stdin(&input[..]); .run_piped_stdin(&input[..])
.success()
assert_empty_stderr!(result); .no_stderr()
assert!(result.success); .stdout_is(expected_output);
assert_eq!(result.stdout, expected_output);
} }
#[test] #[test]
fn test_multibyte() { fn test_multibyte() {
let result = new_ucmd!() new_ucmd!()
.arg("-c") .arg("-c")
.arg("-w12") .arg("-w12")
.run_piped_stdin("Universität Tübingen \u{1B000}".as_bytes()); .run_piped_stdin("Universität Tübingen \u{1B000}".as_bytes())
.success()
assert_empty_stderr!(result); .no_stderr()
assert!(result.success); .stdout_is(unindent(
assert_eq!(
result.stdout,
unindent(
" "
0000000 U n i v e r s i t ä ** t 0000000 U n i v e r s i t ä ** t
0000014 T ü ** b i n g e n \u{1B000} 0000014 T ü ** b i n g e n \u{1B000}
0000030 ** ** ** 0000030 ** ** **
0000033 0000033
" ",
) ));
);
} }
#[test] #[test]
@ -334,11 +312,13 @@ fn test_width() {
", ",
); );
let result = new_ucmd!().arg("-w4").arg("-v").run_piped_stdin(&input[..]); new_ucmd!()
.arg("-w4")
assert_empty_stderr!(result); .arg("-v")
assert!(result.success); .run_piped_stdin(&input[..])
assert_eq!(result.stdout, expected_output); .success()
.no_stderr()
.stdout_is(expected_output);
} }
#[test] #[test]
@ -352,14 +332,13 @@ fn test_invalid_width() {
", ",
); );
let result = new_ucmd!().arg("-w5").arg("-v").run_piped_stdin(&input[..]); new_ucmd!()
.arg("-w5")
assert_eq!( .arg("-v")
result.stderr, .run_piped_stdin(&input[..])
"od: warning: invalid width 5; using 2 instead\n" .success()
); .stderr_is_bytes("od: warning: invalid width 5; using 2 instead\n".as_bytes())
assert!(result.success); .stdout_is(expected_output);
assert_eq!(result.stdout, expected_output);
} }
#[test] #[test]
@ -373,14 +352,13 @@ fn test_zero_width() {
", ",
); );
let result = new_ucmd!().arg("-w0").arg("-v").run_piped_stdin(&input[..]); new_ucmd!()
.arg("-w0")
assert_eq!( .arg("-v")
result.stderr, .run_piped_stdin(&input[..])
"od: warning: invalid width 0; using 2 instead\n" .success()
); .stderr_is_bytes("od: warning: invalid width 0; using 2 instead\n".as_bytes())
assert!(result.success); .stdout_is(expected_output);
assert_eq!(result.stdout, expected_output);
} }
#[test] #[test]
@ -392,11 +370,12 @@ fn test_width_without_value() {
0000050 0000050
"); ");
let result = new_ucmd!().arg("-w").run_piped_stdin(&input[..]); new_ucmd!()
.arg("-w")
assert_empty_stderr!(result); .run_piped_stdin(&input[..])
assert!(result.success); .success()
assert_eq!(result.stdout, expected_output); .no_stderr()
.stdout_is(expected_output);
} }
#[test] #[test]
@ -421,15 +400,14 @@ fn test_suppress_duplicates() {
", ",
); );
let result = new_ucmd!() new_ucmd!()
.arg("-w4") .arg("-w4")
.arg("-O") .arg("-O")
.arg("-x") .arg("-x")
.run_piped_stdin(&input[..]); .run_piped_stdin(&input[..])
.no_stderr()
assert_empty_stderr!(result); .success()
assert!(result.success); .stdout_is(expected_output);
assert_eq!(result.stdout, expected_output);
} }
#[test] #[test]
@ -446,17 +424,16 @@ fn test_big_endian() {
", ",
); );
let result = new_ucmd!() new_ucmd!()
.arg("--endian=big") .arg("--endian=big")
.arg("-F") .arg("-F")
.arg("-f") .arg("-f")
.arg("-X") .arg("-X")
.arg("-x") .arg("-x")
.run_piped_stdin(&input[..]); .run_piped_stdin(&input[..])
.no_stderr()
assert_empty_stderr!(result); .success()
assert!(result.success); .stdout_is(expected_output);
assert_eq!(result.stdout, expected_output);
} }
#[test] #[test]
@ -474,16 +451,15 @@ fn test_alignment_Xxa() {
); );
// in this case the width of the -a (8-bit) determines the alignment for the other fields // in this case the width of the -a (8-bit) determines the alignment for the other fields
let result = new_ucmd!() new_ucmd!()
.arg("--endian=little") .arg("--endian=little")
.arg("-X") .arg("-X")
.arg("-x") .arg("-x")
.arg("-a") .arg("-a")
.run_piped_stdin(&input[..]); .run_piped_stdin(&input[..])
.no_stderr()
assert_empty_stderr!(result); .success()
assert!(result.success); .stdout_is(expected_output);
assert_eq!(result.stdout, expected_output);
} }
#[test] #[test]
@ -500,15 +476,14 @@ fn test_alignment_Fx() {
); );
// in this case the width of the -F (64-bit) determines the alignment for the other field // in this case the width of the -F (64-bit) determines the alignment for the other field
let result = new_ucmd!() new_ucmd!()
.arg("--endian=little") .arg("--endian=little")
.arg("-F") .arg("-F")
.arg("-x") .arg("-x")
.run_piped_stdin(&input[..]); .run_piped_stdin(&input[..])
.no_stderr()
assert_empty_stderr!(result); .success()
assert!(result.success); .stdout_is(expected_output);
assert_eq!(result.stdout, expected_output);
} }
#[test] #[test]
@ -528,16 +503,15 @@ fn test_maxuint() {
", ",
); );
let result = new_ucmd!() new_ucmd!()
.arg("--format=o8") .arg("--format=o8")
.arg("-Oobtu8") .arg("-Oobtu8")
.arg("-Dd") .arg("-Dd")
.arg("--format=u1") .arg("--format=u1")
.run_piped_stdin(&input[..]); .run_piped_stdin(&input[..])
.no_stderr()
assert_empty_stderr!(result); .success()
assert!(result.success); .stdout_is(expected_output);
assert_eq!(result.stdout, expected_output);
} }
#[test] #[test]
@ -553,15 +527,14 @@ fn test_hex_offset() {
", ",
); );
let result = new_ucmd!() new_ucmd!()
.arg("-Ax") .arg("-Ax")
.arg("-X") .arg("-X")
.arg("-X") .arg("-X")
.run_piped_stdin(&input[..]); .run_piped_stdin(&input[..])
.no_stderr()
assert_empty_stderr!(result); .success()
assert!(result.success); .stdout_is(expected_output);
assert_eq!(result.stdout, expected_output);
} }
#[test] #[test]
@ -577,15 +550,14 @@ fn test_dec_offset() {
", ",
); );
let result = new_ucmd!() new_ucmd!()
.arg("-Ad") .arg("-Ad")
.arg("-X") .arg("-X")
.arg("-X") .arg("-X")
.run_piped_stdin(&input[..]); .run_piped_stdin(&input[..])
.no_stderr()
assert_empty_stderr!(result); .success()
assert!(result.success); .stdout_is(expected_output);
assert_eq!(result.stdout, expected_output);
} }
#[test] #[test]
@ -594,66 +566,57 @@ fn test_no_offset() {
const LINE: &'static str = " 00000000 00000000 00000000 00000000\n"; const LINE: &'static str = " 00000000 00000000 00000000 00000000\n";
let expected_output = [LINE, LINE, LINE, LINE].join(""); let expected_output = [LINE, LINE, LINE, LINE].join("");
let result = new_ucmd!() new_ucmd!()
.arg("-An") .arg("-An")
.arg("-X") .arg("-X")
.arg("-X") .arg("-X")
.run_piped_stdin(&input[..]); .run_piped_stdin(&input[..])
.no_stderr()
assert_empty_stderr!(result); .success()
assert!(result.success); .stdout_is(expected_output);
assert_eq!(result.stdout, expected_output);
} }
#[test] #[test]
fn test_invalid_offset() { fn test_invalid_offset() {
let result = new_ucmd!().arg("-Ab").run(); new_ucmd!().arg("-Ab").fails();
assert!(!result.success);
} }
#[test] #[test]
fn test_skip_bytes() { fn test_skip_bytes() {
let input = "abcdefghijklmnopq"; let input = "abcdefghijklmnopq";
let result = new_ucmd!() new_ucmd!()
.arg("-c") .arg("-c")
.arg("--skip-bytes=5") .arg("--skip-bytes=5")
.run_piped_stdin(input.as_bytes()); .run_piped_stdin(input.as_bytes())
.no_stderr()
assert_empty_stderr!(result); .success()
assert!(result.success); .stdout_is(unindent(
assert_eq!(
result.stdout,
unindent(
" "
0000005 f g h i j k l m n o p q 0000005 f g h i j k l m n o p q
0000021 0000021
" ",
) ));
);
} }
#[test] #[test]
fn test_skip_bytes_error() { fn test_skip_bytes_error() {
let input = "12345"; let input = "12345";
let result = new_ucmd!() new_ucmd!()
.arg("--skip-bytes=10") .arg("--skip-bytes=10")
.run_piped_stdin(input.as_bytes()); .run_piped_stdin(input.as_bytes())
.failure();
assert!(!result.success);
} }
#[test] #[test]
fn test_read_bytes() { fn test_read_bytes() {
let input = "abcdefghijklmnopqrstuvwxyz\n12345678"; let input = "abcdefghijklmnopqrstuvwxyz\n12345678";
let result = new_ucmd!() new_ucmd!()
.arg("--endian=little") .arg("--endian=little")
.arg("--read-bytes=27") .arg("--read-bytes=27")
.run_piped_stdin(input.as_bytes()); .run_piped_stdin(input.as_bytes())
.no_stderr()
assert_empty_stderr!(result); .success()
assert!(result.success); .stdout_is(unindent(ALPHA_OUT));
assert_eq!(result.stdout, unindent(ALPHA_OUT));
} }
#[test] #[test]
@ -662,13 +625,12 @@ fn test_ascii_dump() {
0x00, 0x01, 0x0a, 0x0d, 0x10, 0x1f, 0x20, 0x61, 0x62, 0x63, 0x7d, 0x7e, 0x7f, 0x80, 0x90, 0x00, 0x01, 0x0a, 0x0d, 0x10, 0x1f, 0x20, 0x61, 0x62, 0x63, 0x7d, 0x7e, 0x7f, 0x80, 0x90,
0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0, 0xff, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0, 0xff,
]; ];
let result = new_ucmd!().arg("-tx1zacz").run_piped_stdin(&input[..]); new_ucmd!()
.arg("-tx1zacz")
assert_empty_stderr!(result); .run_piped_stdin(&input[..])
assert!(result.success); .no_stderr()
assert_eq!( .success()
result.stdout, .stdout_is(unindent(
unindent(
r" r"
0000000 00 01 0a 0d 10 1f 20 61 62 63 7d 7e 7f 80 90 a0 >...... abc}~....< 0000000 00 01 0a 0d 10 1f 20 61 62 63 7d 7e 7f 80 90 a0 >...... abc}~....<
nul soh nl cr dle us sp a b c } ~ del nul dle sp nul soh nl cr dle us sp a b c } ~ del nul dle sp
@ -677,9 +639,8 @@ fn test_ascii_dump() {
0 @ P ` p del 0 @ P ` p del
** 300 320 340 360 377 >......< ** 300 320 340 360 377 >......<
0000026 0000026
" ",
) ));
);
} }
#[test] #[test]
@ -687,159 +648,136 @@ fn test_filename_parsing() {
// files "a" and "x" both exists, but are no filenames in the commandline below // files "a" and "x" both exists, but are no filenames in the commandline below
// "-f" must be treated as a filename, it contains the text: minus lowercase f // "-f" must be treated as a filename, it contains the text: minus lowercase f
// so "-f" should not be interpreted as a formatting option. // so "-f" should not be interpreted as a formatting option.
let result = new_ucmd!() new_ucmd!()
.arg("--format") .arg("--format")
.arg("a") .arg("a")
.arg("-A") .arg("-A")
.arg("x") .arg("x")
.arg("--") .arg("--")
.arg("-f") .arg("-f")
.run(); .succeeds()
.no_stderr()
assert_empty_stderr!(result); .stdout_is(unindent(
assert!(result.success);
assert_eq!(
result.stdout,
unindent(
" "
000000 m i n u s sp l o w e r c a s e sp 000000 m i n u s sp l o w e r c a s e sp
000010 f nl 000010 f nl
000012 000012
" ",
) ));
);
} }
#[test] #[test]
fn test_stdin_offset() { fn test_stdin_offset() {
let input = "abcdefghijklmnopq"; let input = "abcdefghijklmnopq";
let result = new_ucmd!() new_ucmd!()
.arg("-c") .arg("-c")
.arg("+5") .arg("+5")
.run_piped_stdin(input.as_bytes()); .run_piped_stdin(input.as_bytes())
.no_stderr()
assert_empty_stderr!(result); .success()
assert!(result.success); .stdout_is(unindent(
assert_eq!(
result.stdout,
unindent(
" "
0000005 f g h i j k l m n o p q 0000005 f g h i j k l m n o p q
0000021 0000021
" ",
) ));
);
} }
#[test] #[test]
fn test_file_offset() { fn test_file_offset() {
let result = new_ucmd!().arg("-c").arg("--").arg("-f").arg("10").run(); new_ucmd!()
.arg("-c")
assert_empty_stderr!(result); .arg("--")
assert!(result.success); .arg("-f")
assert_eq!( .arg("10")
result.stdout, .succeeds()
unindent( .no_stderr()
.stdout_is(unindent(
r" r"
0000010 w e r c a s e f \n 0000010 w e r c a s e f \n
0000022 0000022
" ",
) ));
);
} }
#[test] #[test]
fn test_traditional() { fn test_traditional() {
// note gnu od does not align both lines // note gnu od does not align both lines
let input = "abcdefghijklmnopq"; let input = "abcdefghijklmnopq";
let result = new_ucmd!() new_ucmd!()
.arg("--traditional") .arg("--traditional")
.arg("-a") .arg("-a")
.arg("-c") .arg("-c")
.arg("-") .arg("-")
.arg("10") .arg("10")
.arg("0") .arg("0")
.run_piped_stdin(input.as_bytes()); .run_piped_stdin(input.as_bytes())
.no_stderr()
assert_empty_stderr!(result); .success()
assert!(result.success); .stdout_is(unindent(
assert_eq!(
result.stdout,
unindent(
r" r"
0000010 (0000000) i j k l m n o p q 0000010 (0000000) i j k l m n o p q
i j k l m n o p q i j k l m n o p q
0000021 (0000011) 0000021 (0000011)
" ",
) ));
);
} }
#[test] #[test]
fn test_traditional_with_skip_bytes_override() { fn test_traditional_with_skip_bytes_override() {
// --skip-bytes is ignored in this case // --skip-bytes is ignored in this case
let input = "abcdefghijklmnop"; let input = "abcdefghijklmnop";
let result = new_ucmd!() new_ucmd!()
.arg("--traditional") .arg("--traditional")
.arg("--skip-bytes=10") .arg("--skip-bytes=10")
.arg("-c") .arg("-c")
.arg("0") .arg("0")
.run_piped_stdin(input.as_bytes()); .run_piped_stdin(input.as_bytes())
.no_stderr()
assert_empty_stderr!(result); .success()
assert!(result.success); .stdout_is(unindent(
assert_eq!(
result.stdout,
unindent(
r" r"
0000000 a b c d e f g h i j k l m n o p 0000000 a b c d e f g h i j k l m n o p
0000020 0000020
" ",
) ));
);
} }
#[test] #[test]
fn test_traditional_with_skip_bytes_non_override() { fn test_traditional_with_skip_bytes_non_override() {
// no offset specified in the traditional way, so --skip-bytes is used // no offset specified in the traditional way, so --skip-bytes is used
let input = "abcdefghijklmnop"; let input = "abcdefghijklmnop";
let result = new_ucmd!() new_ucmd!()
.arg("--traditional") .arg("--traditional")
.arg("--skip-bytes=10") .arg("--skip-bytes=10")
.arg("-c") .arg("-c")
.run_piped_stdin(input.as_bytes()); .run_piped_stdin(input.as_bytes())
.no_stderr()
assert_empty_stderr!(result); .success()
assert!(result.success); .stdout_is(unindent(
assert_eq!(
result.stdout,
unindent(
r" r"
0000012 k l m n o p 0000012 k l m n o p
0000020 0000020
" ",
) ));
);
} }
#[test] #[test]
fn test_traditional_error() { fn test_traditional_error() {
// file "0" exists - don't fail on that, but --traditional only accepts a single input // file "0" exists - don't fail on that, but --traditional only accepts a single input
let result = new_ucmd!() new_ucmd!()
.arg("--traditional") .arg("--traditional")
.arg("0") .arg("0")
.arg("0") .arg("0")
.arg("0") .arg("0")
.arg("0") .arg("0")
.run(); .fails();
assert!(!result.success);
} }
#[test] #[test]
fn test_traditional_only_label() { fn test_traditional_only_label() {
let input = "abcdefghijklmnopqrstuvwxyz"; let input = "abcdefghijklmnopqrstuvwxyz";
let result = new_ucmd!() new_ucmd!()
.arg("-An") .arg("-An")
.arg("--traditional") .arg("--traditional")
.arg("-a") .arg("-a")
@ -847,20 +785,16 @@ fn test_traditional_only_label() {
.arg("-") .arg("-")
.arg("10") .arg("10")
.arg("0x10") .arg("0x10")
.run_piped_stdin(input.as_bytes()); .run_piped_stdin(input.as_bytes())
.no_stderr()
assert_empty_stderr!(result); .success()
assert!(result.success); .stdout_is(unindent(
assert_eq!(
result.stdout,
unindent(
r" r"
(0000020) i j k l m n o p q r s t u v w x (0000020) i j k l m n o p q r s t u v w x
i j k l m n o p q r s t u v w x i j k l m n o p q r s t u v w x
(0000040) y z (0000040) y z
y z y z
(0000042) (0000042)
" ",
) ));
);
} }