[PATCH 5/5] Add tests for "git diff --check" with core.whitespace options
- From
Wincent Colaiuta <win@wincent.com>
- Date
- Dec 13, 2007, 13:32 UTC
- Message-ID
- <1197552751-53480-6-git-send-email-win@wincent.com>
- In-Reply-To
- <1197552751-53480-5-git-send-email-win@wincent.com>
Make sure that "git diff --check" does the right thing when the core.whitespace options are set.
Signed-off-by: Wincent Colaiuta <win@wincent.com> --- t/t4015-diff-whitespace.sh | 50 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 50 insertions(+), 0 deletions(-)
diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh index a0a47dd..cb90ee7 100755 --- a/t/t4015-diff-whitespace.sh +++ b/t/t4015-diff-whitespace.sh @@ -261,4 +261,54 @@ test_expect_failure 'check with space before tab in indent (diff-tree)' ' ' +test_expect_success 'check trailing whitespace (trailing-space: off)' ' + + git config core.whitespace "-trailing-space" && + echo "foo (); " > x && + git diff --check + +' + +test_expect_failure 'check trailing whitespace (trailing-space: on)' ' + + git config core.whitespace "trailing-space" && + echo "foo (); " > x && + git diff --check + +' + +test_expect_success 'check space before tab in indent (space-before-tab: off)' ' + + # indent contains space followed by HT + git config core.whitespace "-space-before-tab" && + echo " foo ();" > x && + git diff --check + +' + +test_expect_failure 'check space before tab in indent (space-before-tab: on)' ' + + # indent contains space followed by HT + git config core.whitespace "space-before-tab" && + echo " foo (); " > x && + git diff --check + +' + +test_expect_success 'check spaces as indentation (indent-with-non-tab: off)' ' + + git config core.whitespace "-indent-with-non-tab" + echo " foo ();" > x && + git diff --check + +' + +test_expect_failure 'check spaces as indentation (indent-with-non-tab: on)' ' + + git config core.whitespace "indent-with-non-tab" && + echo " foo ();" > x && + git diff --check + +' + test_done
-- 1.5.4.rc0.4.g50348