aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/head.test10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/head.test b/tests/head.test
index 83d93996..6ed027c4 100755
--- a/tests/head.test
+++ b/tests/head.test
@@ -11,9 +11,19 @@ testing "-number" "head -2 input && echo yes" "one\ntwo\nyes\n" \
"one\ntwo\nthree\nfour" ""
testing "head, default lines" "head" "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n" "" "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12"
+# coreutils & busybox name stdin as "standard input", toybox uses "-"
+testing "-v file" "head -v -n 1 input" "==> input <==\none\n" "one\ntwo\n" ""
+testing "-v stdin" "head -v -n 1 | sed 's/==> standard input <==/==> - <==/'" \
+ "==> - <==\none\n" "" "one\ntwo\n"
+
+testing "file and stdin" "head -n 1 input - | sed 's/==> standard input <==/==> - <==/'" \
+ "==> input <==\none\n\n==> - <==\nfoo\n" "one\ntwo\n" "foo\nbar\n"
+
echo "foo
bar
baz" > file1
testing "head, multiple files" "head -n 2 input file1" "==> input <==\none\ntwo\n\n==> file1 <==\nfoo\nbar\n" "one\ntwo\nthree\n" ""
+testing "-q, multiple files" "head -q -n 2 input file1" "one\ntwo\nfoo\nbar\n" \
+ "one\ntwo\nthree\n" ""
rm file1