whitespace: tests for git-diff --check with tab-in-indent error class
[jc: with test fixes from J6t] Signed-off-by: Chris Webb <chris@arachsys.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Chris Webb committed
Apr 3, 2010 at 00:37 UTC
b27eb49948c90af11cee39301d03c37a05e066de
1 file changed
+42
t/t4015-diff-whitespace.sh
+42
@@ -352,6 +352,48 @@ test_expect_success 'check tabs and spaces as indentation (indent-with-non-tab:
352
353
'
354
355
+test_expect_success 'check tabs as indentation (tab-in-indent: off)' '
356
+
357
+ git config core.whitespace "-tab-in-indent" &&
358
+ echo " foo ();" > x &&
359
+ git diff --check
360
+
361
+'
362
+
363
+test_expect_success 'check tabs as indentation (tab-in-indent: on)' '
364
+
365
+ git config core.whitespace "tab-in-indent" &&
366
+ echo " foo ();" > x &&
367
+ test_must_fail git diff --check
368
+
369
+'
370
+
371
+test_expect_success 'check tabs and spaces as indentation (tab-in-indent: on)' '
372
+
373
+ git config core.whitespace "tab-in-indent" &&
374
+ echo " foo ();" > x &&
375
+ test_must_fail git diff --check
376
+
377
+'
378
+
379
+test_expect_success 'check tab-in-indent and indent-with-non-tab conflict' '
380
+
381
+ git config core.whitespace "tab-in-indent,indent-with-non-tab" &&
382
+ echo "foo ();" > x &&
383
+ test_must_fail git diff --check
384
+
385
+'
386
+
387
+test_expect_success 'check tab-in-indent excluded from wildcard whitespace attribute' '
388
+
389
+ git config --unset core.whitespace &&
390
+ echo "x whitespace" > .gitattributes &&
391
+ echo " foo ();" > x &&
392
+ git diff --check &&
393
+ rm -f .gitattributes
394
+
395
+'
396
+
397
test_expect_success 'line numbers in --check output are correct' '
398
399
echo "" > x &&