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

tac: exit with proper code, move from getopts to clap, add test for invalid inputs (#1957)

This commit is contained in:
Yagiz Degirmenci 2021-03-31 22:21:10 +03:00 committed by GitHub
parent 751ae6a8f8
commit e958864bd9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 95 additions and 67 deletions

View file

@ -49,3 +49,21 @@ fn test_single_non_newline_separator_before() {
.run()
.stdout_is_fixture("delimited_primes_before.expected");
}
#[test]
fn test_invalid_input() {
let (_, mut ucmd) = at_and_ucmd!();
ucmd.arg("b")
.run()
.stderr
.contains("tac: error: failed to open 'b' for reading");
let (at, mut ucmd) = at_and_ucmd!();
at.mkdir("a");
ucmd.arg("a")
.run()
.stderr
.contains("tac: error: failed to read 'a'");
}