3 [ -f testing.sh ] && . testing.sh
5 testing "not enough arguments [fail]" "cmp input 2>/dev/null || echo yes" "yes\n" "foo" ""
6 testing "missing file1 [fail]" "cmp file1 input 2>/dev/null || echo yes" "yes\n" "foo" ""
9 #testing "directory [fail]" "cmp dir dir 2>/dev/null || echo yes" \
16 testing "identical files, stdout" "cmp input input2" "" "ab\nc\n" ""
17 testing "identical files, return code" "cmp input input2 && echo yes" "yes\n" "ab\nc\n" ""
19 testing "EOF, stderr" "cmp input input2 2>&1" "cmp: EOF on input2\n" "ab\nc\nx" ""
20 testing "EOF, return code" "cmp input input2 2>/dev/null || echo yes" "yes\n" "ab\nc\nx" ""
21 # The gnu/dammit version fails this because posix says "char" and they don't.
22 testing "diff, stdout" "cmp input input2" "input input2 differ: char 4, line 2\n" "ab\nx\nx" ""
23 testing "diff, return code" "cmp input input2 > /dev/null || echo yes" "yes\n" "ab\nx\nx" ""
25 testing "-s EOF, return code" "cmp -s input input2 || echo yes" "yes\n" "ab\nc\nx" ""
26 testing "-s diff, return code" "cmp -s input input2 || echo yes" "yes\n" "ab\nx\nx" ""
28 testing "-l EOF, stderr" "cmp -l input input2 2>&1" "cmp: EOF on input2\n" "ab\nc\nx" ""
29 testing "-l diff and EOF, stdout and stderr" "cmp -l input input2 2>&1 | sort" "4 170 143\ncmp: EOF on input2\n" "ab\nx\nx" ""
33 testing "stdin and file" "cmp input -" "input - differ: char 4, line 2\n" "ab\nc\n" "ab\nx\n"
34 #testing "stdin and stdin" "cmp input -" "" "" "ab\nc\n"