mirror of
https://github.com/uutils/coreutils
synced 2024-11-17 02:08:09 +00:00
569cd162d3
Updates to individual integration tests - use proposed conventional approach to beginning tests - use new convenience functions for using fixtures - use new names for TestScenario Updates to integration test modules - add proposed conventional module-level functions Updates to test/common/util.rs - rename TestSet, and its methods, for semantic clarity - create convenience functions for use of fixtures - delete convenience functions obsoleted by new conventions
74 lines
1.6 KiB
Rust
74 lines
1.6 KiB
Rust
use common::util::*;
|
|
|
|
static UTIL_NAME: &'static str = "head";
|
|
fn new_ucmd() -> UCommand {
|
|
TestScenario::new(UTIL_NAME).ucmd()
|
|
}
|
|
|
|
static INPUT: &'static str = "lorem_ipsum.txt";
|
|
|
|
#[test]
|
|
fn test_stdin_default() {
|
|
new_ucmd()
|
|
.pipe_in_fixture(INPUT)
|
|
.run().stdout_is_fixture("lorem_ipsum_default.expected");
|
|
}
|
|
|
|
#[test]
|
|
fn test_stdin_1_line_obsolete() {
|
|
new_ucmd()
|
|
.args(&["-1"])
|
|
.pipe_in_fixture(INPUT)
|
|
.run().stdout_is_fixture("lorem_ipsum_1_line.expected");
|
|
}
|
|
|
|
#[test]
|
|
fn test_stdin_1_line() {
|
|
new_ucmd()
|
|
.args(&["-n", "1"])
|
|
.pipe_in_fixture(INPUT)
|
|
.run().stdout_is_fixture("lorem_ipsum_1_line.expected");
|
|
}
|
|
|
|
#[test]
|
|
fn test_stdin_5_chars() {
|
|
new_ucmd()
|
|
.args(&["-c", "5"])
|
|
.pipe_in_fixture(INPUT)
|
|
.run().stdout_is_fixture("lorem_ipsum_5_chars.expected");
|
|
}
|
|
|
|
#[test]
|
|
fn test_single_default() {
|
|
new_ucmd()
|
|
.arg(INPUT)
|
|
.run().stdout_is_fixture("lorem_ipsum_default.expected");
|
|
}
|
|
|
|
#[test]
|
|
fn test_single_1_line_obsolete() {
|
|
new_ucmd()
|
|
.args(&["-1", INPUT])
|
|
.run().stdout_is_fixture("lorem_ipsum_1_line.expected");
|
|
}
|
|
|
|
#[test]
|
|
fn test_single_1_line() {
|
|
new_ucmd()
|
|
.args(&["-n", "1", INPUT])
|
|
.run().stdout_is_fixture("lorem_ipsum_1_line.expected");
|
|
}
|
|
|
|
#[test]
|
|
fn test_single_5_chars() {
|
|
new_ucmd()
|
|
.args(&["-c", "5", INPUT])
|
|
.run().stdout_is_fixture("lorem_ipsum_5_chars.expected");
|
|
}
|
|
|
|
#[test]
|
|
fn test_verbose() {
|
|
new_ucmd()
|
|
.args(&["-v", INPUT])
|
|
.run().stdout_is_fixture("lorem_ipsum_verbose.expected");
|
|
}
|