From 387edf547eb09b27ca6d49772eb048d729f09cf4 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sat, 20 Sep 2014 13:09:14 -0500 Subject: Move testsuite out of scripts/test into its own top level tests directory, and make ctrl-c kill "make test" more reliably. --- tests/head.test | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 tests/head.test (limited to 'tests/head.test') diff --git a/tests/head.test b/tests/head.test new file mode 100755 index 00000000..eeb07e00 --- /dev/null +++ b/tests/head.test @@ -0,0 +1,17 @@ +#!/bin/bash + +[ -f testing.sh ] && . testing.sh + +#testing "name" "command" "result" "infile" "stdin" + +testing "head, stdin" "head -n 1 && echo yes" "one\nyes\n" "" "one\ntwo" +testing "head, stdin via -" "head -n 1 - && echo yes" "one\nyes\n" "" "one\ntwo" +testing "head, file" "head input -n 1 && echo yes" "one\nyes\n" "one\ntwo" "" +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" + +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" "" +rm file1 + -- cgit v1.2.3