From: Chris Webb Date: Fri, 2 Apr 2010 23:37:15 +0000 (+0100) Subject: whitespace: tests for git-diff --check with tab-in-indent error class X-Git-Tag: v1.7.2-rc0~156^2~3 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=b27eb49948c90af11cee39301d03c37a05e066de;p=git.git whitespace: tests for git-diff --check with tab-in-indent error class [jc: with test fixes from J6t] Signed-off-by: Chris Webb Signed-off-by: Junio C Hamano --- diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh index 90f334237..e92eab09c 100755 --- a/t/t4015-diff-whitespace.sh +++ b/t/t4015-diff-whitespace.sh @@ -352,6 +352,48 @@ test_expect_success 'check tabs and spaces as indentation (indent-with-non-tab: ' +test_expect_success 'check tabs as indentation (tab-in-indent: off)' ' + + git config core.whitespace "-tab-in-indent" && + echo " foo ();" > x && + git diff --check + +' + +test_expect_success 'check tabs as indentation (tab-in-indent: on)' ' + + git config core.whitespace "tab-in-indent" && + echo " foo ();" > x && + test_must_fail git diff --check + +' + +test_expect_success 'check tabs and spaces as indentation (tab-in-indent: on)' ' + + git config core.whitespace "tab-in-indent" && + echo " foo ();" > x && + test_must_fail git diff --check + +' + +test_expect_success 'check tab-in-indent and indent-with-non-tab conflict' ' + + git config core.whitespace "tab-in-indent,indent-with-non-tab" && + echo "foo ();" > x && + test_must_fail git diff --check + +' + +test_expect_success 'check tab-in-indent excluded from wildcard whitespace attribute' ' + + git config --unset core.whitespace && + echo "x whitespace" > .gitattributes && + echo " foo ();" > x && + git diff --check && + rm -f .gitattributes + +' + test_expect_success 'line numbers in --check output are correct' ' echo "" > x &&