3 [ -f testing.sh ] && . testing.sh
5 #testing "name" "command" "result" "infile" "stdin"
8 echo -e "one-A\none-B" > file1
9 echo -e "two-A\ntwo-B" > file2
10 testing "tac" "tac && echo yes" "one-B\none-A\nyes\n" "" "one-A\none-B\n"
11 testing "tac -" "tac - && echo yes" "one-B\none-A\nyes\n" "" "one-A\none-B\n"
12 testing "tac file1 file2" "tac file1 file2" "one-B\none-A\ntwo-B\ntwo-A\n" "" ""
13 testing "tac - file" "tac - file1" "zero-B\nzero-A\none-B\none-A\n" "" "zero-A\nzero-B\n"
14 testing "tac file -" "tac file1 -" "one-B\none-A\nzero-B\nzero-A\n" "" "zero-A\nzero-B\n"
16 testing "tac file1 notfound file2" \
17 "tac file1 notfound file2 2>stderr && echo ok ; tac stderr; rm stderr" \
18 "one-B\none-A\ntwo-B\ntwo-A\ntac: notfound: No such file or directory\n" "" ""
20 testing "tac no trailing newline" "tac -" "defabc\n" "" "abc\ndef"
22 # xputs used by tac does not propagate this error condition properly.
23 #testing "tac > /dev/full" \
24 # "tac - > /dev/full 2>stderr && echo ok; cat stderr; rm stderr" \
25 # "tac: write: No space left on device\n" "" "zero\n"