coreutils/tests/test_tac.rs
Nathan Ross 99b39e4237 tests: normalize around chaining asserts
Although for some tests this adds characters
we still use them there because the
brevity cost is now worth the benefit in
terms of instant, natural-language readability
and recognizability for people not familiar
with this tests of this module or even the project
2016-08-13 17:59:21 -04:00

50 lines
1.2 KiB
Rust

use common::util::*;
static UTIL_NAME: &'static str = "tac";
fn new_ucmd() -> UCommand {
TestScenario::new(UTIL_NAME).ucmd()
}
#[test]
fn test_stdin_default() {
new_ucmd()
.pipe_in("100\n200\n300\n400\n500")
.run()
.stdout_is("500400\n300\n200\n100\n");
}
#[test]
fn test_stdin_non_newline_separator() {
new_ucmd()
.args(&["-s", ":"])
.pipe_in("100:200:300:400:500")
.run()
.stdout_is("500400:300:200:100:");
}
#[test]
fn test_stdin_non_newline_separator_before() {
new_ucmd()
.args(&["-b", "-s", ":"])
.pipe_in("100:200:300:400:500")
.run()
.stdout_is("500:400:300:200:100");
}
#[test]
fn test_single_default() {
new_ucmd().arg("prime_per_line.txt")
.run().stdout_is_fixture("prime_per_line.expected");
}
#[test]
fn test_single_non_newline_separator() {
new_ucmd().args(&["-s", ":", "delimited_primes.txt"])
.run().stdout_is_fixture("delimited_primes.expected");
}
#[test]
fn test_single_non_newline_separator_before() {
new_ucmd().args(&["-b", "-s", ":", "delimited_primes.txt"])
.run().stdout_is_fixture("delimited_primes_before.expected");
}