mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
comm: add basic tests
This commit is contained in:
parent
8a6768e9bd
commit
2f4ae615ed
11 changed files with 63 additions and 0 deletions
1
Makefile
1
Makefile
|
@ -114,6 +114,7 @@ TEST_PROGS := \
|
|||
basename \
|
||||
cat \
|
||||
cksum \
|
||||
comm \
|
||||
cp \
|
||||
cut \
|
||||
dirname \
|
||||
|
|
47
tests/comm.rs
Normal file
47
tests/comm.rs
Normal file
|
@ -0,0 +1,47 @@
|
|||
#[macro_use] mod common;
|
||||
|
||||
use common::util;
|
||||
|
||||
static UTIL_NAME: &'static str = "comm";
|
||||
|
||||
#[test]
|
||||
fn test_comm_ab_no_args() {
|
||||
let (at, mut ucmd) = util::testing(UTIL_NAME);
|
||||
let result = ucmd.args(&["a", "b"]).run();
|
||||
assert_eq!(result.stdout, at.read("ab.expected"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_comm_ab_dash_one() {
|
||||
let (at, mut ucmd) = util::testing(UTIL_NAME);
|
||||
let result = ucmd.args(&["a", "b", "-1"]).run();
|
||||
assert_eq!(result.stdout, at.read("ab1.expected"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_comm_ab_dash_two() {
|
||||
let (at, mut ucmd) = util::testing(UTIL_NAME);
|
||||
let result = ucmd.args(&["a", "b", "-2"]).run();
|
||||
assert_eq!(result.stdout, at.read("ab2.expected"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_comm_ab_dash_three() {
|
||||
let (at, mut ucmd) = util::testing(UTIL_NAME);
|
||||
let result = ucmd.args(&["a", "b", "-3"]).run();
|
||||
assert_eq!(result.stdout, at.read("ab3.expected"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_comm_aempty() {
|
||||
let (at, mut ucmd) = util::testing(UTIL_NAME);
|
||||
let result = ucmd.args(&["a", "empty"]).run();
|
||||
assert_eq!(result.stdout, at.read("aempty.expected"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_comm_emptyempty() {
|
||||
let (at, mut ucmd) = util::testing(UTIL_NAME);
|
||||
let result = ucmd.args(&["empty", "empty"]).run();
|
||||
assert_eq!(result.stdout, at.read("emptyempty.expected"));
|
||||
}
|
2
tests/fixtures/comm/a
vendored
Normal file
2
tests/fixtures/comm/a
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
a
|
||||
z
|
3
tests/fixtures/comm/ab.expected
vendored
Normal file
3
tests/fixtures/comm/ab.expected
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
a
|
||||
b
|
||||
z
|
2
tests/fixtures/comm/ab1.expected
vendored
Normal file
2
tests/fixtures/comm/ab1.expected
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
b
|
||||
z
|
2
tests/fixtures/comm/ab2.expected
vendored
Normal file
2
tests/fixtures/comm/ab2.expected
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
a
|
||||
z
|
2
tests/fixtures/comm/ab3.expected
vendored
Normal file
2
tests/fixtures/comm/ab3.expected
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
a
|
||||
b
|
2
tests/fixtures/comm/aempty.expected
vendored
Normal file
2
tests/fixtures/comm/aempty.expected
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
a
|
||||
z
|
2
tests/fixtures/comm/b
vendored
Normal file
2
tests/fixtures/comm/b
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
b
|
||||
z
|
0
tests/fixtures/comm/empty
vendored
Normal file
0
tests/fixtures/comm/empty
vendored
Normal file
0
tests/fixtures/comm/emptyempty.expected
vendored
Normal file
0
tests/fixtures/comm/emptyempty.expected
vendored
Normal file
Loading…
Add table
Add a link
Reference in a new issue