File tree Expand file tree Collapse file tree 6 files changed +219
-0
lines changed
lsdiff-empty-files-removed Expand file tree Collapse file tree 6 files changed +219
-0
lines changed Original file line number Diff line number Diff line change @@ -290,6 +290,11 @@ TESTS = tests/newline1/run-test \
290290 tests/lsdiff13/run-test \
291291 tests/lsdiff14/run-test \
292292 tests/lsdiff15/run-test \
293+ tests/lsdiff-number-files/run-test \
294+ tests/lsdiff-files-range/run-test \
295+ tests/lsdiff-empty-files-removed/run-test \
296+ tests/lsdiff-addprefix/run-test \
297+ tests/lsdiff-strip-match/run-test \
293298 tests/lsdiff-hunks-option/run-test \
294299 tests/lsdiff-lines-option/run-test \
295300 tests/lsdiff-exclusion-combined/run-test \
@@ -459,6 +464,17 @@ XFAIL_TESTS += \
459464 tests/grepdiff-annotate/run-test
460465endif
461466
467+ # lsdiff tests: expected to fail when scanner-patchfilter is enabled
468+ # (features not yet implemented in scanner-based lsdiff)
469+ if USE_SCANNER_PATCHFILTER
470+ XFAIL_TESTS += \
471+ tests/lsdiff-number-files/run-test \
472+ tests/lsdiff-files-range/run-test \
473+ tests/lsdiff-empty-files-removed/run-test \
474+ tests/lsdiff-addprefix/run-test \
475+ tests/lsdiff-strip-match/run-test
476+ endif
477+
462478test-perms : src/combinediff$(EXEEXT ) src/flipdiff$(EXEEXT ) \
463479 src/lsdiff$(EXEEXT ) src/grepdiff$(EXEEXT ) src/patchview$(EXEEXT ) \
464480 scripts/splitdiff
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ # Test lsdiff --addprefix option
4+
5+ . ${top_srcdir-.} /tests/common.sh
6+
7+ cat << EOF > diff
8+ --- file1
9+ +++ file1
10+ @@ -1 +1 @@
11+ -old
12+ +new
13+ --- file2
14+ +++ file2
15+ @@ -1 +1 @@
16+ -foo
17+ +bar
18+ EOF
19+
20+ ${LSDIFF} --addprefix=prefix/ diff 2> errors > output || exit 1
21+ [ -s errors ] && exit 1
22+
23+ cat << EOF | cmp - output || exit 1
24+ prefix/file1
25+ prefix/file2
26+ EOF
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ # Test lsdiff -E/--empty-files-as-removed option
4+
5+ . ${top_srcdir-.} /tests/common.sh
6+
7+ cat << EOF > diff
8+ --- /dev/null
9+ +++ newfile
10+ @@ -0,0 +1 @@
11+ +content
12+ --- emptyfile
13+ +++ emptyfile
14+ --- modified
15+ +++ modified
16+ @@ -1 +1 @@
17+ -old
18+ +new
19+ EOF
20+
21+ # Without -E, empty file shows as modified
22+ ${LSDIFF} -s diff 2> errors > output1 || exit 1
23+ [ -s errors ] && exit 1
24+
25+ cat << EOF | cmp - output1 || exit 1
26+ + newfile
27+ ! emptyfile
28+ ! modified
29+ EOF
30+
31+ # With -E, empty file shows as removed
32+ ${LSDIFF} -sE diff 2> errors > output2 || exit 1
33+ [ -s errors ] && exit 1
34+
35+ cat << EOF | cmp - output2 || exit 1
36+ + newfile
37+ - emptyfile
38+ ! modified
39+ EOF
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ # Test lsdiff -F/--files=RANGE option
4+
5+ . ${top_srcdir-.} /tests/common.sh
6+
7+ cat << EOF > diff
8+ --- file1
9+ +++ file1
10+ @@ -1 +1 @@
11+ -old
12+ +new
13+ --- file2
14+ +++ file2
15+ @@ -1 +1 @@
16+ -foo
17+ +bar
18+ --- file3
19+ +++ file3
20+ @@ -1 +1 @@
21+ -test
22+ +result
23+ --- file4
24+ +++ file4
25+ @@ -1 +1 @@
26+ -data
27+ +value
28+ EOF
29+
30+ # Test single file
31+ ${LSDIFF} -F2 diff 2> errors > output1 || exit 1
32+ [ -s errors ] && exit 1
33+
34+ cat << EOF | cmp - output1 || exit 1
35+ file2
36+ EOF
37+
38+ # Test range
39+ ${LSDIFF} -F2-3 diff 2> errors > output2 || exit 1
40+ [ -s errors ] && exit 1
41+
42+ cat << EOF | cmp - output2 || exit 1
43+ file2
44+ file3
45+ EOF
46+
47+ # Test open-ended range
48+ ${LSDIFF} -F3- diff 2> errors > output3 || exit 1
49+ [ -s errors ] && exit 1
50+
51+ cat << EOF | cmp - output3 || exit 1
52+ file3
53+ file4
54+ EOF
55+
56+ # Test exclusion range
57+ ${LSDIFF} -Fx2-3 diff 2> errors > output4 || exit 1
58+ [ -s errors ] && exit 1
59+
60+ cat << EOF | cmp - output4 || exit 1
61+ file1
62+ file4
63+ EOF
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ # Test lsdiff -N/--number-files option
4+
5+ . ${top_srcdir-.} /tests/common.sh
6+
7+ cat << EOF > diff
8+ --- file1
9+ +++ file1
10+ @@ -1 +1 @@
11+ -old
12+ +new
13+ --- file2
14+ +++ file2
15+ @@ -1 +1 @@
16+ -foo
17+ +bar
18+ --- file3
19+ +++ file3
20+ @@ -1 +1 @@
21+ -test
22+ +result
23+ EOF
24+
25+ ${LSDIFF} -N diff 2> errors > output || exit 1
26+ [ -s errors ] && exit 1
27+
28+ cat << EOF | cmp - output || exit 1
29+ File #1 file1
30+ File #2 file2
31+ File #3 file3
32+ EOF
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ # Test lsdiff -p/--strip-match option
4+
5+ . ${top_srcdir-.} /tests/common.sh
6+
7+ cat << EOF > diff
8+ --- a/src/file1.c
9+ +++ b/src/file1.c
10+ @@ -1 +1 @@
11+ -old
12+ +new
13+ --- a/docs/readme.txt
14+ +++ b/docs/readme.txt
15+ @@ -1 +1 @@
16+ -old
17+ +new
18+ --- a/src/file2.c
19+ +++ b/src/file2.c
20+ @@ -1 +1 @@
21+ -old
22+ +new
23+ EOF
24+
25+ # Use -p to strip 'a/' and 'b/' prefixes when matching
26+ # Include only files in src/ directory
27+ ${LSDIFF} -p1 -i ' src/*' diff 2> errors > output || exit 1
28+ [ -s errors ] && exit 1
29+
30+ cat << EOF | cmp - output || exit 1
31+ src/file1.c
32+ src/file2.c
33+ EOF
34+
35+ # Test that -p affects matching but not output
36+ # Output should still show the paths as they appear in the diff
37+ ${LSDIFF} -p1 -i ' src/*' --strip=0 diff 2> errors > output2 || exit 1
38+ [ -s errors ] && exit 1
39+
40+ cat << EOF | cmp - output2 || exit 1
41+ a/src/file1.c
42+ a/src/file2.c
43+ EOF
You can’t perform that action at this time.
0 commit comments