comm: add basic tests

This commit is contained in:
Michael Gehring
2015-11-28 20:51:11 +01:00
parent 8a6768e9bd
commit 2f4ae615ed
11 changed files with 63 additions and 0 deletions
+1
View File
@@ -114,6 +114,7 @@ TEST_PROGS := \
basename \
cat \
cksum \
comm \
cp \
cut \
dirname \
+47
View 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
View File
@@ -0,0 +1,2 @@
a
z
+3
View File
@@ -0,0 +1,3 @@
a
b
z
+2
View File
@@ -0,0 +1,2 @@
b
z
+2
View File
@@ -0,0 +1,2 @@
a
z
+2
View File
@@ -0,0 +1,2 @@
a
b
+2
View File
@@ -0,0 +1,2 @@
a
z
+2
View File
@@ -0,0 +1,2 @@
b
z
View File
View File