Skip to content

Commit 537a071

Browse files
Keith Casciogitster
authored andcommitted
test more combinations of ignore-whitespace options to diff
There are three flags involved (-w -b and --ignore-space-at-eol) which makes 8 combinations possible in total, but only 3 cases are tested (none, -w alone and -b alone). This adds the other 5 cases. Signed-off-by: Keith Cascio <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3aed2fd commit 537a071

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

t/t4015-diff-whitespace.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@ index d99af23..8b32fb5 100644
9898
EOF
9999
git diff -w > out
100100
test_expect_success 'another test, with -w' 'test_cmp expect out'
101+
git diff -w -b > out
102+
test_expect_failure 'another test, with -w -b' 'test_cmp expect out'
103+
git diff -w --ignore-space-at-eol > out
104+
test_expect_failure 'another test, with -w --ignore-space-at-eol' 'test_cmp expect out'
105+
git diff -w -b --ignore-space-at-eol > out
106+
test_expect_failure 'another test, with -w -b --ignore-space-at-eol' 'test_cmp expect out'
101107

102108
tr 'Q' '\015' << EOF > expect
103109
diff --git a/x b/x
@@ -116,6 +122,27 @@ index d99af23..8b32fb5 100644
116122
EOF
117123
git diff -b > out
118124
test_expect_success 'another test, with -b' 'test_cmp expect out'
125+
git diff -b --ignore-space-at-eol > out
126+
test_expect_failure 'another test, with -b --ignore-space-at-eol' 'test_cmp expect out'
127+
128+
tr 'Q' '\015' << EOF > expect
129+
diff --git a/x b/x
130+
index d99af23..8b32fb5 100644
131+
--- a/x
132+
+++ b/x
133+
@@ -1,6 +1,6 @@
134+
-whitespace at beginning
135+
-whitespace change
136+
-whitespace in the middle
137+
+ whitespace at beginning
138+
+whitespace change
139+
+white space in the middle
140+
whitespace at end
141+
unchanged line
142+
CR at endQ
143+
EOF
144+
git diff --ignore-space-at-eol > out
145+
test_expect_success 'another test, with --ignore-space-at-eol' 'test_cmp expect out'
119146

120147
test_expect_success 'check mixed spaces and tabs in indent' '
121148

0 commit comments

Comments
 (0)