2 # Copyright 2008 by Denys Vlasenko
3 # Licensed under GPL v2, see file LICENSE for details.
7 # testing "test name" "options" "expected result" "file input" "stdin"
9 # diff outputs date/time in the header, which should not be analysed
10 # NB: sed has tab character in s command!
11 TRIM_TAB="sed 's/ .*//'"
13 testing "diff of stdin" \
14 "diff -u - input | $TRIM_TAB" \
26 testing "diff of stdin, no newline in the file" \
27 "diff -u - input | $TRIM_TAB" \
35 \\ No newline at end of file
40 # we also test that stdin is in fact NOT read
41 testing "diff of stdin, twice" \
42 'diff - -; echo $?; wc -c' \
47 testing "diff of empty file against nonempty one" \
48 "diff -u - input | $TRIM_TAB" \
58 testing "diff -b treats EOF as whitespace" \
59 'diff -ub - input; echo $?' \
64 testing "diff -b treats all spaces as equal" \
65 'diff -ub - input; echo $?' \
70 testing "diff -B ignores changes whose lines are all blank" \
71 'diff -uB - input; echo $?' \
76 testing "diff -B does not ignore changes whose lines are not all blank" \
77 "diff -uB - input | $TRIM_TAB" \
90 testing "diff always takes context from old file" \
91 "diff -ub - input | $TRIM_TAB" \
103 # testing "test name" "options" "expected result" "file input" "stdin"
106 mkdir diff1 diff2 diff2/subdir
108 echo asd >diff2/subdir/-
109 optional FEATURE_DIFF_DIR
110 testing "diff diff1 diff2/subdir" \
111 "diff -ur diff1 diff2/subdir | $TRIM_TAB" \
122 # using directory structure from prev test...
123 optional FEATURE_DIFF_DIR
124 testing "diff dir dir2/file/-" \
125 "diff -ur diff1 diff2/subdir/- | $TRIM_TAB" \
136 # using directory structure from prev test...
138 mkfifo diff2/subdir/test
139 optional FEATURE_DIFF_DIR
140 testing "diff of dir and fifo" \
141 "diff -ur diff1 diff2/subdir | $TRIM_TAB" \
148 Only in diff2/subdir: test
153 # using directory structure from prev test...
156 optional FEATURE_DIFF_DIR
157 testing "diff of file and fifo" \
158 "diff -ur diff1 diff2/subdir | $TRIM_TAB" \
165 File diff2/subdir/test is not a regular file or directory and was skipped
170 # using directory structure from prev test...
172 optional FEATURE_DIFF_DIR
173 testing "diff -rN does not read non-regular files" \
174 "diff -urN diff1 diff2/subdir | $TRIM_TAB" \
181 File diff2/subdir/test is not a regular file or directory and was skipped
182 File diff1/test2 is not a regular file or directory and was skipped