mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
Add initial tests for default values
This commit is contained in:
parent
b6abe56357
commit
cf399faad2
5 changed files with 55 additions and 0 deletions
1
Makefile
1
Makefile
|
@ -143,6 +143,7 @@ TEST_PROGS := \
|
|||
stdbuf \
|
||||
sum \
|
||||
tac \
|
||||
tail \
|
||||
test \
|
||||
touch \
|
||||
tr \
|
||||
|
|
11
tests/fixtures/tail/foobar.txt
vendored
Normal file
11
tests/fixtures/tail/foobar.txt
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
baz
|
||||
foo
|
||||
bar
|
||||
foo
|
||||
bar
|
||||
foo
|
||||
bar
|
||||
foo
|
||||
bar
|
||||
foo
|
||||
bar
|
10
tests/fixtures/tail/foobar_single_default.expected
vendored
Normal file
10
tests/fixtures/tail/foobar_single_default.expected
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
foo
|
||||
bar
|
||||
foo
|
||||
bar
|
||||
foo
|
||||
bar
|
||||
foo
|
||||
bar
|
||||
foo
|
||||
bar
|
10
tests/fixtures/tail/foobar_stdin_default.expected
vendored
Normal file
10
tests/fixtures/tail/foobar_stdin_default.expected
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
foo
|
||||
bar
|
||||
foo
|
||||
bar
|
||||
foo
|
||||
bar
|
||||
foo
|
||||
bar
|
||||
foo
|
||||
bar
|
23
tests/tail.rs
Normal file
23
tests/tail.rs
Normal file
|
@ -0,0 +1,23 @@
|
|||
#[macro_use]
|
||||
mod common;
|
||||
|
||||
use common::util::*;
|
||||
|
||||
static UTIL_NAME: &'static str = "tail";
|
||||
|
||||
static INPUT: &'static str = "foobar.txt";
|
||||
|
||||
|
||||
#[test]
|
||||
fn test_stdin_default() {
|
||||
let (at, mut ucmd) = testing(UTIL_NAME);
|
||||
let result = ucmd.run_piped_stdin(at.read(INPUT));
|
||||
assert_eq!(result.stdout, at.read("foobar_stdin_default.expected"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_single_default() {
|
||||
let (at, mut ucmd) = testing(UTIL_NAME);
|
||||
let result = ucmd.arg(INPUT).run();
|
||||
assert_eq!(result.stdout, at.read("foobar_single_default.expected"));
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue