diff options
author | Johannes Sixt <j6t@kdbg.org> | 2014-03-21 22:07:18 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-03-21 15:02:57 -0700 |
commit | f1b75fbaf1380e00668f775f27ba8dd52b78a081 (patch) | |
tree | 7229343c8f7379ddb7715b01708838f8294bb845 /t/t4018-diff-funcname.sh | |
parent | dd4dc5c574c0849fef6855d9efdfae5dc9369f2d (diff) | |
download | git-f1b75fbaf1380e00668f775f27ba8dd52b78a081.tar.gz |
t4018: convert custom pattern test to the new infrastructure
For the test case "matches to end of line", extend the pattern by a few
wildcards so that the pattern captures the "RIGHT" token, which is needed
for verification, without mentioning it in the pattern.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4018-diff-funcname.sh')
-rwxr-xr-x | t/t4018-diff-funcname.sh | 40 |
1 files changed, 16 insertions, 24 deletions
diff --git a/t/t4018-diff-funcname.sh b/t/t4018-diff-funcname.sh index 008325f2a8..5ac744f397 100755 --- a/t/t4018-diff-funcname.sh +++ b/t/t4018-diff-funcname.sh @@ -30,12 +30,19 @@ public class Beer EOF sed 's/beer\\/beer,\\/' <Beer.java >Beer-correct.java -test_expect_funcname () { - lang=${2-java} - test_expect_code 1 git diff --no-index -U1 \ - "Beer.$lang" "Beer-correct.$lang" >diff && - grep "^@@.*@@ $1" diff -} +test_expect_success 'setup' ' + # a non-trivial custom pattern + git config diff.custom1.funcname "!static +!String +[^ ].*s.*" && + + # a custom pattern which matches to end of line + git config diff.custom2.funcname "......Beer\$" && + + # alternation in pattern + git config diff.custom3.funcname "Beer$" && + git config diff.custom3.xfuncname "^[ ]*((public|static).*)$" +' diffpatterns=" ada @@ -53,6 +60,9 @@ diffpatterns=" python ruby tex + custom1 + custom2 + custom3 " for p in $diffpatterns @@ -79,30 +89,12 @@ test_expect_success 'set up .gitattributes declaring drivers to test' ' EOF ' -test_expect_success 'custom pattern' ' - test_config diff.java.funcname "!static -!String -[^ ].*s.*" && - test_expect_funcname "int special;\$" -' - test_expect_success 'last regexp must not be negated' ' test_config diff.java.funcname "!static" && test_expect_code 128 git diff --no-index Beer.java Beer-correct.java 2>msg && grep ": Last expression must not be negated:" msg ' -test_expect_success 'pattern which matches to end of line' ' - test_config diff.java.funcname "Beer\$" && - test_expect_funcname "Beer\$" -' - -test_expect_success 'alternation in pattern' ' - test_config diff.java.funcname "Beer$" && - test_config diff.java.xfuncname "^[ ]*((public|static).*)$" && - test_expect_funcname "public static void main(" -' - test_expect_success 'setup hunk header tests' ' for i in $diffpatterns do |