coreutils/tests/test_head.rs

79 lines
1.5 KiB
Rust
Raw Normal View History

use common::util::*;
static INPUT: &'static str = "lorem_ipsum.txt";
#[test]
fn test_stdin_default() {
new_ucmd!()
.pipe_in_fixture(INPUT)
2020-04-13 18:36:03 +00:00
.run()
.stdout_is_fixture("lorem_ipsum_default.expected");
}
#[test]
fn test_stdin_1_line_obsolete() {
new_ucmd!()
.args(&["-1"])
.pipe_in_fixture(INPUT)
2020-04-13 18:36:03 +00:00
.run()
.stdout_is_fixture("lorem_ipsum_1_line.expected");
}
#[test]
fn test_stdin_1_line() {
new_ucmd!()
.args(&["-n", "1"])
.pipe_in_fixture(INPUT)
2020-04-13 18:36:03 +00:00
.run()
.stdout_is_fixture("lorem_ipsum_1_line.expected");
}
#[test]
fn test_stdin_5_chars() {
new_ucmd!()
.args(&["-c", "5"])
.pipe_in_fixture(INPUT)
2020-04-13 18:36:03 +00:00
.run()
.stdout_is_fixture("lorem_ipsum_5_chars.expected");
}
#[test]
fn test_single_default() {
new_ucmd!()
.arg(INPUT)
2020-04-13 18:36:03 +00:00
.run()
.stdout_is_fixture("lorem_ipsum_default.expected");
}
#[test]
fn test_single_1_line_obsolete() {
new_ucmd!()
.args(&["-1", INPUT])
2020-04-13 18:36:03 +00:00
.run()
.stdout_is_fixture("lorem_ipsum_1_line.expected");
}
#[test]
fn test_single_1_line() {
new_ucmd!()
.args(&["-n", "1", INPUT])
2020-04-13 18:36:03 +00:00
.run()
.stdout_is_fixture("lorem_ipsum_1_line.expected");
}
#[test]
fn test_single_5_chars() {
new_ucmd!()
.args(&["-c", "5", INPUT])
2020-04-13 18:36:03 +00:00
.run()
.stdout_is_fixture("lorem_ipsum_5_chars.expected");
}
#[test]
fn test_verbose() {
new_ucmd!()
.args(&["-v", INPUT])
2020-04-13 18:36:03 +00:00
.run()
.stdout_is_fixture("lorem_ipsum_verbose.expected");
}