aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorIlya Kuzmich <ilya.kuzmich@gmail.com>2017-05-28 17:03:26 +0300
committerRob Landley <rob@landley.net>2017-05-28 17:08:19 -0500
commit1abba7db3df9cd4b7e86355504d39a29312ebedb (patch)
treebdddadf4aa573f0d446bdb1a867ea6c271d735ae /tests
parentcf2e8d08b3e06a7bdf95c30282a976bbf072a168 (diff)
downloadtoybox-1abba7db3df9cd4b7e86355504d39a29312ebedb.tar.gz
teach head -v and -q
Not POSIX, but implemented in coreutils and busybox. Tests use sed to compensate for the stdin naming difference. Signed-off-by: Ilya Kuzmich <ilya.kuzmich@gmail.com>
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