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

od: fix zero width user input (-w0)

This commit is contained in:
Wim Hueskes 2016-08-23 22:55:40 +02:00
parent 92fc286b0e
commit 184c4af76d
2 changed files with 19 additions and 2 deletions

View file

@ -292,6 +292,23 @@ fn test_invalid_width(){
assert_eq!(result.stdout, expected_output);
}
#[test]
fn test_zero_width(){
let input : [u8; 4] = [0x00, 0x00, 0x00, 0x00];
let expected_output = unindent("
0000000 000000
0000002 000000
0000004
");
let result = new_ucmd!().arg("-w0").arg("-v").run_piped_stdin(&input[..]);
assert_eq!(result.stderr, "od: warning: invalid width 0; using 2 instead\n");
assert!(result.success);
assert_eq!(result.stdout, expected_output);
}
#[test]
fn test_width_without_value(){