mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
hashsum: add tests for Windows text mode
This commit is contained in:
parent
3e458f524c
commit
cd5f676903
1 changed files with 24 additions and 0 deletions
|
@ -38,6 +38,30 @@ macro_rules! test_digest {
|
||||||
.no_stderr()
|
.no_stderr()
|
||||||
.stdout_is("input.txt: OK\n");
|
.stdout_is("input.txt: OK\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(windows)]
|
||||||
|
#[test]
|
||||||
|
fn test_text_mode() {
|
||||||
|
// TODO Replace this with hard-coded files that store the
|
||||||
|
// expected output of text mode on an input file that has
|
||||||
|
// "\r\n" line endings.
|
||||||
|
let result = new_ucmd!()
|
||||||
|
.args(&[DIGEST_ARG, BITS_ARG, "-b"])
|
||||||
|
.pipe_in("a\nb\nc\n")
|
||||||
|
.succeeds();
|
||||||
|
let expected = result.no_stderr().stdout();
|
||||||
|
// Replace the "*-\n" at the end of the output with " -\n".
|
||||||
|
// The asterisk indicates that the digest was computed in
|
||||||
|
// binary mode.
|
||||||
|
let n = expected.len();
|
||||||
|
let expected = [&expected[..n - 3], &[b' ', b'-', b'\n']].concat();
|
||||||
|
new_ucmd!()
|
||||||
|
.args(&[DIGEST_ARG, BITS_ARG, "-t"])
|
||||||
|
.pipe_in("a\r\nb\r\nc\r\n")
|
||||||
|
.succeeds()
|
||||||
|
.no_stderr()
|
||||||
|
.stdout_is(std::str::from_utf8(&expected).unwrap());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
)*)
|
)*)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue