From 1abba7db3df9cd4b7e86355504d39a29312ebedb Mon Sep 17 00:00:00 2001 From: Ilya Kuzmich Date: Sun, 28 May 2017 17:03:26 +0300 Subject: 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 --- tests/head.test | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests') 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 -- cgit v1.2.3