userdiff: add support for Emacs Lisp
Subsystems (2)
Re: [PATCH v2 09/27] userdiff tests: match full hunk headers
In reply to Johannes SixtQuoted 10 lines · Johannes Sixt
Quoted 6 lines
t/t4018-diff-funcname.sh | 7 +++--- t/t4018/README | 22 +++++++++---------- t/t4018/README.ctx | 1 + t/t4018/bash-arithmetic-function.ctx | 1 + t/t4018/bash-bashism-style-compact.ctx | 1 +[...and so on...]
This is what I meant by "without burdening test writers with lots of subtleties".
Quoted 8 lines
I'm not a friend of this change :-(
I think you are going overboard with required test precision. To have useful tests for userdiff patterns that demonstrate its features, authors should write *many* tests. The right balance should be on the coverage of userdiff pattern features, not on the subtle details of each and everyone of it. Requiring that many additional context files makes it *really hard* to comply.
Yeah, the first time I saw the t4018 test framework appeared in my tree, I truly appreciated its simplicity, how the test input file is self-documenting and self-contained, with the clever use of "RIGHT", "broken" and "ChangeMe" magic tokens, admired the cleverness of the approach, and wished I was clever enough to invent that pattern to apply to other tests myself.
A little new for each and every test for the miniscule gain of checking which part of the function header line is extracted feels a bit too much noise and rubs my sense of aesthetics, spoiled by the existing t4018 tests, the wrong way.
This is a rough sketch of a different approach aiming for the same. I converted only a few files, but I hope that this is enough to illustrate the idea.
t/t4018-diff-funcname.sh | 17 ++++++++++++++--- t/t4018/README | 9 ++++++--- t/t4018/bash-arithmetic-function | 3 +++ 3 files changed, 23 insertions(+), 6 deletions(-)
t/t4018-diff-funcname.sh +14 -3
@@ -107,10 +107,21 @@ do else result=success fi - test_expect_$result "hunk header: $i" " + + test_expect_$result "hunk header: $i" ' + HEAD=$(sed -n \ + -e "s/^.*HEADER.*|\(.*\)right\(.*\)|.*/ \1RIGHT\2/p" "$i") && + git diff -U1 $i >actual && - grep '@@ .* @@.*RIGHT' actual - " + + sed -ne "s/^@@[^@]*@@//p" actual | + if test -n "$HEAD" + then + grep -F "$HEAD" + else + grep "^.*RIGHT" + fi + ' done test_done
t/t4018/README +6 -3
@@ -10,9 +10,12 @@ The text that must appear in the hunk header must contain the word To mark a test case that highlights a malfunction, insert the word BROKEN in all lower-case somewhere in the file. -This text is a bit twisted and out of order, but it is itself a -test case for the default hunk header pattern. Know what you are doing -if you change it. +This text is a bit twisted and out of order, but it is itself a test +case for the default hunk header pattern. Know what you are doing if +you change it. You can optionally force exactly what should be on +the hunk header line by enclosing the expect text by vertical bars +(but downcasing the word right in it) and place it on a line with +HEADER on it, like |How to write right test cases|. BTW, this tests that the head line goes to the hunk header, not the line of equal signs.
t/t4018/bash-arithmetic-function +3 -0
@@ -2,3 +2,6 @@ RIGHT() (( ChangeMe = "$x" + "$y" )) + + +# HEADER |right()|
Re: [PATCH v2 09/27] userdiff tests: match full hunk headers
Am 16.02.21 um 19:32 schrieb Junio C Hamano:
Quoted 78 lines
Quoted 10 lines · Johannes Sixt
Quoted 6 lines
t/t4018-diff-funcname.sh | 7 +++--- t/t4018/README | 22 +++++++++---------- t/t4018/README.ctx | 1 + t/t4018/bash-arithmetic-function.ctx | 1 + t/t4018/bash-bashism-style-compact.ctx | 1 +[...and so on...]
This is what I meant by "without burdening test writers with lots of subtleties".
Quoted 8 lines
I'm not a friend of this change :-(
I think you are going overboard with required test precision. To have useful tests for userdiff patterns that demonstrate its features, authors should write *many* tests. The right balance should be on the coverage of userdiff pattern features, not on the subtle details of each and everyone of it. Requiring that many additional context files makes it *really hard* to comply.
Yeah, the first time I saw the t4018 test framework appeared in my tree, I truly appreciated its simplicity, how the test input file is self-documenting and self-contained, with the clever use of "RIGHT", "broken" and "ChangeMe" magic tokens, admired the cleverness of the approach, and wished I was clever enough to invent that pattern to apply to other tests myself.
A little new for each and every test for the miniscule gain of checking which part of the function header line is extracted feels a bit too much noise and rubs my sense of aesthetics, spoiled by the existing t4018 tests, the wrong way.
This is a rough sketch of a different approach aiming for the same. I converted only a few files, but I hope that this is enough to illustrate the idea.
t/t4018-diff-funcname.sh | 17 ++++++++++++++--- t/t4018/README | 9 ++++++--- t/t4018/bash-arithmetic-function | 3 +++ 3 files changed, 23 insertions(+), 6 deletions(-)t/t4018-diff-funcname.sh +14
-3@@ -107,10 +107,21 @@ do else result=success fi - test_expect_$result "hunk header: $i" " + + test_expect_$result "hunk header: $i" ' + HEAD=$(sed -n \ + -e "s/^.*HEADER.*|\(.*\)right\(.*\)|.*/ \1RIGHT\2/p" "$i") && + git diff -U1 $i >actual && - grep '@@ .* @@.*RIGHT' actual - " + + sed -ne "s/^@@[^@]*@@//p" actual | + if test -n "$HEAD" + then + grep -F "$HEAD" + else + grep "^.*RIGHT" + fi + ' done test_donet/t4018/bash-arithmetic-function +0
-0
t/t4018/bash-arithmetic-function RIGHT() (( · line 7
Quoted 6 lines
t/t4018/bash-arithmetic-function +3
-0@@ -2,3 +2,6 @@ RIGHT() (( ChangeMe = "$x" + "$y" )) + + +# HEADER |right()|
Clever! Opt-in for those who desire precise tests.
-- Hannes
Re: [PATCH v2 09/27] userdiff tests: match full hunk headers
Quoted 67 lines · Johannes Sixt
Am 16.02.21 um 19:32 schrieb Junio C Hamano:
Quoted 65 lines
Quoted 10 lines · Johannes Sixt
Quoted 6 lines
t/t4018-diff-funcname.sh | 7 +++--- t/t4018/README | 22 +++++++++---------- t/t4018/README.ctx | 1 + t/t4018/bash-arithmetic-function.ctx | 1 + t/t4018/bash-bashism-style-compact.ctx | 1 +[...and so on...]
This is what I meant by "without burdening test writers with lots of subtleties".
Quoted 8 lines
I'm not a friend of this change :-(
I think you are going overboard with required test precision. To have useful tests for userdiff patterns that demonstrate its features, authors should write *many* tests. The right balance should be on the coverage of userdiff pattern features, not on the subtle details of each and everyone of it. Requiring that many additional context files makes it *really hard* to comply.
Yeah, the first time I saw the t4018 test framework appeared in my tree, I truly appreciated its simplicity, how the test input file is self-documenting and self-contained, with the clever use of "RIGHT", "broken" and "ChangeMe" magic tokens, admired the cleverness of the approach, and wished I was clever enough to invent that pattern to apply to other tests myself.
A little new for each and every test for the miniscule gain of checking which part of the function header line is extracted feels a bit too much noise and rubs my sense of aesthetics, spoiled by the existing t4018 tests, the wrong way.
This is a rough sketch of a different approach aiming for the same. I converted only a few files, but I hope that this is enough to illustrate the idea.t/t4018-diff-funcname.sh | 17 ++++++++++++++--- t/t4018/README | 9 ++++++--- t/t4018/bash-arithmetic-function | 3 +++ 3 files changed, 23 insertions(+), 6 deletions(-)t/t4018-diff-funcname.sh +14
-3@@ -107,10 +107,21 @@ do else result=success fi - test_expect_$result "hunk header: $i" " + + test_expect_$result "hunk header: $i" ' + HEAD=$(sed -n \ + -e "s/^.*HEADER.*|\(.*\)right\(.*\)|.*/ \1RIGHT\2/p" "$i") && + git diff -U1 $i >actual && - grep '@@ .* @@.*RIGHT' actual - " + + sed -ne "s/^@@[^@]*@@//p" actual | + if test -n "$HEAD" + then + grep -F "$HEAD" + else + grep "^.*RIGHT" + fi + ' done test_done
Quoted 13 lines
t/t4018/bash-arithmetic-function RIGHT() (( · line 7
Quoted 11 lines
t/t4018/bash-arithmetic-function +3
-0@@ -2,3 +2,6 @@ RIGHT() (( ChangeMe = "$x" + "$y" )) + + +# HEADER |right()|Clever! Opt-in for those who desire precise tests.
Tests aren't only for testing a subjective "good enough" in the estimation of the author of the code in question, but also for others who later touch the same area and want to avoid regressions.
Which is why I think it's an anti-pattern to use "grep SOME-SUBSTR" in lieu of test_cmp if we can easily do the latter.
So e.g. in this case part of my motivation is that this is one of the things I want to look at porting to some general PCREv2 powered backend regex matching library once some of the pickaxe work I have pending lands.
I'm very interested in whether such a port subtly breaks existing semantics, and it's not useful if such regressions are hidden because someone who wrote a userdiff rule didn't think they needed to care about exact matching for their own purposes.
I find this notion that patch authors who we'd expect to hack userdiff.c and somehow understand the arcane rules of the list form of diff.<func>.xfunction (which wasn't even documented until this series), and to carefully read t/t4018/README to see how their test is parsed, would be discouraged by some pretty plain shell syntax to pass in two strings to be implausible.
Whenever I've tried to hack up userdiff.c rules my first stumbling block has been that if you fail the previous test gave you no output, because it used grep instead of test_cmp.
So you'd need to monkeypatch it to dump the value, or know about "-d" and trash directory inspection. So much for sparing prospective authors from the intricacies of our sh-based tests.
The old test format also forces you to try to mix real examples of a programming language with our need to shove an all-caps "RIGHT" identifier somewhere on the hunk line.
In languages like Go, Perl or Elisp such an identifier is somewhere between so strongly discouraged that you'd never see one in the wild, or in others even a syntax error.
It seems much simpler to just ask the author to paste in their snippet, test it, and then then paste what they got on the @@ line as another parameter to their test.
Re: [PATCH v2 09/27] userdiff tests: match full hunk headers
Quoted 25 lines · Ævar Arnfjörð Bjarmason
Quoted 11 lines
Quoted 10 lines
t/t4018-diff-funcname.sh +8
-0+ sed -ne "s/^@@[^@]*@@//p" actual | + if test -n "$HEAD" + then + grep -F "$HEAD" + else + grep "^.*RIGHT" + fi + ' done test_doneQuoted 13 lines
t/t4018/bash-arithmetic-function RIGHT() (( · line 7
Quoted 11 lines
t/t4018/bash-arithmetic-function +3
-0@@ -2,3 +2,6 @@ RIGHT() (( ChangeMe = "$x" + "$y" )) + + +# HEADER |right()|Clever! Opt-in for those who desire precise tests.
Quoted 6 lines
Tests aren't only for testing a subjective "good enough" in the estimation of the author of the code in question, but also for others who later touch the same area and want to avoid regressions.
Which is why I think it's an anti-pattern to use "grep SOME-SUBSTR" in lieu of
test_cmpif we can easily do the latter.
Sounds good. It shouldn't be too hard to satisfy both camps, i.e. the quoted demonstrates one way to allow test writers to give expectation in-place in the single test file, and replacing how it uses "grep" to check the output with test_cmp or whatever wouldn't make the resulting tests too hard to write and maintain.
Re: [PATCH v2 09/27] userdiff tests: match full hunk headers
Quoted 31 lines · Junio C Hamano
Quoted 29 lines · Ævar Arnfjörð Bjarmason
Quoted 11 lines
Quoted 10 lines
t/t4018-diff-funcname.sh +8
-0+ sed -ne "s/^@@[^@]*@@//p" actual | + if test -n "$HEAD" + then + grep -F "$HEAD" + else + grep "^.*RIGHT" + fi + ' done test_doneQuoted 13 lines
t/t4018/bash-arithmetic-function RIGHT() (( · line 7
Quoted 11 lines
t/t4018/bash-arithmetic-function +3
-0@@ -2,3 +2,6 @@ RIGHT() (( ChangeMe = "$x" + "$y" )) + + +# HEADER |right()|Clever! Opt-in for those who desire precise tests.
Tests aren't only for testing a subjective "good enough" in the estimation of the author of the code in question, but also for others who later touch the same area and want to avoid regressions.
Quoted 8 lines
Quoted 2 lines
Which is why I think it's an anti-pattern to use "grep SOME-SUBSTR" in lieu of
test_cmpif we can easily do the latter.Sounds good. It shouldn't be too hard to satisfy both camps, i.e. the quoted demonstrates one way to allow test writers to give expectation in-place in the single test file, and replacing how it uses "grep" to check the output with
test_cmpor whatever wouldn't make the resulting tests too hard to write and maintain.
It doesn't satisfy both camps, because I'd like to convert all these tests to test_cmp because for a subsequent refactoring of userdiff.c by me or others I don't know in advance what might break, so I'd like to assert the exact current behavior.
Whereas your patch provides a way to opt-in individual tests to a test_cmp-alike, but leaves the rest at grepping for the "RIGHT" substring. Failures in the tests who aren't opted-in will be hidden.
It also means that subsequent changes to the behavior in the form of submitted patches won't be as self-documenting, e.g. I've wondered if we could introduce a case to balance parens in this code (sometimes C function declarations stretch across lines), and there's e.g. the arbitrary limit of 80 bytes on the line (which to be fair, we don't curretly have tests for).
Anyway, as noted in [1] I don't see how this custom format of grepping stuff out of plain-text files is simpler, particularly when its behavior would start to rely on other things like "# HEADER |right()|" whose behavior is a function of what we grep/sed when/where in the logic driving the tests.
But if you & Johannes S. disagree with that I don't really say a way forward with this series. I think e.g. squashing 09/27 into the rest would make things simpler/less verbose, but the end-state would still be matching the full hunk line, and if that's not something that's wanted in any shape or form as a default...
Re: [PATCH v2 09/27] userdiff tests: match full hunk headers
Am 23.02.21 um 14:11 schrieb Ævar Arnfjörð Bjarmason:
Quoted 29 lines · Junio C Hamano
Quoted 5 lines
Sounds good. It shouldn't be too hard to satisfy both camps, i.e. the quoted demonstrates one way to allow test writers to give expectation in-place in the single test file, and replacing how it uses "grep" to check the output with
test_cmpor whatever wouldn't make the resulting tests too hard to write and maintain.It doesn't satisfy both camps, because I'd like to convert all these tests to
test_cmpbecause for a subsequent refactoring ofuserdiff.cby me or others I don't know in advance what might break, so I'd like to assert the exact current behavior.Whereas your patch provides a way to opt-in individual tests to a test_cmp-alike, but leaves the rest at grepping for the "RIGHT" substring. Failures in the tests who aren't opted-in will be hidden.
It also means that subsequent changes to the behavior in the form of submitted patches won't be as self-documenting, e.g. I've wondered if we could introduce a case to balance parens in this code (sometimes C function declarations stretch across lines), and there's e.g. the arbitrary limit of 80 bytes on the line (which to be fair, we don't curretly have tests for).
Anyway, as noted in [1] I don't see how this custom format of grepping stuff out of plain-text files is simpler, particularly when its behavior would start to rely on other things like "# HEADER |right()|" whose behavior is a function of what we grep/sed when/where in the logic driving the tests.
Quoted 7 lines
But if you & Johannes S. disagree with that I don't really say a way forward with this series. I think e.g. squashing 09/27 into the rest would make things simpler/less verbose, but the end-state would still be matching the full hunk line, and if that's not something that's wanted in any shape or form as a default...
I could live with a version of Junio's suggestion that is not opt-in, i.e., the checks are mandatory and exact. The important point is that there is only one file per test case; that would still count as "sufficiently simple" in my book.
-- Hannes
Re: [PATCH v2 09/27] userdiff tests: match full hunk headers
Quoted 36 lines · Johannes Sixt
Am 23.02.21 um 14:11 schrieb Ævar Arnfjörð Bjarmason:
Quoted 35 lines · Junio C Hamano
Quoted 5 lines
Sounds good. It shouldn't be too hard to satisfy both camps, i.e. the quoted demonstrates one way to allow test writers to give expectation in-place in the single test file, and replacing how it uses "grep" to check the output with
test_cmpor whatever wouldn't make the resulting tests too hard to write and maintain.It doesn't satisfy both camps, because I'd like to convert all these tests to
test_cmpbecause for a subsequent refactoring ofuserdiff.cby me or others I don't know in advance what might break, so I'd like to assert the exact current behavior.Whereas your patch provides a way to opt-in individual tests to a test_cmp-alike, but leaves the rest at grepping for the "RIGHT" substring. Failures in the tests who aren't opted-in will be hidden.
It also means that subsequent changes to the behavior in the form of submitted patches won't be as self-documenting, e.g. I've wondered if we could introduce a case to balance parens in this code (sometimes C function declarations stretch across lines), and there's e.g. the arbitrary limit of 80 bytes on the line (which to be fair, we don't curretly have tests for).
Anyway, as noted in [1] I don't see how this custom format of grepping stuff out of plain-text files is simpler, particularly when its behavior would start to rely on other things like "# HEADER |right()|" whose behavior is a function of what we grep/sed when/where in the logic driving the tests.
But if you & Johannes S. disagree with that I don't really say a way forward with this series. I think e.g. squashing 09/27 into the rest would make things simpler/less verbose, but the end-state would still be matching the full hunk line, and if that's not something that's wanted in any shape or form as a default...
Quoted 6 lines
Quoted 1 line
I could live with a version of Junio's suggestion that is not opt-in, i.e., the checks are mandatory and exact. The important point is that there is only one file per test case; that would still count as "sufficiently simple" in my book.
So something where the tests in 14-15,17,19/27 would need to go back to having the config that's part of the test driven by setup in t/t4018-diff-funcname.sh, and the contents of a test file being e.g. (to take the test from 25/27):
# HEADER |package main|
package main
import "fmt"
// ChangeMe
?
Re: [PATCH v2 09/27] userdiff tests: match full hunk headers
Am 24.02.21 um 12:12 schrieb Ævar Arnfjörð Bjarmason:
Quoted 10 lines · Johannes Sixt
Quoted 4 lines
I could live with a version of Junio's suggestion that is not opt-in, i.e., the checks are mandatory and exact. The important point is that there is only one file per test case; that would still count as "sufficiently simple" in my book.
So something where the tests in 14-15,17,19/27 would need to go back to having the config that's part of the test driven by setup in
t/t4018-diff-funcname.sh,
I'm afraid, I don't understand what you mean by this sentence. Do you mean "not do the refactoring like in those patches"? Yes, that would likely be unnecessary churn.
Quoted 11 lines
and the contents of a test file being e.g. (to
take the test from 25/27):# HEADER |package main|
package mainimport "fmt"
// ChangeMe?
Yes. Except that I would move the "expected text" part to the end of the file so that there is no danger that it is mistaken as a hunk header (in case that a pattern is so loose that it matches that line).
-- Hannes
Re: [PATCH v2 09/27] userdiff tests: match full hunk headers
In reply to Junio C Hamanot/t4018-diff-funcname.sh do · line 120
Quoted 4 lines · Junio C Hamano
t/t4018-diff-funcname.sh +4
-0+ sed -ne "s/^@@[^@]*@@//p" actual | + if test -n "$HEAD" + then + grep -F "$HEAD"
I think this should also use "-x" (match the whole line) if it is portable enough; the option should be available in POSIX.1 but we haven't used it anywhere in our test suite.
Quoted 5 lines
t/t4018-diff-funcname.sh +4
-0+ else + grep "^.*RIGHT" + fi + ' done
Re: [PATCH v2 09/27] userdiff tests: match full hunk headers
Quoted 10 lines · Junio C Hamano
t/t4018-diff-funcname.sh do · line 120
Quoted 4 lines · Junio C Hamano
t/t4018-diff-funcname.sh +4
-0+ sed -ne "s/^@@[^@]*@@//p" actual | + if test -n "$HEAD" + then + grep -F "$HEAD"I think this should also use "-x" (match the whole line) if it is portable enough; the option should be available in POSIX.1 but we haven't used it anywhere in our test suite.
Isn't that just test_cmp with no debug output when it fails? Noted in
https://lore.kernel.org/git/[email protected]/
Quoted 5 lines
Quoted 5 lines
t/t4018-diff-funcname.sh +4
-0+ else + grep "^.*RIGHT" + fi + ' done
PATCH v2 10/27 blame tests: don't rely on t/t4018/ directory
In reply to Ævar Arnfjörð BjarmasonRefactor a test added in 9466e3809d (blame: enable funcname blaming with userdiff driver, 2020-11-01) so that the blame tests don't rely on stealing the contents of "t/t4018/fortran-external-function".
I'm about to refactor that directory to delete that file, just moving the relevant test file here inline is the easiest solution, and I think also the most readable.
--- t/annotate-tests.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
t/annotate-tests.sh +13 -3
@@ -482,12 +482,22 @@ test_expect_success 'blame -L ^:RE (absolute: end-of-file)' ' test_expect_success 'setup -L :funcname with userdiff driver' ' echo "fortran-* diff=fortran" >.gitattributes && fortran_file=fortran-external-function && - orig_file="$TEST_DIRECTORY/t4018/$fortran_file" && - cp "$orig_file" . && + cat >$fortran_file <<-\EOF && + function RIGHT(a, b) result(c) + + integer, intent(in) :: ChangeMe + integer, intent(in) :: b + integer, intent(out) :: c + + c = a+b + + end function RIGHT + EOF git add "$fortran_file" && GIT_AUTHOR_NAME="A" GIT_AUTHOR_EMAIL="[email protected]" \ git commit -m "add fortran file" && - sed -e "s/ChangeMe/IWasChanged/" <"$orig_file" >"$fortran_file" && + sed -e "s/ChangeMe/IWasChanged/" <"$fortran_file" >"$fortran_file".tmp && + mv "$fortran_file".tmp "$fortran_file" && git add "$fortran_file" && GIT_AUTHOR_NAME="B" GIT_AUTHOR_EMAIL="[email protected]" \ git commit -m "change fortran file"
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7
Re: [PATCH v2 10/27] blame tests: don't rely on t/t4018/ directory
Quoted 3 lines · Ævar Arnfjörð Bjarmason
Refactor a test added in
9466e3809d(blame: enable funcname blaming with userdiff driver, 2020-11-01) so that the blame tests don't rely on stealing the contents of "t/t4018/fortran-external-function".
I like changes like this and wish they (I haven't finished reading the 27 patches, but I am hoping that there may be more) were separately available ;-)
PATCH v2 11/27 blame tests: simplify userdiff driver test
In reply to Ævar Arnfjörð BjarmasonSimplify the test added in 9466e3809d (blame: enable funcname blaming with userdiff driver, 2020-11-01) to use the --author support recently added in 999cfc4f45 (test-lib functions: add --author support to test_commit, 2021-01-12).
We also did not need the full fortran-external-function content, let's cut it down to just the important parts, and further modify it to demonstrate that the fortran-specific userdiff function is in effect by adding "WRONG" lines surrounding the "RIGHT" one.
The test also left behind a .gitattributes files, let's clean it up with "test_when_finished".
--- t/annotate-tests.sh | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-)
t/annotate-tests.sh +15 -21
@@ -479,32 +479,26 @@ test_expect_success 'blame -L ^:RE (absolute: end-of-file)' ' check_count -f hello.c -L$n -L^:ma.. F 4 G 1 H 1 ' -test_expect_success 'setup -L :funcname with userdiff driver' ' - echo "fortran-* diff=fortran" >.gitattributes && - fortran_file=fortran-external-function && - cat >$fortran_file <<-\EOF && +test_expect_success 'blame -L :funcname with userdiff driver' ' + cat >file.template <<-\EOF && + def WRONG begin end function RIGHT(a, b) result(c) + int WRONG(void) {} integer, intent(in) :: ChangeMe - integer, intent(in) :: b - integer, intent(out) :: c - - c = a+b - - end function RIGHT EOF - git add "$fortran_file" && - GIT_AUTHOR_NAME="A" GIT_AUTHOR_EMAIL="[email protected]" \ - git commit -m "add fortran file" && - sed -e "s/ChangeMe/IWasChanged/" <"$fortran_file" >"$fortran_file".tmp && - mv "$fortran_file".tmp "$fortran_file" && - git add "$fortran_file" && - GIT_AUTHOR_NAME="B" GIT_AUTHOR_EMAIL="[email protected]" \ - git commit -m "change fortran file" -' -test_expect_success 'blame -L :funcname with userdiff driver' ' - check_count -f fortran-external-function -L:RIGHT A 7 B 1 + fortran_file=file.f03 && + test_when_finished "rm .gitattributes" && + echo "$fortran_file diff=fortran" >.gitattributes && + + test_commit --author "A <[email protected]>" \ + "add" $fortran_file \ + "$(cat file.template)" && + test_commit --author "B <[email protected]>" \ + "change" $fortran_file \ + "$(cat file.template | sed -e s/ChangeMe/IWasChanged/)" && + check_count -f $fortran_file -L:RIGHT A 3 B 1 ' test_expect_success 'setup incremental' '
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7
Re: [PATCH v2 11/27] blame tests: simplify userdiff driver test
Am 15.02.21 um 16:44 schrieb Ævar Arnfjörð Bjarmason:
Quoted 61 lines
Simplify the test added in
9466e3809d(blame: enable funcname blaming with userdiff driver, 2020-11-01) to use the --author support recently added in999cfc4f45(test-lib functions: add --author support totest_commit, 2021-01-12).We also did not need the full fortran-external-function content, let's cut it down to just the important parts, and further modify it to demonstrate that the fortran-specific userdiff function is in effect by adding "WRONG" lines surrounding the "RIGHT" one.
The test also left behind a .gitattributes files, let's clean it up with "
test_when_finished".Signed-off-by Ævar Arnfjörð Bjarmason <[email protected]>--- t/annotate-tests.sh | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-)t/annotate-tests.sh +8
-21@@ -479,32 +479,26 @@ test_expect_success 'blame -L ^:RE (absolute: end-of-file)' ' check_count -f hello.c -L$n -L^:ma.. F 4 G 1 H 1 ' -test_expect_success 'setup -L :funcname with userdiff driver' ' - echo "fortran-* diff=fortran" >.gitattributes && - fortran_file=fortran-external-function && - cat >$fortran_file <<-\EOF && +test_expect_success 'blame -L :funcname with userdiff driver' ' + cat >file.template <<-\EOF && + def WRONG begin end function RIGHT(a, b) result(c) + int WRONG(void) {} integer, intent(in) :: ChangeMe - integer, intent(in) :: b - integer, intent(out) :: c - - c = a+b - - end function RIGHT EOF - git add "$fortran_file" && - GIT_AUTHOR_NAME="A" GIT_AUTHOR_EMAIL="[email protected]" \ - git commit -m "add fortran file" && - sed -e "s/ChangeMe/IWasChanged/" <"$fortran_file" >"$fortran_file".tmp && - mv "$fortran_file".tmp "$fortran_file" && - git add "$fortran_file" && - GIT_AUTHOR_NAME="B" GIT_AUTHOR_EMAIL="[email protected]" \ - git commit -m "change fortran file" -' -test_expect_success 'blame -L :funcname with userdiff driver' ' - check_count -f fortran-external-function -L:RIGHT A 7 B 1 + fortran_file=file.f03 && + test_when_finished "rm .gitattributes" && + echo "$fortran_file diff=fortran" >.gitattributes && +
t/annotate-tests.sh test_expect_success 'blame -L ^:RE (absolute: end-of-file)' ' · line 504
Quoted 10 lines
t/annotate-tests.sh +7
-0+ test_commit --author "A <[email protected]>" \ + "add" $fortran_file \ + "$(cat file.template)" && + test_commit --author "B <[email protected]>" \ + "change" $fortran_file \ + "$(cat file.template | sed -e s/ChangeMe/IWasChanged/)" && + check_count -f $fortran_file -L:RIGHT A 3 B 1 ' test_expect_success 'setup incremental' '
I don't get the point. What do you need the tokens "WRONG" for when they are not checked anywhere? Instead of adding unrelated lines (that do not even look like Fortran), couldn't you just not remove some of the others? In particular, the last one that contains "RIGHT" as well may be useful to keep in order to show that the code is not confused by it.
Please place "$fortran_file" in dquotes on the check_count line.
-- Hannes
Re: [PATCH v2 11/27] blame tests: simplify userdiff driver test
Quoted 64 lines · Johannes Sixt
Am 15.02.21 um 16:44 schrieb Ævar Arnfjörð Bjarmason:
Quoted 63 lines
Simplify the test added in
9466e3809d(blame: enable funcname blaming with userdiff driver, 2020-11-01) to use the --author support recently added in999cfc4f45(test-lib functions: add --author support totest_commit, 2021-01-12).
We also did not need the full fortran-external-function content, let's
cut it down to just the important parts, and further modify it to demonstrate that the fortran-specific userdiff function is in effect by adding "WRONG" lines surrounding the "RIGHT" one.
The test also left behind a .gitattributes files, let's clean it up with "test_when_finished".Signed-off-by Ævar Arnfjörð Bjarmason <[email protected]>--- t/annotate-tests.sh | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-)t/annotate-tests.sh +15
-19@@ -479,32 +479,26 @@ test_expect_success 'blame -L ^:RE (absolute: end-of-file)' ' check_count -f hello.c -L$n -L^:ma.. F 4 G 1 H 1 ' -test_expect_success 'setup -L :funcname with userdiff driver' ' - echo "fortran-* diff=fortran" >.gitattributes && - fortran_file=fortran-external-function && - cat >$fortran_file <<-\EOF && +test_expect_success 'blame -L :funcname with userdiff driver' ' + cat >file.template <<-\EOF && + def WRONG begin end function RIGHT(a, b) result(c) + int WRONG(void) {} integer, intent(in) :: ChangeMe - integer, intent(in) :: b - integer, intent(out) :: c - - c = a+b - - end function RIGHT EOF - git add "$fortran_file" && - GIT_AUTHOR_NAME="A" GIT_AUTHOR_EMAIL="[email protected]" \ - git commit -m "add fortran file" && - sed -e "s/ChangeMe/IWasChanged/" <"$fortran_file" >"$fortran_file".tmp && - mv "$fortran_file".tmp "$fortran_file" && - git add "$fortran_file" && - GIT_AUTHOR_NAME="B" GIT_AUTHOR_EMAIL="[email protected]" \ - git commit -m "change fortran file" -' -test_expect_success 'blame -L :funcname with userdiff driver' ' - check_count -f fortran-external-function -L:RIGHT A 7 B 1 + fortran_file=file.f03 && + test_when_finished "rm .gitattributes" && + echo "$fortran_file diff=fortran" >.gitattributes && + + test_commit --author "A <[email protected]>" \ + "add" $fortran_file \ + "$(cat file.template)" && + test_commit --author "B <[email protected]>" \ + "change" $fortran_file \ + "$(cat file.template | sed -e s/ChangeMe/IWasChanged/)" && + check_count -f $fortran_file -L:RIGHT A 3 B 1 ' test_expect_success 'setup incremental' '
Quoted 8 lines
Quoted 1 line
I don't get the point. What do you need the tokens "WRONG" for when they are not checked anywhere? Instead of adding unrelated lines (that do not even look like Fortran), couldn't you just not remove some of the others? In particular, the last one that contains "RIGHT" as well may be useful to keep in order to show that the code is not confused by it.
Isn't the point of the test to assert that we're using a userdiff driver over the built-in xdiff rules here?
We can imagine that a change to its default heuristics would be to find the first non-whitespace line, but it jumping over non-whitespace lines in search of a fortran-looking line doesn't seem like it would ever happen. Hence the WRONG lines.
Quoted 1 line
Please place "$fortran_file" in dquotes on the
check_countline.
Why do we need to dquote a convenience variable defined in the test itself that'll never contain spaces or other funny things we'd get if we had $(pwd) or whatever in there? It wouldn't hurt, but maybe I'm missing some reason for why it's necessary or desired here.
Re: [PATCH v2 11/27] blame tests: simplify userdiff driver test
Quoted 12 lines · Ævar Arnfjörð Bjarmason
Quoted 11 lines
Quoted 11 lines
t/annotate-tests.sh +11
-0+ fortran_file=file.f03 && + test_when_finished "rm .gitattributes" && + echo "$fortran_file diff=fortran" >.gitattributes && + + test_commit --author "A <[email protected]>" \ + "add" $fortran_file \ + "$(cat file.template)" && + test_commit --author "B <[email protected]>" \ + "change" $fortran_file \ + "$(cat file.template | sed -e s/ChangeMe/IWasChanged/)" && + check_count -f $fortran_file -L:RIGHT A 3 B 1...
Quoted 6 lines
Quoted 1 line
Please place "$fortran_file" in dquotes on the
check_countline.Why do we need to dquote a convenience variable defined in the test itself that'll never contain spaces or other funny things we'd get if we had $(pwd) or whatever in there? It wouldn't hurt, but maybe I'm missing some reason for why it's necessary or desired here.
Always dquoting when the code does not depend on splitting at IFS whitespace reduces cognitive load. The person who looks at the variable reference, $fortran_file, has to wonder if the unquoted form is used to take advantage of being split at IFS whitespaces, or the test author saved two keystrokes because the filename does not have any such whitespace, and go back to the assignment to check.
Re: [PATCH v2 11/27] blame tests: simplify userdiff driver test
In reply to Ævar Arnfjörð BjarmasonAm 17.02.21 um 02:33 schrieb Ævar Arnfjörð Bjarmason:
Quoted 76 lines · Johannes Sixt
Quoted 65 lines
Am 15.02.21 um 16:44 schrieb Ævar Arnfjörð Bjarmason:
Quoted 63 lines
Simplify the test added in
9466e3809d(blame: enable funcname blaming with userdiff driver, 2020-11-01) to use the --author support recently added in999cfc4f45(test-lib functions: add --author support totest_commit, 2021-01-12).
We also did not need the full fortran-external-function content, let's
cut it down to just the important parts, and further modify it to demonstrate that the fortran-specific userdiff function is in effect by adding "WRONG" lines surrounding the "RIGHT" one.
The test also left behind a .gitattributes files, let's clean it up with "test_when_finished".Signed-off-by Ævar Arnfjörð Bjarmason <[email protected]>--- t/annotate-tests.sh | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-)t/annotate-tests.sh +15
-19@@ -479,32 +479,26 @@ test_expect_success 'blame -L ^:RE (absolute: end-of-file)' ' check_count -f hello.c -L$n -L^:ma.. F 4 G 1 H 1 ' -test_expect_success 'setup -L :funcname with userdiff driver' ' - echo "fortran-* diff=fortran" >.gitattributes && - fortran_file=fortran-external-function && - cat >$fortran_file <<-\EOF && +test_expect_success 'blame -L :funcname with userdiff driver' ' + cat >file.template <<-\EOF && + def WRONG begin end function RIGHT(a, b) result(c) + int WRONG(void) {} integer, intent(in) :: ChangeMe - integer, intent(in) :: b - integer, intent(out) :: c - - c = a+b - - end function RIGHT EOF - git add "$fortran_file" && - GIT_AUTHOR_NAME="A" GIT_AUTHOR_EMAIL="[email protected]" \ - git commit -m "add fortran file" && - sed -e "s/ChangeMe/IWasChanged/" <"$fortran_file" >"$fortran_file".tmp && - mv "$fortran_file".tmp "$fortran_file" && - git add "$fortran_file" && - GIT_AUTHOR_NAME="B" GIT_AUTHOR_EMAIL="[email protected]" \ - git commit -m "change fortran file" -' -test_expect_success 'blame -L :funcname with userdiff driver' ' - check_count -f fortran-external-function -L:RIGHT A 7 B 1 + fortran_file=file.f03 && + test_when_finished "rm .gitattributes" && + echo "$fortran_file diff=fortran" >.gitattributes && + + test_commit --author "A <[email protected]>" \ + "add" $fortran_file \ + "$(cat file.template)" && + test_commit --author "B <[email protected]>" \ + "change" $fortran_file \ + "$(cat file.template | sed -e s/ChangeMe/IWasChanged/)" && + check_count -f $fortran_file -L:RIGHT A 3 B 1 ' test_expect_success 'setup incremental' 'Quoted 8 lines
Quoted 1 line
I don't get the point. What do you need the tokens "WRONG" for when they are not checked anywhere? Instead of adding unrelated lines (that do not even look like Fortran), couldn't you just not remove some of the others? In particular, the last one that contains "RIGHT" as well may be useful to keep in order to show that the code is not confused by it.
Quoted 7 lines
Isn't the point of the test to assert that we're using a userdiff driver over the built-in xdiff rules here?
We can imagine that a change to its default heuristics would be to find the first non-whitespace line, but it jumping over non-whitespace lines in search of a fortran-looking line doesn't seem like it would ever happen. Hence the WRONG lines.
Fair enough. A justification along these lines either as comment or in the commit message would have helped; the existing text in the commit message was not sufficient to get the point across. I was distracted by the capitalized "WRONG" token because we use a capitalized "RIGHT" token and check for it, so I expected that we also should check for "WRONG". Wouldn't it then just be sufficient to remove the blank lines from the exiting Fortran content?
Quoted 1 line
Quoted 1 line
Please place "$fortran_file" in dquotes on the
check_countline.
I just noticed that there are more unquoted expansions above that line. (I'm just mentioning it for completeness.)
-- Hannes
PATCH v2 12/27 userdiff tests: rewrite hunk header test infrastructure
In reply to Ævar Arnfjörð BjarmasonRewrite the hunk header test infrastructure introduced in bfa7d01413 (t4018: an infrastructure to test hunk headers, 2014-03-21). See c228a5c077 (Merge branch 'js/userdiff-cc', 2014-03-31) for the whole series that commit was part of.
As noted in an earlier commit that change introduced the regression of not testing for the full hunk line, but just whether "RIGHT" appeared on it[1]. A preceding commit fixed that specific issue, but we were still left with the inflexibility of the approach described in the now-deleted t/t4018/README.
I.e. to add any sort of new tests that used the existing test data we'd either need to add more files like the recently added (but now deleted) *.ctx) files, using the filesystem as our test datastructure, or introduce more parsing for the custom file format we were growing here.
Let's instead just move this over to using a custom test function. This makes it trivial to add new tests by adding new optional parameters to the function. Let's still keep the relevant files in the "t/t4018/" subdirectory instead of adding ~1.5k lines (and growing) to "t/t4018-diff-funcname.sh"
If this diff is viewed with "--color-moved=plain" we can see that there's no changes to the lines being moved into the new *.sh files, i.e. all the deletions are moves. I'm just adding boilerplate around those existing lines.
The one-off refactoring was performed by an ad-hoc shellscript [2].
1. https://lore.kernel.org/git/[email protected]/
2.
#!/bin/sh set -ex git rm README* for t in $(git ls-files ':!*.ctx') do lang=$(echo $t | sed 's/-.*//') desc=$(echo $t | sed -E 's/^[^-]*-//' | tr - " ") if ! test -e $lang.sh then cat >$lang.sh <<-EOF #!/bin/sh # # See ../t4018-diff-funcname.sh's test_diff_funcname() # EOF else echo >>$lang.sh fi ( printf "test_diff_funcname '%s: %s' \\" "$lang" "$desc" echo printf "\t8<<%sEOF_HUNK 9<<%sEOF_TEST\n" '\' '\' cat $t.ctx printf "EOF_HUNK\n" cat $t printf "EOF_TEST\n" ) >>$lang.sh chmod +x $lang.sh git add $lang.sh git rm $t $t.ctx done
--- t/t4018-diff-funcname.sh | 59 +++-- t/t4018/README | 15 -- t/t4018/README.ctx | 1 - t/t4018/bash-arithmetic-function | 4 - t/t4018/bash-arithmetic-function.ctx | 1 - t/t4018/bash-bashism-style-compact | 6 - t/t4018/bash-bashism-style-compact.ctx | 1 - t/t4018/bash-bashism-style-function | 4 - t/t4018/bash-bashism-style-function.ctx | 1 - t/t4018/bash-bashism-style-whitespace | 4 - t/t4018/bash-bashism-style-whitespace.ctx | 1 - t/t4018/bash-conditional-function | 4 - t/t4018/bash-conditional-function.ctx | 1 - t/t4018/bash-missing-parentheses | 6 - t/t4018/bash-missing-parentheses.ctx | 1 - t/t4018/bash-mixed-style-compact | 4 - t/t4018/bash-mixed-style-compact.ctx | 1 - t/t4018/bash-mixed-style-function | 4 - t/t4018/bash-mixed-style-function.ctx | 1 - t/t4018/bash-nested-functions | 6 - t/t4018/bash-nested-functions.ctx | 1 - t/t4018/bash-other-characters | 4 - t/t4018/bash-other-characters.ctx | 1 - t/t4018/bash-posix-style-compact | 4 - t/t4018/bash-posix-style-compact.ctx | 1 - t/t4018/bash-posix-style-function | 4 - t/t4018/bash-posix-style-function.ctx | 1 - t/t4018/bash-posix-style-whitespace | 4 - t/t4018/bash-posix-style-whitespace.ctx | 1 - t/t4018/bash-subshell-function | 4 - t/t4018/bash-subshell-function.ctx | 1 - t/t4018/bash-trailing-comment | 4 - t/t4018/bash-trailing-comment.ctx | 1 - t/t4018/bash.sh | 160 ++++++++++++ t/t4018/cpp-c++-function | 4 - t/t4018/cpp-c++-function.ctx | 1 - t/t4018/cpp-class-constructor | 4 - t/t4018/cpp-class-constructor-mem-init | 5 - t/t4018/cpp-class-constructor-mem-init.ctx | 1 - t/t4018/cpp-class-constructor.ctx | 1 - t/t4018/cpp-class-definition | 4 - t/t4018/cpp-class-definition-derived | 5 - t/t4018/cpp-class-definition-derived.ctx | 1 - t/t4018/cpp-class-definition.ctx | 1 - t/t4018/cpp-class-destructor | 4 - t/t4018/cpp-class-destructor.ctx | 1 - t/t4018/cpp-function-returning-global-type | 4 - .../cpp-function-returning-global-type.ctx | 1 - t/t4018/cpp-function-returning-nested | 5 - t/t4018/cpp-function-returning-nested.ctx | 1 - t/t4018/cpp-function-returning-pointer | 4 - t/t4018/cpp-function-returning-pointer.ctx | 1 - t/t4018/cpp-function-returning-reference | 4 - t/t4018/cpp-function-returning-reference.ctx | 1 - t/t4018/cpp-gnu-style-function | 5 - t/t4018/cpp-gnu-style-function.ctx | 1 - t/t4018/cpp-namespace-definition | 4 - t/t4018/cpp-namespace-definition.ctx | 1 - t/t4018/cpp-operator-definition | 4 - t/t4018/cpp-operator-definition.ctx | 1 - t/t4018/cpp-skip-access-specifiers | 8 - t/t4018/cpp-skip-access-specifiers.ctx | 1 - t/t4018/cpp-skip-comment-block | 9 - t/t4018/cpp-skip-comment-block.ctx | 1 - t/t4018/cpp-skip-labels | 8 - t/t4018/cpp-skip-labels.ctx | 1 - t/t4018/cpp-struct-definition | 9 - t/t4018/cpp-struct-definition.ctx | 1 - t/t4018/cpp-struct-single-line | 7 - t/t4018/cpp-struct-single-line.ctx | 1 - t/t4018/cpp-template-function-definition | 4 - t/t4018/cpp-template-function-definition.ctx | 1 - t/t4018/cpp-union-definition | 4 - t/t4018/cpp-union-definition.ctx | 1 - t/t4018/cpp-void-c-function | 4 - t/t4018/cpp-void-c-function.ctx | 1 - t/t4018/cpp.sh | 239 ++++++++++++++++++ t/t4018/css-attribute-value-selector | 4 - t/t4018/css-attribute-value-selector.ctx | 1 - t/t4018/css-block-level-@-statements | 10 - t/t4018/[email protected] | 1 - t/t4018/css-brace-in-col-1 | 5 - t/t4018/css-brace-in-col-1.ctx | 1 - t/t4018/css-class-selector | 4 - t/t4018/css-class-selector.ctx | 1 - t/t4018/css-colon-eol | 4 - t/t4018/css-colon-eol.ctx | 1 - t/t4018/css-colon-selector | 5 - t/t4018/css-colon-selector.ctx | 1 - t/t4018/css-common | 4 - t/t4018/css-common.ctx | 1 - t/t4018/css-id-selector | 4 - t/t4018/css-id-selector.ctx | 1 - t/t4018/css-long-selector-list | 6 - t/t4018/css-long-selector-list.ctx | 1 - t/t4018/css-prop-sans-indent | 5 - t/t4018/css-prop-sans-indent.ctx | 1 - t/t4018/css-root-selector | 4 - t/t4018/css-root-selector.ctx | 1 - t/t4018/css-short-selector-list | 4 - t/t4018/css-short-selector-list.ctx | 1 - t/t4018/css-trailing-space | 5 - t/t4018/css-trailing-space.ctx | 1 - t/t4018/css.sh | 146 +++++++++++ t/t4018/custom1-pattern.ctx | 1 - t/t4018/{custom1-pattern => custom1.sh} | 10 + t/t4018/custom2-match-to-end-of-line | 8 - t/t4018/custom2-match-to-end-of-line.ctx | 1 - t/t4018/custom2.sh | 18 ++ t/t4018/custom3-alternation-in-pattern.ctx | 1 - ...tom3-alternation-in-pattern => custom3.sh} | 10 + t/t4018/dts-labels | 9 - t/t4018/dts-labels.ctx | 1 - t/t4018/dts-node-unitless | 8 - t/t4018/dts-node-unitless.ctx | 1 - t/t4018/dts-nodes | 8 - t/t4018/dts-nodes-boolean-prop | 9 - t/t4018/dts-nodes-boolean-prop.ctx | 1 - t/t4018/dts-nodes-comment1 | 8 - t/t4018/dts-nodes-comment1.ctx | 1 - t/t4018/dts-nodes-comment2 | 8 - t/t4018/dts-nodes-comment2.ctx | 1 - t/t4018/dts-nodes-multiline-prop | 13 - t/t4018/dts-nodes-multiline-prop.ctx | 1 - t/t4018/dts-nodes.ctx | 1 - t/t4018/dts-reference | 9 - t/t4018/dts-reference.ctx | 1 - t/t4018/dts-root | 5 - t/t4018/dts-root-comment | 8 - t/t4018/dts-root-comment.ctx | 1 - t/t4018/dts-root.ctx | 1 - t/t4018/dts.sh | 149 +++++++++++ t/t4018/elixir-do-not-pick-end | 5 - t/t4018/elixir-do-not-pick-end.ctx | 1 - t/t4018/elixir-ex-unit-test | 6 - t/t4018/elixir-ex-unit-test.ctx | 1 - t/t4018/elixir-function | 5 - t/t4018/elixir-function.ctx | 1 - t/t4018/elixir-macro | 5 - t/t4018/elixir-macro.ctx | 1 - t/t4018/elixir-module | 9 - t/t4018/elixir-module-func | 8 - t/t4018/elixir-module-func.ctx | 1 - t/t4018/elixir-module.ctx | 1 - t/t4018/elixir-nested-module | 9 - t/t4018/elixir-nested-module.ctx | 1 - t/t4018/elixir-private-function | 5 - t/t4018/elixir-private-function.ctx | 1 - t/t4018/elixir-protocol | 6 - t/t4018/elixir-protocol-implementation | 5 - t/t4018/elixir-protocol-implementation.ctx | 1 - t/t4018/elixir-protocol.ctx | 1 - t/t4018/elixir.sh | 127 ++++++++++ t/t4018/fortran-block-data | 5 - t/t4018/fortran-block-data.ctx | 1 - t/t4018/fortran-comment | 13 - t/t4018/fortran-comment-keyword | 14 - t/t4018/fortran-comment-keyword.ctx | 1 - t/t4018/fortran-comment-legacy | 13 - t/t4018/fortran-comment-legacy-star | 13 - t/t4018/fortran-comment-legacy-star.ctx | 1 - t/t4018/fortran-comment-legacy.ctx | 1 - t/t4018/fortran-comment.ctx | 1 - t/t4018/fortran-external-function | 9 - t/t4018/fortran-external-function.ctx | 1 - t/t4018/fortran-external-subroutine | 5 - t/t4018/fortran-external-subroutine.ctx | 1 - t/t4018/fortran-module | 5 - t/t4018/fortran-module-procedure | 13 - t/t4018/fortran-module-procedure.ctx | 1 - t/t4018/fortran-module.ctx | 1 - t/t4018/fortran-program | 5 - t/t4018/fortran-program.ctx | 1 - t/t4018/fortran.sh | 159 ++++++++++++ t/t4018/fountain-scene | 4 - t/t4018/fountain-scene.ctx | 1 - t/t4018/fountain.sh | 14 + t/t4018/golang-complex-function | 8 - t/t4018/golang-complex-function.ctx | 1 - t/t4018/golang-func | 4 - t/t4018/golang-func.ctx | 1 - t/t4018/golang-interface | 4 - t/t4018/golang-interface.ctx | 1 - t/t4018/golang-long-func | 5 - t/t4018/golang-long-func.ctx | 1 - t/t4018/golang-struct | 4 - t/t4018/golang-struct.ctx | 1 - t/t4018/golang.sh | 59 +++++ t/t4018/java-class-member-function | 8 - t/t4018/java-class-member-function.ctx | 1 - t/t4018/java.sh | 18 ++ t/t4018/markdown-heading-indented | 6 - t/t4018/markdown-heading-indented.ctx | 1 - t/t4018/markdown-heading-non-headings | 17 -- t/t4018/markdown-heading-non-headings.ctx | 1 - t/t4018/markdown.sh | 39 +++ t/t4018/matlab-class-definition | 5 - t/t4018/matlab-class-definition.ctx | 1 - t/t4018/matlab-function | 4 - t/t4018/matlab-function.ctx | 1 - t/t4018/matlab-octave-section-1 | 3 - t/t4018/matlab-octave-section-1.ctx | 1 - t/t4018/matlab-octave-section-2 | 3 - t/t4018/matlab-octave-section-2.ctx | 1 - t/t4018/matlab-section | 3 - t/t4018/matlab-section.ctx | 1 - t/t4018/matlab.sh | 52 ++++ t/t4018/perl-skip-end-of-heredoc | 8 - t/t4018/perl-skip-end-of-heredoc.ctx | 1 - t/t4018/perl-skip-forward-decl | 10 - t/t4018/perl-skip-forward-decl.ctx | 1 - t/t4018/perl-skip-sub-in-pod | 18 -- t/t4018/perl-skip-sub-in-pod.ctx | 1 - t/t4018/perl-sub-definition | 4 - t/t4018/perl-sub-definition-kr-brace | 4 - t/t4018/perl-sub-definition-kr-brace.ctx | 1 - t/t4018/perl-sub-definition.ctx | 1 - t/t4018/perl.sh | 78 ++++++ t/t4018/php-abstract-class | 4 - t/t4018/php-abstract-class.ctx | 1 - t/t4018/php-abstract-method | 7 - t/t4018/php-abstract-method.ctx | 1 - t/t4018/php-class | 4 - t/t4018/php-class.ctx | 1 - t/t4018/php-final-class | 4 - t/t4018/php-final-class.ctx | 1 - t/t4018/php-final-method | 7 - t/t4018/php-final-method.ctx | 1 - t/t4018/php-function | 4 - t/t4018/php-function.ctx | 1 - t/t4018/php-interface | 4 - t/t4018/php-interface.ctx | 1 - t/t4018/php-method | 7 - t/t4018/php-method.ctx | 1 - t/t4018/php-trait | 7 - t/t4018/php-trait.ctx | 1 - t/t4018/php.sh | 106 ++++++++ t/t4018/python-async-def | 4 - t/t4018/python-async-def.ctx | 1 - t/t4018/python-class | 4 - t/t4018/python-class.ctx | 1 - t/t4018/python-def | 4 - t/t4018/python-def.ctx | 1 - t/t4018/python-indented-async-def | 7 - t/t4018/python-indented-async-def.ctx | 1 - t/t4018/python-indented-class | 5 - t/t4018/python-indented-class.ctx | 1 - t/t4018/python-indented-def | 7 - t/t4018/python-indented-def.ctx | 1 - t/t4018/python.sh | 71 ++++++ t/t4018/rust-fn | 5 - t/t4018/rust-fn.ctx | 1 - t/t4018/rust-impl | 5 - t/t4018/rust-impl.ctx | 1 - t/t4018/rust-macro-rules | 6 - t/t4018/rust-macro-rules.ctx | 1 - t/t4018/rust-struct | 5 - t/t4018/rust-struct.ctx | 1 - t/t4018/rust-trait | 5 - t/t4018/rust-trait.ctx | 1 - t/t4018/rust.sh | 60 +++++ 261 files changed, 1549 insertions(+), 879 deletions(-) delete mode 100644 t/t4018/README delete mode 100644 t/t4018/README.ctx delete mode 100644 t/t4018/bash-arithmetic-function delete mode 100644 t/t4018/bash-arithmetic-function.ctx delete mode 100644 t/t4018/bash-bashism-style-compact delete mode 100644 t/t4018/bash-bashism-style-compact.ctx delete mode 100644 t/t4018/bash-bashism-style-function delete mode 100644 t/t4018/bash-bashism-style-function.ctx delete mode 100644 t/t4018/bash-bashism-style-whitespace delete mode 100644 t/t4018/bash-bashism-style-whitespace.ctx delete mode 100644 t/t4018/bash-conditional-function delete mode 100644 t/t4018/bash-conditional-function.ctx delete mode 100644 t/t4018/bash-missing-parentheses delete mode 100644 t/t4018/bash-missing-parentheses.ctx delete mode 100644 t/t4018/bash-mixed-style-compact delete mode 100644 t/t4018/bash-mixed-style-compact.ctx delete mode 100644 t/t4018/bash-mixed-style-function delete mode 100644 t/t4018/bash-mixed-style-function.ctx delete mode 100644 t/t4018/bash-nested-functions delete mode 100644 t/t4018/bash-nested-functions.ctx delete mode 100644 t/t4018/bash-other-characters delete mode 100644 t/t4018/bash-other-characters.ctx delete mode 100644 t/t4018/bash-posix-style-compact delete mode 100644 t/t4018/bash-posix-style-compact.ctx delete mode 100644 t/t4018/bash-posix-style-function delete mode 100644 t/t4018/bash-posix-style-function.ctx delete mode 100644 t/t4018/bash-posix-style-whitespace delete mode 100644 t/t4018/bash-posix-style-whitespace.ctx delete mode 100644 t/t4018/bash-subshell-function delete mode 100644 t/t4018/bash-subshell-function.ctx delete mode 100644 t/t4018/bash-trailing-comment delete mode 100644 t/t4018/bash-trailing-comment.ctx create mode 100755 t/t4018/bash.sh delete mode 100644 t/t4018/cpp-c++-function delete mode 100644 t/t4018/cpp-c++-function.ctx delete mode 100644 t/t4018/cpp-class-constructor delete mode 100644 t/t4018/cpp-class-constructor-mem-init delete mode 100644 t/t4018/cpp-class-constructor-mem-init.ctx delete mode 100644 t/t4018/cpp-class-constructor.ctx delete mode 100644 t/t4018/cpp-class-definition delete mode 100644 t/t4018/cpp-class-definition-derived delete mode 100644 t/t4018/cpp-class-definition-derived.ctx delete mode 100644 t/t4018/cpp-class-definition.ctx delete mode 100644 t/t4018/cpp-class-destructor delete mode 100644 t/t4018/cpp-class-destructor.ctx delete mode 100644 t/t4018/cpp-function-returning-global-type delete mode 100644 t/t4018/cpp-function-returning-global-type.ctx delete mode 100644 t/t4018/cpp-function-returning-nested delete mode 100644 t/t4018/cpp-function-returning-nested.ctx delete mode 100644 t/t4018/cpp-function-returning-pointer delete mode 100644 t/t4018/cpp-function-returning-pointer.ctx delete mode 100644 t/t4018/cpp-function-returning-reference delete mode 100644 t/t4018/cpp-function-returning-reference.ctx delete mode 100644 t/t4018/cpp-gnu-style-function delete mode 100644 t/t4018/cpp-gnu-style-function.ctx delete mode 100644 t/t4018/cpp-namespace-definition delete mode 100644 t/t4018/cpp-namespace-definition.ctx delete mode 100644 t/t4018/cpp-operator-definition delete mode 100644 t/t4018/cpp-operator-definition.ctx delete mode 100644 t/t4018/cpp-skip-access-specifiers delete mode 100644 t/t4018/cpp-skip-access-specifiers.ctx delete mode 100644 t/t4018/cpp-skip-comment-block delete mode 100644 t/t4018/cpp-skip-comment-block.ctx delete mode 100644 t/t4018/cpp-skip-labels delete mode 100644 t/t4018/cpp-skip-labels.ctx delete mode 100644 t/t4018/cpp-struct-definition delete mode 100644 t/t4018/cpp-struct-definition.ctx delete mode 100644 t/t4018/cpp-struct-single-line delete mode 100644 t/t4018/cpp-struct-single-line.ctx delete mode 100644 t/t4018/cpp-template-function-definition delete mode 100644 t/t4018/cpp-template-function-definition.ctx delete mode 100644 t/t4018/cpp-union-definition delete mode 100644 t/t4018/cpp-union-definition.ctx delete mode 100644 t/t4018/cpp-void-c-function delete mode 100644 t/t4018/cpp-void-c-function.ctx create mode 100755 t/t4018/cpp.sh delete mode 100644 t/t4018/css-attribute-value-selector delete mode 100644 t/t4018/css-attribute-value-selector.ctx delete mode 100644 t/t4018/css-block-level-@-statements delete mode 100644 t/t4018/[email protected] delete mode 100644 t/t4018/css-brace-in-col-1 delete mode 100644 t/t4018/css-brace-in-col-1.ctx delete mode 100644 t/t4018/css-class-selector delete mode 100644 t/t4018/css-class-selector.ctx delete mode 100644 t/t4018/css-colon-eol delete mode 100644 t/t4018/css-colon-eol.ctx delete mode 100644 t/t4018/css-colon-selector delete mode 100644 t/t4018/css-colon-selector.ctx delete mode 100644 t/t4018/css-common delete mode 100644 t/t4018/css-common.ctx delete mode 100644 t/t4018/css-id-selector delete mode 100644 t/t4018/css-id-selector.ctx delete mode 100644 t/t4018/css-long-selector-list delete mode 100644 t/t4018/css-long-selector-list.ctx delete mode 100644 t/t4018/css-prop-sans-indent delete mode 100644 t/t4018/css-prop-sans-indent.ctx delete mode 100644 t/t4018/css-root-selector delete mode 100644 t/t4018/css-root-selector.ctx delete mode 100644 t/t4018/css-short-selector-list delete mode 100644 t/t4018/css-short-selector-list.ctx delete mode 100644 t/t4018/css-trailing-space delete mode 100644 t/t4018/css-trailing-space.ctx create mode 100755 t/t4018/css.sh delete mode 100644 t/t4018/custom1-pattern.ctx rename t/t4018/{custom1-pattern => custom1.sh} (71%) mode change 100644 => 100755 delete mode 100644 t/t4018/custom2-match-to-end-of-line delete mode 100644 t/t4018/custom2-match-to-end-of-line.ctx create mode 100755 t/t4018/custom2.sh delete mode 100644 t/t4018/custom3-alternation-in-pattern.ctx rename t/t4018/{custom3-alternation-in-pattern => custom3.sh} (66%) mode change 100644 => 100755 delete mode 100644 t/t4018/dts-labels delete mode 100644 t/t4018/dts-labels.ctx delete mode 100644 t/t4018/dts-node-unitless delete mode 100644 t/t4018/dts-node-unitless.ctx delete mode 100644 t/t4018/dts-nodes delete mode 100644 t/t4018/dts-nodes-boolean-prop delete mode 100644 t/t4018/dts-nodes-boolean-prop.ctx delete mode 100644 t/t4018/dts-nodes-comment1 delete mode 100644 t/t4018/dts-nodes-comment1.ctx delete mode 100644 t/t4018/dts-nodes-comment2 delete mode 100644 t/t4018/dts-nodes-comment2.ctx delete mode 100644 t/t4018/dts-nodes-multiline-prop delete mode 100644 t/t4018/dts-nodes-multiline-prop.ctx delete mode 100644 t/t4018/dts-nodes.ctx delete mode 100644 t/t4018/dts-reference delete mode 100644 t/t4018/dts-reference.ctx delete mode 100644 t/t4018/dts-root delete mode 100644 t/t4018/dts-root-comment delete mode 100644 t/t4018/dts-root-comment.ctx delete mode 100644 t/t4018/dts-root.ctx create mode 100755 t/t4018/dts.sh delete mode 100644 t/t4018/elixir-do-not-pick-end delete mode 100644 t/t4018/elixir-do-not-pick-end.ctx delete mode 100644 t/t4018/elixir-ex-unit-test delete mode 100644 t/t4018/elixir-ex-unit-test.ctx delete mode 100644 t/t4018/elixir-function delete mode 100644 t/t4018/elixir-function.ctx delete mode 100644 t/t4018/elixir-macro delete mode 100644 t/t4018/elixir-macro.ctx delete mode 100644 t/t4018/elixir-module delete mode 100644 t/t4018/elixir-module-func delete mode 100644 t/t4018/elixir-module-func.ctx delete mode 100644 t/t4018/elixir-module.ctx delete mode 100644 t/t4018/elixir-nested-module delete mode 100644 t/t4018/elixir-nested-module.ctx delete mode 100644 t/t4018/elixir-private-function delete mode 100644 t/t4018/elixir-private-function.ctx delete mode 100644 t/t4018/elixir-protocol delete mode 100644 t/t4018/elixir-protocol-implementation delete mode 100644 t/t4018/elixir-protocol-implementation.ctx delete mode 100644 t/t4018/elixir-protocol.ctx create mode 100755 t/t4018/elixir.sh delete mode 100644 t/t4018/fortran-block-data delete mode 100644 t/t4018/fortran-block-data.ctx delete mode 100644 t/t4018/fortran-comment delete mode 100644 t/t4018/fortran-comment-keyword delete mode 100644 t/t4018/fortran-comment-keyword.ctx delete mode 100644 t/t4018/fortran-comment-legacy delete mode 100644 t/t4018/fortran-comment-legacy-star delete mode 100644 t/t4018/fortran-comment-legacy-star.ctx delete mode 100644 t/t4018/fortran-comment-legacy.ctx delete mode 100644 t/t4018/fortran-comment.ctx delete mode 100644 t/t4018/fortran-external-function delete mode 100644 t/t4018/fortran-external-function.ctx delete mode 100644 t/t4018/fortran-external-subroutine delete mode 100644 t/t4018/fortran-external-subroutine.ctx delete mode 100644 t/t4018/fortran-module delete mode 100644 t/t4018/fortran-module-procedure delete mode 100644 t/t4018/fortran-module-procedure.ctx delete mode 100644 t/t4018/fortran-module.ctx delete mode 100644 t/t4018/fortran-program delete mode 100644 t/t4018/fortran-program.ctx create mode 100755 t/t4018/fortran.sh delete mode 100644 t/t4018/fountain-scene delete mode 100644 t/t4018/fountain-scene.ctx create mode 100755 t/t4018/fountain.sh delete mode 100644 t/t4018/golang-complex-function delete mode 100644 t/t4018/golang-complex-function.ctx delete mode 100644 t/t4018/golang-func delete mode 100644 t/t4018/golang-func.ctx delete mode 100644 t/t4018/golang-interface delete mode 100644 t/t4018/golang-interface.ctx delete mode 100644 t/t4018/golang-long-func delete mode 100644 t/t4018/golang-long-func.ctx delete mode 100644 t/t4018/golang-struct delete mode 100644 t/t4018/golang-struct.ctx create mode 100755 t/t4018/golang.sh delete mode 100644 t/t4018/java-class-member-function delete mode 100644 t/t4018/java-class-member-function.ctx create mode 100755 t/t4018/java.sh delete mode 100644 t/t4018/markdown-heading-indented delete mode 100644 t/t4018/markdown-heading-indented.ctx delete mode 100644 t/t4018/markdown-heading-non-headings delete mode 100644 t/t4018/markdown-heading-non-headings.ctx create mode 100755 t/t4018/markdown.sh delete mode 100644 t/t4018/matlab-class-definition delete mode 100644 t/t4018/matlab-class-definition.ctx delete mode 100644 t/t4018/matlab-function delete mode 100644 t/t4018/matlab-function.ctx delete mode 100644 t/t4018/matlab-octave-section-1 delete mode 100644 t/t4018/matlab-octave-section-1.ctx delete mode 100644 t/t4018/matlab-octave-section-2 delete mode 100644 t/t4018/matlab-octave-section-2.ctx delete mode 100644 t/t4018/matlab-section delete mode 100644 t/t4018/matlab-section.ctx create mode 100755 t/t4018/matlab.sh delete mode 100644 t/t4018/perl-skip-end-of-heredoc delete mode 100644 t/t4018/perl-skip-end-of-heredoc.ctx delete mode 100644 t/t4018/perl-skip-forward-decl delete mode 100644 t/t4018/perl-skip-forward-decl.ctx delete mode 100644 t/t4018/perl-skip-sub-in-pod delete mode 100644 t/t4018/perl-skip-sub-in-pod.ctx delete mode 100644 t/t4018/perl-sub-definition delete mode 100644 t/t4018/perl-sub-definition-kr-brace delete mode 100644 t/t4018/perl-sub-definition-kr-brace.ctx delete mode 100644 t/t4018/perl-sub-definition.ctx create mode 100755 t/t4018/perl.sh delete mode 100644 t/t4018/php-abstract-class delete mode 100644 t/t4018/php-abstract-class.ctx delete mode 100644 t/t4018/php-abstract-method delete mode 100644 t/t4018/php-abstract-method.ctx delete mode 100644 t/t4018/php-class delete mode 100644 t/t4018/php-class.ctx delete mode 100644 t/t4018/php-final-class delete mode 100644 t/t4018/php-final-class.ctx delete mode 100644 t/t4018/php-final-method delete mode 100644 t/t4018/php-final-method.ctx delete mode 100644 t/t4018/php-function delete mode 100644 t/t4018/php-function.ctx delete mode 100644 t/t4018/php-interface delete mode 100644 t/t4018/php-interface.ctx delete mode 100644 t/t4018/php-method delete mode 100644 t/t4018/php-method.ctx delete mode 100644 t/t4018/php-trait delete mode 100644 t/t4018/php-trait.ctx create mode 100755 t/t4018/php.sh delete mode 100644 t/t4018/python-async-def delete mode 100644 t/t4018/python-async-def.ctx delete mode 100644 t/t4018/python-class delete mode 100644 t/t4018/python-class.ctx delete mode 100644 t/t4018/python-def delete mode 100644 t/t4018/python-def.ctx delete mode 100644 t/t4018/python-indented-async-def delete mode 100644 t/t4018/python-indented-async-def.ctx delete mode 100644 t/t4018/python-indented-class delete mode 100644 t/t4018/python-indented-class.ctx delete mode 100644 t/t4018/python-indented-def delete mode 100644 t/t4018/python-indented-def.ctx create mode 100755 t/t4018/python.sh delete mode 100644 t/t4018/rust-fn delete mode 100644 t/t4018/rust-fn.ctx delete mode 100644 t/t4018/rust-impl delete mode 100644 t/t4018/rust-impl.ctx delete mode 100644 t/t4018/rust-macro-rules delete mode 100644 t/t4018/rust-macro-rules.ctx delete mode 100644 t/t4018/rust-struct delete mode 100644 t/t4018/rust-struct.ctx delete mode 100644 t/t4018/rust-trait delete mode 100644 t/t4018/rust-trait.ctx create mode 100755 t/t4018/rust.sh
t/t4018-diff-funcname.sh +34 -25
@@ -60,33 +60,42 @@ test_expect_success 'last regexp must not be negated' ' test_i18ngrep ": Last expression must not be negated:" msg ' -test_expect_success 'setup hunk header tests' ' - for i in $diffpatterns - do - echo "$i-* diff=$i" - done > .gitattributes && - - # add all test files to the index - ( - cd "$TEST_DIRECTORY"/t4018 && - git --git-dir="$TRASH_DIRECTORY/.git" add . - ) && - - # place modified files in the worktree - for i in $(git ls-files) - do - sed -e "s/ChangeMe/IWasChanged/" <"$TEST_DIRECTORY/t4018/$i" >"$i" || return 1 - done -' +test_diff_funcname () { + desc=$1 + cat <&8 >arg.header && + cat <&9 >arg.test && + what=$(cat arg.what) && + + test_expect_success "setup: $desc" ' + cp arg.test "$what" && + cp arg.header expected && + git add "$what" && + sed -e "s/ChangeMe/IWasChanged/" <"$what" >tmp && + mv tmp "$what" + ' && + + test_expect_success "$desc" ' + git diff -U1 "$what" >diff && + sed -n -e "s/^.*@@$//p" -e "s/^.*@@ //p" <diff >actual && + test_cmp expected actual + ' +} -# check each individual file -for i in $(git ls-files -- ':!*.ctx') +for what in $diffpatterns do - test_expect_success "hunk header: $i" " - git diff -U1 $i >diff && - sed -n -e 's/^.*@@$//p' -e 's/^.*@@ //p' <diff >ctx && - test_cmp $i.ctx ctx - " + test="$TEST_DIRECTORY/t4018/$what.sh" + if ! test -e "$test" + then + test_expect_failure "$what: no tests" 'false' + continue + fi && + + test_expect_success "setup: hunk header for $what" ' + echo "$what diff=$what" >.gitattributes && + echo "$what" >arg.what + ' && + + . "$test" done test_done
t/t4018/README deleted +0 -15
@@ -1,15 +0,0 @@ -How to write test cases -======================= - -Create test cases called "LANG-whatever" in this directory, where -"LANG" is e.g. the userdiff driver name, where "whatever" is a brief -description of the test. - -Insert the word "ChangeMe" (exactly this form) at a distance of -at least two lines from the line that must appear in the hunk header. - -The text that must appear in the hunk header must contains the word -"RIGHT" by convention. The "LANG-whatever.ctx" file contains what we -expect to appear in the hunk header. We munged away the starting "@@ -[...] @@" part of the line for ease of not having to hardcode the line -numbers and offsets.
t/t4018/README.ctx deleted +0 -1
@@ -1 +0,0 @@ -description of the test.
t/t4018/bash-arithmetic-function deleted +0 -4
@@ -1,4 +0,0 @@ -RIGHT() (( - - ChangeMe = "$x" + "$y" -))
t/t4018/bash-arithmetic-function.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT()
t/t4018/bash-bashism-style-compact deleted +0 -6
@@ -1,6 +0,0 @@ -function RIGHT { - function InvalidSyntax{ - : - echo 'ChangeMe' - } -}
t/t4018/bash-bashism-style-compact.ctx deleted +0 -1
@@ -1 +0,0 @@ -function RIGHT {
t/t4018/bash-bashism-style-function deleted +0 -4
@@ -1,4 +0,0 @@ -function RIGHT { - : - echo 'ChangeMe' -}
t/t4018/bash-bashism-style-function.ctx deleted +0 -1
@@ -1 +0,0 @@ -function RIGHT {
t/t4018/bash-bashism-style-whitespace deleted +0 -4
@@ -1,4 +0,0 @@ - function RIGHT ( ) { - - ChangeMe - }
t/t4018/bash-bashism-style-whitespace.ctx deleted +0 -1
@@ -1 +0,0 @@ -function RIGHT ( ) {
t/t4018/bash-conditional-function deleted +0 -4
@@ -1,4 +0,0 @@ -RIGHT() [[ \ - - "$a" > "$ChangeMe" -]]
t/t4018/bash-conditional-function.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT()
t/t4018/bash-missing-parentheses deleted +0 -6
@@ -1,6 +0,0 @@ -function RIGHT { - functionInvalidSyntax { - : - echo 'ChangeMe' - } -}
t/t4018/bash-missing-parentheses.ctx deleted +0 -1
@@ -1 +0,0 @@ -function RIGHT {
t/t4018/bash-mixed-style-compact deleted +0 -4
@@ -1,4 +0,0 @@ -function RIGHT(){ - : - echo 'ChangeMe' -}
t/t4018/bash-mixed-style-compact.ctx deleted +0 -1
@@ -1 +0,0 @@ -function RIGHT(){
t/t4018/bash-mixed-style-function deleted +0 -4
@@ -1,4 +0,0 @@ -function RIGHT() { - - ChangeMe -}
t/t4018/bash-mixed-style-function.ctx deleted +0 -1
@@ -1 +0,0 @@ -function RIGHT() {
t/t4018/bash-nested-functions deleted +0 -6
@@ -1,6 +0,0 @@ -outer() { - RIGHT() { - : - echo 'ChangeMe' - } -}
t/t4018/bash-nested-functions.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT()
t/t4018/bash-other-characters deleted +0 -4
@@ -1,4 +0,0 @@ -_RIGHT_0n() { - - ChangeMe -}
t/t4018/bash-other-characters.ctx deleted +0 -1
@@ -1 +0,0 @@ -_RIGHT_0n()
t/t4018/bash-posix-style-compact deleted +0 -4
@@ -1,4 +0,0 @@ -RIGHT(){ - - ChangeMe -}
t/t4018/bash-posix-style-compact.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT()
t/t4018/bash-posix-style-function deleted +0 -4
@@ -1,4 +0,0 @@ -RIGHT() { - - ChangeMe -}
t/t4018/bash-posix-style-function.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT()
t/t4018/bash-posix-style-whitespace deleted +0 -4
@@ -1,4 +0,0 @@ - RIGHT ( ) { - - ChangeMe - }
t/t4018/bash-posix-style-whitespace.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT ( )
t/t4018/bash-subshell-function deleted +0 -4
@@ -1,4 +0,0 @@ -RIGHT() ( - - ChangeMe=2 -)
t/t4018/bash-subshell-function.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT()
t/t4018/bash-trailing-comment deleted +0 -4
@@ -1,4 +0,0 @@ -RIGHT() { # Comment - - ChangeMe -}
t/t4018/bash-trailing-comment.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT()
t/t4018/bash.sh new file +160 -0
160 lines not on this page · raw message
t/t4018/cpp-c++-function deleted +0 -4
@@ -1,4 +0,0 @@ -Item RIGHT::DoSomething( Args with_spaces ) -{ - ChangeMe; -}
t/t4018/cpp-c++-function.ctx deleted +0 -1
@@ -1 +0,0 @@ -Item RIGHT::DoSomething( Args with_spaces )
t/t4018/cpp-class-constructor deleted +0 -4
@@ -1,4 +0,0 @@ -Item::Item(int RIGHT) -{ - ChangeMe; -}
t/t4018/cpp-class-constructor-mem-init deleted +0 -5
@@ -1,5 +0,0 @@ -Item::Item(int RIGHT) : - member(0) -{ - ChangeMe; -}
t/t4018/cpp-class-constructor-mem-init.ctx deleted +0 -1
@@ -1 +0,0 @@ -Item::Item(int RIGHT) :
t/t4018/cpp-class-constructor.ctx deleted +0 -1
@@ -1 +0,0 @@ -Item::Item(int RIGHT)
t/t4018/cpp-class-definition deleted +0 -4
@@ -1,4 +0,0 @@ -class RIGHT -{ - int ChangeMe; -};
t/t4018/cpp-class-definition-derived deleted +0 -5
@@ -1,5 +0,0 @@ -class RIGHT : - public Baseclass -{ - int ChangeMe; -};
t/t4018/cpp-class-definition-derived.ctx deleted +0 -1
@@ -1 +0,0 @@ -class RIGHT :
t/t4018/cpp-class-definition.ctx deleted +0 -1
@@ -1 +0,0 @@ -class RIGHT
t/t4018/cpp-class-destructor deleted +0 -4
@@ -1,4 +0,0 @@ -RIGHT::~RIGHT() -{ - ChangeMe; -}
t/t4018/cpp-class-destructor.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT::~RIGHT()
t/t4018/cpp-function-returning-global-type deleted +0 -4
@@ -1,4 +0,0 @@ -::Item get::it::RIGHT() -{ - ChangeMe; -}
t/t4018/cpp-function-returning-global-type.ctx deleted +0 -1
@@ -1 +0,0 @@ -::Item get::it::RIGHT()
t/t4018/cpp-function-returning-nested deleted +0 -5
@@ -1,5 +0,0 @@ -get::Item get::it::RIGHT() -{ - ChangeMe; -} -
t/t4018/cpp-function-returning-nested.ctx deleted +0 -1
@@ -1 +0,0 @@ -get::Item get::it::RIGHT()
t/t4018/cpp-function-returning-pointer deleted +0 -4
@@ -1,4 +0,0 @@ -const char *get_it_RIGHT(char *ptr) -{ - ChangeMe; -}
t/t4018/cpp-function-returning-pointer.ctx deleted +0 -1
@@ -1 +0,0 @@ -const char *get_it_RIGHT(char *ptr)
t/t4018/cpp-function-returning-reference deleted +0 -4
@@ -1,4 +0,0 @@ -string& get::it::RIGHT(char *ptr) -{ - ChangeMe; -}
t/t4018/cpp-function-returning-reference.ctx deleted +0 -1
@@ -1 +0,0 @@ -string& get::it::RIGHT(char *ptr)
t/t4018/cpp-gnu-style-function deleted +0 -5
@@ -1,5 +0,0 @@ -const char * -RIGHT(int arg) -{ - ChangeMe; -}
t/t4018/cpp-gnu-style-function.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT(int arg)
t/t4018/cpp-namespace-definition deleted +0 -4
@@ -1,4 +0,0 @@ -namespace RIGHT -{ - ChangeMe; -}
t/t4018/cpp-namespace-definition.ctx deleted +0 -1
@@ -1 +0,0 @@ -namespace RIGHT
t/t4018/cpp-operator-definition deleted +0 -4
@@ -1,4 +0,0 @@ -Value operator+(Value LEFT, Value RIGHT) -{ - ChangeMe; -}
t/t4018/cpp-operator-definition.ctx deleted +0 -1
@@ -1 +0,0 @@ -Value operator+(Value LEFT, Value RIGHT)
t/t4018/cpp-skip-access-specifiers deleted +0 -8
@@ -1,8 +0,0 @@ -class RIGHT : public Baseclass -{ -public: -protected: -private: - void DoSomething(); - int ChangeMe; -};
t/t4018/cpp-skip-access-specifiers.ctx deleted +0 -1
@@ -1 +0,0 @@ -class RIGHT : public Baseclass
t/t4018/cpp-skip-comment-block deleted +0 -9
@@ -1,9 +0,0 @@ -struct item RIGHT(int i) -// Do not -// pick up -/* these -** comments. -*/ -{ - ChangeMe; -}
t/t4018/cpp-skip-comment-block.ctx deleted +0 -1
@@ -1 +0,0 @@ -struct item RIGHT(int i)
t/t4018/cpp-skip-labels deleted +0 -8
@@ -1,8 +0,0 @@ -void RIGHT (void) -{ -repeat: // C++ comment -next: /* C comment */ - do_something(); - - ChangeMe; -}
t/t4018/cpp-skip-labels.ctx deleted +0 -1
@@ -1 +0,0 @@ -void RIGHT (void)
t/t4018/cpp-struct-definition deleted +0 -9
@@ -1,9 +0,0 @@ -struct RIGHT { - unsigned - /* this bit field looks like a label and should not be picked up */ - decoy_bitfield: 2, - more : 1; - int filler; - - int ChangeMe; -};
t/t4018/cpp-struct-definition.ctx deleted +0 -1
@@ -1 +0,0 @@ -struct RIGHT {
t/t4018/cpp-struct-single-line deleted +0 -7
@@ -1,7 +0,0 @@ -void wrong() -{ -} - -struct RIGHT_iterator_tag {}; - -int ChangeMe;
t/t4018/cpp-struct-single-line.ctx deleted +0 -1
@@ -1 +0,0 @@ -struct RIGHT_iterator_tag {};
t/t4018/cpp-template-function-definition deleted +0 -4
@@ -1,4 +0,0 @@ -template<class T> int RIGHT(T arg) -{ - ChangeMe; -}
t/t4018/cpp-template-function-definition.ctx deleted +0 -1
@@ -1 +0,0 @@ -template<class T> int RIGHT(T arg)
t/t4018/cpp-union-definition deleted +0 -4
@@ -1,4 +0,0 @@ -union RIGHT { - double v; - int ChangeMe; -};
t/t4018/cpp-union-definition.ctx deleted +0 -1
@@ -1 +0,0 @@ -union RIGHT {
t/t4018/cpp-void-c-function deleted +0 -4
@@ -1,4 +0,0 @@ -void RIGHT (void) -{ - ChangeMe; -}
t/t4018/cpp-void-c-function.ctx deleted +0 -1
@@ -1 +0,0 @@ -void RIGHT (void)
t/t4018/cpp.sh new file +239 -0
239 lines not on this page · raw message
t/t4018/css-attribute-value-selector deleted +0 -4
@@ -1,4 +0,0 @@ -[class*="RIGHT"] { - background : #000; - border : 10px ChangeMe #C6C6C6; -}
t/t4018/css-attribute-value-selector.ctx deleted +0 -1
@@ -1 +0,0 @@ -[class*="RIGHT"] {
t/t4018/css-block-level-@-statements deleted +0 -10
@@ -1,10 +0,0 @@ -@keyframes RIGHT { - from { - background : #000; - border : 10px ChangeMe #C6C6C6; - } - to { - background : #fff; - border : 10px solid #C6C6C6; - } -}
t/t4018/[email protected] deleted +0 -1
@@ -1 +0,0 @@ -@keyframes RIGHT {
t/t4018/css-brace-in-col-1 deleted +0 -5
@@ -1,5 +0,0 @@ -RIGHT label.control-label -{ - margin-top: 10px!important; - border : 10px ChangeMe #C6C6C6; -}
t/t4018/css-brace-in-col-1.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT label.control-label
t/t4018/css-class-selector deleted +0 -4
@@ -1,4 +0,0 @@ -.RIGHT { - background : #000; - border : 10px ChangeMe #C6C6C6; -}
t/t4018/css-class-selector.ctx deleted +0 -1
@@ -1 +0,0 @@ -.RIGHT {
t/t4018/css-colon-eol deleted +0 -4
@@ -1,4 +0,0 @@ -RIGHT h1 { -color: -ChangeMe; -}
t/t4018/css-colon-eol.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT h1 {
t/t4018/css-colon-selector deleted +0 -5
@@ -1,5 +0,0 @@ -RIGHT a:hover { - margin-top: - 10px!important; - border : 10px ChangeMe #C6C6C6; -}
t/t4018/css-colon-selector.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT a:hover {
t/t4018/css-common deleted +0 -4
@@ -1,4 +0,0 @@ -RIGHT label.control-label { - margin-top: 10px!important; - border : 10px ChangeMe #C6C6C6; -}
t/t4018/css-common.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT label.control-label {
t/t4018/css-id-selector deleted +0 -4
@@ -1,4 +0,0 @@ -#RIGHT { - background : #000; - border : 10px ChangeMe #C6C6C6; -}
t/t4018/css-id-selector.ctx deleted +0 -1
@@ -1 +0,0 @@ -#RIGHT {
t/t4018/css-long-selector-list deleted +0 -6
@@ -1,6 +0,0 @@ -p.header, -label.control-label, -div ul#RIGHT { - margin-top: 10px!important; - border : 10px ChangeMe #C6C6C6; -}
t/t4018/css-long-selector-list.ctx deleted +0 -1
@@ -1 +0,0 @@ -div ul#RIGHT {
t/t4018/css-prop-sans-indent deleted +0 -5
@@ -1,5 +0,0 @@ -RIGHT, label.control-label { -margin-top: 10px!important; -padding: 0; -border : 10px ChangeMe #C6C6C6; -}
t/t4018/css-prop-sans-indent.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT, label.control-label {
t/t4018/css-root-selector deleted +0 -4
@@ -1,4 +0,0 @@ -:RIGHT { - background : #000; - border : 10px ChangeMe #C6C6C6; -}
t/t4018/css-root-selector.ctx deleted +0 -1
@@ -1 +0,0 @@ -:RIGHT {
t/t4018/css-short-selector-list deleted +0 -4
@@ -1,4 +0,0 @@ -label.control, div ul#RIGHT { - margin-top: 10px!important; - border : 10px ChangeMe #C6C6C6; -}
t/t4018/css-short-selector-list.ctx deleted +0 -1
@@ -1 +0,0 @@ -label.control, div ul#RIGHT {
t/t4018/css-trailing-space deleted +0 -5
@@ -1,5 +0,0 @@ -RIGHT label.control-label { - margin:10px; - padding:10px; - border : 10px ChangeMe #C6C6C6; -}
t/t4018/css-trailing-space.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT label.control-label {
t/t4018/css.sh new file +146 -0
146 lines not on this page · raw message
t/t4018/custom1-pattern.ctx deleted +0 -1
@@ -1 +0,0 @@ -int special, RIGHT;
t/t4018/custom1.sh renamed from t/t4018/custom1-pattern +10 -0
@@ -1,3 +1,12 @@ +#!/bin/sh +# +# See ../t4018-diff-funcname.sh's test_diff_funcname() +# + +test_diff_funcname 'custom1: pattern' \ + 8<<\EOF_HUNK 9<<\EOF_TEST +int special, RIGHT; +EOF_HUNK public class Beer { int special, RIGHT;
@@ -15,3 +24,4 @@ public class Beer + "99 bottles of beer on the wall.\n"); } } +EOF_TEST
t/t4018/custom2-match-to-end-of-line deleted +0 -8
@@ -1,8 +0,0 @@ -public class RIGHT_Beer -{ - int special; - public static void main(String args[]) - { - System.out.print("ChangeMe"); - } -}
t/t4018/custom2-match-to-end-of-line.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT_Beer
t/t4018/custom2.sh new file +18 -0
@@ -0,0 +1,18 @@ +#!/bin/sh +# +# See ../t4018-diff-funcname.sh's test_diff_funcname() +# + +test_diff_funcname 'custom2: match to end of line' \ + 8<<\EOF_HUNK 9<<\EOF_TEST +RIGHT_Beer +EOF_HUNK +public class RIGHT_Beer +{ + int special; + public static void main(String args[]) + { + System.out.print("ChangeMe"); + } +} +EOF_TEST
t/t4018/custom3-alternation-in-pattern.ctx deleted +0 -1
@@ -1 +0,0 @@ -public static void main(String RIGHT[])
t/t4018/custom3.sh renamed from t/t4018/custom3-alternation-in-pattern +10 -0
@@ -1,3 +1,12 @@ +#!/bin/sh +# +# See ../t4018-diff-funcname.sh's test_diff_funcname() +# + +test_diff_funcname 'custom3: alternation in pattern' \ + 8<<\EOF_HUNK 9<<\EOF_TEST +public static void main(String RIGHT[]) +EOF_HUNK public class Beer { int special;
@@ -15,3 +24,4 @@ public class Beer + "99 bottles of beer on the wall.\n"); } } +EOF_TEST
t/t4018/dts-labels deleted +0 -9
@@ -1,9 +0,0 @@ -/ { - label_1: node1@ff00 { - label2: RIGHT { - vendor,some-property; - - ChangeMe = <0x45-30>; - }; - }; -};
t/t4018/dts-labels.ctx deleted +0 -1
@@ -1 +0,0 @@ -label2: RIGHT {
t/t4018/dts-node-unitless deleted +0 -8
@@ -1,8 +0,0 @@ -/ { - label_1: node1 { - RIGHT { - prop-array = <1>, <4>; - ChangeMe = <0xffeedd00>; - }; - }; -};
t/t4018/dts-node-unitless.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT {
t/t4018/dts-nodes deleted +0 -8
@@ -1,8 +0,0 @@ -/ { - label_1: node1@ff00 { - RIGHT@deadf00,4000 { - #size-cells = <1>; - ChangeMe = <0xffeedd00>; - }; - }; -};
t/t4018/dts-nodes-boolean-prop deleted +0 -9
@@ -1,9 +0,0 @@ -/ { - label_1: node1@ff00 { - RIGHT@deadf00,4000 { - boolean-prop1; - - ChangeMe; - }; - }; -};
t/t4018/dts-nodes-boolean-prop.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT@deadf00,4000 {
t/t4018/dts-nodes-comment1 deleted +0 -8
@@ -1,8 +0,0 @@ -/ { - label_1: node1@ff00 { - RIGHT@deadf00,4000 /* &a comment */ { - #size-cells = <1>; - ChangeMe = <0xffeedd00>; - }; - }; -};
t/t4018/dts-nodes-comment1.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT@deadf00,4000 /* &a comment */ {
t/t4018/dts-nodes-comment2 deleted +0 -8
@@ -1,8 +0,0 @@ -/ { - label_1: node1@ff00 { - RIGHT@deadf00,4000 { /* a trailing comment */ - #size-cells = <1>; - ChangeMe = <0xffeedd00>; - }; - }; -};
t/t4018/dts-nodes-comment2.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT@deadf00,4000 { /* a trailing comment */
t/t4018/dts-nodes-multiline-prop deleted +0 -13
@@ -1,13 +0,0 @@ -/ { - label_1: node1@ff00 { - RIGHT@deadf00,4000 { - multilineprop = <3>, - <4>, - <5>, - <6>, - <7>; - - ChangeMe = <0xffeedd00>; - }; - }; -};
t/t4018/dts-nodes-multiline-prop.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT@deadf00,4000 {
t/t4018/dts-nodes.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT@deadf00,4000 {
t/t4018/dts-reference deleted +0 -9
@@ -1,9 +0,0 @@ -&label_1 { - TEST = <455>; -}; - -&RIGHT { - vendor,some-property; - - ChangeMe = <0x45-30>; -};
t/t4018/dts-reference.ctx deleted +0 -1
@@ -1 +0,0 @@ -&RIGHT {
t/t4018/dts-root deleted +0 -5
@@ -1,5 +0,0 @@ -/ { RIGHT /* Technically just supposed to be a slash and brace */ - #size-cells = <1>; - - ChangeMe = <0xffeedd00>; -};
t/t4018/dts-root-comment deleted +0 -8
@@ -1,8 +0,0 @@ -/ { RIGHT /* Technically just supposed to be a slash and brace */ - #size-cells = <1>; - - /* This comment should be ignored */ - - some-property = <40+2>; - ChangeMe = <0xffeedd00>; -};
t/t4018/dts-root-comment.ctx deleted +0 -1
@@ -1 +0,0 @@ -/ { RIGHT /* Technically just supposed to be a slash and brace */
t/t4018/dts-root.ctx deleted +0 -1
@@ -1 +0,0 @@ -/ { RIGHT /* Technically just supposed to be a slash and brace */
t/t4018/dts.sh new file +149 -0
149 lines not on this page · raw message
t/t4018/elixir-do-not-pick-end deleted +0 -5
@@ -1,5 +0,0 @@ -defmodule RIGHT do -end -# -# -# ChangeMe; do not pick up 'end' line
t/t4018/elixir-do-not-pick-end.ctx deleted +0 -1
@@ -1 +0,0 @@ -defmodule RIGHT do
t/t4018/elixir-ex-unit-test deleted +0 -6
@@ -1,6 +0,0 @@ -defmodule Test do - test "RIGHT" do - assert true == true - assert ChangeMe - end -end
t/t4018/elixir-ex-unit-test.ctx deleted +0 -1
@@ -1 +0,0 @@ -test "RIGHT" do
t/t4018/elixir-function deleted +0 -5
@@ -1,5 +0,0 @@ -def function(RIGHT, arg) do - # comment - # comment - ChangeMe -end
t/t4018/elixir-function.ctx deleted +0 -1
@@ -1 +0,0 @@ -def function(RIGHT, arg) do
t/t4018/elixir-macro deleted +0 -5
@@ -1,5 +0,0 @@ -defmacro foo(RIGHT) do - # Code - # Code - ChangeMe -end
t/t4018/elixir-macro.ctx deleted +0 -1
@@ -1 +0,0 @@ -defmacro foo(RIGHT) do
t/t4018/elixir-module deleted +0 -9
@@ -1,9 +0,0 @@ -defmodule RIGHT do - @moduledoc """ - Foo bar - """ - - def ChangeMe(a) where is_map(a) do - a - end -end
t/t4018/elixir-module-func deleted +0 -8
@@ -1,8 +0,0 @@ -defmodule Foo do - def fun(RIGHT) do - # Code - # Code - # Code - ChangeMe - end -end
t/t4018/elixir-module-func.ctx deleted +0 -1
@@ -1 +0,0 @@ -def fun(RIGHT) do
t/t4018/elixir-module.ctx deleted +0 -1
@@ -1 +0,0 @@ -defmodule RIGHT do
t/t4018/elixir-nested-module deleted +0 -9
@@ -1,9 +0,0 @@ -defmodule MyApp.RIGHT do - @moduledoc """ - Foo bar - """ - - def ChangeMe(a) where is_map(a) do - a - end -end
t/t4018/elixir-nested-module.ctx deleted +0 -1
@@ -1 +0,0 @@ -defmodule MyApp.RIGHT do
t/t4018/elixir-private-function deleted +0 -5
@@ -1,5 +0,0 @@ -defp function(RIGHT, arg) do - # comment - # comment - ChangeMe -end
t/t4018/elixir-private-function.ctx deleted +0 -1
@@ -1 +0,0 @@ -defp function(RIGHT, arg) do
t/t4018/elixir-protocol deleted +0 -6
@@ -1,6 +0,0 @@ -defprotocol RIGHT do - @doc """ - Calculates the size (and not the length!) of a data structure - """ - def size(data, ChangeMe) -end
t/t4018/elixir-protocol-implementation deleted +0 -5
@@ -1,5 +0,0 @@ -defimpl RIGHT do - # Docs - # Docs - def foo(ChangeMe), do: :ok -end
t/t4018/elixir-protocol-implementation.ctx deleted +0 -1
@@ -1 +0,0 @@ -defimpl RIGHT do
t/t4018/elixir-protocol.ctx deleted +0 -1
@@ -1 +0,0 @@ -defprotocol RIGHT do
t/t4018/elixir.sh new file +127 -0
127 lines not on this page · raw message
t/t4018/fortran-block-data deleted +0 -5
@@ -1,5 +0,0 @@ - BLOCK DATA RIGHT - - COMMON /B/ C, ChangeMe - DATA C, ChangeMe / 2.0, 6.0 / - END
t/t4018/fortran-block-data.ctx deleted +0 -1
@@ -1 +0,0 @@ -BLOCK DATA RIGHT
t/t4018/fortran-comment deleted +0 -13
@@ -1,13 +0,0 @@ - module a - - contains - - ! subroutine wrong - subroutine RIGHT - ! subroutine wrong - - real ChangeMe - - end subroutine RIGHT - - end module a
t/t4018/fortran-comment-keyword deleted +0 -14
@@ -1,14 +0,0 @@ - module a - - contains - - subroutine RIGHT (funcA, funcB) - - real funcA ! grid function a - real funcB ! grid function b - - real ChangeMe - - end subroutine RIGHT - - end module a
t/t4018/fortran-comment-keyword.ctx deleted +0 -1
@@ -1 +0,0 @@ -subroutine RIGHT (funcA, funcB)
t/t4018/fortran-comment-legacy deleted +0 -13
@@ -1,13 +0,0 @@ - module a - - contains - -C subroutine wrong - subroutine RIGHT -C subroutine wrong - - real ChangeMe - - end subroutine RIGHT - - end module a
t/t4018/fortran-comment-legacy-star deleted +0 -13
@@ -1,13 +0,0 @@ - module a - - contains - -* subroutine wrong - subroutine RIGHT -* subroutine wrong - - real ChangeMe - - end subroutine RIGHT - - end module a
t/t4018/fortran-comment-legacy-star.ctx deleted +0 -1
@@ -1 +0,0 @@ -subroutine RIGHT
t/t4018/fortran-comment-legacy.ctx deleted +0 -1
@@ -1 +0,0 @@ -subroutine RIGHT
t/t4018/fortran-comment.ctx deleted +0 -1
@@ -1 +0,0 @@ -subroutine RIGHT
t/t4018/fortran-external-function deleted +0 -9
@@ -1,9 +0,0 @@ -function RIGHT(a, b) result(c) - -integer, intent(in) :: ChangeMe -integer, intent(in) :: b -integer, intent(out) :: c - -c = a+b - -end function RIGHT
t/t4018/fortran-external-function.ctx deleted +0 -1
@@ -1 +0,0 @@ -function RIGHT(a, b) result(c)
t/t4018/fortran-external-subroutine deleted +0 -5
@@ -1,5 +0,0 @@ -subroutine RIGHT - -real ChangeMe - -end subroutine RIGHT
t/t4018/fortran-external-subroutine.ctx deleted +0 -1
@@ -1 +0,0 @@ -subroutine RIGHT
t/t4018/fortran-module deleted +0 -5
@@ -1,5 +0,0 @@ -module RIGHT - -use ChangeMe - -end module RIGHT
t/t4018/fortran-module-procedure deleted +0 -13
@@ -1,13 +0,0 @@ - module RIGHT - - implicit none - private - - interface letters ! generic interface - module procedure aaaa, & - bbbb, & - ChangeMe, & - dddd - end interface - -end module RIGHT
t/t4018/fortran-module-procedure.ctx deleted +0 -1
@@ -1 +0,0 @@ -module RIGHT
t/t4018/fortran-module.ctx deleted +0 -1
@@ -1 +0,0 @@ -module RIGHT
t/t4018/fortran-program deleted +0 -5
@@ -1,5 +0,0 @@ -program RIGHT - -call ChangeMe - -end program RIGHT
t/t4018/fortran-program.ctx deleted +0 -1
@@ -1 +0,0 @@ -program RIGHT
t/t4018/fortran.sh new file +159 -0
159 lines not on this page · raw message
t/t4018/fountain-scene deleted +0 -4
@@ -1,4 +0,0 @@ -EXT. STREET RIGHT OUTSIDE - DAY - -CHARACTER -You didn't say the magic phrase, "ChangeMe".
t/t4018/fountain-scene.ctx deleted +0 -1
@@ -1 +0,0 @@ -EXT. STREET RIGHT OUTSIDE - DAY
t/t4018/fountain.sh new file +14 -0
@@ -0,0 +1,14 @@ +#!/bin/sh +# +# See ../t4018-diff-funcname.sh's test_diff_funcname() +# + +test_diff_funcname 'fountain: scene' \ + 8<<\EOF_HUNK 9<<\EOF_TEST +EXT. STREET RIGHT OUTSIDE - DAY +EOF_HUNK +EXT. STREET RIGHT OUTSIDE - DAY + +CHARACTER +You didn't say the magic phrase, "ChangeMe". +EOF_TEST
t/t4018/golang-complex-function deleted +0 -8
@@ -1,8 +0,0 @@ -type Test struct { - a Type -} - -func (t *Test) RIGHT(a Type) (Type, error) { - t.a = a - return ChangeMe, nil -}
t/t4018/golang-complex-function.ctx deleted +0 -1
@@ -1 +0,0 @@ -func (t *Test) RIGHT(a Type) (Type, error) {
t/t4018/golang-func deleted +0 -4
@@ -1,4 +0,0 @@ -func RIGHT() { - a := 5 - b := ChangeMe -}
t/t4018/golang-func.ctx deleted +0 -1
@@ -1 +0,0 @@ -func RIGHT() {
t/t4018/golang-interface deleted +0 -4
@@ -1,4 +0,0 @@ -type RIGHT interface { - a() Type - b() ChangeMe -}
t/t4018/golang-interface.ctx deleted +0 -1
@@ -1 +0,0 @@ -type RIGHT interface {
t/t4018/golang-long-func deleted +0 -5
@@ -1,5 +0,0 @@ -func RIGHT(aVeryVeryVeryLongVariableName AVeryVeryVeryLongType, - anotherLongVariableName AnotherLongType) { - a := 5 - b := ChangeMe -}
t/t4018/golang-long-func.ctx deleted +0 -1
@@ -1 +0,0 @@ -func RIGHT(aVeryVeryVeryLongVariableName AVeryVeryVeryLongType,
t/t4018/golang-struct deleted +0 -4
@@ -1,4 +0,0 @@ -type RIGHT struct { - a Type - b ChangeMe -}
t/t4018/golang-struct.ctx deleted +0 -1
@@ -1 +0,0 @@ -type RIGHT struct {
t/t4018/golang.sh new file +59 -0
59 lines not on this page · raw message
t/t4018/java-class-member-function deleted +0 -8
@@ -1,8 +0,0 @@ -public class Beer -{ - int special; - public static void main(String RIGHT[]) - { - System.out.print("ChangeMe"); - } -}
t/t4018/java-class-member-function.ctx deleted +0 -1
@@ -1 +0,0 @@ -public static void main(String RIGHT[])
t/t4018/java.sh new file +18 -0
@@ -0,0 +1,18 @@ +#!/bin/sh +# +# See ../t4018-diff-funcname.sh's test_diff_funcname() +# + +test_diff_funcname 'java: class member function' \ + 8<<\EOF_HUNK 9<<\EOF_TEST +public static void main(String RIGHT[]) +EOF_HUNK +public class Beer +{ + int special; + public static void main(String RIGHT[]) + { + System.out.print("ChangeMe"); + } +} +EOF_TEST
t/t4018/markdown-heading-indented deleted +0 -6
@@ -1,6 +0,0 @@ -Indented headings are allowed, as long as the indent is no more than 3 spaces. - - ### RIGHT - -- something -- ChangeMe
t/t4018/markdown-heading-indented.ctx deleted +0 -1
@@ -1 +0,0 @@ - ### RIGHT
t/t4018/markdown-heading-non-headings deleted +0 -17
@@ -1,17 +0,0 @@ -Headings can be right next to other lines of the file: -# RIGHT -Indents of four or more spaces make a code block: - - # code comment, not heading - -If there's no space after the final hash, it's not a heading: - -#hashtag - -Sequences of more than 6 hashes don't make a heading: - -####### over-enthusiastic heading - -So the detected heading should be right up at the start of this file. - -ChangeMe
t/t4018/markdown-heading-non-headings.ctx deleted +0 -1
@@ -1 +0,0 @@ -# RIGHT
t/t4018/markdown.sh new file +39 -0
@@ -0,0 +1,39 @@ +#!/bin/sh +# +# See ../t4018-diff-funcname.sh's test_diff_funcname() +# + +test_diff_funcname 'markdown: heading indented' \ + 8<<\EOF_HUNK 9<<\EOF_TEST + ### RIGHT +EOF_HUNK +Indented headings are allowed, as long as the indent is no more than 3 spaces. + + ### RIGHT + +- something +- ChangeMe +EOF_TEST + +test_diff_funcname 'markdown: heading non headings' \ + 8<<\EOF_HUNK 9<<\EOF_TEST +# RIGHT +EOF_HUNK +Headings can be right next to other lines of the file: +# RIGHT +Indents of four or more spaces make a code block: + + # code comment, not heading + +If there's no space after the final hash, it's not a heading: + +#hashtag + +Sequences of more than 6 hashes don't make a heading: + +####### over-enthusiastic heading + +So the detected heading should be right up at the start of this file. + +ChangeMe +EOF_TEST
t/t4018/matlab-class-definition deleted +0 -5
@@ -1,5 +0,0 @@ -classdef RIGHT - properties - ChangeMe - end -end
t/t4018/matlab-class-definition.ctx deleted +0 -1
@@ -1 +0,0 @@ -classdef RIGHT
t/t4018/matlab-function deleted +0 -4
@@ -1,4 +0,0 @@ -function y = RIGHT() -x = 5; -y = ChangeMe + x; -end
t/t4018/matlab-function.ctx deleted +0 -1
@@ -1 +0,0 @@ -function y = RIGHT()
t/t4018/matlab-octave-section-1 deleted +0 -3
@@ -1,3 +0,0 @@ -%%% RIGHT section -# this is octave script -ChangeMe = 1;
t/t4018/matlab-octave-section-1.ctx deleted +0 -1
@@ -1 +0,0 @@ -%%% RIGHT section
t/t4018/matlab-octave-section-2 deleted +0 -3
@@ -1,3 +0,0 @@ -## RIGHT section -# this is octave script -ChangeMe = 1;
t/t4018/matlab-octave-section-2.ctx deleted +0 -1
@@ -1 +0,0 @@ -## RIGHT section
t/t4018/matlab-section deleted +0 -3
@@ -1,3 +0,0 @@ -%% RIGHT section -% this is understood by both matlab and octave -ChangeMe = 1;
t/t4018/matlab-section.ctx deleted +0 -1
@@ -1 +0,0 @@ -%% RIGHT section
t/t4018/matlab.sh new file +52 -0
52 lines not on this page · raw message
t/t4018/perl-skip-end-of-heredoc deleted +0 -8
@@ -1,8 +0,0 @@ -sub RIGHTwithheredocument { - print <<"EOF" -decoy here-doc -EOF - # some lines of context - # to pad it out - print "ChangeMe\n"; -}
t/t4018/perl-skip-end-of-heredoc.ctx deleted +0 -1
@@ -1 +0,0 @@ -sub RIGHTwithheredocument {
t/t4018/perl-skip-forward-decl deleted +0 -10
@@ -1,10 +0,0 @@ -package RIGHT; - -use strict; -use warnings; -use parent qw(Exporter); -our @EXPORT_OK = qw(round finalround); - -sub other; # forward declaration - -# ChangeMe
t/t4018/perl-skip-forward-decl.ctx deleted +0 -1
@@ -1 +0,0 @@ -package RIGHT;
t/t4018/perl-skip-sub-in-pod deleted +0 -18
@@ -1,18 +0,0 @@ -=head1 NAME - -Beer - subroutine to output fragment of a drinking song - -=head1 SYNOPSIS_RIGHT - - use Beer qw(round finalround); - - sub song { - for (my $i = 99; $i > 0; $i--) { - round $i; - } - finalround; - } - - ChangeMe; - -=cut
t/t4018/perl-skip-sub-in-pod.ctx deleted +0 -1
@@ -1 +0,0 @@ -=head1 SYNOPSIS_RIGHT
t/t4018/perl-sub-definition deleted +0 -4
@@ -1,4 +0,0 @@ -sub RIGHT { - my ($n) = @_; - print "ChangeMe"; -}
t/t4018/perl-sub-definition-kr-brace deleted +0 -4
@@ -1,4 +0,0 @@ -sub RIGHT -{ - print "ChangeMe\n"; -}
t/t4018/perl-sub-definition-kr-brace.ctx deleted +0 -1
@@ -1 +0,0 @@ -sub RIGHT
t/t4018/perl-sub-definition.ctx deleted +0 -1
@@ -1 +0,0 @@ -sub RIGHT {
t/t4018/perl.sh new file +78 -0
78 lines not on this page · raw message
t/t4018/php-abstract-class deleted +0 -4
@@ -1,4 +0,0 @@ -abstract class RIGHT -{ - const FOO = 'ChangeMe'; -}
t/t4018/php-abstract-class.ctx deleted +0 -1
@@ -1 +0,0 @@ -abstract class RIGHT
t/t4018/php-abstract-method deleted +0 -7
@@ -1,7 +0,0 @@ -abstract class Klass -{ - abstract public function RIGHT(): ?string - { - return 'ChangeMe'; - } -}
t/t4018/php-abstract-method.ctx deleted +0 -1
@@ -1 +0,0 @@ -abstract public function RIGHT(): ?string
t/t4018/php-class deleted +0 -4
@@ -1,4 +0,0 @@ -class RIGHT -{ - const FOO = 'ChangeMe'; -}
t/t4018/php-class.ctx deleted +0 -1
@@ -1 +0,0 @@ -class RIGHT
t/t4018/php-final-class deleted +0 -4
@@ -1,4 +0,0 @@ -final class RIGHT -{ - const FOO = 'ChangeMe'; -}
t/t4018/php-final-class.ctx deleted +0 -1
@@ -1 +0,0 @@ -final class RIGHT
t/t4018/php-final-method deleted +0 -7
@@ -1,7 +0,0 @@ -class Klass -{ - final public function RIGHT(): string - { - return 'ChangeMe'; - } -}
t/t4018/php-final-method.ctx deleted +0 -1
@@ -1 +0,0 @@ -final public function RIGHT(): string
t/t4018/php-function deleted +0 -4
@@ -1,4 +0,0 @@ -function RIGHT() -{ - return 'ChangeMe'; -}
t/t4018/php-function.ctx deleted +0 -1
@@ -1 +0,0 @@ -function RIGHT()
t/t4018/php-interface deleted +0 -4
@@ -1,4 +0,0 @@ -interface RIGHT -{ - public function foo($ChangeMe); -}
t/t4018/php-interface.ctx deleted +0 -1
@@ -1 +0,0 @@ -interface RIGHT
t/t4018/php-method deleted +0 -7
@@ -1,7 +0,0 @@ -class Klass -{ - public static function RIGHT() - { - return 'ChangeMe'; - } -}
t/t4018/php-method.ctx deleted +0 -1
@@ -1 +0,0 @@ -public static function RIGHT()
t/t4018/php-trait deleted +0 -7
@@ -1,7 +0,0 @@ -trait RIGHT -{ - public function foo($ChangeMe) - { - return 'foo'; - } -}
t/t4018/php-trait.ctx deleted +0 -1
@@ -1 +0,0 @@ -trait RIGHT
t/t4018/php.sh new file +106 -0
106 lines not on this page · raw message
t/t4018/python-async-def deleted +0 -4
@@ -1,4 +0,0 @@ -async def RIGHT(pi: int = 3.14): - while True: - break - return ChangeMe()
t/t4018/python-async-def.ctx deleted +0 -1
@@ -1 +0,0 @@ -async def RIGHT(pi: int = 3.14):
t/t4018/python-class deleted +0 -4
@@ -1,4 +0,0 @@ -class RIGHT(int, str): - # comment - # another comment - # ChangeMe
t/t4018/python-class.ctx deleted +0 -1
@@ -1 +0,0 @@ -class RIGHT(int, str):
t/t4018/python-def deleted +0 -4
@@ -1,4 +0,0 @@ -def RIGHT(pi: int = 3.14): - while True: - break - return ChangeMe()
t/t4018/python-def.ctx deleted +0 -1
@@ -1 +0,0 @@ -def RIGHT(pi: int = 3.14):
t/t4018/python-indented-async-def deleted +0 -7
@@ -1,7 +0,0 @@ -class Foo: - async def RIGHT(self, x: int): - return [ - 1, - 2, - ChangeMe, - ]
t/t4018/python-indented-async-def.ctx deleted +0 -1
@@ -1 +0,0 @@ -async def RIGHT(self, x: int):
t/t4018/python-indented-class deleted +0 -5
@@ -1,5 +0,0 @@ -if TYPE_CHECKING: - class RIGHT: - # comment - # another comment - # ChangeMe
t/t4018/python-indented-class.ctx deleted +0 -1
@@ -1 +0,0 @@ -class RIGHT:
t/t4018/python-indented-def deleted +0 -7
@@ -1,7 +0,0 @@ -class Foo: - def RIGHT(self, x: int): - return [ - 1, - 2, - ChangeMe, - ]
t/t4018/python-indented-def.ctx deleted +0 -1
@@ -1 +0,0 @@ -def RIGHT(self, x: int):
t/t4018/python.sh new file +71 -0
71 lines not on this page · raw message
t/t4018/rust-fn deleted +0 -5
@@ -1,5 +0,0 @@ -pub(self) fn RIGHT<T>(x: &[T]) where T: Debug { - let _ = x; - // a comment - let a = ChangeMe; -}
t/t4018/rust-fn.ctx deleted +0 -1
@@ -1 +0,0 @@ -pub(self) fn RIGHT<T>(x: &[T]) where T: Debug {
t/t4018/rust-impl deleted +0 -5
@@ -1,5 +0,0 @@ -impl<'a, T: AsRef<[u8]>> std::RIGHT for Git<'a> { - - pub fn ChangeMe(&self) -> () { - } -}
t/t4018/rust-impl.ctx deleted +0 -1
@@ -1 +0,0 @@ -impl<'a, T: AsRef<[u8]>> std::RIGHT for Git<'a> {
t/t4018/rust-macro-rules deleted +0 -6
@@ -1,6 +0,0 @@ -macro_rules! RIGHT { - () => { - // a comment - let x = ChangeMe; - }; -}
t/t4018/rust-macro-rules.ctx deleted +0 -1
@@ -1 +0,0 @@ -macro_rules! RIGHT {
t/t4018/rust-struct deleted +0 -5
@@ -1,5 +0,0 @@ -#[derive(Debug)] -pub(super) struct RIGHT<'a> { - name: &'a str, - age: ChangeMe, -}
t/t4018/rust-struct.ctx deleted +0 -1
@@ -1 +0,0 @@ -pub(super) struct RIGHT<'a> {
t/t4018/rust-trait deleted +0 -5
@@ -1,5 +0,0 @@ -unsafe trait RIGHT<T> { - fn len(&self) -> u32; - fn ChangeMe(&self, n: u32) -> T; - fn iter<F>(&self, f: F) where F: Fn(T); -}
t/t4018/rust-trait.ctx deleted +0 -1
@@ -1 +0,0 @@ -unsafe trait RIGHT<T> {
t/t4018/rust.sh new file +60 -0
60 lines not on this page · raw message
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7
Re: [PATCH v2 12/27] userdiff tests: rewrite hunk header test infrastructure
Am 15.02.21 um 16:44 schrieb Ævar Arnfjörð Bjarmason:
Quoted 105 lines
Rewrite the hunk header test infrastructure introduced in
bfa7d01413(t4018: an infrastructure to test hunk headers, 2014-03-21). Seec228a5c077(Merge branch 'js/userdiff-cc', 2014-03-31) for the whole series that commit was part of.As noted in an earlier commit that change introduced the regression of not testing for the full hunk line, but just whether "RIGHT" appeared on it[1]. A preceding commit fixed that specific issue, but we were still left with the inflexibility of the approach described in the now-deleted t/t4018/README.
I.e. to add any sort of new tests that used the existing test data we'd either need to add more files like the recently added (but now deleted) *.ctx) files, using the filesystem as our test datastructure, or introduce more parsing for the custom file format we were growing here.
Let's instead just move this over to using a custom test function. This makes it trivial to add new tests by adding new optional parameters to the function. Let's still keep the relevant files in the "t/t4018/" subdirectory instead of adding ~1.5k lines (and growing) to "
t/t4018-diff-funcname.sh"If this diff is viewed with "--color-moved=plain" we can see that there's no changes to the lines being moved into the new *.sh files, i.e. all the deletions are moves. I'm just adding boilerplate around those existing lines.
The one-off refactoring was performed by an ad-hoc shellscript [2].
1. https://lore.kernel.org/git/[email protected]/
2.#!/bin/sh set -ex git rm README* for t in $(git ls-files ':!*.ctx') do lang=$(echo $t | sed 's/-.*//') desc=$(echo $t | sed -E 's/^[^-]*-//' | tr - " ") if ! test -e $lang.sh then cat >$lang.sh <<-EOF #!/bin/sh # # See ../t4018-diff-funcname.sh's test_diff_funcname() # EOF else echo >>$lang.sh fi ( printf "test_diff_funcname '%s: %s' \\" "$lang" "$desc" echo printf "\t8<<%sEOF_HUNK 9<<%sEOF_TEST\n" '\' '\' cat $t.ctx printf "EOF_HUNK\n" cat $t printf "EOF_TEST\n" ) >>$lang.sh chmod +x $lang.sh git add $lang.sh git rm $t $t.ctx doneSigned-off-by Ævar Arnfjörð Bjarmason <[email protected]>---
t/t4018/bash.sh new file +27
-0@@ -0,0 +1,160 @@ +#!/bin/sh +# +# See ../t4018-diff-funcname.sh's test_diff_funcname() +# + +test_diff_funcname 'bash: arithmetic function' \ + 8<<\EOF_HUNK 9<<\EOF_TEST +RIGHT() +EOF_HUNK +RIGHT() (( + + ChangeMe = "$x" + "$y" +)) +EOF_TEST + +test_diff_funcname 'bash: bashism style compact' \ + 8<<\EOF_HUNK 9<<\EOF_TEST +function RIGHT { +EOF_HUNK +function RIGHT { + function InvalidSyntax{ + : + echo 'ChangeMe' + } +} +EOF_TEST +
t/t4018/bash.sh line 36
Quoted 10 lines
t/t4018/bash.sh new file +9
-0+test_diff_funcname 'bash: bashism style function' \ + 8<<\EOF_HUNK 9<<\EOF_TEST +function RIGHT { +EOF_HUNK +function RIGHT { + : + echo 'ChangeMe' +} +EOF_TEST
That is not my dream of "simple". But I'm not a userdiff author anymore, so...
I don't know, yet, where this is heading to what the advantage is. At any rate, "trivial to add new tests" was also the case when each test case was in its own file. Without the boilerplate!
-- Hannes
Re: [PATCH v2 12/27] userdiff tests: rewrite hunk header test infrastructure
Quoted 109 lines · Johannes Sixt
Am 15.02.21 um 16:44 schrieb Ævar Arnfjörð Bjarmason:
Quoted 94 lines
Rewrite the hunk header test infrastructure introduced in
bfa7d01413(t4018: an infrastructure to test hunk headers, 2014-03-21). Seec228a5c077(Merge branch 'js/userdiff-cc', 2014-03-31) for the whole series that commit was part of. As noted in an earlier commit that change introduced the regression of
not testing for the full hunk line, but just whether "RIGHT" appeared on it[1]. A preceding commit fixed that specific issue, but we were still left with the inflexibility of the approach described in the now-deleted t/t4018/README.
I.e. to add any sort of new tests that used the existing test data we'd either need to add more files like the recently added (but now deleted) *.ctx) files, using the filesystem as our test datastructure, or introduce more parsing for the custom file format we were growing here.
Let's instead just move this over to using a custom test function. This makes it trivial to add new tests by adding new optional parameters to the function. Let's still keep the relevant files in the "t/t4018/" subdirectory instead of adding ~1.5k lines (and growing) to "t/t4018-diff-funcname.sh"
If this diff is viewed with "--color-moved=plain" we can see that there's no changes to the lines being moved into the new *.sh files, i.e. all the deletions are moves. I'm just adding boilerplate around those existing lines.
The one-off refactoring was performed by an ad-hoc shellscript [2].
1. https://lore.kernel.org/git/[email protected]/
2.#!/bin/sh set -ex git rm README* for t in $(git ls-files ':!*.ctx') do lang=$(echo $t | sed 's/-.*//') desc=$(echo $t | sed -E 's/^[^-]*-//' | tr - " ") if ! test -e $lang.sh then cat >$lang.sh <<-EOF #!/bin/sh # # See ../t4018-diff-funcname.sh's test_diff_funcname() # EOF else echo >>$lang.sh fi ( printf "test_diff_funcname '%s: %s' \\" "$lang" "$desc" echo printf "\t8<<%sEOF_HUNK 9<<%sEOF_TEST\n" '\' '\' cat $t.ctx printf "EOF_HUNK\n" cat $t printf "EOF_TEST\n" ) >>$lang.sh chmod +x $lang.sh git add $lang.sh git rm $t $t.ctx doneSigned-off-by Ævar Arnfjörð Bjarmason <[email protected]>---
t/t4018/bash.sh new file +27
-0@@ -0,0 +1,160 @@ +#!/bin/sh +# +# See ../t4018-diff-funcname.sh's test_diff_funcname() +# + +test_diff_funcname 'bash: arithmetic function' \ + 8<<\EOF_HUNK 9<<\EOF_TEST +RIGHT() +EOF_HUNK +RIGHT() (( + + ChangeMe = "$x" + "$y" +)) +EOF_TEST + +test_diff_funcname 'bash: bashism style compact' \ + 8<<\EOF_HUNK 9<<\EOF_TEST +function RIGHT { +EOF_HUNK +function RIGHT { + function InvalidSyntax{ + : + echo 'ChangeMe' + } +} +EOF_TEST +t/t4018/bash.sh line 36
Quoted 10 lines
t/t4018/bash.sh new file +9
-0+test_diff_funcname 'bash: bashism style function' \ + 8<<\EOF_HUNK 9<<\EOF_TEST +function RIGHT { +EOF_HUNK +function RIGHT { + : + echo 'ChangeMe' +} +EOF_TESTThat is not my dream of "simple". But I'm not a userdiff author anymore, so...
Quoted 2 lines
I don't know, yet, where this is heading to what the advantage is. At any rate,[...]
I originally started writing this because I noticed I could break the userdiff.c patterns and still have all tests pass, i.e. if you screw up the capture grouping you can go from:
@@ -2,3 +2,3 @@ function RIGHT ( ) {
@@ -2,3 +2,3 @@ RIGHT ( )to:
@@ -2,3 +2,3 @@ function RIGHT ( ) {
@@ -2,3 +2,3 @@ RIGHT ( )And we wouldn't care because we just "grep 'RIGHT'". In this case we really care about the difference between "^[ \t]*(.*)$" and a broken "^([ \t]*.*)$" so not having the tests structurally hide the difference makes sense.
Quoted 2 lines
[...] "trivial to add new tests" was also the case when each test case was in its own file[...]
"trivial to add new tests by adding new optional parameters to the function". I.e. aside from the s/grep/test_cmp/ change in 09/27 the existing tests were OK if you wanted to test exactly what they expected, and no more.
I think it just makes sense to have a test helper function instead and little bit of boilerplate, as seen e.g. in 14/27 and later in the series we can add new test modes and set per-test config without needing the top-level dispatch loop to be aware of it.
Quoted 1 line
[...] Without the boilerplate!
I realize that's a matter of taste, i.e. when to come up with some custom format v.s. writng a function.
FWIW as someone who didn't author the format I've come across it N times over the years and each time ended up being more confused than when reading any custom test function we have.
For those you can usually just look at the definition/arguments, whereas this always required a careful read of t4018-diff-funcname.sh.
I also find it easier to have one ~160 line file in my editor than ~150 lines spread over 15 files, as in the recent addition of bash support in 2ff6c34612 (userdiff: support Bash, 2020-10-22).
It also depends on how you're counting boilerplate, if you're looking at it as a patch on the ML it would be ~160 lines of bash.sh, v.s. ~150 lines of the same content, if we're counting the boilerplate diff of 6 lines for every new file :)
Re: [PATCH v2 12/27] userdiff tests: rewrite hunk header test infrastructure
Am 15.02.21 um 21:06 schrieb Ævar Arnfjörð Bjarmason:
Quoted 40 lines · Johannes Sixt
Quoted 27 lines
Am 15.02.21 um 16:44 schrieb Ævar Arnfjörð Bjarmason:
Quoted 12 lines
t/t4018/bash.sh new file +12
-0+test_diff_funcname 'bash: bashism style compact' \ + 8<<\EOF_HUNK 9<<\EOF_TEST +function RIGHT { +EOF_HUNK +function RIGHT { + function InvalidSyntax{ + : + echo 'ChangeMe' + } +} +EOF_TEST +t/t4018/bash.sh line 36
Quoted 10 lines
t/t4018/bash.sh new file +9
-0+test_diff_funcname 'bash: bashism style function' \ + 8<<\EOF_HUNK 9<<\EOF_TEST +function RIGHT { +EOF_HUNK +function RIGHT { + : + echo 'ChangeMe' +} +EOF_TESTThat is not my dream of "simple". But I'm not a userdiff author anymore, so...
Quoted 2 lines
I don't know, yet, where this is heading to what the advantage is. At any rate,[...]
I originally started writing this because I noticed I could break the
userdiff.cpatterns and still have all tests pass, i.e. if you screw up the capture grouping you can go from:@@ -2,3 +2,3 @@ function RIGHT ( ) { @@ -2,3 +2,3 @@ RIGHT ( )to:
Quoted 7 lines
@@ -2,3 +2,3 @@ function RIGHT ( ) { @@ -2,3 +2,3 @@ RIGHT ( )And we wouldn't care because we just "grep 'RIGHT'". In this case we really care about the difference between "^[ \t]*(.*)$" and a broken "^([ \t]*.*)$" so not having the tests structurally hide the difference makes sense.
But why care? The second version is not wrong. If it's not pretty, the pattern author will notice soon enough. I regard avoiding the regression you cite less important than the simplicity of adding new test cases.
Quoted 8 lines
Quoted 3 lines
[...] "trivial to add new tests" was also the case when each test case was in its own file[...]
"trivial to add new tests by adding new optional parameters to the function". I.e. aside from the s/grep/test_cmp/ change in 09/27 the existing tests were OK if you wanted to test exactly what they expected, and no more.
I did not understand what you meant with "new optional parameters" and I still do not and why it is desirable.
Quoted 15 lines
I think it just makes sense to have a test helper function instead and little bit of boilerplate, as seen e.g. in 14/27 and later in the series we can add new test modes and set per-test config without needing the top-level dispatch loop to be aware of it.
Quoted 1 line
[...] Without the boilerplate!
I realize that's a matter of taste, i.e. when to come up with some custom format v.s. writng a function.
FWIW as someone who didn't author the format I've come across it N times over the years and each time ended up being more confused than when reading any custom test function we have.
Quoted 6 lines
For those you can usually just look at the definition/arguments, whereas this always required a careful read of
t4018-diff-funcname.sh.I also find it easier to have one ~160 line file in my editor than ~150 lines spread over 15 files, as in the recent addition of bash support in
2ff6c34612(userdiff: support Bash, 2020-10-22).
I wouldn't mind having all test cases in a single file. But then it should be one file in the language that is being tested, not shell script with foreign text between the lines. Adding test cases should be easy for authors; they should not have to be proficient in shell scripting (and knwo about 130 lines of CodingGuidelines).
-- Hannes
Re: [PATCH v2 12/27] userdiff tests: rewrite hunk header test infrastructure
In reply to Ævar Arnfjörð BjarmasonQuoted 3 lines · Ævar Arnfjörð Bjarmason
Rewrite the hunk header test infrastructure introduced in
bfa7d01413(t4018: an infrastructure to test hunk headers, 2014-03-21).
Is this "oops, we added something unacceptably ugly in 09/27 and this step fixes it"? Please don't.
PATCH v2 13/27 userdiff tests: do config teardown in test_diff_funcname()
In reply to Ævar Arnfjörð BjarmasonDo a teardown of any custom "diff.<what>.x?funcname" config after a test_diff_funcname() test runs. Nothing currently uses this, but a follow-up commit will start setting custom config before certain tests. Centralizing this teardown makes the tests simpler.
--- t/t4018-diff-funcname.sh | 7 +++++++ 1 file changed, 7 insertions(+)
t/t4018-diff-funcname.sh +7 -0
@@ -78,6 +78,13 @@ test_diff_funcname () { git diff -U1 "$what" >diff && sed -n -e "s/^.*@@$//p" -e "s/^.*@@ //p" <diff >actual && test_cmp expected actual + ' && + + test_expect_success "teardown: $desc" ' + # In case any custom config was set immediately before + # the test itself in the test file + test_unconfig "diff.$what.funcname" && + test_unconfig "diff.$what.xfuncname" ' }
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7
PATCH v2 14/27 userdiff tests: move custom patterns into one test file
In reply to Ævar Arnfjörð BjarmasonIn a preceding commit the test infrastructure got rewritten so "t/t4018/" are now normal test files which can do things like set config, so let's make it responsible for setting up and tearing down the config for its tests.
--- t/t4018-diff-funcname.sh | 16 +------- t/t4018/custom.sh | 79 ++++++++++++++++++++++++++++++++++++++++ t/t4018/custom1.sh | 27 -------------- t/t4018/custom2.sh | 18 --------- t/t4018/custom3.sh | 27 -------------- 5 files changed, 80 insertions(+), 87 deletions(-) create mode 100755 t/t4018/custom.sh delete mode 100755 t/t4018/custom1.sh delete mode 100755 t/t4018/custom2.sh delete mode 100755 t/t4018/custom3.sh
t/t4018-diff-funcname.sh +1 -15
@@ -11,18 +11,6 @@ test_expect_success 'setup' ' builtin_drivers=$(test-tool userdiff list-builtin-drivers) && test -n "$builtin_drivers" && - # 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).*)$" && - # for regexp compilation tests echo A >A.java && echo B >B.java
@@ -30,9 +18,7 @@ test_expect_success 'setup' ' diffpatterns=" $builtin_drivers - custom1 - custom2 - custom3 + custom " for p in $diffpatterns
t/t4018/custom.sh new file +79 -0
79 lines not on this page · raw message
t/t4018/custom1.sh deleted +0 -27
@@ -1,27 +0,0 @@ -#!/bin/sh -# -# See ../t4018-diff-funcname.sh's test_diff_funcname() -# - -test_diff_funcname 'custom1: pattern' \ - 8<<\EOF_HUNK 9<<\EOF_TEST -int special, RIGHT; -EOF_HUNK -public class Beer -{ - int special, RIGHT; - public static void main(String args[]) - { - String s=" "; - for(int x = 99; x > 0; x--) - { - System.out.print(x + " bottles of beer on the wall " - + x + " bottles of beer\n" // ChangeMe - + "Take one down, pass it around, " + (x - 1) - + " bottles of beer on the wall.\n"); - } - System.out.print("Go to the store, buy some more,\n" - + "99 bottles of beer on the wall.\n"); - } -} -EOF_TEST
t/t4018/custom2.sh deleted +0 -18
@@ -1,18 +0,0 @@ -#!/bin/sh -# -# See ../t4018-diff-funcname.sh's test_diff_funcname() -# - -test_diff_funcname 'custom2: match to end of line' \ - 8<<\EOF_HUNK 9<<\EOF_TEST -RIGHT_Beer -EOF_HUNK -public class RIGHT_Beer -{ - int special; - public static void main(String args[]) - { - System.out.print("ChangeMe"); - } -} -EOF_TEST
t/t4018/custom3.sh deleted +0 -27
@@ -1,27 +0,0 @@ -#!/bin/sh -# -# See ../t4018-diff-funcname.sh's test_diff_funcname() -# - -test_diff_funcname 'custom3: alternation in pattern' \ - 8<<\EOF_HUNK 9<<\EOF_TEST -public static void main(String RIGHT[]) -EOF_HUNK -public class Beer -{ - int special; - public static void main(String RIGHT[]) - { - String s=" "; - for(int x = 99; x > 0; x--) - { - System.out.print(x + " bottles of beer on the wall " - + x + " bottles of beer\n" // ChangeMe - + "Take one down, pass it around, " + (x - 1) - + " bottles of beer on the wall.\n"); - } - System.out.print("Go to the store, buy some more,\n" - + "99 bottles of beer on the wall.\n"); - } -} -EOF_TEST
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7
PATCH v2 15/27 userdiff tests: remove hack for "RIGHT" token
In reply to Ævar Arnfjörð BjarmasonNow that the "RIGHT" token isn't how we select the desired hunk header line in the test anymore we can revert a hack added in f1b75fbaf1 (t4018: convert custom pattern test to the new infrastructure, 2014-03-21) and go back to the regular expression we were testing before that change.
--- t/t4018/custom.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
t/t4018/custom.sh +3 -3
@@ -33,14 +33,14 @@ public class Beer EOF_TEST test_expect_success 'custom: setup match to end of line' ' - git config diff.custom.funcname "......Beer\$" + git config diff.custom.funcname "Beer\$" ' test_diff_funcname 'custom: match to end of line' \ 8<<\EOF_HUNK 9<<\EOF_TEST -RIGHT_Beer +Beer EOF_HUNK -public class RIGHT_Beer +public class Beer { int special; public static void main(String args[])
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7
PATCH v2 16/27 userdiff tests: do not do compile tests on "custom" pattern
In reply to Ævar Arnfjörð BjarmasonSince f1b75fbaf1 (t4018: convert custom pattern test to the new infrastructure, 2014-03-21) we have been doing the basic sanity check of whether patterns in userdiff.c compile on the "custom" patterns.
That we were doing this was an emergent effect of that change and an earlier refactoring in bfa7d01413 (t4018: an infrastructure to test hunk headers, 2014-03-21).
This was never intended by the test added ine3bf5e43fd (t4018-diff-funcname: test syntax of builtin xfuncname patterns, 2008-09-22), nor is there any point in doing this. We'll error out in the custom.sh test itself if those patterns don't compile.
--- t/t4018-diff-funcname.sh | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
t/t4018-diff-funcname.sh +2 -7
@@ -16,12 +16,7 @@ test_expect_success 'setup' ' echo B >B.java ' -diffpatterns=" - $builtin_drivers - custom -" - -for p in $diffpatterns +for p in $builtin_drivers do test_expect_success "builtin $p pattern compiles" ' echo "*.java diff=$p" >.gitattributes &&
@@ -74,7 +69,7 @@ test_diff_funcname () { ' } -for what in $diffpatterns +for what in $builtin_drivers custom do test="$TEST_DIRECTORY/t4018/$what.sh" if ! test -e "$test"
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7
PATCH v2 17/27 userdiff tests + docs: document & test "diff.<driver>.x?funcname"
In reply to Ævar Arnfjörð BjarmasonAdd the missing documentation for "diff.<driver>.funcname" and test for how it and "diff.<driver>.xfuncname" interact.
Between the introduction of the "diff.<driver>.xfuncname" form in 45d9414fa5 (diff.*.xfuncname which uses "extended" regex's for hunk header selection, 2008-09-18) and when this documentation was written in 90b94c26f7 (Documentation: Add diff.<driver>.* to config, 2011-04-07) we forgot to document the existence of "diff.<driver>.funcname".
Let's make a mention of it here, we could also partially revert the former commit and discuss the more verbose form in gitattributes(5), but let's stop short of that. It makes sense to guide users towards ERE over BRE whenever possible.
--- Documentation/config/diff.txt | 11 +++++++++++ t/t4018/custom.sh | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+)
Documentation/config/diff.txt +11 -0
@@ -153,10 +153,21 @@ diff.<driver>.command:: The custom diff driver command. See linkgit:gitattributes[5] for details. +diff.<driver>.funcname:: diff.<driver>.xfuncname:: The regular expression that the diff driver should use to recognize the hunk header. A built-in pattern may also be used. See linkgit:gitattributes[5] for details. ++ +When provided as `diff.<driver>.funcname` the regular expression is +interpreted as a basic regular expression. With +`diff.<driver>.xfuncname` it's interpreted as an extended regular +expression. ++ +The `*.funcname` and `*.xfuncname` variables behave as if though they +were one configuration variable for the purposes of what value +eventually gets used. Setting `*.funcname` will override an earlier +`*.xfuncname` and vice-versa. diff.<driver>.binary:: Set this option to true to make the diff driver treat files as
t/t4018/custom.sh +34 -0
@@ -77,3 +77,37 @@ public class Beer } } EOF_TEST + +test_expect_success 'custom: setup config precedence' ' + git config diff.custom.funcname "foo" && + git config diff.custom.xfuncname "bar" +' + +test_diff_funcname 'custom: config precedence' \ + 8<<\EOF_HUNK 9<<\EOF_TEST +bar +EOF_HUNK +foo +bar + +ChangeMe + +baz +EOF_TEST + +test_expect_success 'custom: setup config precedence' ' + git config diff.custom.xfuncname "bar" && + git config diff.custom.funcname "foo" +' + +test_diff_funcname 'custom: config precedence' \ + 8<<\EOF_HUNK 9<<\EOF_TEST +foo +EOF_HUNK +foo +bar + +ChangeMe + +baz +EOF_TEST
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7
PATCH v2 18/27 gitattributes doc: reword discussion of built-in userdiff patterns
In reply to Ævar Arnfjörð BjarmasonReword the discussion of the built-in userdiff patterns to make it more natural to precede it with a discussion about the semantics of pattern matching, instead of assuming that it follows right after the "diff.tex.xfuncname" example which now immediately precedes it. This will make a follow-up commit smaller.
--- Documentation/gitattributes.txt | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
Documentation/gitattributes.txt +11 -5
@@ -794,11 +794,17 @@ backslashes; the pattern above picks a line that begins with a backslash, and zero or more occurrences of `sub` followed by `section` followed by open brace, to the end of line. -There are a few built-in patterns to make this easier, and `tex` -is one of them, so you do not have to write the above in your -configuration file (you still need to enable this with the -attribute mechanism, via `.gitattributes`). The following built in -patterns are available: +There are built-in patterns shipped as part of git itself. A more +advanced version of the `tex` pattern discussed above is one of them. + +For built-in patterns, you do not need `diff.<lang>.xfuncname` in your +configuration file as discussed above, but if present, it will +override a built-in pattern. + +Nevertheless, you need to enable built-in patterns via .gitattributes` +for the pattern to take effect. + +The following built-in patterns are available: - `ada` suitable for source code in the Ada language.
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7
Re: [PATCH v2 18/27] gitattributes doc: reword discussion of built-in userdiff patterns
Quoted 11 lines · Ævar Arnfjörð Bjarmason
Reword the discussion of the built-in userdiff patterns to make it more natural to precede it with a discussion about the semantics of pattern matching, instead of assuming that it follows right after the "diff.tex.xfuncname" example which now immediately precedes it. This will make a follow-up commit smaller.
Helped-by Eric Sunshine <[email protected]>Signed-off-by Ævar Arnfjörð Bjarmason <[email protected]>--- Documentation/gitattributes.txt | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
Good changes. The current text, which dates back to ae7aa499 (Document custom hunk header selection, 2007-07-08), may have been adequate back when there were only "java" and "tex" built-in patterns but not anymore.
I may (or may not) give the series a second pass to collect independently salvageable bits, and if I did so, this would be one of those that would be gleaned.
Thanks.
Quoted 26 lines
Documentation/gitattributes.txt +11
-5@@ -794,11 +794,17 @@ backslashes; the pattern above picks a line that begins with a backslash, and zero or more occurrences of `sub` followed by `section` followed by open brace, to the end of line. -There are a few built-in patterns to make this easier, and `tex` -is one of them, so you do not have to write the above in your -configuration file (you still need to enable this with the -attribute mechanism, via `.gitattributes`). The following built in -patterns are available: +There are built-in patterns shipped as part of git itself. A more +advanced version of the `tex` pattern discussed above is one of them. + +For built-in patterns, you do not need `diff.<lang>.xfuncname` in your +configuration file as discussed above, but if present, it will +override a built-in pattern. + +Nevertheless, you need to enable built-in patterns via .gitattributes` +for the pattern to take effect. + +The following built-in patterns are available: - `ada` suitable for source code in the Ada language.
PATCH v2 19/27 gitattributes doc: document multi-line userdiff patterns
In reply to Ævar Arnfjörð BjarmasonDocument the multi-line userdiff patterns and how their matching and the negation syntax works.
These patterns have been supported since f258475a6e (Per-path attribute based hunk header selection., 2007-07-06), and have had their current semantics ever since 3d8dccd74a (diff: fix "multiple regexp" semantics to find hunk header comment, 2008-09-20).
But we had no documentation for them, let's fix that, and also add tests showing how some of the things being discussed here work.
--- Documentation/gitattributes.txt | 33 +++++++++++++++++++--- t/t4018/custom.sh | 50 +++++++++++++++++++++++++++++++++ t/t4018/perl.sh | 16 +++++++++++ 3 files changed, 95 insertions(+), 4 deletions(-)
Documentation/gitattributes.txt +29 -4
@@ -794,12 +794,37 @@ backslashes; the pattern above picks a line that begins with a backslash, and zero or more occurrences of `sub` followed by `section` followed by open brace, to the end of line. -There are built-in patterns shipped as part of git itself. A more -advanced version of the `tex` pattern discussed above is one of them. +Multiple patterns can be supplied by listing them one per line +separated by `\n`. They will be matched one at a time from left to +right. Do not supply a trailing "\n" for the last pattern. E.g.: + +------------------------ +[diff "perl"] + xfuncname = "!^=head\n^[^ ]+.*" +------------------------ + +Patterns in in a list of multiple that begin with "!" are negated. A +matching negated pattern will cause the matched line to be +skipped. Use it to skip a later pattern that would otherwise match. It +is an error if one or more negated patterns aren't followed by a +non-negated pattern. + +To match a literal "!" at the start of a line, use some other regex +construct that will match a literal "!" without "!" being the first +character on that line, such as "[!]". + +If the pattern contains a `$1` capture it will be used instead of the +entire matching line (`$0`) to display the hunk header. This can be +used e.g. to strip whitespace from the beginning of the line, or to +only display the function name as part of a longer function +definition. + +There are built-in patterns shipped as part of git itself, see the +full listing below. For built-in patterns, you do not need `diff.<lang>.xfuncname` in your -configuration file as discussed above, but if present, it will -override a built-in pattern. +configuration file. If present, it will override a built-in pattern, +as shown in the `diff.perl.xfuncname` example above. Nevertheless, you need to enable built-in patterns via .gitattributes` for the pattern to take effect.
t/t4018/custom.sh +50 -0
53 lines not on this page · raw message
t/t4018/perl.sh +16 -0
@@ -76,3 +76,19 @@ sub RIGHT print "ChangeMe\n"; } EOF_TEST + + +test_expect_success 'custom: setup config overrides built-in patterns' ' + git config diff.perl.xfuncname "!^=head +^[^ ]+.*" +' + +test_diff_funcname 'custom: config overrides built-in patterns' \ + 8<<\EOF_HUNK 9<<\EOF_TEST +sub foo; +EOF_HUNK +sub foo; +=head1 +ChangeMe + +EOF_TEST
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7
Re: [PATCH v2 19/27] gitattributes doc: document multi-line userdiff patterns
Am 15.02.21 um 16:44 schrieb Ævar Arnfjörð Bjarmason:
Quoted 48 lines
t/t4018/custom.sh +40
-0@@ -111,3 +111,53 @@ ChangeMe baz EOF_TEST + +test_expect_success 'custom: setup negation syntax, ! is magic' ' + git config diff.custom.xfuncname "!negation +line" +' + +test_diff_funcname 'custom: negation syntax, ! is magic' \ + 8<<\EOF_HUNK 9<<\EOF_TEST +line +EOF_HUNK +line +!negation + +ChangeMe + +baz +EOF_TEST + +test_expect_success 'custom: setup negation syntax, use [!] to override ! magic' ' + git config diff.custom.xfuncname "[!]negation +line" +' + +test_diff_funcname 'custom: negation syntax, use [!] to override ! magic' \ + 8<<\EOF_HUNK 9<<\EOF_TEST +!negation +EOF_HUNK +line +!negation + +ChangeMe + +baz +EOF_TEST + +test_expect_success 'custom: setup captures in multiple patterns' ' + git config diff.custom.xfuncname "!^=head +^format ([^ ]+) +^sub ([^;]+)" +'
t/t4018/custom.sh ChangeMe · line 163
Quoted 10 lines
t/t4018/custom.sh +10
-0+ +test_diff_funcname 'custom: captures in multiple patterns' \ + 8<<\EOF_HUNK 9<<\EOF_TEST +foo +EOF_HUNK +sub foo; +=head1 +ChangeMe + +EOF_TEST
This test would not catch a regression. You must leave a line between the candidate-that-must-not-be, =head1, and ChangeMe, otherwise, =head1 is never tested against the negation pattern.
Or did you change the diff invocation in an earlier patch such that it does not emit context lines?
Quoted 14 lines
t/t4018/perl.sh +6
-0@@ -76,3 +76,19 @@ sub RIGHT print "ChangeMe\n"; } EOF_TEST + + +test_expect_success 'custom: setup config overrides built-in patterns' ' + git config diff.perl.xfuncname "!^=head +^[^ ]+.*" +'
t/t4018/perl.sh sub RIGHT · line 94
Quoted 10 lines
t/t4018/perl.sh +10
-0+ +test_diff_funcname 'custom: config overrides built-in patterns' \ + 8<<\EOF_HUNK 9<<\EOF_TEST +sub foo; +EOF_HUNK +sub foo; +=head1 +ChangeMe + +EOF_TEST
Same here.
-- Hannes
Re: [PATCH v2 19/27] gitattributes doc: document multi-line userdiff patterns
Quoted 84 lines · Johannes Sixt
Am 15.02.21 um 16:44 schrieb Ævar Arnfjörð Bjarmason:
Quoted 47 lines
t/t4018/custom.sh +40
-0@@ -111,3 +111,53 @@ ChangeMe baz EOF_TEST + +test_expect_success 'custom: setup negation syntax, ! is magic' ' + git config diff.custom.xfuncname "!negation +line" +' + +test_diff_funcname 'custom: negation syntax, ! is magic' \ + 8<<\EOF_HUNK 9<<\EOF_TEST +line +EOF_HUNK +line +!negation + +ChangeMe + +baz +EOF_TEST + +test_expect_success 'custom: setup negation syntax, use [!] to override ! magic' ' + git config diff.custom.xfuncname "[!]negation +line" +' + +test_diff_funcname 'custom: negation syntax, use [!] to override ! magic' \ + 8<<\EOF_HUNK 9<<\EOF_TEST +!negation +EOF_HUNK +line +!negation + +ChangeMe + +baz +EOF_TEST + +test_expect_success 'custom: setup captures in multiple patterns' ' + git config diff.custom.xfuncname "!^=head +^format ([^ ]+) +^sub ([^;]+)" +'t/t4018/custom.sh ChangeMe · line 162
Quoted 10 lines
t/t4018/custom.sh +10
-0+ +test_diff_funcname 'custom: captures in multiple patterns' \ + 8<<\EOF_HUNK 9<<\EOF_TEST +foo +EOF_HUNK +sub foo; +=head1 +ChangeMe + +EOF_TESTThis test would not catch a regression. You must leave a line between the candidate-that-must-not-be, =head1, and ChangeMe, otherwise, =head1 is never tested against the negation pattern.
Or did you change the diff invocation in an earlier patch such that it does not emit context lines?
Quoted 18 lines
t/t4018/perl.sh +10
-0@@ -76,3 +76,19 @@ sub RIGHT print "ChangeMe\n"; } EOF_TEST + + +test_expect_success 'custom: setup config overrides built-in patterns' ' + git config diff.perl.xfuncname "!^=head +^[^ ]+.*" +' + +test_diff_funcname 'custom: config overrides built-in patterns' \ + 8<<\EOF_HUNK 9<<\EOF_TEST +sub foo;
Quoted 8 lines
t/t4018/perl.sh sub RIGHT · line 94
Quoted 6 lines
t/t4018/perl.sh +6
-0+EOF_HUNK +sub foo; +=head1 +ChangeMe + +EOF_TESTSame here.
Well spotted. Both of these test work for their advertised purpose. I.e. "we can override the perl built-in config" and "capture count gets reset", but you're right that the =head1 negation rule is redundant at this point in the series.
In 23/27 we start testing with -U0, at which point it starts working. But of course a better fix is to just add an empty line here...
Re: [PATCH v2 19/27] gitattributes doc: document multi-line userdiff patterns
In reply to Ævar Arnfjörð BjarmasonDocumentation/gitattributes.txt backslashes; the pattern above picks a line that begins with a · line 799
Quoted 5 lines · Ævar Arnfjörð Bjarmason
Documentation/gitattributes.txt +3
-2-There are built-in patterns shipped as part of git itself. A more -advanced version of the `tex` pattern discussed above is one of them. +Multiple patterns can be supplied by listing them one per line +separated by `\n`. They will be matched one at a time from left to +right. Do not supply a trailing "\n" for the last pattern. E.g.:
I've always thought that this was modelled after "grep --file=FILE", where patterns are listed one per line, so "from left to right" looked a bit funny, at least to me.
If the "do not supply" is because "it would result in giving an empty string '' as the final pattern, which may not be what you want", then it is a good idea to spell it out.
Documentation/gitattributes.txt backslashes; the pattern above picks a line that begins with a · line 806
Quoted 6 lines
+------------------------
+[diff "perl"]Documentation/gitattributes.txt +4
-0+ xfuncname = "!^=head\n^[^ ]+.*" +------------------------ + +Patterns in in a list of multiple that begin with "!" are negated. A
"in in"???
Quoted 7 lines
Documentation/gitattributes.txt +7
-0+matching negated pattern will cause the matched line to be +skipped. Use it to skip a later pattern that would otherwise match. It +is an error if one or more negated patterns aren't followed by a +non-negated pattern. + +To match a literal "!" at the start of a line, use some other regex +construct that will match a literal "!" without "!" being the first
Documentation/gitattributes.txt backslashes; the pattern above picks a line that begins with a · line 823
Quoted 10 lines
Documentation/gitattributes.txt +10
-0+character on that line, such as "[!]". + +If the pattern contains a `$1` capture it will be used instead of the +entire matching line (`$0`) to display the hunk header. This can be +used e.g. to strip whitespace from the beginning of the line, or to +only display the function name as part of a longer function +definition. + +There are built-in patterns shipped as part of git itself, see the +full listing below.
Other than the minor nits above, the new text is written very well.
PATCH v2 20/27 userdiff tests: remove "funcname" from custom3 test
In reply to Ævar Arnfjörð BjarmasonWe can only have one "funcname" or "xfuncname", any later definition overrides the earlier one, so this configuration wasn't doing anything.
When this test was originally added in 3632cfc248 (Use compatibility regex library for OSX/Darwin, 2008-09-07) we had no such definition of two patters for this test. Back then this was setting the "diff.java.funcname" configuration variable.
The stage for that second pattern being set got set later. In 45d9414fa5 (diff.*.xfuncname which uses "extended" regex's for hunk header selection, 2008-09-18) the pattern got converted from "funcname" to "xfuncname".
Soon after in b19d288b4d (t4018-diff-funcname: demonstrate end of line funcname matching flaw, 2008-10-15) another test immediately preceding this one got added, using "diff.java.funcname" for its configuration.
Then f792a0b88e (t4018 (funcname patterns): make configuration easier to track, 2011-05-21) came along and codified this whole thing when converting the two tests from "git config" to "test_config".
Since this was never the intent of the test let's just remove this, the rationale in f792a0b88e for having some test for the clobbering behavior makes sense, but I'll do that in another follow-up test, not as a hard to read side-effect of this one.
--- t/t4018/custom.sh | 1 - 1 file changed, 1 deletion(-)
t/t4018/custom.sh +0 -1
@@ -51,7 +51,6 @@ public class Beer EOF_TEST test_expect_success 'custom: setup alternation in pattern' ' - git config diff.custom.funcname "Beer$" && git config diff.custom.xfuncname "^[ ]*((public|static).*)$" '
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7
PATCH v2 21/27 userdiff tests: factor out test_diff_funcname() logic
In reply to Ævar Arnfjörð BjarmasonFactor out logic in test_diff_funcname() into two helper functions, these will be useful in a follow-up commit where we'll do this munging in more than one place.
--- t/t4018-diff-funcname.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
t/t4018-diff-funcname.sh +13 -3
@@ -41,6 +41,17 @@ test_expect_success 'last regexp must not be negated' ' test_i18ngrep ": Last expression must not be negated:" msg ' +do_change_me () { + file=$1 + sed -e "s/ChangeMe/IWasChanged/" <"$file" >tmp && + mv tmp "$file" +} + +last_diff_context_line () { + file=$1 + sed -n -e "s/^.*@@$//p" -e "s/^.*@@ //p" <$file +} + test_diff_funcname () { desc=$1 cat <&8 >arg.header &&
@@ -51,13 +62,12 @@ test_diff_funcname () { cp arg.test "$what" && cp arg.header expected && git add "$what" && - sed -e "s/ChangeMe/IWasChanged/" <"$what" >tmp && - mv tmp "$what" + do_change_me "$what" ' && test_expect_success "$desc" ' git diff -U1 "$what" >diff && - sed -n -e "s/^.*@@$//p" -e "s/^.*@@ //p" <diff >actual && + last_diff_context_line diff >actual && test_cmp expected actual ' &&
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7
PATCH v2 22/27 userdiff tests: test hunk headers on accumulated files
In reply to Ævar Arnfjörð BjarmasonThe existing tests in "t/t4018/" are unrealistic in that they're all setting up small few-line isolated test cases with one thing we could match as a hunk header, right above the one change in the file.
Expand those tests by accumulating changes within the same file type in the "test_diff_funcname" function. So e.g. for "bash" we'll end up a "bash.acc" file with 15 s/ChangeMe/IWasChanged/ changes.
This stress tests whether the hunk header selection will "jump across" to an earlier change because the match for that is greedier.
As it turns out we had one false positive in "t/t4018/cpp.sh" and "t4018/matlab.sh" because of how the tests were structured, we must always give the "ChangeMe" line at least one line of separation from the header, since it was at the end of those tests we'd select the "wrong" header. Let's adjust the spacing to compensate.
So in the end we found nothing of interest here, regardless, I think it is useful to continue to test in this mode. It's likely to aid in finding bugs in combinations of our positive and negative matching as we add more built-in patterns.
--- t/t4018-diff-funcname.sh | 19 +++++++++++++++++++ t/t4018/cpp.sh | 1 + t/t4018/matlab.sh | 3 +++ 3 files changed, 23 insertions(+)
t/t4018-diff-funcname.sh +19 -0
@@ -65,12 +65,26 @@ test_diff_funcname () { do_change_me "$what" ' && + test_expect_success "setup: $desc (accumulated)" ' + cat arg.test >>arg.tests && + cp arg.tests "$what".acc && + git add "$what".acc && + do_change_me "$what".acc + ' && + test_expect_success "$desc" ' git diff -U1 "$what" >diff && last_diff_context_line diff >actual && test_cmp expected actual ' && + test_expect_success "$desc (accumulated)" ' + git diff -U1 "$what".acc >diff && + last_diff_context_line diff >actual.lines && + tail -n 1 actual.lines >actual && + test_cmp expected actual + ' && + test_expect_success "teardown: $desc" ' # In case any custom config was set immediately before # the test itself in the test file
@@ -93,6 +107,11 @@ do echo "$what" >arg.what ' && + test_expect_success "setup: hunk header for $what (accumulated)" ' + >arg.tests && + echo "$what.acc diff=$what" >>.gitattributes + ' && + . "$test" done
t/t4018/cpp.sh +1 -0
@@ -206,6 +206,7 @@ void wrong() struct RIGHT_iterator_tag {}; int ChangeMe; + EOF_TEST test_diff_funcname 'cpp: template function definition' \
t/t4018/matlab.sh +3 -0
@@ -31,6 +31,7 @@ EOF_HUNK %%% RIGHT section # this is octave script ChangeMe = 1; + EOF_TEST test_diff_funcname 'matlab: octave section 2' \
@@ -40,6 +41,7 @@ EOF_HUNK ## RIGHT section # this is octave script ChangeMe = 1; + EOF_TEST test_diff_funcname 'matlab: section' \
@@ -49,4 +51,5 @@ EOF_HUNK %% RIGHT section % this is understood by both matlab and octave ChangeMe = 1; + EOF_TEST
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7
Re: [PATCH v2 22/27] userdiff tests: test hunk headers on accumulated files
Am 15.02.21 um 16:44 schrieb Ævar Arnfjörð Bjarmason:
Quoted 8 lines
The existing tests in "t/t4018/" are unrealistic in that they're all setting up small few-line isolated test cases with one thing we could match as a hunk header, right above the one change in the file.
Expand those tests by accumulating changes within the same file type in the "
test_diff_funcname" function. So e.g. for "bash" we'll end up a "bash.acc" file with 15 s/ChangeMe/IWasChanged/ changes.
Quoted 8 lines
This stress tests whether the hunk header selection will "jump across" to an earlier change because the match for that is greedier.
As it turns out we had one false positive in "
t/t4018/cpp.sh" and "t4018/matlab.sh" because of how the tests were structured, we must always give the "ChangeMe" line at least one line of separation from the header, since it was at the end of those tests we'd select the "wrong" header. Let's adjust the spacing to compensate.
I can't wrap my head around this. The ChangeMe lines are one line away from the RIGHT lines. Why would we need a line below ChangeMe?
Or is this just a fall-out from this change itself? Then I'd appreciate to describe it as "This change now triggers false positives in... because... Let's adjust the spacing compensate.".
Quoted 90 lines
So in the end we found nothing of interest here, regardless, I think it is useful to continue to test in this mode. It's likely to aid in finding bugs in combinations of our positive and negative matching as we add more built-in patterns.
Signed-off-by Ævar Arnfjörð Bjarmason <[email protected]>--- t/t4018-diff-funcname.sh | 19 +++++++++++++++++++ t/t4018/cpp.sh | 1 + t/t4018/matlab.sh | 3 +++ 3 files changed, 23 insertions(+)t/t4018-diff-funcname.sh +19
-0@@ -65,12 +65,26 @@ test_diff_funcname () { do_change_me "$what" ' && + test_expect_success "setup: $desc (accumulated)" ' + cat arg.test >>arg.tests && + cp arg.tests "$what".acc && + git add "$what".acc && + do_change_me "$what".acc + ' && + test_expect_success "$desc" ' git diff -U1 "$what" >diff && last_diff_context_line diff >actual && test_cmp expected actual ' && + test_expect_success "$desc (accumulated)" ' + git diff -U1 "$what".acc >diff && + last_diff_context_line diff >actual.lines && + tail -n 1 actual.lines >actual && + test_cmp expected actual + ' && + test_expect_success "teardown: $desc" ' # In case any custom config was set immediately before # the test itself in the test file@@ -93,6 +107,11 @@ do echo "$what" >arg.what ' && + test_expect_success "setup: hunk header for $what (accumulated)" ' + >arg.tests && + echo "$what.acc diff=$what" >>.gitattributes + ' && + . "$test" donet/t4018/cpp.sh +1
-0@@ -206,6 +206,7 @@ void wrong() struct RIGHT_iterator_tag {}; int ChangeMe; + EOF_TEST test_diff_funcname 'cpp: template function definition' \t/t4018/matlab.sh +2
-0@@ -31,6 +31,7 @@ EOF_HUNK %%% RIGHT section # this is octave script ChangeMe = 1; + EOF_TEST test_diff_funcname 'matlab: octave section 2' \@@ -40,6 +41,7 @@ EOF_HUNK ## RIGHT section # this is octave script ChangeMe = 1; + EOF_TEST test_diff_funcname 'matlab: section' \
t/t4018/matlab.sh EOF_HUNK · line 55
Quoted 5 lines
t/t4018/matlab.sh +1
-0@@ -49,4 +51,5 @@ EOF_HUNK %% RIGHT section % this is understood by both matlab and octave ChangeMe = 1; + EOF_TEST
-- Hannes
PATCH v2 23/27 userdiff tests: test hunk header selection with -U0
In reply to Ævar Arnfjörð BjarmasonThe userdiff tests have used a custom -U1 context since f12c66b9bb (userdiff/perl: anchor "sub" and "package" patterns on the left, 2011-05-21). Changing it to -U0 doesn't change the results for any of the tests, except one.
Let's test for this case explicitly. I.e. that we go "beyond" the selected context to find our hunk header. In many cases the desired hunk header is part of the diff itself under -U1.
--- t/t4018-diff-funcname.sh | 13 +++++++++++++ t/t4018/custom.sh | 1 + 2 files changed, 14 insertions(+)
t/t4018-diff-funcname.sh +13 -0
@@ -57,6 +57,7 @@ test_diff_funcname () { cat <&8 >arg.header && cat <&9 >arg.test && what=$(cat arg.what) && + arg_diff_U0=$2 && test_expect_success "setup: $desc" ' cp arg.test "$what" &&
@@ -78,6 +79,18 @@ test_diff_funcname () { test_cmp expected actual ' && + test_expect_success "$desc -U0" ' + git diff -U0 "$what" >diff && + last_diff_context_line diff >actual && + if test -n "$arg_diff_U0" + then + echo "$arg_diff_U0" >new-expected && + test_cmp new-expected actual + else + test_cmp expected actual + fi + ' && + test_expect_success "$desc (accumulated)" ' git diff -U1 "$what".acc >diff && last_diff_context_line diff >actual.lines &&
t/t4018/custom.sh +1 -0
@@ -10,6 +10,7 @@ test_expect_success 'custom: setup non-trivial custom' ' ' test_diff_funcname 'custom: non-trivial custom pattern' \ + 'System.out.print(x + " bottles of beer on the wall "' \ 8<<\EOF_HUNK 9<<\EOF_TEST int special, RIGHT; EOF_HUNK
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7
Re: [PATCH v2 23/27] userdiff tests: test hunk header selection with -U0
Am 15.02.21 um 16:44 schrieb Ævar Arnfjörð Bjarmason:
Quoted 8 lines
The userdiff tests have used a custom -U1 context since
f12c66b9bb(userdiff/perl: anchor "sub" and "package" patterns on the left, 2011-05-21). Changing it to -U0 doesn't change the results for any of the tests, except one.Let's test for this case explicitly. I.e. that we go "beyond" the selected context to find our hunk header. In many cases the desired hunk header is part of the diff itself under -U1.
Is this intended as a sanity check of test cases? (Otherwise, I see only that we are running two diffs instead of just one against every test case, but not which problem this is solving.)
Quoted 44 lines
Signed-off-by Ævar Arnfjörð Bjarmason <[email protected]>--- t/t4018-diff-funcname.sh | 13 +++++++++++++ t/t4018/custom.sh | 1 + 2 files changed, 14 insertions(+)t/t4018-diff-funcname.sh +13
-0@@ -57,6 +57,7 @@ test_diff_funcname () { cat <&8 >arg.header && cat <&9 >arg.test && what=$(cat arg.what) && + arg_diff_U0=$2 && test_expect_success "setup: $desc" ' cp arg.test "$what" &&@@ -78,6 +79,18 @@ test_diff_funcname () { test_cmp expected actual ' && + test_expect_success "$desc -U0" ' + git diff -U0 "$what" >diff && + last_diff_context_line diff >actual && + if test -n "$arg_diff_U0" + then + echo "$arg_diff_U0" >new-expected && + test_cmp new-expected actual + else + test_cmp expected actual + fi + ' && + test_expect_success "$desc (accumulated)" ' git diff -U1 "$what".acc >diff && last_diff_context_line diff >actual.lines &&t/t4018/custom.sh +0
-0
t/t4018/custom.sh test_expect_success 'custom: setup non-trivial custom' ' · line 16
Quoted 7 lines
t/t4018/custom.sh +1
-0@@ -10,6 +10,7 @@ test_expect_success 'custom: setup non-trivial custom' ' ' test_diff_funcname 'custom: non-trivial custom pattern' \ + 'System.out.print(x + " bottles of beer on the wall "' \ 8<<\EOF_HUNK 9<<\EOF_TEST int special, RIGHT; EOF_HUNK
-- Hannes
PATCH v2 24/27 userdiff tests: assert empty hunk header context on -U<large>
In reply to Ævar Arnfjörð BjarmasonAssert the existing behavior that under -U<large> we'll show no hunk header context, where <large> takes us past the potential hunk header we'd have extracted. I'm just picking a number over nine thousand as a really large number we're unlikely to exceed in these tests.
--- t/t4018-diff-funcname.sh | 8 ++++++++ 1 file changed, 8 insertions(+)
t/t4018-diff-funcname.sh +8 -0
@@ -98,6 +98,14 @@ test_diff_funcname () { test_cmp expected actual ' && + test_expect_success "$desc -U9001 (accumulated)" ' + git diff -U9001 "$what".acc >diff && + last_diff_context_line diff >actual.lines && + tail -n 1 actual.lines >actual && + echo >blank && + test_cmp blank actual + ' && + test_expect_success "teardown: $desc" ' # In case any custom config was set immediately before # the test itself in the test file
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7
PATCH v2 25/27 userdiff: match "package" in diff=golang
In reply to Ævar Arnfjörð BjarmasonImprove the "golang" built-in pattern to match "package" lines, as they weren't matched before changing e.g. the imports would commonly result in an empty hunk header, now we'll instead show the package name.
--- t/t4018/golang.sh | 10 ++++++++++ userdiff.c | 2 ++ 2 files changed, 12 insertions(+)
t/t4018/golang.sh +10 -0
@@ -3,6 +3,16 @@ # See ../t4018-diff-funcname.sh's test_diff_funcname() # +test_diff_funcname 'golang: package' \ + 8<<\EOF_HUNK 9<<\EOF_TEST +package main +EOF_HUNK +package main + +import "fmt" +// ChangeMe +EOF_TEST + test_diff_funcname 'golang: complex function' \ 8<<\EOF_HUNK 9<<\EOF_TEST func (t *Test) RIGHT(a Type) (Type, error) {
userdiff.c +2 -0
@@ -128,6 +128,8 @@ IPATTERN("fountain",/* -- */ "[^ \t-]+"),PATTERNS ("golang" , +/* Packages */ +"^[ \t]*(package[ \t]*(.*))\n" /* Functions */ "^[ \t]*(func[ \t]*.*(\\{[ \t]*)?)\n" /* Structs and interfaces */
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7
PATCH v2 26/27 userdiff tests: add basic test for ada
In reply to Ævar Arnfjörð BjarmasonAdd test for the ada userdiff pattern added in e90d065e64 (Add userdiff patterns for Ada, 2012-09-16).
I don't know the ada language itself, I just stole a couple of examples of code that used tokens we're matching[1][2]. Both test examples stress our negative and positive matching rules.
1. https://rosettacode.org/wiki/99_bottles_of_beer#Ada
2. https://en.wikibooks.org/wiki/Ada_Programming/Tasking
--- t/t4018/ada.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 t/t4018/ada.sh
t/t4018/ada.sh new file +37 -0
@@ -0,0 +1,37 @@ +#!/bin/sh +# +# See ../t4018-diff-funcname.sh's test_diff_funcname() +# + +test_diff_funcname 'ada: "procedure" over "with"' \ + 8<<\EOF_HUNK 9<<\EOF_TEST +procedure Bottles is +EOF_HUNK +with Ada.Text_Io; use Ada.Text_Io; + procedure Bottles is + begin + for X in reverse 1..99 loop + Put_Line(Integer'Image(X) & " bottles of beer on the wall"); + Put_Line(Integer'Image(X) & " bottles of beer"); -- ChangeMe + Put_Line("Take one down, pass it around"); + Put_Line(Integer'Image(X - 1) & " bottles of beer on the wall"); + New_Line; + end loop; + end Bottles; +EOF_TEST + +test_diff_funcname 'ada: "task" over "procedure"' \ + 8<<\EOF_HUNK 9<<\EOF_TEST +task body Check_CPU is +EOF_HUNK +procedure Housekeeping is + task Check_CPU; + task Backup_Disk; + + task body Check_CPU is + -- Comment for spacing with + -- the above "task" for -U1 + ChangeMe + end Check_CPU; +end Housekeeping; +EOF_TEST
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7
PATCH v2 27/27 userdiff tests: add basic test for ruby
In reply to Ævar Arnfjörð BjarmasonAdd a test for the Ruby pattern added way back in ad8c1d9260 (diff:
add ruby funcname pattern, 2008-07-31).
The "One/Two" picking demonstrates existing behavior, and a general case where we may not do what the user expects since we're not aware of the indentation level.
The code is modified from the Ruby code we have in-tree at Documentation/asciidoctor-extensions.rb.
--- t/t4018/ruby.sh | 58 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100755 t/t4018/ruby.sh
t/t4018/ruby.sh new file +58 -0
@@ -0,0 +1,58 @@ +#!/bin/sh +# +# See ../t4018-diff-funcname.sh's test_diff_funcname() +# + +test_diff_funcname 'ruby: "def" over "class/module"' \ + 8<<\EOF_HUNK 9<<\EOF_TEST +def process(parent) +EOF_HUNK +require 'asciidoctor' + +module Git + module Documentation + class SomeClass + use_some + + def process(parent) + puts("hello") + puts(ChangeMe) + end + end + end +end +EOF_TEST + +test_diff_funcname 'ruby: "class" over "class/module"' \ + 8<<\EOF_HUNK 9<<\EOF_TEST +class Two +EOF_HUNK +module Git + module Documentation + class One + end + + class Two + # Spacing for -U1 + ChangeMe + end + end +end +EOF_TEST + +test_diff_funcname 'ruby: picks first "class/module/def" before changed context' \ + "class Two" \ + 8<<\EOF_HUNK 9<<\EOF_TEST +class One +EOF_HUNK +module Git + module Documentation + class One + end + + class Two + ChangeMe + end + end +end +EOF_TEST
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7
PATCH 1/20 userdiff: refactor away the parse_bool() function
In reply to Ævar Arnfjörð BjarmasonSince 6680a0874f (drop odd return value semantics from userdiff_config, 2012-02-07) we have not cared about the return values of parse_tristate() or git_config_bool() v.s. falling through in userdiff_config(), so let's do so in those cases to make the code easier to read.
Having a wrapper function for git_config_bool() dates back to d9bae1a178 (diff: cache textconv output, 2010-04-01) and 122aa6f9c0 (diff: introduce diff.<driver>.binary, 2008-10-05), both of which predated the change in 6680a0874f which made their return values redundant.
--- userdiff.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-)
userdiff.c +6 -12
@@ -275,19 +275,12 @@ static int parse_funcname(struct userdiff_funcname *f, const char *k,return 0 ; } -static int parse_tristate (int *b,const char *k,const char *v) +static void parse_tristate (int *b,const char *k,const char *v) {if (v && !strcasecmp (v,"auto" )) *b =-1 ;else *b =git_config_bool (k, v); -return 0 ; -} - -static int parse_bool (int *b,const char *k,const char *v) -{ - *b =git_config_bool (k, v); -return 0 ; }int userdiff_config (const char *k,const char *v)
@@ -312,16 +305,17 @@ int userdiff_config(const char *k, const char *v)return parse_funcname (&drv->funcname, k, v,0 );if (!strcmp (type,"xfuncname" ))return parse_funcname (&drv->funcname, k, v,REG_EXTENDED ); -if (!strcmp (type,"binary" )) -return parse_tristate (&drv->binary, k, v);if (!strcmp (type,"command" ))return git_config_string (&drv->external, k, v);if (!strcmp (type,"textconv" ))return git_config_string (&drv->textconv, k, v); -if (!strcmp (type,"cachetextconv" )) -return parse_bool (&drv->textconv_want_cache, k, v);if (!strcmp (type,"wordregex" ))return git_config_string (&drv->word_regex, k, v); +/* Don't care about the parse errors for these, fallthrough */ +if (!strcmp (type,"cachetextconv" )) + drv->textconv_want_cache =git_config_bool (k, v); +if (!strcmp (type,"binary" )) +parse_tristate (&drv->binary, k, v);return 0 ; }
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7
PATCH 2/20 userdiff: re-order builtin drivers in alphabetical order
In reply to Ævar Arnfjörð BjarmasonAddress some old code smell and move around the built-in userdiff definitions so they're both in alphabetical order, and now in the same order they appear in the gitattributes(5) documentation.
The two started drifting in be58e70dba (diff: unify external diff and funcname parsing code, 2008-10-05), and then even further in 80c49c3de2 (color-words: make regex configurable via attributes, 2009-01-17) when the "cpp" pattern was added.
There are no functional changes here, and as --color-moved will show only moved existing lines.
--- userdiff.c | 76 +++++++++++++++++++++++++++--------------------------- 1 file changed, 38 insertions(+), 38 deletions(-)
userdiff.c +38 -38
@@ -44,6 +44,44 @@ PATTERNS("bash",/* -- */ /* Characters not in the default $IFS value */ "[^ \t]+"), +PATTERNS ("bibtex" ,"(@[a-zA-Z]{1,}[ \t]*\\{{0,1}[ \t]*[^ \t\"@',\\#}{~%]*).*$" , +"[={}\"]|[^={}\" \t]+" ), +PATTERNS ("cpp" , +/* Jump targets or access declarations */ +"!^[ \t]*[A-Za-z_][A-Za-z_0-9]*:[[:space:]]*($|/[/*])\n" +/* functions/methods, variables, and compounds at top level */ +"^((::[[:space:]]*)?[A-Za-z_].*)$" , +/* -- */ +"[a-zA-Z_][a-zA-Z0-9_]*" +"|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lLuU]*" +"|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->\\*?|\\.\\*" ), +PATTERNS ("csharp" , +/* Keywords */ +"!^[ \t]*(do|while|for|if|else|instanceof|new|return|switch|case|throw|catch|using)\n" +/* Methods and constructors */ +"^[ \t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe|async)[ \t]+)*[][<>@.~_[:alnum:]]+[ \t]+[<>@._[:alnum:]]+[ \t]*\\(.*\\))[ \t]*$\n" +/* Properties */ +"^[ \t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe)[ \t]+)*[][<>@.~_[:alnum:]]+[ \t]+[@._[:alnum:]]+)[ \t]*$\n" +/* Type definitions */ +"^[ \t]*(((static|public|internal|private|protected|new|unsafe|sealed|abstract|partial)[ \t]+)*(class|enum|interface|struct)[ \t]+.*)$\n" +/* Namespace */ +"^[ \t]*(namespace[ \t]+.*)$" , +/* -- */ +"[a-zA-Z_][a-zA-Z0-9_]*" +"|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?" +"|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->" ), +IPATTERN ("css" , +"![:;][[:space:]]*$\n" +"^[:[@.#]?[_a-z0-9].*$" , +/* -- */ +/* +* This regex comes from W3C CSS specs. Should theoretically also +* allow ISO 10646 characters U+00A0 and higher, +* but they are not handled in this regex. +*/ +"-?[_a-zA-Z][-_a-zA-Z0-9]*" /* identifiers */ +"|-?[0-9]+|\\#[0-9a-fA-F]+" /* numbers */ +),PATTERNS ("dts" ,"!;\n" "!=\n"
@@ -191,46 +229,8 @@ PATTERNS("rust","[a-zA-Z_][a-zA-Z0-9_]*" "|[0-9][0-9_a-fA-Fiosuxz]*(\\.([0-9]*[eE][+-]?)?[0-9_fF]*)?" "|[-+*\\/<>%&^|=!:]=|<<=?|>>=?|&&|\\|\\||->|=>|\\.{2}=|\\.{3}|::"), -PATTERNS ("bibtex" ,"(@[a-zA-Z]{1,}[ \t]*\\{{0,1}[ \t]*[^ \t\"@',\\#}{~%]*).*$" , -"[={}\"]|[^={}\" \t]+" ),PATTERNS ("tex" ,"^(\\\\((sub)*section|chapter|part)\\*{0,1}\\{.*)$" ,"\\\\[a-zA-Z@]+|\\\\.|[a-zA-Z0-9\x80-\xff]+" ), -PATTERNS ("cpp" , -/* Jump targets or access declarations */ -"!^[ \t]*[A-Za-z_][A-Za-z_0-9]*:[[:space:]]*($|/[/*])\n" -/* functions/methods, variables, and compounds at top level */ -"^((::[[:space:]]*)?[A-Za-z_].*)$" , -/* -- */ -"[a-zA-Z_][a-zA-Z0-9_]*" -"|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lLuU]*" -"|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->\\*?|\\.\\*" ), -PATTERNS ("csharp" , -/* Keywords */ -"!^[ \t]*(do|while|for|if|else|instanceof|new|return|switch|case|throw|catch|using)\n" -/* Methods and constructors */ -"^[ \t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe|async)[ \t]+)*[][<>@.~_[:alnum:]]+[ \t]+[<>@._[:alnum:]]+[ \t]*\\(.*\\))[ \t]*$\n" -/* Properties */ -"^[ \t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe)[ \t]+)*[][<>@.~_[:alnum:]]+[ \t]+[@._[:alnum:]]+)[ \t]*$\n" -/* Type definitions */ -"^[ \t]*(((static|public|internal|private|protected|new|unsafe|sealed|abstract|partial)[ \t]+)*(class|enum|interface|struct)[ \t]+.*)$\n" -/* Namespace */ -"^[ \t]*(namespace[ \t]+.*)$" , -/* -- */ -"[a-zA-Z_][a-zA-Z0-9_]*" -"|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?" -"|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->" ), -IPATTERN ("css" , -"![:;][[:space:]]*$\n" -"^[:[@.#]?[_a-z0-9].*$" , -/* -- */ -/* -* This regex comes from W3C CSS specs. Should theoretically also -* allow ISO 10646 characters U+00A0 and higher, -* but they are not handled in this regex. -*/ -"-?[_a-zA-Z][-_a-zA-Z0-9]*" /* identifiers */ -"|-?[0-9]+|\\#[0-9a-fA-F]+" /* numbers */ -), { "default", NULL, -1, { NULL, 0 } }, };#undef PATTERNS
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7
PATCH 3/20 userdiff: add and use for_each_userdiff_driver()
In reply to Ævar Arnfjörð BjarmasonRefactor the userdiff_find_by_namelen() function so that a new for_each_userdiff_driver() API function does most of the work.
This will be useful for the same reason we've got other for_each_*() API functions as part of various APIs, and will be used in a follow-up commit.
--- userdiff.c | 61 +++++++++++++++++++++++++++++++++++++++++++----------- userdiff.h | 15 ++++++++++++++ 2 files changed, 64 insertions(+), 12 deletions(-)
userdiff.c +49 -12
@@ -250,20 +250,32 @@ static struct userdiff_driver driver_false = { { NULL, 0 } }; -static struct userdiff_driver *userdiff_find_by_namelen (const char *k,size_t len) +struct for_each_userdiff_driver_cb { +const char *k; +size_t len; +struct userdiff_driver *driver; +}; + +static int userdiff_find_by_namelen_cb (struct userdiff_driver *driver, +enum userdiff_driver_type type,void *priv) { -int i; -for (i =0 ; i < ndrivers; i++) { -struct userdiff_driver *drv = drivers + i; -if (!strncmp (drv->name, k, len) && !drv->name[len]) -return drv; - } -for (i =0 ; i <ARRAY_SIZE (builtin_drivers); i++) { -struct userdiff_driver *drv = builtin_drivers + i; -if (!strncmp (drv->name, k, len) && !drv->name[len]) -return drv; +struct for_each_userdiff_driver_cb *cb_data = priv; + +if (!strncmp (driver->name, cb_data->k, cb_data->len) && + !driver->name[cb_data->len]) { + cb_data->driver = driver; +return -1 ;/* found it! */ } -return NULL ; +return 0 ; +} + +static struct userdiff_driver *userdiff_find_by_namelen (const char *k,size_t len) +{ +struct for_each_userdiff_driver_cb udcbdata = { .k = k, .len = len, .driver =NULL }; + +for_each_userdiff_driver (userdiff_find_by_namelen_cb, +USERDIFF_DRIVER_TYPE_UNSPECIFIED , &udcbdata); +return udcbdata.driver; } static int parse_funcname(struct userdiff_funcname *f, const char *k,
@@ -364,3 +376,28 @@ struct userdiff_driver *userdiff_get_textconv(struct repository *r,return driver; } + +int for_each_userdiff_driver (each_userdiff_driver_fn fn, +enum userdiff_driver_type type,void *cb_data) +{ +int i, ret; +if (type & (USERDIFF_DRIVER_TYPE_UNSPECIFIED |USERDIFF_DRIVER_TYPE_CUSTOM )) { + +for (i =0 ; i < ndrivers; i++) { +struct userdiff_driver *drv = drivers + i; + ret =fn (drv,USERDIFF_DRIVER_TYPE_CUSTOM , cb_data); +if (ret) +return ret; + } + } +if (type & (USERDIFF_DRIVER_TYPE_UNSPECIFIED |USERDIFF_DRIVER_TYPE_BUILTIN )) { + +for (i =0 ; i <ARRAY_SIZE (builtin_drivers); i++) { +struct userdiff_driver *drv = builtin_drivers + i; + ret =fn (drv,USERDIFF_DRIVER_TYPE_BUILTIN , cb_data); +if (ret) +return ret; + } + } +return 0 ; +}
userdiff.h +15 -0
@@ -21,6 +21,13 @@ struct userdiff_driver {struct notes_cache *textconv_cache;int textconv_want_cache; }; +enum userdiff_driver_type { +USERDIFF_DRIVER_TYPE_UNSPECIFIED =1 <<0 , +USERDIFF_DRIVER_TYPE_BUILTIN =1 <<1 , +USERDIFF_DRIVER_TYPE_CUSTOM =1 <<2 , +}; +typedef int (*each_userdiff_driver_fn )(struct userdiff_driver *, +enum userdiff_driver_type ,void *);int userdiff_config (const char *k,const char *v);struct userdiff_driver *userdiff_find_by_name (const char *name);
@@ -34,4 +41,12 @@ struct userdiff_driver *userdiff_find_by_path(struct index_state *istate,struct userdiff_driver *userdiff_get_textconv (struct repository *r,struct userdiff_driver *driver); +/* +* Iterate over each driver of type userdiff_driver_type, or +* USERDIFF_DRIVER_TYPE_UNSPECIFIED for all of them. Return non-zero +* to exit from the loop. +*/ +int for_each_userdiff_driver (each_userdiff_driver_fn , +enum userdiff_driver_type ,void *); +#endif /* USERDIFF */
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7
PATCH 4/20 userdiff tests: explicitly test "default" pattern
In reply to Ævar Arnfjörð BjarmasonSince 122aa6f9c0 (diff: introduce diff.<driver>.binary, 2008-10-05) the internals of the userdiff.c code have understood a "default" name, which is invoked as userdiff_find_by_name("default") and present in the "builtin_drivers" struct. Let's test for this special case.
--- t/t4018-diff-funcname.sh | 1 + 1 file changed, 1 insertion(+)
t/t4018-diff-funcname.sh +1 -0
@@ -49,6 +49,7 @@ diffpatterns=" ruby rust tex + default custom1 custom2 custom3
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7
PATCH 5/20 userdiff tests: list builtin drivers via test-tool
In reply to Ævar Arnfjörð BjarmasonChange the userdiff test to list the builtin drivers via the test-tool, using the new for_each_userdiff_driver() API function.
This gets rid of the need to modify this part of the test every time a new pattern is added, see 2ff6c34612 (userdiff: support Bash, 2020-10-22) and 09dad9256a (userdiff: support Markdown, 2020-05-02) for two recent examples.
I only need the "list-builtin-drivers "argument here, but let's add "list-custom-drivers" and "list-drivers" too, just because it's easy.
--- Makefile | 1 + t/helper/test-tool.c | 1 + t/helper/test-tool.h | 1 + t/helper/test-userdiff.c | 32 ++++++++++++++++++++++++++++++++ t/t4018-diff-funcname.sh | 29 +++++------------------------ 5 files changed, 40 insertions(+), 24 deletions(-) create mode 100644 t/helper/test-userdiff.c
Makefile +1 -0
@@ -741,6 +741,7 @@ TEST_BUILTINS_OBJS += test-submodule-nested-repo-config.o TEST_BUILTINS_OBJS += test-subprocess.o TEST_BUILTINS_OBJS += test-trace2.o TEST_BUILTINS_OBJS += test-urlmatch-normalization.o +TEST_BUILTINS_OBJS += test-userdiff.o TEST_BUILTINS_OBJS += test-wildmatch.o TEST_BUILTINS_OBJS += test-windows-named-pipe.o TEST_BUILTINS_OBJS += test-write-cache.o
t/helper/test-tool.c +1 -0
@@ -71,6 +71,7 @@ static struct test_cmd cmds[] = { { "submodule-nested-repo-config", cmd__submodule_nested_repo_config }, { "subprocess", cmd__subprocess }, { "trace2", cmd__trace2 }, + { "userdiff", cmd__userdiff }, { "urlmatch-normalization", cmd__urlmatch_normalization }, { "xml-encode", cmd__xml_encode }, { "wildmatch", cmd__wildmatch },
t/helper/test-tool.h +1 -0
@@ -61,6 +61,7 @@ int cmd__submodule_config(int argc, const char **argv);int cmd__submodule_nested_repo_config (int argc,const char **argv);int cmd__subprocess (int argc,const char **argv);int cmd__trace2 (int argc,const char **argv); +int cmd__userdiff (int argc,const char **argv);int cmd__urlmatch_normalization (int argc,const char **argv);int cmd__xml_encode (int argc,const char **argv);int cmd__wildmatch (int argc,const char **argv);
t/helper/test-userdiff.c new file +32 -0
@@ -0,0 +1,32 @@ +#include "test-tool.h" +#include "cache.h" +#include "userdiff.h" + +static int userdiff_list_builtin_drivers_cb (struct userdiff_driver *driver, +enum userdiff_driver_type type, +void *priv) +{ +puts (driver->name); +return 0 ; +} + +static int list_what (enum userdiff_driver_type type) +{ +return for_each_userdiff_driver (userdiff_list_builtin_drivers_cb, type, +NULL ); +} + +int cmd__userdiff (int argc,const char **argv) +{ +if (argc !=2 ) +return 1 ; + +if (!strcmp (argv[1 ],"list-drivers" )) +return list_what (USERDIFF_DRIVER_TYPE_UNSPECIFIED ); +else if (!strcmp (argv[1 ],"list-builtin-drivers" )) +return list_what (USERDIFF_DRIVER_TYPE_BUILTIN ); +else if (!strcmp (argv[1 ],"list-custom-drivers" )) +return list_what (USERDIFF_DRIVER_TYPE_CUSTOM ); +else +return error ("unknown argument %s" , argv[1 ]); +}
t/t4018-diff-funcname.sh +5 -24
@@ -8,6 +8,10 @@ test_description='Test custom diff function name patterns' . ./test-lib.sh test_expect_success 'setup' ' + test-tool userdiff list-builtin-drivers >builtin-drivers && + test_file_not_empty builtin-drivers && + builtin_drivers=$(cat builtin-drivers) && + # a non-trivial custom pattern git config diff.custom1.funcname "!static !String
@@ -26,30 +30,7 @@ test_expect_success 'setup' ' ' diffpatterns=" - ada - bash - bibtex - cpp - csharp - css - dts - elixir - fortran - fountain - golang - html - java - markdown - matlab - objc - pascal - perl - php - python - ruby - rust - tex - default + $builtin_drivers custom1 custom2 custom3
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7
Re: [PATCH 05/20] userdiff tests: list builtin drivers via test-tool
Quoted 10 lines · Ævar Arnfjörð Bjarmason
Change the userdiff test to list the builtin drivers via the test-tool, using the new
for_each_userdiff_driver()API function. [...]
I only need the "list-builtin-drivers "argument here, but let's add "list-custom-drivers" and "list-drivers" too, just because it's easy.Signed-off-by Ævar Arnfjörð Bjarmason <[email protected]>---
t/helper/test-userdiff.c line 7
Quoted 7 lines
t/helper/test-userdiff.c +7
-0@@ -0,0 +1,32 @@ +static int userdiff_list_builtin_drivers_cb (struct userdiff_driver *driver, +enum userdiff_driver_type type, +void *priv) +{ +puts (driver->name); +return 0 ; +}
Nit: The word "builtin" in the name of this callback function made me search the patch for its cousin function which would be used for custom drivers. It was only after reading on that I discovered that this one function is used for both builtin and custom drivers. (Caught me off guard, but not itself worth a re-roll.)
t/t4018-diff-funcname.sh test_description='Test custom diff function name patterns' · line 11
Quoted 6 lines
t/t4018-diff-funcname.sh +3
-0@@ -8,6 +8,10 @@ test_description='Test custom diff function name patterns' test_expect_success 'setup' ' + test-tool userdiff list-builtin-drivers >builtin-drivers && + test_file_not_empty builtin-drivers && + builtin_drivers=$(cat builtin-drivers) &&
Nit: I get why you are using test_file_not_empty() for its diagnostic value, but it does confuse the reader a bit to see the file "builtin-drivers" created for no particularly good reason. This could easily have been:
builtin_drivers=$(test-tool userdiff list-builtin-drivers) &&
test -n "$builtin_drivers" &&Subjective and not worth a re-roll.
PATCH 6/20 userdiff: remove support for "broken" tests
In reply to Ævar Arnfjörð BjarmasonThere have been no "broken" tests since 75c3b6b2e8 (userdiff: improve Fortran xfuncname regex, 2020-08-12). Let's remove the test support for them, this is in preparation for a more general refactoring of the tests.
--- t/t4018-diff-funcname.sh | 8 +------- t/t4018/README | 3 --- 2 files changed, 1 insertion(+), 10 deletions(-)
t/t4018-diff-funcname.sh +1 -7
@@ -83,13 +83,7 @@ test_expect_success 'setup hunk header tests' ' # check each individual file for i in $(git ls-files) do - if grep broken "$i" >/dev/null 2>&1 - then - result=failure - else - result=success - fi - test_expect_$result "hunk header: $i" " + test_expect_success "hunk header: $i" " git diff -U1 $i >actual && grep '@@ .* @@.*RIGHT' actual "
t/t4018/README +0 -3
@@ -7,9 +7,6 @@ at least two lines from the line that must appear in the hunk header. The text that must appear in the hunk header must contain the word "right", but in all upper-case, like in the title above. -To mark a test case that highlights a malfunction, insert the word -BROKEN in all lower-case somewhere in the file. - This text is a bit twisted and out of order, but it is itself a test case for the default hunk header pattern. Know what you are doing if you change it.
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7
PATCH 7/20 userdiff tests: match full hunk headers
In reply to Ævar Arnfjörð BjarmasonFix a regression in the test framework for userdiff added in bfa7d01413 (t4018: an infrastructure to test hunk headers, 2014-03-21).
The testing infrastructure added in that change went overboard with simplifying the tests, to the point where we lost test coverage.
Before that we'd been able to test the full context line, or ever since the feature was originally added in f258475a6e (Per-path attribute based hunk header selection., 2007-07-06).
After bfa7d01413 all we cared about was whether "RIGHT" appeared on the line. We thus lost the information about whether or not "RIGHT" was extracted from the line for the hunk header, or the line appeared in full (or other subset of the line).
Let's bring back coverage for that by adding corresponding *.ctx files, this has the added advantage that we're doing a "test_cmp", so when we have failures it's just a non-zero exit code from "grep", we'll actually have something meaningful in the "-v" output.
As we'll see in a follow-up commit this is an intermediate step towards even better test coverage. I'm structuring these tests in such a way as to benefit from the diff.colorMove detection.
--- t/t4018-diff-funcname.sh | 7 +++--- t/t4018/README | 22 +++++++++---------- t/t4018/README.ctx | 1 + t/t4018/bash-arithmetic-function.ctx | 1 + t/t4018/bash-bashism-style-compact.ctx | 1 + t/t4018/bash-bashism-style-function.ctx | 1 + t/t4018/bash-bashism-style-whitespace.ctx | 1 + t/t4018/bash-conditional-function.ctx | 1 + t/t4018/bash-missing-parentheses.ctx | 1 + t/t4018/bash-mixed-style-compact.ctx | 1 + t/t4018/bash-mixed-style-function.ctx | 1 + t/t4018/bash-nested-functions.ctx | 1 + t/t4018/bash-other-characters.ctx | 1 + t/t4018/bash-posix-style-compact.ctx | 1 + t/t4018/bash-posix-style-function.ctx | 1 + t/t4018/bash-posix-style-whitespace.ctx | 1 + t/t4018/bash-subshell-function.ctx | 1 + t/t4018/bash-trailing-comment.ctx | 1 + t/t4018/cpp-c++-function.ctx | 1 + t/t4018/cpp-class-constructor-mem-init.ctx | 1 + t/t4018/cpp-class-constructor.ctx | 1 + t/t4018/cpp-class-definition-derived.ctx | 1 + t/t4018/cpp-class-definition.ctx | 1 + t/t4018/cpp-class-destructor.ctx | 1 + .../cpp-function-returning-global-type.ctx | 1 + t/t4018/cpp-function-returning-nested.ctx | 1 + t/t4018/cpp-function-returning-pointer.ctx | 1 + t/t4018/cpp-function-returning-reference.ctx | 1 + t/t4018/cpp-gnu-style-function.ctx | 1 + t/t4018/cpp-namespace-definition.ctx | 1 + t/t4018/cpp-operator-definition.ctx | 1 + t/t4018/cpp-skip-access-specifiers.ctx | 1 + t/t4018/cpp-skip-comment-block.ctx | 1 + t/t4018/cpp-skip-labels.ctx | 1 + t/t4018/cpp-struct-definition.ctx | 1 + t/t4018/cpp-struct-single-line.ctx | 1 + t/t4018/cpp-template-function-definition.ctx | 1 + t/t4018/cpp-union-definition.ctx | 1 + t/t4018/cpp-void-c-function.ctx | 1 + t/t4018/css-attribute-value-selector.ctx | 1 + t/t4018/[email protected] | 1 + t/t4018/css-brace-in-col-1.ctx | 1 + t/t4018/css-class-selector.ctx | 1 + t/t4018/css-colon-eol.ctx | 1 + t/t4018/css-colon-selector.ctx | 1 + t/t4018/css-common.ctx | 1 + t/t4018/css-id-selector.ctx | 1 + t/t4018/css-long-selector-list.ctx | 1 + t/t4018/css-prop-sans-indent.ctx | 1 + t/t4018/css-root-selector.ctx | 1 + t/t4018/css-short-selector-list.ctx | 1 + t/t4018/css-trailing-space.ctx | 1 + t/t4018/custom1-pattern.ctx | 1 + t/t4018/custom2-match-to-end-of-line.ctx | 1 + t/t4018/custom3-alternation-in-pattern.ctx | 1 + t/t4018/dts-labels.ctx | 1 + t/t4018/dts-node-unitless.ctx | 1 + t/t4018/dts-nodes-boolean-prop.ctx | 1 + t/t4018/dts-nodes-comment1.ctx | 1 + t/t4018/dts-nodes-comment2.ctx | 1 + t/t4018/dts-nodes-multiline-prop.ctx | 1 + t/t4018/dts-nodes.ctx | 1 + t/t4018/dts-reference.ctx | 1 + t/t4018/dts-root-comment.ctx | 1 + t/t4018/dts-root.ctx | 1 + t/t4018/elixir-do-not-pick-end.ctx | 1 + t/t4018/elixir-ex-unit-test.ctx | 1 + t/t4018/elixir-function.ctx | 1 + t/t4018/elixir-macro.ctx | 1 + t/t4018/elixir-module-func.ctx | 1 + t/t4018/elixir-module.ctx | 1 + t/t4018/elixir-nested-module.ctx | 1 + t/t4018/elixir-private-function.ctx | 1 + t/t4018/elixir-protocol-implementation.ctx | 1 + t/t4018/elixir-protocol.ctx | 1 + t/t4018/fortran-block-data.ctx | 1 + t/t4018/fortran-comment-keyword.ctx | 1 + t/t4018/fortran-comment-legacy-star.ctx | 1 + t/t4018/fortran-comment-legacy.ctx | 1 + t/t4018/fortran-comment.ctx | 1 + t/t4018/fortran-external-function.ctx | 1 + t/t4018/fortran-external-subroutine.ctx | 1 + t/t4018/fortran-module-procedure.ctx | 1 + t/t4018/fortran-module.ctx | 1 + t/t4018/fortran-program.ctx | 1 + t/t4018/fountain-scene.ctx | 1 + t/t4018/golang-complex-function.ctx | 1 + t/t4018/golang-func.ctx | 1 + t/t4018/golang-interface.ctx | 1 + t/t4018/golang-long-func.ctx | 1 + t/t4018/golang-struct.ctx | 1 + t/t4018/java-class-member-function.ctx | 1 + t/t4018/markdown-heading-indented.ctx | 1 + t/t4018/markdown-heading-non-headings.ctx | 1 + t/t4018/matlab-class-definition.ctx | 1 + t/t4018/matlab-function.ctx | 1 + t/t4018/matlab-octave-section-1.ctx | 1 + t/t4018/matlab-octave-section-2.ctx | 1 + t/t4018/matlab-section.ctx | 1 + t/t4018/perl-skip-end-of-heredoc.ctx | 1 + t/t4018/perl-skip-forward-decl.ctx | 1 + t/t4018/perl-skip-sub-in-pod.ctx | 1 + t/t4018/perl-sub-definition-kr-brace.ctx | 1 + t/t4018/perl-sub-definition.ctx | 1 + t/t4018/php-abstract-class.ctx | 1 + t/t4018/php-abstract-method.ctx | 1 + t/t4018/php-class.ctx | 1 + t/t4018/php-final-class.ctx | 1 + t/t4018/php-final-method.ctx | 1 + t/t4018/php-function.ctx | 1 + t/t4018/php-interface.ctx | 1 + t/t4018/php-method.ctx | 1 + t/t4018/php-trait.ctx | 1 + t/t4018/python-async-def.ctx | 1 + t/t4018/python-class.ctx | 1 + t/t4018/python-def.ctx | 1 + t/t4018/python-indented-async-def.ctx | 1 + t/t4018/python-indented-class.ctx | 1 + t/t4018/python-indented-def.ctx | 1 + t/t4018/rust-fn.ctx | 1 + t/t4018/rust-impl.ctx | 1 + t/t4018/rust-macro-rules.ctx | 1 + t/t4018/rust-struct.ctx | 1 + t/t4018/rust-trait.ctx | 1 + 124 files changed, 137 insertions(+), 14 deletions(-) create mode 100644 t/t4018/README.ctx create mode 100644 t/t4018/bash-arithmetic-function.ctx create mode 100644 t/t4018/bash-bashism-style-compact.ctx create mode 100644 t/t4018/bash-bashism-style-function.ctx create mode 100644 t/t4018/bash-bashism-style-whitespace.ctx create mode 100644 t/t4018/bash-conditional-function.ctx create mode 100644 t/t4018/bash-missing-parentheses.ctx create mode 100644 t/t4018/bash-mixed-style-compact.ctx create mode 100644 t/t4018/bash-mixed-style-function.ctx create mode 100644 t/t4018/bash-nested-functions.ctx create mode 100644 t/t4018/bash-other-characters.ctx create mode 100644 t/t4018/bash-posix-style-compact.ctx create mode 100644 t/t4018/bash-posix-style-function.ctx create mode 100644 t/t4018/bash-posix-style-whitespace.ctx create mode 100644 t/t4018/bash-subshell-function.ctx create mode 100644 t/t4018/bash-trailing-comment.ctx create mode 100644 t/t4018/cpp-c++-function.ctx create mode 100644 t/t4018/cpp-class-constructor-mem-init.ctx create mode 100644 t/t4018/cpp-class-constructor.ctx create mode 100644 t/t4018/cpp-class-definition-derived.ctx create mode 100644 t/t4018/cpp-class-definition.ctx create mode 100644 t/t4018/cpp-class-destructor.ctx create mode 100644 t/t4018/cpp-function-returning-global-type.ctx create mode 100644 t/t4018/cpp-function-returning-nested.ctx create mode 100644 t/t4018/cpp-function-returning-pointer.ctx create mode 100644 t/t4018/cpp-function-returning-reference.ctx create mode 100644 t/t4018/cpp-gnu-style-function.ctx create mode 100644 t/t4018/cpp-namespace-definition.ctx create mode 100644 t/t4018/cpp-operator-definition.ctx create mode 100644 t/t4018/cpp-skip-access-specifiers.ctx create mode 100644 t/t4018/cpp-skip-comment-block.ctx create mode 100644 t/t4018/cpp-skip-labels.ctx create mode 100644 t/t4018/cpp-struct-definition.ctx create mode 100644 t/t4018/cpp-struct-single-line.ctx create mode 100644 t/t4018/cpp-template-function-definition.ctx create mode 100644 t/t4018/cpp-union-definition.ctx create mode 100644 t/t4018/cpp-void-c-function.ctx create mode 100644 t/t4018/css-attribute-value-selector.ctx create mode 100644 t/t4018/[email protected] create mode 100644 t/t4018/css-brace-in-col-1.ctx create mode 100644 t/t4018/css-class-selector.ctx create mode 100644 t/t4018/css-colon-eol.ctx create mode 100644 t/t4018/css-colon-selector.ctx create mode 100644 t/t4018/css-common.ctx create mode 100644 t/t4018/css-id-selector.ctx create mode 100644 t/t4018/css-long-selector-list.ctx create mode 100644 t/t4018/css-prop-sans-indent.ctx create mode 100644 t/t4018/css-root-selector.ctx create mode 100644 t/t4018/css-short-selector-list.ctx create mode 100644 t/t4018/css-trailing-space.ctx create mode 100644 t/t4018/custom1-pattern.ctx create mode 100644 t/t4018/custom2-match-to-end-of-line.ctx create mode 100644 t/t4018/custom3-alternation-in-pattern.ctx create mode 100644 t/t4018/dts-labels.ctx create mode 100644 t/t4018/dts-node-unitless.ctx create mode 100644 t/t4018/dts-nodes-boolean-prop.ctx create mode 100644 t/t4018/dts-nodes-comment1.ctx create mode 100644 t/t4018/dts-nodes-comment2.ctx create mode 100644 t/t4018/dts-nodes-multiline-prop.ctx create mode 100644 t/t4018/dts-nodes.ctx create mode 100644 t/t4018/dts-reference.ctx create mode 100644 t/t4018/dts-root-comment.ctx create mode 100644 t/t4018/dts-root.ctx create mode 100644 t/t4018/elixir-do-not-pick-end.ctx create mode 100644 t/t4018/elixir-ex-unit-test.ctx create mode 100644 t/t4018/elixir-function.ctx create mode 100644 t/t4018/elixir-macro.ctx create mode 100644 t/t4018/elixir-module-func.ctx create mode 100644 t/t4018/elixir-module.ctx create mode 100644 t/t4018/elixir-nested-module.ctx create mode 100644 t/t4018/elixir-private-function.ctx create mode 100644 t/t4018/elixir-protocol-implementation.ctx create mode 100644 t/t4018/elixir-protocol.ctx create mode 100644 t/t4018/fortran-block-data.ctx create mode 100644 t/t4018/fortran-comment-keyword.ctx create mode 100644 t/t4018/fortran-comment-legacy-star.ctx create mode 100644 t/t4018/fortran-comment-legacy.ctx create mode 100644 t/t4018/fortran-comment.ctx create mode 100644 t/t4018/fortran-external-function.ctx create mode 100644 t/t4018/fortran-external-subroutine.ctx create mode 100644 t/t4018/fortran-module-procedure.ctx create mode 100644 t/t4018/fortran-module.ctx create mode 100644 t/t4018/fortran-program.ctx create mode 100644 t/t4018/fountain-scene.ctx create mode 100644 t/t4018/golang-complex-function.ctx create mode 100644 t/t4018/golang-func.ctx create mode 100644 t/t4018/golang-interface.ctx create mode 100644 t/t4018/golang-long-func.ctx create mode 100644 t/t4018/golang-struct.ctx create mode 100644 t/t4018/java-class-member-function.ctx create mode 100644 t/t4018/markdown-heading-indented.ctx create mode 100644 t/t4018/markdown-heading-non-headings.ctx create mode 100644 t/t4018/matlab-class-definition.ctx create mode 100644 t/t4018/matlab-function.ctx create mode 100644 t/t4018/matlab-octave-section-1.ctx create mode 100644 t/t4018/matlab-octave-section-2.ctx create mode 100644 t/t4018/matlab-section.ctx create mode 100644 t/t4018/perl-skip-end-of-heredoc.ctx create mode 100644 t/t4018/perl-skip-forward-decl.ctx create mode 100644 t/t4018/perl-skip-sub-in-pod.ctx create mode 100644 t/t4018/perl-sub-definition-kr-brace.ctx create mode 100644 t/t4018/perl-sub-definition.ctx create mode 100644 t/t4018/php-abstract-class.ctx create mode 100644 t/t4018/php-abstract-method.ctx create mode 100644 t/t4018/php-class.ctx create mode 100644 t/t4018/php-final-class.ctx create mode 100644 t/t4018/php-final-method.ctx create mode 100644 t/t4018/php-function.ctx create mode 100644 t/t4018/php-interface.ctx create mode 100644 t/t4018/php-method.ctx create mode 100644 t/t4018/php-trait.ctx create mode 100644 t/t4018/python-async-def.ctx create mode 100644 t/t4018/python-class.ctx create mode 100644 t/t4018/python-def.ctx create mode 100644 t/t4018/python-indented-async-def.ctx create mode 100644 t/t4018/python-indented-class.ctx create mode 100644 t/t4018/python-indented-def.ctx create mode 100644 t/t4018/rust-fn.ctx create mode 100644 t/t4018/rust-impl.ctx create mode 100644 t/t4018/rust-macro-rules.ctx create mode 100644 t/t4018/rust-struct.ctx create mode 100644 t/t4018/rust-trait.ctx
t/t4018-diff-funcname.sh +4 -3
@@ -81,11 +81,12 @@ test_expect_success 'setup hunk header tests' ' ' # check each individual file -for i in $(git ls-files) +for i in $(git ls-files -- ':!*.ctx') do test_expect_success "hunk header: $i" " - git diff -U1 $i >actual && - grep '@@ .* @@.*RIGHT' actual + git diff -U1 $i >diff && + sed -n -e 's/^.*@@\( \|$\)//p' <diff >ctx && + test_cmp $i.ctx ctx " done
t/t4018/README +11 -11
@@ -1,15 +1,15 @@ -How to write RIGHT test cases -============================= +How to write test cases +======================= + +Create test cases called "LANG-whatever" in this directory, where +"LANG" is e.g. the userdiff driver name, where "whatever" is a brief +description of the test. Insert the word "ChangeMe" (exactly this form) at a distance of at least two lines from the line that must appear in the hunk header. -The text that must appear in the hunk header must contain the word -"right", but in all upper-case, like in the title above. - -This text is a bit twisted and out of order, but it is itself a -test case for the default hunk header pattern. Know what you are doing -if you change it. - -BTW, this tests that the head line goes to the hunk header, not the line -of equal signs. +The text that must appear in the hunk header must contains the word +"RIGHT" by convention. The "LANG-whatever.ctx" file contains what we +expect to appear in the hunk header. We munged the start of the line +to "@@ [...] @@" for ease of not having to hardcode the line numbers +and offsets.
t/t4018/README.ctx new file +1 -0
@@ -0,0 +1 @@ +description of the test.
t/t4018/bash-arithmetic-function.ctx new file +1 -0
@@ -0,0 +1 @@ +RIGHT()
t/t4018/bash-bashism-style-compact.ctx new file +1 -0
@@ -0,0 +1 @@ +function RIGHT {
t/t4018/bash-bashism-style-function.ctx new file +1 -0
@@ -0,0 +1 @@ +function RIGHT {
t/t4018/bash-bashism-style-whitespace.ctx new file +1 -0
@@ -0,0 +1 @@ +function RIGHT ( ) {
t/t4018/bash-conditional-function.ctx new file +1 -0
@@ -0,0 +1 @@ +RIGHT()
t/t4018/bash-missing-parentheses.ctx new file +1 -0
@@ -0,0 +1 @@ +function RIGHT {
t/t4018/bash-mixed-style-compact.ctx new file +1 -0
@@ -0,0 +1 @@ +function RIGHT(){
t/t4018/bash-mixed-style-function.ctx new file +1 -0
@@ -0,0 +1 @@ +function RIGHT() {
t/t4018/bash-nested-functions.ctx new file +1 -0
@@ -0,0 +1 @@ +RIGHT()
t/t4018/bash-other-characters.ctx new file +1 -0
@@ -0,0 +1 @@ +_RIGHT_0n()
t/t4018/bash-posix-style-compact.ctx new file +1 -0
@@ -0,0 +1 @@ +RIGHT()
t/t4018/bash-posix-style-function.ctx new file +1 -0
@@ -0,0 +1 @@ +RIGHT()
t/t4018/bash-posix-style-whitespace.ctx new file +1 -0
@@ -0,0 +1 @@ +RIGHT ( )
t/t4018/bash-subshell-function.ctx new file +1 -0
@@ -0,0 +1 @@ +RIGHT()
t/t4018/bash-trailing-comment.ctx new file +1 -0
@@ -0,0 +1 @@ +RIGHT()
t/t4018/cpp-c++-function.ctx new file +1 -0
@@ -0,0 +1 @@ +Item RIGHT::DoSomething( Args with_spaces )
t/t4018/cpp-class-constructor-mem-init.ctx new file +1 -0
@@ -0,0 +1 @@ +Item::Item(int RIGHT) :
t/t4018/cpp-class-constructor.ctx new file +1 -0
@@ -0,0 +1 @@ +Item::Item(int RIGHT)
t/t4018/cpp-class-definition-derived.ctx new file +1 -0
@@ -0,0 +1 @@ +class RIGHT :
t/t4018/cpp-class-definition.ctx new file +1 -0
@@ -0,0 +1 @@ +class RIGHT
t/t4018/cpp-class-destructor.ctx new file +1 -0
@@ -0,0 +1 @@ +RIGHT::~RIGHT()
t/t4018/cpp-function-returning-global-type.ctx new file +1 -0
@@ -0,0 +1 @@ +::Item get::it::RIGHT()
t/t4018/cpp-function-returning-nested.ctx new file +1 -0
@@ -0,0 +1 @@ +get::Item get::it::RIGHT()
t/t4018/cpp-function-returning-pointer.ctx new file +1 -0
@@ -0,0 +1 @@ +const char *get_it_RIGHT(char *ptr)
t/t4018/cpp-function-returning-reference.ctx new file +1 -0
@@ -0,0 +1 @@ +string& get::it::RIGHT(char *ptr)
t/t4018/cpp-gnu-style-function.ctx new file +1 -0
@@ -0,0 +1 @@ +RIGHT(int arg)
t/t4018/cpp-namespace-definition.ctx new file +1 -0
@@ -0,0 +1 @@ +namespace RIGHT
t/t4018/cpp-operator-definition.ctx new file +1 -0
@@ -0,0 +1 @@ +Value operator+(Value LEFT, Value RIGHT)
t/t4018/cpp-skip-access-specifiers.ctx new file +1 -0
@@ -0,0 +1 @@ +class RIGHT : public Baseclass
t/t4018/cpp-skip-comment-block.ctx new file +1 -0
@@ -0,0 +1 @@ +struct item RIGHT(int i)
t/t4018/cpp-skip-labels.ctx new file +1 -0
@@ -0,0 +1 @@ +void RIGHT (void)
t/t4018/cpp-struct-definition.ctx new file +1 -0
@@ -0,0 +1 @@ +struct RIGHT {
t/t4018/cpp-struct-single-line.ctx new file +1 -0
@@ -0,0 +1 @@ +struct RIGHT_iterator_tag {};
t/t4018/cpp-template-function-definition.ctx new file +1 -0
@@ -0,0 +1 @@ +template<class T> int RIGHT(T arg)
t/t4018/cpp-union-definition.ctx new file +1 -0
@@ -0,0 +1 @@ +union RIGHT {
t/t4018/cpp-void-c-function.ctx new file +1 -0
@@ -0,0 +1 @@ +void RIGHT (void)
t/t4018/css-attribute-value-selector.ctx new file +1 -0
@@ -0,0 +1 @@ +[class*="RIGHT"] {
t/t4018/[email protected] new file +1 -0
@@ -0,0 +1 @@ +@keyframes RIGHT {
t/t4018/css-brace-in-col-1.ctx new file +1 -0
@@ -0,0 +1 @@ +RIGHT label.control-label
t/t4018/css-class-selector.ctx new file +1 -0
@@ -0,0 +1 @@ +.RIGHT {
t/t4018/css-colon-eol.ctx new file +1 -0
@@ -0,0 +1 @@ +RIGHT h1 {
t/t4018/css-colon-selector.ctx new file +1 -0
@@ -0,0 +1 @@ +RIGHT a:hover {
t/t4018/css-common.ctx new file +1 -0
@@ -0,0 +1 @@ +RIGHT label.control-label {
t/t4018/css-id-selector.ctx new file +1 -0
@@ -0,0 +1 @@ +#RIGHT {
t/t4018/css-long-selector-list.ctx new file +1 -0
@@ -0,0 +1 @@ +div ul#RIGHT {
t/t4018/css-prop-sans-indent.ctx new file +1 -0
@@ -0,0 +1 @@ +RIGHT, label.control-label {
t/t4018/css-root-selector.ctx new file +1 -0
@@ -0,0 +1 @@ +:RIGHT {
t/t4018/css-short-selector-list.ctx new file +1 -0
@@ -0,0 +1 @@ +label.control, div ul#RIGHT {
t/t4018/css-trailing-space.ctx new file +1 -0
@@ -0,0 +1 @@ +RIGHT label.control-label {
t/t4018/custom1-pattern.ctx new file +1 -0
@@ -0,0 +1 @@ +int special, RIGHT;
t/t4018/custom2-match-to-end-of-line.ctx new file +1 -0
@@ -0,0 +1 @@ +RIGHT_Beer
t/t4018/custom3-alternation-in-pattern.ctx new file +1 -0
@@ -0,0 +1 @@ +public static void main(String RIGHT[])
t/t4018/dts-labels.ctx new file +1 -0
@@ -0,0 +1 @@ +label2: RIGHT {
t/t4018/dts-node-unitless.ctx new file +1 -0
@@ -0,0 +1 @@ +RIGHT {
t/t4018/dts-nodes-boolean-prop.ctx new file +1 -0
@@ -0,0 +1 @@ +RIGHT@deadf00,4000 {
t/t4018/dts-nodes-comment1.ctx new file +1 -0
@@ -0,0 +1 @@ +RIGHT@deadf00,4000 /* &a comment */ {
t/t4018/dts-nodes-comment2.ctx new file +1 -0
@@ -0,0 +1 @@ +RIGHT@deadf00,4000 { /* a trailing comment */
t/t4018/dts-nodes-multiline-prop.ctx new file +1 -0
@@ -0,0 +1 @@ +RIGHT@deadf00,4000 {
t/t4018/dts-nodes.ctx new file +1 -0
@@ -0,0 +1 @@ +RIGHT@deadf00,4000 {
t/t4018/dts-reference.ctx new file +1 -0
@@ -0,0 +1 @@ +&RIGHT {
t/t4018/dts-root-comment.ctx new file +1 -0
@@ -0,0 +1 @@ +/ { RIGHT /* Technically just supposed to be a slash and brace */
t/t4018/dts-root.ctx new file +1 -0
@@ -0,0 +1 @@ +/ { RIGHT /* Technically just supposed to be a slash and brace */
t/t4018/elixir-do-not-pick-end.ctx new file +1 -0
@@ -0,0 +1 @@ +defmodule RIGHT do
t/t4018/elixir-ex-unit-test.ctx new file +1 -0
@@ -0,0 +1 @@ +test "RIGHT" do
t/t4018/elixir-function.ctx new file +1 -0
@@ -0,0 +1 @@ +def function(RIGHT, arg) do
t/t4018/elixir-macro.ctx new file +1 -0
@@ -0,0 +1 @@ +defmacro foo(RIGHT) do
t/t4018/elixir-module-func.ctx new file +1 -0
@@ -0,0 +1 @@ +def fun(RIGHT) do
t/t4018/elixir-module.ctx new file +1 -0
@@ -0,0 +1 @@ +defmodule RIGHT do
t/t4018/elixir-nested-module.ctx new file +1 -0
@@ -0,0 +1 @@ +defmodule MyApp.RIGHT do
t/t4018/elixir-private-function.ctx new file +1 -0
@@ -0,0 +1 @@ +defp function(RIGHT, arg) do
t/t4018/elixir-protocol-implementation.ctx new file +1 -0
@@ -0,0 +1 @@ +defimpl RIGHT do
t/t4018/elixir-protocol.ctx new file +1 -0
@@ -0,0 +1 @@ +defprotocol RIGHT do
t/t4018/fortran-block-data.ctx new file +1 -0
@@ -0,0 +1 @@ +BLOCK DATA RIGHT
t/t4018/fortran-comment-keyword.ctx new file +1 -0
@@ -0,0 +1 @@ +subroutine RIGHT (funcA, funcB)
t/t4018/fortran-comment-legacy-star.ctx new file +1 -0
@@ -0,0 +1 @@ +subroutine RIGHT
t/t4018/fortran-comment-legacy.ctx new file +1 -0
@@ -0,0 +1 @@ +subroutine RIGHT
t/t4018/fortran-comment.ctx new file +1 -0
@@ -0,0 +1 @@ +subroutine RIGHT
t/t4018/fortran-external-function.ctx new file +1 -0
@@ -0,0 +1 @@ +function RIGHT(a, b) result(c)
t/t4018/fortran-external-subroutine.ctx new file +1 -0
@@ -0,0 +1 @@ +subroutine RIGHT
t/t4018/fortran-module-procedure.ctx new file +1 -0
@@ -0,0 +1 @@ +module RIGHT
t/t4018/fortran-module.ctx new file +1 -0
@@ -0,0 +1 @@ +module RIGHT
t/t4018/fortran-program.ctx new file +1 -0
@@ -0,0 +1 @@ +program RIGHT
t/t4018/fountain-scene.ctx new file +1 -0
@@ -0,0 +1 @@ +EXT. STREET RIGHT OUTSIDE - DAY
t/t4018/golang-complex-function.ctx new file +1 -0
@@ -0,0 +1 @@ +func (t *Test) RIGHT(a Type) (Type, error) {
t/t4018/golang-func.ctx new file +1 -0
@@ -0,0 +1 @@ +func RIGHT() {
t/t4018/golang-interface.ctx new file +1 -0
@@ -0,0 +1 @@ +type RIGHT interface {
t/t4018/golang-long-func.ctx new file +1 -0
@@ -0,0 +1 @@ +func RIGHT(aVeryVeryVeryLongVariableName AVeryVeryVeryLongType,
t/t4018/golang-struct.ctx new file +1 -0
@@ -0,0 +1 @@ +type RIGHT struct {
t/t4018/java-class-member-function.ctx new file +1 -0
@@ -0,0 +1 @@ +public static void main(String RIGHT[])
t/t4018/markdown-heading-indented.ctx new file +1 -0
@@ -0,0 +1 @@ + ### RIGHT
t/t4018/markdown-heading-non-headings.ctx new file +1 -0
@@ -0,0 +1 @@ +# RIGHT
t/t4018/matlab-class-definition.ctx new file +1 -0
@@ -0,0 +1 @@ +classdef RIGHT
t/t4018/matlab-function.ctx new file +1 -0
@@ -0,0 +1 @@ +function y = RIGHT()
t/t4018/matlab-octave-section-1.ctx new file +1 -0
@@ -0,0 +1 @@ +%%% RIGHT section
t/t4018/matlab-octave-section-2.ctx new file +1 -0
@@ -0,0 +1 @@ +## RIGHT section
t/t4018/matlab-section.ctx new file +1 -0
@@ -0,0 +1 @@ +%% RIGHT section
t/t4018/perl-skip-end-of-heredoc.ctx new file +1 -0
@@ -0,0 +1 @@ +sub RIGHTwithheredocument {
t/t4018/perl-skip-forward-decl.ctx new file +1 -0
@@ -0,0 +1 @@ +package RIGHT;
t/t4018/perl-skip-sub-in-pod.ctx new file +1 -0
@@ -0,0 +1 @@ +=head1 SYNOPSIS_RIGHT
t/t4018/perl-sub-definition-kr-brace.ctx new file +1 -0
@@ -0,0 +1 @@ +sub RIGHT
t/t4018/perl-sub-definition.ctx new file +1 -0
@@ -0,0 +1 @@ +sub RIGHT {
t/t4018/php-abstract-class.ctx new file +1 -0
@@ -0,0 +1 @@ +abstract class RIGHT
t/t4018/php-abstract-method.ctx new file +1 -0
@@ -0,0 +1 @@ +abstract public function RIGHT(): ?string
t/t4018/php-class.ctx new file +1 -0
@@ -0,0 +1 @@ +class RIGHT
t/t4018/php-final-class.ctx new file +1 -0
@@ -0,0 +1 @@ +final class RIGHT
t/t4018/php-final-method.ctx new file +1 -0
@@ -0,0 +1 @@ +final public function RIGHT(): string
t/t4018/php-function.ctx new file +1 -0
@@ -0,0 +1 @@ +function RIGHT()
t/t4018/php-interface.ctx new file +1 -0
@@ -0,0 +1 @@ +interface RIGHT
t/t4018/php-method.ctx new file +1 -0
@@ -0,0 +1 @@ +public static function RIGHT()
t/t4018/php-trait.ctx new file +1 -0
@@ -0,0 +1 @@ +trait RIGHT
t/t4018/python-async-def.ctx new file +1 -0
@@ -0,0 +1 @@ +async def RIGHT(pi: int = 3.14):
t/t4018/python-class.ctx new file +1 -0
@@ -0,0 +1 @@ +class RIGHT(int, str):
t/t4018/python-def.ctx new file +1 -0
@@ -0,0 +1 @@ +def RIGHT(pi: int = 3.14):
t/t4018/python-indented-async-def.ctx new file +1 -0
@@ -0,0 +1 @@ +async def RIGHT(self, x: int):
t/t4018/python-indented-class.ctx new file +1 -0
@@ -0,0 +1 @@ +class RIGHT:
t/t4018/python-indented-def.ctx new file +1 -0
@@ -0,0 +1 @@ +def RIGHT(self, x: int):
t/t4018/rust-fn.ctx new file +1 -0
@@ -0,0 +1 @@ +pub(self) fn RIGHT<T>(x: &[T]) where T: Debug {
t/t4018/rust-impl.ctx new file +1 -0
@@ -0,0 +1 @@ +impl<'a, T: AsRef<[u8]>> std::RIGHT for Git<'a> {
t/t4018/rust-macro-rules.ctx new file +1 -0
@@ -0,0 +1 @@ +macro_rules! RIGHT {
t/t4018/rust-struct.ctx new file +1 -0
@@ -0,0 +1 @@ +pub(super) struct RIGHT<'a> {
t/t4018/rust-trait.ctx new file +1 -0
@@ -0,0 +1 @@ +unsafe trait RIGHT<T> {
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7
Re: [PATCH 07/20] userdiff tests: match full hunk headers
Quoted 10 lines · Ævar Arnfjörð Bjarmason
[...]
Let's bring back coverage for that by adding corresponding *.ctx files, this has the added advantage that we're doing a "test_cmp", so when we have failures it's just a non-zero exit code from "grep", we'll actually have something meaningful in the "-v" output.[...]Signed-off-by Ævar Arnfjörð Bjarmason <[email protected]>---
t/t4018-diff-funcname.sh test_expect_success 'setup hunk header tests' ' · line 88
Quoted 8 lines
t/t4018-diff-funcname.sh +4
-0@@ -81,11 +81,12 @@ test_expect_success 'setup hunk header tests' ' +for i in $(git ls-files -- ':!*.ctx') do test_expect_success "hunk header: $i" " + git diff -U1 $i >diff && + sed -n -e 's/^.*@@\( \|$\)//p' <diff >ctx && + test_cmp $i.ctx ctx " done
If I'm reading this correctly, you're simply stripping off all the leading @@ blah @@ stuff...
t/t4018/README line 5
Quoted 7 lines
t/t4018/README +5
-0@@ -1,15 +1,15 @@ +The text that must appear in the hunk header must contains the word +"RIGHT" by convention. The "LANG-whatever.ctx" file contains what we +expect to appear in the hunk header. We munged the start of the line +to "@@ [...] @@" for ease of not having to hardcode the line numbers +and offsets.
...which makes me wonder what this "munging to @@ [...] @@" is about.
Is this documentation update wrong or am I misunderstanding?
PATCH 8/20 userdiff tests: rewrite hunk header test infrastructure
In reply to Ævar Arnfjörð BjarmasonRewrite the hunk header test infrastructure introduced in bfa7d01413 (t4018: an infrastructure to test hunk headers, 2014-03-21). See c228a5c077 (Merge branch 'js/userdiff-cc', 2014-03-31) for the whole series that commit was part of.
As noted in an earlier commit that change introduced the regression of not testing for the full hunk line, but just whether "RIGHT" appeared on it[1]. A preceding commit fixed that specific issue, but we were still left with the inflexibility of the approach described in the now-deleted t/t4018/README.
I.e. to add any sort of new tests that used the existing test data we'd either need to add more files like the recently added (but now deleted) *.ctx) files, using the filesystem as our test datastructure, or introduce more parsing for the custom file format we were growing here.
Let's instead just move this over to using a custom test function. This makes it trivial to add new tests by adding new optional parameters to the function. Let's still keep the relevant files in the "t/t4018/" subdirectory instead of adding ~1.5k lines (and growing) to "t/t4018-diff-funcname.sh"
If this diff is viewed with "--color-moved=plain" we can see that there's no changes to the lines being moved into the new *.sh files, i.e. all the deletions are moves. I'm just adding boilerplate around those existing lines.
The one-off refactoring was performed by an ad-hoc shellscript [2].
1. https://lore.kernel.org/git/[email protected]/
2.
#!/bin/sh set -ex git rm README* for t in $(git ls-files ':!*.ctx') do lang=$(echo $t | sed 's/-.*//') desc=$(echo $t | sed -E 's/^[^-]*-//' | tr - " ") if ! test -e $lang.sh then cat >$lang.sh <<-EOF #!/bin/sh # # See ../t4018-diff-funcname.sh's test_diff_funcname() # EOF else echo >>$lang.sh fi ( printf "test_diff_funcname '%s: %s' \\" "$lang" "$desc" echo printf "\t8<<%sEOF_HUNK 9<<%sEOF_TEST\n" '\' '\' cat $t.ctx printf "EOF_HUNK\n" cat $t printf "EOF_TEST\n" ) >>$lang.sh chmod +x $lang.sh git add $lang.sh git rm $t $t.ctx done
--- t/t4018-diff-funcname.sh | 59 +++-- t/t4018/README | 15 -- t/t4018/README.ctx | 1 - t/t4018/bash-arithmetic-function | 4 - t/t4018/bash-arithmetic-function.ctx | 1 - t/t4018/bash-bashism-style-compact | 6 - t/t4018/bash-bashism-style-compact.ctx | 1 - t/t4018/bash-bashism-style-function | 4 - t/t4018/bash-bashism-style-function.ctx | 1 - t/t4018/bash-bashism-style-whitespace | 4 - t/t4018/bash-bashism-style-whitespace.ctx | 1 - t/t4018/bash-conditional-function | 4 - t/t4018/bash-conditional-function.ctx | 1 - t/t4018/bash-missing-parentheses | 6 - t/t4018/bash-missing-parentheses.ctx | 1 - t/t4018/bash-mixed-style-compact | 4 - t/t4018/bash-mixed-style-compact.ctx | 1 - t/t4018/bash-mixed-style-function | 4 - t/t4018/bash-mixed-style-function.ctx | 1 - t/t4018/bash-nested-functions | 6 - t/t4018/bash-nested-functions.ctx | 1 - t/t4018/bash-other-characters | 4 - t/t4018/bash-other-characters.ctx | 1 - t/t4018/bash-posix-style-compact | 4 - t/t4018/bash-posix-style-compact.ctx | 1 - t/t4018/bash-posix-style-function | 4 - t/t4018/bash-posix-style-function.ctx | 1 - t/t4018/bash-posix-style-whitespace | 4 - t/t4018/bash-posix-style-whitespace.ctx | 1 - t/t4018/bash-subshell-function | 4 - t/t4018/bash-subshell-function.ctx | 1 - t/t4018/bash-trailing-comment | 4 - t/t4018/bash-trailing-comment.ctx | 1 - t/t4018/bash.sh | 160 ++++++++++++ t/t4018/cpp-c++-function | 4 - t/t4018/cpp-c++-function.ctx | 1 - t/t4018/cpp-class-constructor | 4 - t/t4018/cpp-class-constructor-mem-init | 5 - t/t4018/cpp-class-constructor-mem-init.ctx | 1 - t/t4018/cpp-class-constructor.ctx | 1 - t/t4018/cpp-class-definition | 4 - t/t4018/cpp-class-definition-derived | 5 - t/t4018/cpp-class-definition-derived.ctx | 1 - t/t4018/cpp-class-definition.ctx | 1 - t/t4018/cpp-class-destructor | 4 - t/t4018/cpp-class-destructor.ctx | 1 - t/t4018/cpp-function-returning-global-type | 4 - .../cpp-function-returning-global-type.ctx | 1 - t/t4018/cpp-function-returning-nested | 5 - t/t4018/cpp-function-returning-nested.ctx | 1 - t/t4018/cpp-function-returning-pointer | 4 - t/t4018/cpp-function-returning-pointer.ctx | 1 - t/t4018/cpp-function-returning-reference | 4 - t/t4018/cpp-function-returning-reference.ctx | 1 - t/t4018/cpp-gnu-style-function | 5 - t/t4018/cpp-gnu-style-function.ctx | 1 - t/t4018/cpp-namespace-definition | 4 - t/t4018/cpp-namespace-definition.ctx | 1 - t/t4018/cpp-operator-definition | 4 - t/t4018/cpp-operator-definition.ctx | 1 - t/t4018/cpp-skip-access-specifiers | 8 - t/t4018/cpp-skip-access-specifiers.ctx | 1 - t/t4018/cpp-skip-comment-block | 9 - t/t4018/cpp-skip-comment-block.ctx | 1 - t/t4018/cpp-skip-labels | 8 - t/t4018/cpp-skip-labels.ctx | 1 - t/t4018/cpp-struct-definition | 9 - t/t4018/cpp-struct-definition.ctx | 1 - t/t4018/cpp-struct-single-line | 7 - t/t4018/cpp-struct-single-line.ctx | 1 - t/t4018/cpp-template-function-definition | 4 - t/t4018/cpp-template-function-definition.ctx | 1 - t/t4018/cpp-union-definition | 4 - t/t4018/cpp-union-definition.ctx | 1 - t/t4018/cpp-void-c-function | 4 - t/t4018/cpp-void-c-function.ctx | 1 - t/t4018/cpp.sh | 239 ++++++++++++++++++ t/t4018/css-attribute-value-selector | 4 - t/t4018/css-attribute-value-selector.ctx | 1 - t/t4018/css-block-level-@-statements | 10 - t/t4018/[email protected] | 1 - t/t4018/css-brace-in-col-1 | 5 - t/t4018/css-brace-in-col-1.ctx | 1 - t/t4018/css-class-selector | 4 - t/t4018/css-class-selector.ctx | 1 - t/t4018/css-colon-eol | 4 - t/t4018/css-colon-eol.ctx | 1 - t/t4018/css-colon-selector | 5 - t/t4018/css-colon-selector.ctx | 1 - t/t4018/css-common | 4 - t/t4018/css-common.ctx | 1 - t/t4018/css-id-selector | 4 - t/t4018/css-id-selector.ctx | 1 - t/t4018/css-long-selector-list | 6 - t/t4018/css-long-selector-list.ctx | 1 - t/t4018/css-prop-sans-indent | 5 - t/t4018/css-prop-sans-indent.ctx | 1 - t/t4018/css-root-selector | 4 - t/t4018/css-root-selector.ctx | 1 - t/t4018/css-short-selector-list | 4 - t/t4018/css-short-selector-list.ctx | 1 - t/t4018/css-trailing-space | 5 - t/t4018/css-trailing-space.ctx | 1 - t/t4018/css.sh | 146 +++++++++++ t/t4018/custom1-pattern.ctx | 1 - t/t4018/{custom1-pattern => custom1.sh} | 10 + t/t4018/custom2-match-to-end-of-line | 8 - t/t4018/custom2-match-to-end-of-line.ctx | 1 - t/t4018/custom2.sh | 18 ++ t/t4018/custom3-alternation-in-pattern.ctx | 1 - ...tom3-alternation-in-pattern => custom3.sh} | 10 + t/t4018/dts-labels | 9 - t/t4018/dts-labels.ctx | 1 - t/t4018/dts-node-unitless | 8 - t/t4018/dts-node-unitless.ctx | 1 - t/t4018/dts-nodes | 8 - t/t4018/dts-nodes-boolean-prop | 9 - t/t4018/dts-nodes-boolean-prop.ctx | 1 - t/t4018/dts-nodes-comment1 | 8 - t/t4018/dts-nodes-comment1.ctx | 1 - t/t4018/dts-nodes-comment2 | 8 - t/t4018/dts-nodes-comment2.ctx | 1 - t/t4018/dts-nodes-multiline-prop | 13 - t/t4018/dts-nodes-multiline-prop.ctx | 1 - t/t4018/dts-nodes.ctx | 1 - t/t4018/dts-reference | 9 - t/t4018/dts-reference.ctx | 1 - t/t4018/dts-root | 5 - t/t4018/dts-root-comment | 8 - t/t4018/dts-root-comment.ctx | 1 - t/t4018/dts-root.ctx | 1 - t/t4018/dts.sh | 149 +++++++++++ t/t4018/elixir-do-not-pick-end | 5 - t/t4018/elixir-do-not-pick-end.ctx | 1 - t/t4018/elixir-ex-unit-test | 6 - t/t4018/elixir-ex-unit-test.ctx | 1 - t/t4018/elixir-function | 5 - t/t4018/elixir-function.ctx | 1 - t/t4018/elixir-macro | 5 - t/t4018/elixir-macro.ctx | 1 - t/t4018/elixir-module | 9 - t/t4018/elixir-module-func | 8 - t/t4018/elixir-module-func.ctx | 1 - t/t4018/elixir-module.ctx | 1 - t/t4018/elixir-nested-module | 9 - t/t4018/elixir-nested-module.ctx | 1 - t/t4018/elixir-private-function | 5 - t/t4018/elixir-private-function.ctx | 1 - t/t4018/elixir-protocol | 6 - t/t4018/elixir-protocol-implementation | 5 - t/t4018/elixir-protocol-implementation.ctx | 1 - t/t4018/elixir-protocol.ctx | 1 - t/t4018/elixir.sh | 127 ++++++++++ t/t4018/fortran-block-data | 5 - t/t4018/fortran-block-data.ctx | 1 - t/t4018/fortran-comment | 13 - t/t4018/fortran-comment-keyword | 14 - t/t4018/fortran-comment-keyword.ctx | 1 - t/t4018/fortran-comment-legacy | 13 - t/t4018/fortran-comment-legacy-star | 13 - t/t4018/fortran-comment-legacy-star.ctx | 1 - t/t4018/fortran-comment-legacy.ctx | 1 - t/t4018/fortran-comment.ctx | 1 - t/t4018/fortran-external-function | 9 - t/t4018/fortran-external-function.ctx | 1 - t/t4018/fortran-external-subroutine | 5 - t/t4018/fortran-external-subroutine.ctx | 1 - t/t4018/fortran-module | 5 - t/t4018/fortran-module-procedure | 13 - t/t4018/fortran-module-procedure.ctx | 1 - t/t4018/fortran-module.ctx | 1 - t/t4018/fortran-program | 5 - t/t4018/fortran-program.ctx | 1 - t/t4018/fortran.sh | 159 ++++++++++++ t/t4018/fountain-scene | 4 - t/t4018/fountain-scene.ctx | 1 - t/t4018/fountain.sh | 14 + t/t4018/golang-complex-function | 8 - t/t4018/golang-complex-function.ctx | 1 - t/t4018/golang-func | 4 - t/t4018/golang-func.ctx | 1 - t/t4018/golang-interface | 4 - t/t4018/golang-interface.ctx | 1 - t/t4018/golang-long-func | 5 - t/t4018/golang-long-func.ctx | 1 - t/t4018/golang-struct | 4 - t/t4018/golang-struct.ctx | 1 - t/t4018/golang.sh | 59 +++++ t/t4018/java-class-member-function | 8 - t/t4018/java-class-member-function.ctx | 1 - t/t4018/java.sh | 18 ++ t/t4018/markdown-heading-indented | 6 - t/t4018/markdown-heading-indented.ctx | 1 - t/t4018/markdown-heading-non-headings | 17 -- t/t4018/markdown-heading-non-headings.ctx | 1 - t/t4018/markdown.sh | 39 +++ t/t4018/matlab-class-definition | 5 - t/t4018/matlab-class-definition.ctx | 1 - t/t4018/matlab-function | 4 - t/t4018/matlab-function.ctx | 1 - t/t4018/matlab-octave-section-1 | 3 - t/t4018/matlab-octave-section-1.ctx | 1 - t/t4018/matlab-octave-section-2 | 3 - t/t4018/matlab-octave-section-2.ctx | 1 - t/t4018/matlab-section | 3 - t/t4018/matlab-section.ctx | 1 - t/t4018/matlab.sh | 52 ++++ t/t4018/perl-skip-end-of-heredoc | 8 - t/t4018/perl-skip-end-of-heredoc.ctx | 1 - t/t4018/perl-skip-forward-decl | 10 - t/t4018/perl-skip-forward-decl.ctx | 1 - t/t4018/perl-skip-sub-in-pod | 18 -- t/t4018/perl-skip-sub-in-pod.ctx | 1 - t/t4018/perl-sub-definition | 4 - t/t4018/perl-sub-definition-kr-brace | 4 - t/t4018/perl-sub-definition-kr-brace.ctx | 1 - t/t4018/perl-sub-definition.ctx | 1 - t/t4018/perl.sh | 78 ++++++ t/t4018/php-abstract-class | 4 - t/t4018/php-abstract-class.ctx | 1 - t/t4018/php-abstract-method | 7 - t/t4018/php-abstract-method.ctx | 1 - t/t4018/php-class | 4 - t/t4018/php-class.ctx | 1 - t/t4018/php-final-class | 4 - t/t4018/php-final-class.ctx | 1 - t/t4018/php-final-method | 7 - t/t4018/php-final-method.ctx | 1 - t/t4018/php-function | 4 - t/t4018/php-function.ctx | 1 - t/t4018/php-interface | 4 - t/t4018/php-interface.ctx | 1 - t/t4018/php-method | 7 - t/t4018/php-method.ctx | 1 - t/t4018/php-trait | 7 - t/t4018/php-trait.ctx | 1 - t/t4018/php.sh | 106 ++++++++ t/t4018/python-async-def | 4 - t/t4018/python-async-def.ctx | 1 - t/t4018/python-class | 4 - t/t4018/python-class.ctx | 1 - t/t4018/python-def | 4 - t/t4018/python-def.ctx | 1 - t/t4018/python-indented-async-def | 7 - t/t4018/python-indented-async-def.ctx | 1 - t/t4018/python-indented-class | 5 - t/t4018/python-indented-class.ctx | 1 - t/t4018/python-indented-def | 7 - t/t4018/python-indented-def.ctx | 1 - t/t4018/python.sh | 71 ++++++ t/t4018/rust-fn | 5 - t/t4018/rust-fn.ctx | 1 - t/t4018/rust-impl | 5 - t/t4018/rust-impl.ctx | 1 - t/t4018/rust-macro-rules | 6 - t/t4018/rust-macro-rules.ctx | 1 - t/t4018/rust-struct | 5 - t/t4018/rust-struct.ctx | 1 - t/t4018/rust-trait | 5 - t/t4018/rust-trait.ctx | 1 - t/t4018/rust.sh | 60 +++++ 261 files changed, 1549 insertions(+), 879 deletions(-) delete mode 100644 t/t4018/README delete mode 100644 t/t4018/README.ctx delete mode 100644 t/t4018/bash-arithmetic-function delete mode 100644 t/t4018/bash-arithmetic-function.ctx delete mode 100644 t/t4018/bash-bashism-style-compact delete mode 100644 t/t4018/bash-bashism-style-compact.ctx delete mode 100644 t/t4018/bash-bashism-style-function delete mode 100644 t/t4018/bash-bashism-style-function.ctx delete mode 100644 t/t4018/bash-bashism-style-whitespace delete mode 100644 t/t4018/bash-bashism-style-whitespace.ctx delete mode 100644 t/t4018/bash-conditional-function delete mode 100644 t/t4018/bash-conditional-function.ctx delete mode 100644 t/t4018/bash-missing-parentheses delete mode 100644 t/t4018/bash-missing-parentheses.ctx delete mode 100644 t/t4018/bash-mixed-style-compact delete mode 100644 t/t4018/bash-mixed-style-compact.ctx delete mode 100644 t/t4018/bash-mixed-style-function delete mode 100644 t/t4018/bash-mixed-style-function.ctx delete mode 100644 t/t4018/bash-nested-functions delete mode 100644 t/t4018/bash-nested-functions.ctx delete mode 100644 t/t4018/bash-other-characters delete mode 100644 t/t4018/bash-other-characters.ctx delete mode 100644 t/t4018/bash-posix-style-compact delete mode 100644 t/t4018/bash-posix-style-compact.ctx delete mode 100644 t/t4018/bash-posix-style-function delete mode 100644 t/t4018/bash-posix-style-function.ctx delete mode 100644 t/t4018/bash-posix-style-whitespace delete mode 100644 t/t4018/bash-posix-style-whitespace.ctx delete mode 100644 t/t4018/bash-subshell-function delete mode 100644 t/t4018/bash-subshell-function.ctx delete mode 100644 t/t4018/bash-trailing-comment delete mode 100644 t/t4018/bash-trailing-comment.ctx create mode 100755 t/t4018/bash.sh delete mode 100644 t/t4018/cpp-c++-function delete mode 100644 t/t4018/cpp-c++-function.ctx delete mode 100644 t/t4018/cpp-class-constructor delete mode 100644 t/t4018/cpp-class-constructor-mem-init delete mode 100644 t/t4018/cpp-class-constructor-mem-init.ctx delete mode 100644 t/t4018/cpp-class-constructor.ctx delete mode 100644 t/t4018/cpp-class-definition delete mode 100644 t/t4018/cpp-class-definition-derived delete mode 100644 t/t4018/cpp-class-definition-derived.ctx delete mode 100644 t/t4018/cpp-class-definition.ctx delete mode 100644 t/t4018/cpp-class-destructor delete mode 100644 t/t4018/cpp-class-destructor.ctx delete mode 100644 t/t4018/cpp-function-returning-global-type delete mode 100644 t/t4018/cpp-function-returning-global-type.ctx delete mode 100644 t/t4018/cpp-function-returning-nested delete mode 100644 t/t4018/cpp-function-returning-nested.ctx delete mode 100644 t/t4018/cpp-function-returning-pointer delete mode 100644 t/t4018/cpp-function-returning-pointer.ctx delete mode 100644 t/t4018/cpp-function-returning-reference delete mode 100644 t/t4018/cpp-function-returning-reference.ctx delete mode 100644 t/t4018/cpp-gnu-style-function delete mode 100644 t/t4018/cpp-gnu-style-function.ctx delete mode 100644 t/t4018/cpp-namespace-definition delete mode 100644 t/t4018/cpp-namespace-definition.ctx delete mode 100644 t/t4018/cpp-operator-definition delete mode 100644 t/t4018/cpp-operator-definition.ctx delete mode 100644 t/t4018/cpp-skip-access-specifiers delete mode 100644 t/t4018/cpp-skip-access-specifiers.ctx delete mode 100644 t/t4018/cpp-skip-comment-block delete mode 100644 t/t4018/cpp-skip-comment-block.ctx delete mode 100644 t/t4018/cpp-skip-labels delete mode 100644 t/t4018/cpp-skip-labels.ctx delete mode 100644 t/t4018/cpp-struct-definition delete mode 100644 t/t4018/cpp-struct-definition.ctx delete mode 100644 t/t4018/cpp-struct-single-line delete mode 100644 t/t4018/cpp-struct-single-line.ctx delete mode 100644 t/t4018/cpp-template-function-definition delete mode 100644 t/t4018/cpp-template-function-definition.ctx delete mode 100644 t/t4018/cpp-union-definition delete mode 100644 t/t4018/cpp-union-definition.ctx delete mode 100644 t/t4018/cpp-void-c-function delete mode 100644 t/t4018/cpp-void-c-function.ctx create mode 100755 t/t4018/cpp.sh delete mode 100644 t/t4018/css-attribute-value-selector delete mode 100644 t/t4018/css-attribute-value-selector.ctx delete mode 100644 t/t4018/css-block-level-@-statements delete mode 100644 t/t4018/[email protected] delete mode 100644 t/t4018/css-brace-in-col-1 delete mode 100644 t/t4018/css-brace-in-col-1.ctx delete mode 100644 t/t4018/css-class-selector delete mode 100644 t/t4018/css-class-selector.ctx delete mode 100644 t/t4018/css-colon-eol delete mode 100644 t/t4018/css-colon-eol.ctx delete mode 100644 t/t4018/css-colon-selector delete mode 100644 t/t4018/css-colon-selector.ctx delete mode 100644 t/t4018/css-common delete mode 100644 t/t4018/css-common.ctx delete mode 100644 t/t4018/css-id-selector delete mode 100644 t/t4018/css-id-selector.ctx delete mode 100644 t/t4018/css-long-selector-list delete mode 100644 t/t4018/css-long-selector-list.ctx delete mode 100644 t/t4018/css-prop-sans-indent delete mode 100644 t/t4018/css-prop-sans-indent.ctx delete mode 100644 t/t4018/css-root-selector delete mode 100644 t/t4018/css-root-selector.ctx delete mode 100644 t/t4018/css-short-selector-list delete mode 100644 t/t4018/css-short-selector-list.ctx delete mode 100644 t/t4018/css-trailing-space delete mode 100644 t/t4018/css-trailing-space.ctx create mode 100755 t/t4018/css.sh delete mode 100644 t/t4018/custom1-pattern.ctx rename t/t4018/{custom1-pattern => custom1.sh} (71%) mode change 100644 => 100755 delete mode 100644 t/t4018/custom2-match-to-end-of-line delete mode 100644 t/t4018/custom2-match-to-end-of-line.ctx create mode 100755 t/t4018/custom2.sh delete mode 100644 t/t4018/custom3-alternation-in-pattern.ctx rename t/t4018/{custom3-alternation-in-pattern => custom3.sh} (66%) mode change 100644 => 100755 delete mode 100644 t/t4018/dts-labels delete mode 100644 t/t4018/dts-labels.ctx delete mode 100644 t/t4018/dts-node-unitless delete mode 100644 t/t4018/dts-node-unitless.ctx delete mode 100644 t/t4018/dts-nodes delete mode 100644 t/t4018/dts-nodes-boolean-prop delete mode 100644 t/t4018/dts-nodes-boolean-prop.ctx delete mode 100644 t/t4018/dts-nodes-comment1 delete mode 100644 t/t4018/dts-nodes-comment1.ctx delete mode 100644 t/t4018/dts-nodes-comment2 delete mode 100644 t/t4018/dts-nodes-comment2.ctx delete mode 100644 t/t4018/dts-nodes-multiline-prop delete mode 100644 t/t4018/dts-nodes-multiline-prop.ctx delete mode 100644 t/t4018/dts-nodes.ctx delete mode 100644 t/t4018/dts-reference delete mode 100644 t/t4018/dts-reference.ctx delete mode 100644 t/t4018/dts-root delete mode 100644 t/t4018/dts-root-comment delete mode 100644 t/t4018/dts-root-comment.ctx delete mode 100644 t/t4018/dts-root.ctx create mode 100755 t/t4018/dts.sh delete mode 100644 t/t4018/elixir-do-not-pick-end delete mode 100644 t/t4018/elixir-do-not-pick-end.ctx delete mode 100644 t/t4018/elixir-ex-unit-test delete mode 100644 t/t4018/elixir-ex-unit-test.ctx delete mode 100644 t/t4018/elixir-function delete mode 100644 t/t4018/elixir-function.ctx delete mode 100644 t/t4018/elixir-macro delete mode 100644 t/t4018/elixir-macro.ctx delete mode 100644 t/t4018/elixir-module delete mode 100644 t/t4018/elixir-module-func delete mode 100644 t/t4018/elixir-module-func.ctx delete mode 100644 t/t4018/elixir-module.ctx delete mode 100644 t/t4018/elixir-nested-module delete mode 100644 t/t4018/elixir-nested-module.ctx delete mode 100644 t/t4018/elixir-private-function delete mode 100644 t/t4018/elixir-private-function.ctx delete mode 100644 t/t4018/elixir-protocol delete mode 100644 t/t4018/elixir-protocol-implementation delete mode 100644 t/t4018/elixir-protocol-implementation.ctx delete mode 100644 t/t4018/elixir-protocol.ctx create mode 100755 t/t4018/elixir.sh delete mode 100644 t/t4018/fortran-block-data delete mode 100644 t/t4018/fortran-block-data.ctx delete mode 100644 t/t4018/fortran-comment delete mode 100644 t/t4018/fortran-comment-keyword delete mode 100644 t/t4018/fortran-comment-keyword.ctx delete mode 100644 t/t4018/fortran-comment-legacy delete mode 100644 t/t4018/fortran-comment-legacy-star delete mode 100644 t/t4018/fortran-comment-legacy-star.ctx delete mode 100644 t/t4018/fortran-comment-legacy.ctx delete mode 100644 t/t4018/fortran-comment.ctx delete mode 100644 t/t4018/fortran-external-function delete mode 100644 t/t4018/fortran-external-function.ctx delete mode 100644 t/t4018/fortran-external-subroutine delete mode 100644 t/t4018/fortran-external-subroutine.ctx delete mode 100644 t/t4018/fortran-module delete mode 100644 t/t4018/fortran-module-procedure delete mode 100644 t/t4018/fortran-module-procedure.ctx delete mode 100644 t/t4018/fortran-module.ctx delete mode 100644 t/t4018/fortran-program delete mode 100644 t/t4018/fortran-program.ctx create mode 100755 t/t4018/fortran.sh delete mode 100644 t/t4018/fountain-scene delete mode 100644 t/t4018/fountain-scene.ctx create mode 100755 t/t4018/fountain.sh delete mode 100644 t/t4018/golang-complex-function delete mode 100644 t/t4018/golang-complex-function.ctx delete mode 100644 t/t4018/golang-func delete mode 100644 t/t4018/golang-func.ctx delete mode 100644 t/t4018/golang-interface delete mode 100644 t/t4018/golang-interface.ctx delete mode 100644 t/t4018/golang-long-func delete mode 100644 t/t4018/golang-long-func.ctx delete mode 100644 t/t4018/golang-struct delete mode 100644 t/t4018/golang-struct.ctx create mode 100755 t/t4018/golang.sh delete mode 100644 t/t4018/java-class-member-function delete mode 100644 t/t4018/java-class-member-function.ctx create mode 100755 t/t4018/java.sh delete mode 100644 t/t4018/markdown-heading-indented delete mode 100644 t/t4018/markdown-heading-indented.ctx delete mode 100644 t/t4018/markdown-heading-non-headings delete mode 100644 t/t4018/markdown-heading-non-headings.ctx create mode 100755 t/t4018/markdown.sh delete mode 100644 t/t4018/matlab-class-definition delete mode 100644 t/t4018/matlab-class-definition.ctx delete mode 100644 t/t4018/matlab-function delete mode 100644 t/t4018/matlab-function.ctx delete mode 100644 t/t4018/matlab-octave-section-1 delete mode 100644 t/t4018/matlab-octave-section-1.ctx delete mode 100644 t/t4018/matlab-octave-section-2 delete mode 100644 t/t4018/matlab-octave-section-2.ctx delete mode 100644 t/t4018/matlab-section delete mode 100644 t/t4018/matlab-section.ctx create mode 100755 t/t4018/matlab.sh delete mode 100644 t/t4018/perl-skip-end-of-heredoc delete mode 100644 t/t4018/perl-skip-end-of-heredoc.ctx delete mode 100644 t/t4018/perl-skip-forward-decl delete mode 100644 t/t4018/perl-skip-forward-decl.ctx delete mode 100644 t/t4018/perl-skip-sub-in-pod delete mode 100644 t/t4018/perl-skip-sub-in-pod.ctx delete mode 100644 t/t4018/perl-sub-definition delete mode 100644 t/t4018/perl-sub-definition-kr-brace delete mode 100644 t/t4018/perl-sub-definition-kr-brace.ctx delete mode 100644 t/t4018/perl-sub-definition.ctx create mode 100755 t/t4018/perl.sh delete mode 100644 t/t4018/php-abstract-class delete mode 100644 t/t4018/php-abstract-class.ctx delete mode 100644 t/t4018/php-abstract-method delete mode 100644 t/t4018/php-abstract-method.ctx delete mode 100644 t/t4018/php-class delete mode 100644 t/t4018/php-class.ctx delete mode 100644 t/t4018/php-final-class delete mode 100644 t/t4018/php-final-class.ctx delete mode 100644 t/t4018/php-final-method delete mode 100644 t/t4018/php-final-method.ctx delete mode 100644 t/t4018/php-function delete mode 100644 t/t4018/php-function.ctx delete mode 100644 t/t4018/php-interface delete mode 100644 t/t4018/php-interface.ctx delete mode 100644 t/t4018/php-method delete mode 100644 t/t4018/php-method.ctx delete mode 100644 t/t4018/php-trait delete mode 100644 t/t4018/php-trait.ctx create mode 100755 t/t4018/php.sh delete mode 100644 t/t4018/python-async-def delete mode 100644 t/t4018/python-async-def.ctx delete mode 100644 t/t4018/python-class delete mode 100644 t/t4018/python-class.ctx delete mode 100644 t/t4018/python-def delete mode 100644 t/t4018/python-def.ctx delete mode 100644 t/t4018/python-indented-async-def delete mode 100644 t/t4018/python-indented-async-def.ctx delete mode 100644 t/t4018/python-indented-class delete mode 100644 t/t4018/python-indented-class.ctx delete mode 100644 t/t4018/python-indented-def delete mode 100644 t/t4018/python-indented-def.ctx create mode 100755 t/t4018/python.sh delete mode 100644 t/t4018/rust-fn delete mode 100644 t/t4018/rust-fn.ctx delete mode 100644 t/t4018/rust-impl delete mode 100644 t/t4018/rust-impl.ctx delete mode 100644 t/t4018/rust-macro-rules delete mode 100644 t/t4018/rust-macro-rules.ctx delete mode 100644 t/t4018/rust-struct delete mode 100644 t/t4018/rust-struct.ctx delete mode 100644 t/t4018/rust-trait delete mode 100644 t/t4018/rust-trait.ctx create mode 100755 t/t4018/rust.sh
t/t4018-diff-funcname.sh +34 -25
@@ -61,33 +61,42 @@ test_expect_success 'last regexp must not be negated' ' test_i18ngrep ": Last expression must not be negated:" msg ' -test_expect_success 'setup hunk header tests' ' - for i in $diffpatterns - do - echo "$i-* diff=$i" - done > .gitattributes && - - # add all test files to the index - ( - cd "$TEST_DIRECTORY"/t4018 && - git --git-dir="$TRASH_DIRECTORY/.git" add . - ) && - - # place modified files in the worktree - for i in $(git ls-files) - do - sed -e "s/ChangeMe/IWasChanged/" <"$TEST_DIRECTORY/t4018/$i" >"$i" || return 1 - done -' +test_diff_funcname () { + desc=$1 + cat <&8 >arg.header && + cat <&9 >arg.test && + what=$(cat arg.what) && + + test_expect_success "setup: $desc" ' + cp arg.test "$what" && + cp arg.header expected && + git add "$what" && + sed -e "s/ChangeMe/IWasChanged/" <"$what" >tmp && + mv tmp "$what" + ' && + + test_expect_success "$desc" ' + git diff -U1 "$what" >diff && + sed -n -e "s/^.*@@\( \|$\)//p" <diff >actual && + test_cmp expected actual + ' +} -# check each individual file -for i in $(git ls-files -- ':!*.ctx') +for what in $diffpatterns do - test_expect_success "hunk header: $i" " - git diff -U1 $i >diff && - sed -n -e 's/^.*@@\( \|$\)//p' <diff >ctx && - test_cmp $i.ctx ctx - " + test="$TEST_DIRECTORY/t4018/$what.sh" + if ! test -e "$test" + then + test_expect_failure "$what: no tests" 'false' + continue + fi && + + test_expect_success "setup: hunk header for $what" ' + echo "$what diff=$what" >.gitattributes && + echo "$what" >arg.what + ' && + + . "$test" done test_done
t/t4018/README deleted +0 -15
@@ -1,15 +0,0 @@ -How to write test cases -======================= - -Create test cases called "LANG-whatever" in this directory, where -"LANG" is e.g. the userdiff driver name, where "whatever" is a brief -description of the test. - -Insert the word "ChangeMe" (exactly this form) at a distance of -at least two lines from the line that must appear in the hunk header. - -The text that must appear in the hunk header must contains the word -"RIGHT" by convention. The "LANG-whatever.ctx" file contains what we -expect to appear in the hunk header. We munged the start of the line -to "@@ [...] @@" for ease of not having to hardcode the line numbers -and offsets.
t/t4018/README.ctx deleted +0 -1
@@ -1 +0,0 @@ -description of the test.
t/t4018/bash-arithmetic-function deleted +0 -4
@@ -1,4 +0,0 @@ -RIGHT() (( - - ChangeMe = "$x" + "$y" -))
t/t4018/bash-arithmetic-function.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT()
t/t4018/bash-bashism-style-compact deleted +0 -6
@@ -1,6 +0,0 @@ -function RIGHT { - function InvalidSyntax{ - : - echo 'ChangeMe' - } -}
t/t4018/bash-bashism-style-compact.ctx deleted +0 -1
@@ -1 +0,0 @@ -function RIGHT {
t/t4018/bash-bashism-style-function deleted +0 -4
@@ -1,4 +0,0 @@ -function RIGHT { - : - echo 'ChangeMe' -}
t/t4018/bash-bashism-style-function.ctx deleted +0 -1
@@ -1 +0,0 @@ -function RIGHT {
t/t4018/bash-bashism-style-whitespace deleted +0 -4
@@ -1,4 +0,0 @@ - function RIGHT ( ) { - - ChangeMe - }
t/t4018/bash-bashism-style-whitespace.ctx deleted +0 -1
@@ -1 +0,0 @@ -function RIGHT ( ) {
t/t4018/bash-conditional-function deleted +0 -4
@@ -1,4 +0,0 @@ -RIGHT() [[ \ - - "$a" > "$ChangeMe" -]]
t/t4018/bash-conditional-function.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT()
t/t4018/bash-missing-parentheses deleted +0 -6
@@ -1,6 +0,0 @@ -function RIGHT { - functionInvalidSyntax { - : - echo 'ChangeMe' - } -}
t/t4018/bash-missing-parentheses.ctx deleted +0 -1
@@ -1 +0,0 @@ -function RIGHT {
t/t4018/bash-mixed-style-compact deleted +0 -4
@@ -1,4 +0,0 @@ -function RIGHT(){ - : - echo 'ChangeMe' -}
t/t4018/bash-mixed-style-compact.ctx deleted +0 -1
@@ -1 +0,0 @@ -function RIGHT(){
t/t4018/bash-mixed-style-function deleted +0 -4
@@ -1,4 +0,0 @@ -function RIGHT() { - - ChangeMe -}
t/t4018/bash-mixed-style-function.ctx deleted +0 -1
@@ -1 +0,0 @@ -function RIGHT() {
t/t4018/bash-nested-functions deleted +0 -6
@@ -1,6 +0,0 @@ -outer() { - RIGHT() { - : - echo 'ChangeMe' - } -}
t/t4018/bash-nested-functions.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT()
t/t4018/bash-other-characters deleted +0 -4
@@ -1,4 +0,0 @@ -_RIGHT_0n() { - - ChangeMe -}
t/t4018/bash-other-characters.ctx deleted +0 -1
@@ -1 +0,0 @@ -_RIGHT_0n()
t/t4018/bash-posix-style-compact deleted +0 -4
@@ -1,4 +0,0 @@ -RIGHT(){ - - ChangeMe -}
t/t4018/bash-posix-style-compact.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT()
t/t4018/bash-posix-style-function deleted +0 -4
@@ -1,4 +0,0 @@ -RIGHT() { - - ChangeMe -}
t/t4018/bash-posix-style-function.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT()
t/t4018/bash-posix-style-whitespace deleted +0 -4
@@ -1,4 +0,0 @@ - RIGHT ( ) { - - ChangeMe - }
t/t4018/bash-posix-style-whitespace.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT ( )
t/t4018/bash-subshell-function deleted +0 -4
@@ -1,4 +0,0 @@ -RIGHT() ( - - ChangeMe=2 -)
t/t4018/bash-subshell-function.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT()
t/t4018/bash-trailing-comment deleted +0 -4
@@ -1,4 +0,0 @@ -RIGHT() { # Comment - - ChangeMe -}
t/t4018/bash-trailing-comment.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT()
t/t4018/bash.sh new file +160 -0
160 lines not on this page · raw message
t/t4018/cpp-c++-function deleted +0 -4
@@ -1,4 +0,0 @@ -Item RIGHT::DoSomething( Args with_spaces ) -{ - ChangeMe; -}
t/t4018/cpp-c++-function.ctx deleted +0 -1
@@ -1 +0,0 @@ -Item RIGHT::DoSomething( Args with_spaces )
t/t4018/cpp-class-constructor deleted +0 -4
@@ -1,4 +0,0 @@ -Item::Item(int RIGHT) -{ - ChangeMe; -}
t/t4018/cpp-class-constructor-mem-init deleted +0 -5
@@ -1,5 +0,0 @@ -Item::Item(int RIGHT) : - member(0) -{ - ChangeMe; -}
t/t4018/cpp-class-constructor-mem-init.ctx deleted +0 -1
@@ -1 +0,0 @@ -Item::Item(int RIGHT) :
t/t4018/cpp-class-constructor.ctx deleted +0 -1
@@ -1 +0,0 @@ -Item::Item(int RIGHT)
t/t4018/cpp-class-definition deleted +0 -4
@@ -1,4 +0,0 @@ -class RIGHT -{ - int ChangeMe; -};
t/t4018/cpp-class-definition-derived deleted +0 -5
@@ -1,5 +0,0 @@ -class RIGHT : - public Baseclass -{ - int ChangeMe; -};
t/t4018/cpp-class-definition-derived.ctx deleted +0 -1
@@ -1 +0,0 @@ -class RIGHT :
t/t4018/cpp-class-definition.ctx deleted +0 -1
@@ -1 +0,0 @@ -class RIGHT
t/t4018/cpp-class-destructor deleted +0 -4
@@ -1,4 +0,0 @@ -RIGHT::~RIGHT() -{ - ChangeMe; -}
t/t4018/cpp-class-destructor.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT::~RIGHT()
t/t4018/cpp-function-returning-global-type deleted +0 -4
@@ -1,4 +0,0 @@ -::Item get::it::RIGHT() -{ - ChangeMe; -}
t/t4018/cpp-function-returning-global-type.ctx deleted +0 -1
@@ -1 +0,0 @@ -::Item get::it::RIGHT()
t/t4018/cpp-function-returning-nested deleted +0 -5
@@ -1,5 +0,0 @@ -get::Item get::it::RIGHT() -{ - ChangeMe; -} -
t/t4018/cpp-function-returning-nested.ctx deleted +0 -1
@@ -1 +0,0 @@ -get::Item get::it::RIGHT()
t/t4018/cpp-function-returning-pointer deleted +0 -4
@@ -1,4 +0,0 @@ -const char *get_it_RIGHT(char *ptr) -{ - ChangeMe; -}
t/t4018/cpp-function-returning-pointer.ctx deleted +0 -1
@@ -1 +0,0 @@ -const char *get_it_RIGHT(char *ptr)
t/t4018/cpp-function-returning-reference deleted +0 -4
@@ -1,4 +0,0 @@ -string& get::it::RIGHT(char *ptr) -{ - ChangeMe; -}
t/t4018/cpp-function-returning-reference.ctx deleted +0 -1
@@ -1 +0,0 @@ -string& get::it::RIGHT(char *ptr)
t/t4018/cpp-gnu-style-function deleted +0 -5
@@ -1,5 +0,0 @@ -const char * -RIGHT(int arg) -{ - ChangeMe; -}
t/t4018/cpp-gnu-style-function.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT(int arg)
t/t4018/cpp-namespace-definition deleted +0 -4
@@ -1,4 +0,0 @@ -namespace RIGHT -{ - ChangeMe; -}
t/t4018/cpp-namespace-definition.ctx deleted +0 -1
@@ -1 +0,0 @@ -namespace RIGHT
t/t4018/cpp-operator-definition deleted +0 -4
@@ -1,4 +0,0 @@ -Value operator+(Value LEFT, Value RIGHT) -{ - ChangeMe; -}
t/t4018/cpp-operator-definition.ctx deleted +0 -1
@@ -1 +0,0 @@ -Value operator+(Value LEFT, Value RIGHT)
t/t4018/cpp-skip-access-specifiers deleted +0 -8
@@ -1,8 +0,0 @@ -class RIGHT : public Baseclass -{ -public: -protected: -private: - void DoSomething(); - int ChangeMe; -};
t/t4018/cpp-skip-access-specifiers.ctx deleted +0 -1
@@ -1 +0,0 @@ -class RIGHT : public Baseclass
t/t4018/cpp-skip-comment-block deleted +0 -9
@@ -1,9 +0,0 @@ -struct item RIGHT(int i) -// Do not -// pick up -/* these -** comments. -*/ -{ - ChangeMe; -}
t/t4018/cpp-skip-comment-block.ctx deleted +0 -1
@@ -1 +0,0 @@ -struct item RIGHT(int i)
t/t4018/cpp-skip-labels deleted +0 -8
@@ -1,8 +0,0 @@ -void RIGHT (void) -{ -repeat: // C++ comment -next: /* C comment */ - do_something(); - - ChangeMe; -}
t/t4018/cpp-skip-labels.ctx deleted +0 -1
@@ -1 +0,0 @@ -void RIGHT (void)
t/t4018/cpp-struct-definition deleted +0 -9
@@ -1,9 +0,0 @@ -struct RIGHT { - unsigned - /* this bit field looks like a label and should not be picked up */ - decoy_bitfield: 2, - more : 1; - int filler; - - int ChangeMe; -};
t/t4018/cpp-struct-definition.ctx deleted +0 -1
@@ -1 +0,0 @@ -struct RIGHT {
t/t4018/cpp-struct-single-line deleted +0 -7
@@ -1,7 +0,0 @@ -void wrong() -{ -} - -struct RIGHT_iterator_tag {}; - -int ChangeMe;
t/t4018/cpp-struct-single-line.ctx deleted +0 -1
@@ -1 +0,0 @@ -struct RIGHT_iterator_tag {};
t/t4018/cpp-template-function-definition deleted +0 -4
@@ -1,4 +0,0 @@ -template<class T> int RIGHT(T arg) -{ - ChangeMe; -}
t/t4018/cpp-template-function-definition.ctx deleted +0 -1
@@ -1 +0,0 @@ -template<class T> int RIGHT(T arg)
t/t4018/cpp-union-definition deleted +0 -4
@@ -1,4 +0,0 @@ -union RIGHT { - double v; - int ChangeMe; -};
t/t4018/cpp-union-definition.ctx deleted +0 -1
@@ -1 +0,0 @@ -union RIGHT {
t/t4018/cpp-void-c-function deleted +0 -4
@@ -1,4 +0,0 @@ -void RIGHT (void) -{ - ChangeMe; -}
t/t4018/cpp-void-c-function.ctx deleted +0 -1
@@ -1 +0,0 @@ -void RIGHT (void)
t/t4018/cpp.sh new file +239 -0
239 lines not on this page · raw message
t/t4018/css-attribute-value-selector deleted +0 -4
@@ -1,4 +0,0 @@ -[class*="RIGHT"] { - background : #000; - border : 10px ChangeMe #C6C6C6; -}
t/t4018/css-attribute-value-selector.ctx deleted +0 -1
@@ -1 +0,0 @@ -[class*="RIGHT"] {
t/t4018/css-block-level-@-statements deleted +0 -10
@@ -1,10 +0,0 @@ -@keyframes RIGHT { - from { - background : #000; - border : 10px ChangeMe #C6C6C6; - } - to { - background : #fff; - border : 10px solid #C6C6C6; - } -}
t/t4018/[email protected] deleted +0 -1
@@ -1 +0,0 @@ -@keyframes RIGHT {
t/t4018/css-brace-in-col-1 deleted +0 -5
@@ -1,5 +0,0 @@ -RIGHT label.control-label -{ - margin-top: 10px!important; - border : 10px ChangeMe #C6C6C6; -}
t/t4018/css-brace-in-col-1.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT label.control-label
t/t4018/css-class-selector deleted +0 -4
@@ -1,4 +0,0 @@ -.RIGHT { - background : #000; - border : 10px ChangeMe #C6C6C6; -}
t/t4018/css-class-selector.ctx deleted +0 -1
@@ -1 +0,0 @@ -.RIGHT {
t/t4018/css-colon-eol deleted +0 -4
@@ -1,4 +0,0 @@ -RIGHT h1 { -color: -ChangeMe; -}
t/t4018/css-colon-eol.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT h1 {
t/t4018/css-colon-selector deleted +0 -5
@@ -1,5 +0,0 @@ -RIGHT a:hover { - margin-top: - 10px!important; - border : 10px ChangeMe #C6C6C6; -}
t/t4018/css-colon-selector.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT a:hover {
t/t4018/css-common deleted +0 -4
@@ -1,4 +0,0 @@ -RIGHT label.control-label { - margin-top: 10px!important; - border : 10px ChangeMe #C6C6C6; -}
t/t4018/css-common.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT label.control-label {
t/t4018/css-id-selector deleted +0 -4
@@ -1,4 +0,0 @@ -#RIGHT { - background : #000; - border : 10px ChangeMe #C6C6C6; -}
t/t4018/css-id-selector.ctx deleted +0 -1
@@ -1 +0,0 @@ -#RIGHT {
t/t4018/css-long-selector-list deleted +0 -6
@@ -1,6 +0,0 @@ -p.header, -label.control-label, -div ul#RIGHT { - margin-top: 10px!important; - border : 10px ChangeMe #C6C6C6; -}
t/t4018/css-long-selector-list.ctx deleted +0 -1
@@ -1 +0,0 @@ -div ul#RIGHT {
t/t4018/css-prop-sans-indent deleted +0 -5
@@ -1,5 +0,0 @@ -RIGHT, label.control-label { -margin-top: 10px!important; -padding: 0; -border : 10px ChangeMe #C6C6C6; -}
t/t4018/css-prop-sans-indent.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT, label.control-label {
t/t4018/css-root-selector deleted +0 -4
@@ -1,4 +0,0 @@ -:RIGHT { - background : #000; - border : 10px ChangeMe #C6C6C6; -}
t/t4018/css-root-selector.ctx deleted +0 -1
@@ -1 +0,0 @@ -:RIGHT {
t/t4018/css-short-selector-list deleted +0 -4
@@ -1,4 +0,0 @@ -label.control, div ul#RIGHT { - margin-top: 10px!important; - border : 10px ChangeMe #C6C6C6; -}
t/t4018/css-short-selector-list.ctx deleted +0 -1
@@ -1 +0,0 @@ -label.control, div ul#RIGHT {
t/t4018/css-trailing-space deleted +0 -5
@@ -1,5 +0,0 @@ -RIGHT label.control-label { - margin:10px; - padding:10px; - border : 10px ChangeMe #C6C6C6; -}
t/t4018/css-trailing-space.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT label.control-label {
t/t4018/css.sh new file +146 -0
146 lines not on this page · raw message
t/t4018/custom1-pattern.ctx deleted +0 -1
@@ -1 +0,0 @@ -int special, RIGHT;
t/t4018/custom1.sh renamed from t/t4018/custom1-pattern +10 -0
@@ -1,3 +1,12 @@ +#!/bin/sh +# +# See ../t4018-diff-funcname.sh's test_diff_funcname() +# + +test_diff_funcname 'custom1: pattern' \ + 8<<\EOF_HUNK 9<<\EOF_TEST +int special, RIGHT; +EOF_HUNK public class Beer { int special, RIGHT;
@@ -15,3 +24,4 @@ public class Beer + "99 bottles of beer on the wall.\n"); } } +EOF_TEST
t/t4018/custom2-match-to-end-of-line deleted +0 -8
@@ -1,8 +0,0 @@ -public class RIGHT_Beer -{ - int special; - public static void main(String args[]) - { - System.out.print("ChangeMe"); - } -}
t/t4018/custom2-match-to-end-of-line.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT_Beer
t/t4018/custom2.sh new file +18 -0
@@ -0,0 +1,18 @@ +#!/bin/sh +# +# See ../t4018-diff-funcname.sh's test_diff_funcname() +# + +test_diff_funcname 'custom2: match to end of line' \ + 8<<\EOF_HUNK 9<<\EOF_TEST +RIGHT_Beer +EOF_HUNK +public class RIGHT_Beer +{ + int special; + public static void main(String args[]) + { + System.out.print("ChangeMe"); + } +} +EOF_TEST
t/t4018/custom3-alternation-in-pattern.ctx deleted +0 -1
@@ -1 +0,0 @@ -public static void main(String RIGHT[])
t/t4018/custom3.sh renamed from t/t4018/custom3-alternation-in-pattern +10 -0
@@ -1,3 +1,12 @@ +#!/bin/sh +# +# See ../t4018-diff-funcname.sh's test_diff_funcname() +# + +test_diff_funcname 'custom3: alternation in pattern' \ + 8<<\EOF_HUNK 9<<\EOF_TEST +public static void main(String RIGHT[]) +EOF_HUNK public class Beer { int special;
@@ -15,3 +24,4 @@ public class Beer + "99 bottles of beer on the wall.\n"); } } +EOF_TEST
t/t4018/dts-labels deleted +0 -9
@@ -1,9 +0,0 @@ -/ { - label_1: node1@ff00 { - label2: RIGHT { - vendor,some-property; - - ChangeMe = <0x45-30>; - }; - }; -};
t/t4018/dts-labels.ctx deleted +0 -1
@@ -1 +0,0 @@ -label2: RIGHT {
t/t4018/dts-node-unitless deleted +0 -8
@@ -1,8 +0,0 @@ -/ { - label_1: node1 { - RIGHT { - prop-array = <1>, <4>; - ChangeMe = <0xffeedd00>; - }; - }; -};
t/t4018/dts-node-unitless.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT {
t/t4018/dts-nodes deleted +0 -8
@@ -1,8 +0,0 @@ -/ { - label_1: node1@ff00 { - RIGHT@deadf00,4000 { - #size-cells = <1>; - ChangeMe = <0xffeedd00>; - }; - }; -};
t/t4018/dts-nodes-boolean-prop deleted +0 -9
@@ -1,9 +0,0 @@ -/ { - label_1: node1@ff00 { - RIGHT@deadf00,4000 { - boolean-prop1; - - ChangeMe; - }; - }; -};
t/t4018/dts-nodes-boolean-prop.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT@deadf00,4000 {
t/t4018/dts-nodes-comment1 deleted +0 -8
@@ -1,8 +0,0 @@ -/ { - label_1: node1@ff00 { - RIGHT@deadf00,4000 /* &a comment */ { - #size-cells = <1>; - ChangeMe = <0xffeedd00>; - }; - }; -};
t/t4018/dts-nodes-comment1.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT@deadf00,4000 /* &a comment */ {
t/t4018/dts-nodes-comment2 deleted +0 -8
@@ -1,8 +0,0 @@ -/ { - label_1: node1@ff00 { - RIGHT@deadf00,4000 { /* a trailing comment */ - #size-cells = <1>; - ChangeMe = <0xffeedd00>; - }; - }; -};
t/t4018/dts-nodes-comment2.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT@deadf00,4000 { /* a trailing comment */
t/t4018/dts-nodes-multiline-prop deleted +0 -13
@@ -1,13 +0,0 @@ -/ { - label_1: node1@ff00 { - RIGHT@deadf00,4000 { - multilineprop = <3>, - <4>, - <5>, - <6>, - <7>; - - ChangeMe = <0xffeedd00>; - }; - }; -};
t/t4018/dts-nodes-multiline-prop.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT@deadf00,4000 {
t/t4018/dts-nodes.ctx deleted +0 -1
@@ -1 +0,0 @@ -RIGHT@deadf00,4000 {
t/t4018/dts-reference deleted +0 -9
@@ -1,9 +0,0 @@ -&label_1 { - TEST = <455>; -}; - -&RIGHT { - vendor,some-property; - - ChangeMe = <0x45-30>; -};
t/t4018/dts-reference.ctx deleted +0 -1
@@ -1 +0,0 @@ -&RIGHT {
t/t4018/dts-root deleted +0 -5
@@ -1,5 +0,0 @@ -/ { RIGHT /* Technically just supposed to be a slash and brace */ - #size-cells = <1>; - - ChangeMe = <0xffeedd00>; -};
t/t4018/dts-root-comment deleted +0 -8
@@ -1,8 +0,0 @@ -/ { RIGHT /* Technically just supposed to be a slash and brace */ - #size-cells = <1>; - - /* This comment should be ignored */ - - some-property = <40+2>; - ChangeMe = <0xffeedd00>; -};
t/t4018/dts-root-comment.ctx deleted +0 -1
@@ -1 +0,0 @@ -/ { RIGHT /* Technically just supposed to be a slash and brace */
t/t4018/dts-root.ctx deleted +0 -1
@@ -1 +0,0 @@ -/ { RIGHT /* Technically just supposed to be a slash and brace */
t/t4018/dts.sh new file +149 -0
149 lines not on this page · raw message
t/t4018/elixir-do-not-pick-end deleted +0 -5
@@ -1,5 +0,0 @@ -defmodule RIGHT do -end -# -# -# ChangeMe; do not pick up 'end' line
t/t4018/elixir-do-not-pick-end.ctx deleted +0 -1
@@ -1 +0,0 @@ -defmodule RIGHT do
t/t4018/elixir-ex-unit-test deleted +0 -6
@@ -1,6 +0,0 @@ -defmodule Test do - test "RIGHT" do - assert true == true - assert ChangeMe - end -end
t/t4018/elixir-ex-unit-test.ctx deleted +0 -1
@@ -1 +0,0 @@ -test "RIGHT" do
t/t4018/elixir-function deleted +0 -5
@@ -1,5 +0,0 @@ -def function(RIGHT, arg) do - # comment - # comment - ChangeMe -end
t/t4018/elixir-function.ctx deleted +0 -1
@@ -1 +0,0 @@ -def function(RIGHT, arg) do
t/t4018/elixir-macro deleted +0 -5
@@ -1,5 +0,0 @@ -defmacro foo(RIGHT) do - # Code - # Code - ChangeMe -end
t/t4018/elixir-macro.ctx deleted +0 -1
@@ -1 +0,0 @@ -defmacro foo(RIGHT) do
t/t4018/elixir-module deleted +0 -9
@@ -1,9 +0,0 @@ -defmodule RIGHT do - @moduledoc """ - Foo bar - """ - - def ChangeMe(a) where is_map(a) do - a - end -end
t/t4018/elixir-module-func deleted +0 -8
@@ -1,8 +0,0 @@ -defmodule Foo do - def fun(RIGHT) do - # Code - # Code - # Code - ChangeMe - end -end
t/t4018/elixir-module-func.ctx deleted +0 -1
@@ -1 +0,0 @@ -def fun(RIGHT) do
t/t4018/elixir-module.ctx deleted +0 -1
@@ -1 +0,0 @@ -defmodule RIGHT do
t/t4018/elixir-nested-module deleted +0 -9
@@ -1,9 +0,0 @@ -defmodule MyApp.RIGHT do - @moduledoc """ - Foo bar - """ - - def ChangeMe(a) where is_map(a) do - a - end -end
t/t4018/elixir-nested-module.ctx deleted +0 -1
@@ -1 +0,0 @@ -defmodule MyApp.RIGHT do
t/t4018/elixir-private-function deleted +0 -5
@@ -1,5 +0,0 @@ -defp function(RIGHT, arg) do - # comment - # comment - ChangeMe -end
t/t4018/elixir-private-function.ctx deleted +0 -1
@@ -1 +0,0 @@ -defp function(RIGHT, arg) do
t/t4018/elixir-protocol deleted +0 -6
@@ -1,6 +0,0 @@ -defprotocol RIGHT do - @doc """ - Calculates the size (and not the length!) of a data structure - """ - def size(data, ChangeMe) -end
t/t4018/elixir-protocol-implementation deleted +0 -5
@@ -1,5 +0,0 @@ -defimpl RIGHT do - # Docs - # Docs - def foo(ChangeMe), do: :ok -end
t/t4018/elixir-protocol-implementation.ctx deleted +0 -1
@@ -1 +0,0 @@ -defimpl RIGHT do
t/t4018/elixir-protocol.ctx deleted +0 -1
@@ -1 +0,0 @@ -defprotocol RIGHT do
t/t4018/elixir.sh new file +127 -0
127 lines not on this page · raw message
t/t4018/fortran-block-data deleted +0 -5
@@ -1,5 +0,0 @@ - BLOCK DATA RIGHT - - COMMON /B/ C, ChangeMe - DATA C, ChangeMe / 2.0, 6.0 / - END
t/t4018/fortran-block-data.ctx deleted +0 -1
@@ -1 +0,0 @@ -BLOCK DATA RIGHT
t/t4018/fortran-comment deleted +0 -13
@@ -1,13 +0,0 @@ - module a - - contains - - ! subroutine wrong - subroutine RIGHT - ! subroutine wrong - - real ChangeMe - - end subroutine RIGHT - - end module a
t/t4018/fortran-comment-keyword deleted +0 -14
@@ -1,14 +0,0 @@ - module a - - contains - - subroutine RIGHT (funcA, funcB) - - real funcA ! grid function a - real funcB ! grid function b - - real ChangeMe - - end subroutine RIGHT - - end module a
t/t4018/fortran-comment-keyword.ctx deleted +0 -1
@@ -1 +0,0 @@ -subroutine RIGHT (funcA, funcB)
t/t4018/fortran-comment-legacy deleted +0 -13
@@ -1,13 +0,0 @@ - module a - - contains - -C subroutine wrong - subroutine RIGHT -C subroutine wrong - - real ChangeMe - - end subroutine RIGHT - - end module a
t/t4018/fortran-comment-legacy-star deleted +0 -13
@@ -1,13 +0,0 @@ - module a - - contains - -* subroutine wrong - subroutine RIGHT -* subroutine wrong - - real ChangeMe - - end subroutine RIGHT - - end module a
t/t4018/fortran-comment-legacy-star.ctx deleted +0 -1
@@ -1 +0,0 @@ -subroutine RIGHT
t/t4018/fortran-comment-legacy.ctx deleted +0 -1
@@ -1 +0,0 @@ -subroutine RIGHT
t/t4018/fortran-comment.ctx deleted +0 -1
@@ -1 +0,0 @@ -subroutine RIGHT
t/t4018/fortran-external-function deleted +0 -9
@@ -1,9 +0,0 @@ -function RIGHT(a, b) result(c) - -integer, intent(in) :: ChangeMe -integer, intent(in) :: b -integer, intent(out) :: c - -c = a+b - -end function RIGHT
t/t4018/fortran-external-function.ctx deleted +0 -1
@@ -1 +0,0 @@ -function RIGHT(a, b) result(c)
t/t4018/fortran-external-subroutine deleted +0 -5
@@ -1,5 +0,0 @@ -subroutine RIGHT - -real ChangeMe - -end subroutine RIGHT
t/t4018/fortran-external-subroutine.ctx deleted +0 -1
@@ -1 +0,0 @@ -subroutine RIGHT
t/t4018/fortran-module deleted +0 -5
@@ -1,5 +0,0 @@ -module RIGHT - -use ChangeMe - -end module RIGHT
t/t4018/fortran-module-procedure deleted +0 -13
@@ -1,13 +0,0 @@ - module RIGHT - - implicit none - private - - interface letters ! generic interface - module procedure aaaa, & - bbbb, & - ChangeMe, & - dddd - end interface - -end module RIGHT
t/t4018/fortran-module-procedure.ctx deleted +0 -1
@@ -1 +0,0 @@ -module RIGHT
t/t4018/fortran-module.ctx deleted +0 -1
@@ -1 +0,0 @@ -module RIGHT
t/t4018/fortran-program deleted +0 -5
@@ -1,5 +0,0 @@ -program RIGHT - -call ChangeMe - -end program RIGHT
t/t4018/fortran-program.ctx deleted +0 -1
@@ -1 +0,0 @@ -program RIGHT
t/t4018/fortran.sh new file +159 -0
159 lines not on this page · raw message
t/t4018/fountain-scene deleted +0 -4
@@ -1,4 +0,0 @@ -EXT. STREET RIGHT OUTSIDE - DAY - -CHARACTER -You didn't say the magic phrase, "ChangeMe".
t/t4018/fountain-scene.ctx deleted +0 -1
@@ -1 +0,0 @@ -EXT. STREET RIGHT OUTSIDE - DAY
t/t4018/fountain.sh new file +14 -0
@@ -0,0 +1,14 @@ +#!/bin/sh +# +# See ../t4018-diff-funcname.sh's test_diff_funcname() +# + +test_diff_funcname 'fountain: scene' \ + 8<<\EOF_HUNK 9<<\EOF_TEST +EXT. STREET RIGHT OUTSIDE - DAY +EOF_HUNK +EXT. STREET RIGHT OUTSIDE - DAY + +CHARACTER +You didn't say the magic phrase, "ChangeMe". +EOF_TEST
t/t4018/golang-complex-function deleted +0 -8
@@ -1,8 +0,0 @@ -type Test struct { - a Type -} - -func (t *Test) RIGHT(a Type) (Type, error) { - t.a = a - return ChangeMe, nil -}
t/t4018/golang-complex-function.ctx deleted +0 -1
@@ -1 +0,0 @@ -func (t *Test) RIGHT(a Type) (Type, error) {
t/t4018/golang-func deleted +0 -4
@@ -1,4 +0,0 @@ -func RIGHT() { - a := 5 - b := ChangeMe -}
t/t4018/golang-func.ctx deleted +0 -1
@@ -1 +0,0 @@ -func RIGHT() {
t/t4018/golang-interface deleted +0 -4
@@ -1,4 +0,0 @@ -type RIGHT interface { - a() Type - b() ChangeMe -}
t/t4018/golang-interface.ctx deleted +0 -1
@@ -1 +0,0 @@ -type RIGHT interface {
t/t4018/golang-long-func deleted +0 -5
@@ -1,5 +0,0 @@ -func RIGHT(aVeryVeryVeryLongVariableName AVeryVeryVeryLongType, - anotherLongVariableName AnotherLongType) { - a := 5 - b := ChangeMe -}
t/t4018/golang-long-func.ctx deleted +0 -1
@@ -1 +0,0 @@ -func RIGHT(aVeryVeryVeryLongVariableName AVeryVeryVeryLongType,
t/t4018/golang-struct deleted +0 -4
@@ -1,4 +0,0 @@ -type RIGHT struct { - a Type - b ChangeMe -}
t/t4018/golang-struct.ctx deleted +0 -1
@@ -1 +0,0 @@ -type RIGHT struct {
t/t4018/golang.sh new file +59 -0
59 lines not on this page · raw message
t/t4018/java-class-member-function deleted +0 -8
@@ -1,8 +0,0 @@ -public class Beer -{ - int special; - public static void main(String RIGHT[]) - { - System.out.print("ChangeMe"); - } -}
t/t4018/java-class-member-function.ctx deleted +0 -1
@@ -1 +0,0 @@ -public static void main(String RIGHT[])
t/t4018/java.sh new file +18 -0
@@ -0,0 +1,18 @@ +#!/bin/sh +# +# See ../t4018-diff-funcname.sh's test_diff_funcname() +# + +test_diff_funcname 'java: class member function' \ + 8<<\EOF_HUNK 9<<\EOF_TEST +public static void main(String RIGHT[]) +EOF_HUNK +public class Beer +{ + int special; + public static void main(String RIGHT[]) + { + System.out.print("ChangeMe"); + } +} +EOF_TEST
t/t4018/markdown-heading-indented deleted +0 -6
@@ -1,6 +0,0 @@ -Indented headings are allowed, as long as the indent is no more than 3 spaces. - - ### RIGHT - -- something -- ChangeMe
t/t4018/markdown-heading-indented.ctx deleted +0 -1
@@ -1 +0,0 @@ - ### RIGHT
t/t4018/markdown-heading-non-headings deleted +0 -17
@@ -1,17 +0,0 @@ -Headings can be right next to other lines of the file: -# RIGHT -Indents of four or more spaces make a code block: - - # code comment, not heading - -If there's no space after the final hash, it's not a heading: - -#hashtag - -Sequences of more than 6 hashes don't make a heading: - -####### over-enthusiastic heading - -So the detected heading should be right up at the start of this file. - -ChangeMe
t/t4018/markdown-heading-non-headings.ctx deleted +0 -1
@@ -1 +0,0 @@ -# RIGHT
t/t4018/markdown.sh new file +39 -0
@@ -0,0 +1,39 @@ +#!/bin/sh +# +# See ../t4018-diff-funcname.sh's test_diff_funcname() +# + +test_diff_funcname 'markdown: heading indented' \ + 8<<\EOF_HUNK 9<<\EOF_TEST + ### RIGHT +EOF_HUNK +Indented headings are allowed, as long as the indent is no more than 3 spaces. + + ### RIGHT + +- something +- ChangeMe +EOF_TEST + +test_diff_funcname 'markdown: heading non headings' \ + 8<<\EOF_HUNK 9<<\EOF_TEST +# RIGHT +EOF_HUNK +Headings can be right next to other lines of the file: +# RIGHT +Indents of four or more spaces make a code block: + + # code comment, not heading + +If there's no space after the final hash, it's not a heading: + +#hashtag + +Sequences of more than 6 hashes don't make a heading: + +####### over-enthusiastic heading + +So the detected heading should be right up at the start of this file. + +ChangeMe +EOF_TEST
t/t4018/matlab-class-definition deleted +0 -5
@@ -1,5 +0,0 @@ -classdef RIGHT - properties - ChangeMe - end -end
t/t4018/matlab-class-definition.ctx deleted +0 -1
@@ -1 +0,0 @@ -classdef RIGHT
t/t4018/matlab-function deleted +0 -4
@@ -1,4 +0,0 @@ -function y = RIGHT() -x = 5; -y = ChangeMe + x; -end
t/t4018/matlab-function.ctx deleted +0 -1
@@ -1 +0,0 @@ -function y = RIGHT()
t/t4018/matlab-octave-section-1 deleted +0 -3
@@ -1,3 +0,0 @@ -%%% RIGHT section -# this is octave script -ChangeMe = 1;
t/t4018/matlab-octave-section-1.ctx deleted +0 -1
@@ -1 +0,0 @@ -%%% RIGHT section
t/t4018/matlab-octave-section-2 deleted +0 -3
@@ -1,3 +0,0 @@ -## RIGHT section -# this is octave script -ChangeMe = 1;
t/t4018/matlab-octave-section-2.ctx deleted +0 -1
@@ -1 +0,0 @@ -## RIGHT section
t/t4018/matlab-section deleted +0 -3
@@ -1,3 +0,0 @@ -%% RIGHT section -% this is understood by both matlab and octave -ChangeMe = 1;
t/t4018/matlab-section.ctx deleted +0 -1
@@ -1 +0,0 @@ -%% RIGHT section
t/t4018/matlab.sh new file +52 -0
52 lines not on this page · raw message
t/t4018/perl-skip-end-of-heredoc deleted +0 -8
@@ -1,8 +0,0 @@ -sub RIGHTwithheredocument { - print <<"EOF" -decoy here-doc -EOF - # some lines of context - # to pad it out - print "ChangeMe\n"; -}
t/t4018/perl-skip-end-of-heredoc.ctx deleted +0 -1
@@ -1 +0,0 @@ -sub RIGHTwithheredocument {
t/t4018/perl-skip-forward-decl deleted +0 -10
@@ -1,10 +0,0 @@ -package RIGHT; - -use strict; -use warnings; -use parent qw(Exporter); -our @EXPORT_OK = qw(round finalround); - -sub other; # forward declaration - -# ChangeMe
t/t4018/perl-skip-forward-decl.ctx deleted +0 -1
@@ -1 +0,0 @@ -package RIGHT;
t/t4018/perl-skip-sub-in-pod deleted +0 -18
@@ -1,18 +0,0 @@ -=head1 NAME - -Beer - subroutine to output fragment of a drinking song - -=head1 SYNOPSIS_RIGHT - - use Beer qw(round finalround); - - sub song { - for (my $i = 99; $i > 0; $i--) { - round $i; - } - finalround; - } - - ChangeMe; - -=cut
t/t4018/perl-skip-sub-in-pod.ctx deleted +0 -1
@@ -1 +0,0 @@ -=head1 SYNOPSIS_RIGHT
t/t4018/perl-sub-definition deleted +0 -4
@@ -1,4 +0,0 @@ -sub RIGHT { - my ($n) = @_; - print "ChangeMe"; -}
t/t4018/perl-sub-definition-kr-brace deleted +0 -4
@@ -1,4 +0,0 @@ -sub RIGHT -{ - print "ChangeMe\n"; -}
t/t4018/perl-sub-definition-kr-brace.ctx deleted +0 -1
@@ -1 +0,0 @@ -sub RIGHT
t/t4018/perl-sub-definition.ctx deleted +0 -1
@@ -1 +0,0 @@ -sub RIGHT {
t/t4018/perl.sh new file +78 -0
78 lines not on this page · raw message
t/t4018/php-abstract-class deleted +0 -4
@@ -1,4 +0,0 @@ -abstract class RIGHT -{ - const FOO = 'ChangeMe'; -}
t/t4018/php-abstract-class.ctx deleted +0 -1
@@ -1 +0,0 @@ -abstract class RIGHT
t/t4018/php-abstract-method deleted +0 -7
@@ -1,7 +0,0 @@ -abstract class Klass -{ - abstract public function RIGHT(): ?string - { - return 'ChangeMe'; - } -}
t/t4018/php-abstract-method.ctx deleted +0 -1
@@ -1 +0,0 @@ -abstract public function RIGHT(): ?string
t/t4018/php-class deleted +0 -4
@@ -1,4 +0,0 @@ -class RIGHT -{ - const FOO = 'ChangeMe'; -}
t/t4018/php-class.ctx deleted +0 -1
@@ -1 +0,0 @@ -class RIGHT
t/t4018/php-final-class deleted +0 -4
@@ -1,4 +0,0 @@ -final class RIGHT -{ - const FOO = 'ChangeMe'; -}
t/t4018/php-final-class.ctx deleted +0 -1
@@ -1 +0,0 @@ -final class RIGHT
t/t4018/php-final-method deleted +0 -7
@@ -1,7 +0,0 @@ -class Klass -{ - final public function RIGHT(): string - { - return 'ChangeMe'; - } -}
t/t4018/php-final-method.ctx deleted +0 -1
@@ -1 +0,0 @@ -final public function RIGHT(): string
t/t4018/php-function deleted +0 -4
@@ -1,4 +0,0 @@ -function RIGHT() -{ - return 'ChangeMe'; -}
t/t4018/php-function.ctx deleted +0 -1
@@ -1 +0,0 @@ -function RIGHT()
t/t4018/php-interface deleted +0 -4
@@ -1,4 +0,0 @@ -interface RIGHT -{ - public function foo($ChangeMe); -}
t/t4018/php-interface.ctx deleted +0 -1
@@ -1 +0,0 @@ -interface RIGHT
t/t4018/php-method deleted +0 -7
@@ -1,7 +0,0 @@ -class Klass -{ - public static function RIGHT() - { - return 'ChangeMe'; - } -}
t/t4018/php-method.ctx deleted +0 -1
@@ -1 +0,0 @@ -public static function RIGHT()
t/t4018/php-trait deleted +0 -7
@@ -1,7 +0,0 @@ -trait RIGHT -{ - public function foo($ChangeMe) - { - return 'foo'; - } -}
t/t4018/php-trait.ctx deleted +0 -1
@@ -1 +0,0 @@ -trait RIGHT
t/t4018/php.sh new file +106 -0
106 lines not on this page · raw message
t/t4018/python-async-def deleted +0 -4
@@ -1,4 +0,0 @@ -async def RIGHT(pi: int = 3.14): - while True: - break - return ChangeMe()
t/t4018/python-async-def.ctx deleted +0 -1
@@ -1 +0,0 @@ -async def RIGHT(pi: int = 3.14):
t/t4018/python-class deleted +0 -4
@@ -1,4 +0,0 @@ -class RIGHT(int, str): - # comment - # another comment - # ChangeMe
t/t4018/python-class.ctx deleted +0 -1
@@ -1 +0,0 @@ -class RIGHT(int, str):
t/t4018/python-def deleted +0 -4
@@ -1,4 +0,0 @@ -def RIGHT(pi: int = 3.14): - while True: - break - return ChangeMe()
t/t4018/python-def.ctx deleted +0 -1
@@ -1 +0,0 @@ -def RIGHT(pi: int = 3.14):
t/t4018/python-indented-async-def deleted +0 -7
@@ -1,7 +0,0 @@ -class Foo: - async def RIGHT(self, x: int): - return [ - 1, - 2, - ChangeMe, - ]
t/t4018/python-indented-async-def.ctx deleted +0 -1
@@ -1 +0,0 @@ -async def RIGHT(self, x: int):
t/t4018/python-indented-class deleted +0 -5
@@ -1,5 +0,0 @@ -if TYPE_CHECKING: - class RIGHT: - # comment - # another comment - # ChangeMe
t/t4018/python-indented-class.ctx deleted +0 -1
@@ -1 +0,0 @@ -class RIGHT:
t/t4018/python-indented-def deleted +0 -7
@@ -1,7 +0,0 @@ -class Foo: - def RIGHT(self, x: int): - return [ - 1, - 2, - ChangeMe, - ]
t/t4018/python-indented-def.ctx deleted +0 -1
@@ -1 +0,0 @@ -def RIGHT(self, x: int):
t/t4018/python.sh new file +71 -0
71 lines not on this page · raw message
t/t4018/rust-fn deleted +0 -5
@@ -1,5 +0,0 @@ -pub(self) fn RIGHT<T>(x: &[T]) where T: Debug { - let _ = x; - // a comment - let a = ChangeMe; -}
t/t4018/rust-fn.ctx deleted +0 -1
@@ -1 +0,0 @@ -pub(self) fn RIGHT<T>(x: &[T]) where T: Debug {
t/t4018/rust-impl deleted +0 -5
@@ -1,5 +0,0 @@ -impl<'a, T: AsRef<[u8]>> std::RIGHT for Git<'a> { - - pub fn ChangeMe(&self) -> () { - } -}
t/t4018/rust-impl.ctx deleted +0 -1
@@ -1 +0,0 @@ -impl<'a, T: AsRef<[u8]>> std::RIGHT for Git<'a> {
t/t4018/rust-macro-rules deleted +0 -6
@@ -1,6 +0,0 @@ -macro_rules! RIGHT { - () => { - // a comment - let x = ChangeMe; - }; -}
t/t4018/rust-macro-rules.ctx deleted +0 -1
@@ -1 +0,0 @@ -macro_rules! RIGHT {
t/t4018/rust-struct deleted +0 -5
@@ -1,5 +0,0 @@ -#[derive(Debug)] -pub(super) struct RIGHT<'a> { - name: &'a str, - age: ChangeMe, -}
t/t4018/rust-struct.ctx deleted +0 -1
@@ -1 +0,0 @@ -pub(super) struct RIGHT<'a> {
t/t4018/rust-trait deleted +0 -5
@@ -1,5 +0,0 @@ -unsafe trait RIGHT<T> { - fn len(&self) -> u32; - fn ChangeMe(&self, n: u32) -> T; - fn iter<F>(&self, f: F) where F: Fn(T); -}
t/t4018/rust-trait.ctx deleted +0 -1
@@ -1 +0,0 @@ -unsafe trait RIGHT<T> {
t/t4018/rust.sh new file +60 -0
60 lines not on this page · raw message
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7
PATCH 9/20 blame tests: don't rely on t/t4018/ directory
In reply to Ævar Arnfjörð BjarmasonRefactor a test added in 9466e3809d (blame: enable funcname blaming with userdiff driver, 2020-11-01) so that the blame tests don't rely on stealing the contents of "t/t4018/fortran-external-function".
I'm about to refactor that directory, just moving the relevant test file here inline is the easiest solution, and I think also the most readable.
--- t/annotate-tests.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
t/annotate-tests.sh +13 -3
@@ -482,12 +482,22 @@ test_expect_success 'blame -L ^:RE (absolute: end-of-file)' ' test_expect_success 'setup -L :funcname with userdiff driver' ' echo "fortran-* diff=fortran" >.gitattributes && fortran_file=fortran-external-function && - orig_file="$TEST_DIRECTORY/t4018/$fortran_file" && - cp "$orig_file" . && + cat >$fortran_file <<-\EOF && + function RIGHT(a, b) result(c) + + integer, intent(in) :: ChangeMe + integer, intent(in) :: b + integer, intent(out) :: c + + c = a+b + + end function RIGHT + EOF git add "$fortran_file" && GIT_AUTHOR_NAME="A" GIT_AUTHOR_EMAIL="[email protected]" \ git commit -m "add fortran file" && - sed -e "s/ChangeMe/IWasChanged/" <"$orig_file" >"$fortran_file" && + sed -e "s/ChangeMe/IWasChanged/" <"$fortran_file" >"$fortran_file".tmp && + mv "$fortran_file".tmp "$fortran_file" && git add "$fortran_file" && GIT_AUTHOR_NAME="B" GIT_AUTHOR_EMAIL="[email protected]" \ git commit -m "change fortran file"
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7
PATCH 10/20 userdiff tests: move custom patterns into one test file
In reply to Ævar Arnfjörð BjarmasonIn a preceding commit the test infrastructure got rewritten so "t/t4018/" are now normal test files which can do things like set config, so let's make it responsible for setting up and tearing down the config for its tests.
--- t/t4018-diff-funcname.sh | 16 +------- t/t4018/custom.sh | 84 ++++++++++++++++++++++++++++++++++++++++ t/t4018/custom1.sh | 27 ------------- t/t4018/custom2.sh | 18 --------- t/t4018/custom3.sh | 27 ------------- 5 files changed, 85 insertions(+), 87 deletions(-) create mode 100755 t/t4018/custom.sh delete mode 100755 t/t4018/custom1.sh delete mode 100755 t/t4018/custom2.sh delete mode 100755 t/t4018/custom3.sh
t/t4018-diff-funcname.sh +1 -15
@@ -12,18 +12,6 @@ test_expect_success 'setup' ' test_file_not_empty builtin-drivers && builtin_drivers=$(cat builtin-drivers) && - # 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).*)$" && - # for regexp compilation tests echo A >A.java && echo B >B.java
@@ -31,9 +19,7 @@ test_expect_success 'setup' ' diffpatterns=" $builtin_drivers - custom1 - custom2 - custom3 + custom " for p in $diffpatterns
t/t4018/custom.sh new file +84 -0
84 lines not on this page · raw message
t/t4018/custom1.sh deleted +0 -27
@@ -1,27 +0,0 @@ -#!/bin/sh -# -# See ../t4018-diff-funcname.sh's test_diff_funcname() -# - -test_diff_funcname 'custom1: pattern' \ - 8<<\EOF_HUNK 9<<\EOF_TEST -int special, RIGHT; -EOF_HUNK -public class Beer -{ - int special, RIGHT; - public static void main(String args[]) - { - String s=" "; - for(int x = 99; x > 0; x--) - { - System.out.print(x + " bottles of beer on the wall " - + x + " bottles of beer\n" // ChangeMe - + "Take one down, pass it around, " + (x - 1) - + " bottles of beer on the wall.\n"); - } - System.out.print("Go to the store, buy some more,\n" - + "99 bottles of beer on the wall.\n"); - } -} -EOF_TEST
t/t4018/custom2.sh deleted +0 -18
@@ -1,18 +0,0 @@ -#!/bin/sh -# -# See ../t4018-diff-funcname.sh's test_diff_funcname() -# - -test_diff_funcname 'custom2: match to end of line' \ - 8<<\EOF_HUNK 9<<\EOF_TEST -RIGHT_Beer -EOF_HUNK -public class RIGHT_Beer -{ - int special; - public static void main(String args[]) - { - System.out.print("ChangeMe"); - } -} -EOF_TEST
t/t4018/custom3.sh deleted +0 -27
@@ -1,27 +0,0 @@ -#!/bin/sh -# -# See ../t4018-diff-funcname.sh's test_diff_funcname() -# - -test_diff_funcname 'custom3: alternation in pattern' \ - 8<<\EOF_HUNK 9<<\EOF_TEST -public static void main(String RIGHT[]) -EOF_HUNK -public class Beer -{ - int special; - public static void main(String RIGHT[]) - { - String s=" "; - for(int x = 99; x > 0; x--) - { - System.out.print(x + " bottles of beer on the wall " - + x + " bottles of beer\n" // ChangeMe - + "Take one down, pass it around, " + (x - 1) - + " bottles of beer on the wall.\n"); - } - System.out.print("Go to the store, buy some more,\n" - + "99 bottles of beer on the wall.\n"); - } -} -EOF_TEST
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7
PATCH 11/20 userdiff tests: remove hack for "RIGHT" token
In reply to Ævar Arnfjörð BjarmasonNow that the "RIGHT" token isn't how we select the desired hunk header line in the test anymore we can revert a hack added in f1b75fbaf1 (t4018: convert custom pattern test to the new infrastructure, 2014-03-21) and go back to the regular expression we were testing before that change.
--- t/t4018/custom.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
t/t4018/custom.sh +3 -3
@@ -33,14 +33,14 @@ public class Beer EOF_TEST test_expect_success 'custom: setup match to end of line' ' - git config diff.custom.funcname "......Beer\$" + git config diff.custom.funcname "Beer\$" ' test_diff_funcname 'custom: match to end of line' \ 8<<\EOF_HUNK 9<<\EOF_TEST -RIGHT_Beer +Beer EOF_HUNK -public class RIGHT_Beer +public class Beer { int special; public static void main(String args[])
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7
PATCH 12/20 userdiff: match "package" in diff=golang
In reply to Ævar Arnfjörð BjarmasonImprove the "golang" built-in pattern to match "package" lines, as they weren't matched before changing e.g. the imports would commonly result in an empty hunk header, now we'll instead show the package name.
--- t/t4018/golang.sh | 10 ++++++++++ userdiff.c | 2 ++ 2 files changed, 12 insertions(+)
t/t4018/golang.sh +10 -0
@@ -3,6 +3,16 @@ # See ../t4018-diff-funcname.sh's test_diff_funcname() # +test_diff_funcname 'golang: package' \ + 8<<\EOF_HUNK 9<<\EOF_TEST +package main +EOF_HUNK +package main + +import "fmt" +// ChangeMe +EOF_TEST + test_diff_funcname 'golang: complex function' \ 8<<\EOF_HUNK 9<<\EOF_TEST func (t *Test) RIGHT(a Type) (Type, error) {
userdiff.c +2 -0
@@ -124,6 +124,8 @@ IPATTERN("fortran",IPATTERN ("fountain" ,"^((\\.[^.]|(int|ext|est|int\\.?/ext|i/e)[. ]).*)$" ,"[^ \t-]+" ),PATTERNS ("golang" , +/* Packages */ +"^[ \t]*(package[ \t]*(.*))\n" /* Functions */ "^[ \t]*(func[ \t]*.*(\\{[ \t]*)?)\n" /* Structs and interfaces */
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7
PATCH 13/20 userdiff tests + docs: document & test "diff.<driver>.x?funcname"
In reply to Ævar Arnfjörð BjarmasonAdd the missing documentation for "diff.<driver>.funcname" and test for how it and "diff.<driver>.xfuncname" interact.
Between the introduction of the "diff.<driver>.xfuncname" form in 45d9414fa5 (diff.*.xfuncname which uses "extended" regex's for hunk header selection, 2008-09-18) and when this documentation was written in 90b94c26f7 (Documentation: Add diff.<driver>.* to config, 2011-04-07) we forgot to document the existence of "diff.<driver>.funcname".
Let's make a mention of it here, we could also partially revert the former commit and discuss the more verbose form in gitattributes(5), but let's stop short of that. It makes sense to guide users towards ERE over BRE whenever possible.
--- Documentation/config/diff.txt | 12 +++++++++++ t/t4018/custom.sh | 40 +++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+)
Documentation/config/diff.txt +12 -0
@@ -153,10 +153,22 @@ diff.<driver>.command:: The custom diff driver command. See linkgit:gitattributes[5] for details. +diff.<driver>.funcname:: diff.<driver>.xfuncname:: The regular expression that the diff driver should use to recognize the hunk header. A built-in pattern may also be used. See linkgit:gitattributes[5] for details. ++ +When provided as `diff.<driver>.funcname` the regular expression is +interpreted as a basic regular expression, with +`diff.<driver>.xfuncname` it's interpreted as an extended regular +expression. ++ + +The `*.funcname` and `*.xfuncname` variables behave as if though they +were one configuration variable for the purposes of what value +eventually gets used. Setting `*.funcname` will override an earlier +`*.xfuncname` and vice-versa. diff.<driver>.binary:: Set this option to true to make the diff driver treat files as
t/t4018/custom.sh +40 -0
@@ -78,6 +78,46 @@ public class Beer } EOF_TEST +test_expect_success 'custom; setup config precedence' ' + git config diff.custom.funcname "foo" && + git config diff.custom.xfuncname "bar" +' + +test_diff_funcname 'custom: config precedence' \ + 8<<\EOF_HUNK 9<<\EOF_TEST +bar +EOF_HUNK +foo +bar + +ChangeMe + +baz +EOF_TEST + +test_expect_success 'custom: teardown' ' + test_unconfig diff.custom.funcname && + test_unconfig diff.custom.xfuncname +' + +test_expect_success 'custom; setup config precedence' ' + git config diff.custom.xfuncname "bar" && + git config diff.custom.funcname "foo" + +' + +test_diff_funcname 'custom: config precedence' \ + 8<<\EOF_HUNK 9<<\EOF_TEST +foo +EOF_HUNK +foo +bar + +ChangeMe + +baz +EOF_TEST + test_expect_success 'custom: teardown' ' test_unconfig diff.custom.funcname && test_unconfig diff.custom.xfuncname
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7
Re: [PATCH 13/20] userdiff tests + docs: document & test "diff.<driver>.x?funcname"
Quoted 7 lines · Ævar Arnfjörð Bjarmason
Add the missing documentation for "diff.<driver>.funcname" and test for how it and "diff.<driver>.xfuncname" interact.
[...]Signed-off-by Ævar Arnfjörð Bjarmason <[email protected]>---
Documentation/config/diff.txt diff.<driver>.command:: · line 160
Quoted 8 lines
Documentation/config/diff.txt +4
-0@@ -153,10 +153,22 @@ diff.<driver>.command:: +diff.<driver>.funcname:: diff.<driver>.xfuncname:: The regular expression that the diff driver should use to recognize the hunk header. A built-in pattern may also be used. See linkgit:gitattributes[5] for details. ++ +When provided as `diff.<driver>.funcname` the regular expression is +interpreted as a basic regular expression, with
This would be easier to understand: s/, with/. With/
Documentation/config/diff.txt diff.<driver>.command:: · line 171
Quoted 8 lines
Documentation/config/diff.txt +8
-0+`diff.<driver>.xfuncname` it's interpreted as an extended regular +expression. ++ + +The `*.funcname` and `*.xfuncname` variables behave as if though they +were one configuration variable for the purposes of what value +eventually gets used. Setting `*.funcname` will override an earlier +`*.xfuncname` and vice-versa.
Extra blank line before this paragraph?
PATCH 14/20 gitattributes doc: reword discussion of built-in userdiff patterns
In reply to Ævar Arnfjörð BjarmasonReword the discussion of the built-in userdiff patterns to make it more natural to precede it with a discussion about the semantics of pattern matching, instead of assuming that it follows right after the "diff.tex.xfuncname" example which now immediately precedes it. This will make a follow-up commit smaller.
--- Documentation/gitattributes.txt | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
Documentation/gitattributes.txt +11 -5
@@ -794,11 +794,17 @@ backslashes; the pattern above picks a line that begins with a backslash, and zero or more occurrences of `sub` followed by `section` followed by open brace, to the end of line. -There are a few built-in patterns to make this easier, and `tex` -is one of them, so you do not have to write the above in your -configuration file (you still need to enable this with the -attribute mechanism, via `.gitattributes`). The following built in -patterns are available: +There are built-in patterns shipped as part of git itself. A more +advanced version of the `tex` pattern discussed above is one of them. + +For built-in patterns you do not need the "diff.tex.xfuncname" +discussed above in your configuration file, but if present it'll +override the built-in pattern. + +You still need to enable built-in patterns with the the attribute +mechanism, via `.gitattributes`). + +The following built in patterns are available: - `ada` suitable for source code in the Ada language.
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7
Re: [PATCH 14/20] gitattributes doc: reword discussion of built-in userdiff patterns
Quoted 11 lines · Ævar Arnfjörð Bjarmason
Reword the discussion of the built-in userdiff patterns to make it more natural to precede it with a discussion about the semantics of pattern matching, instead of assuming that it follows right after the "diff.tex.xfuncname" example which now immediately precedes it. This will make a follow-up commit smaller.
Signed-off-by Ævar Arnfjörð Bjarmason <[email protected]>---
Documentation/gitattributes.txt +0
-1@@ -794,11 +794,17 @@ backslashes; the pattern above picks a line that begins with a -There are a few built-in patterns to make this easier, and `tex`
Documentation/gitattributes.txt backslashes; the pattern above picks a line that begins with a · line 799
Quoted 10 lines
Documentation/gitattributes.txt +6
-4-is one of them, so you do not have to write the above in your -configuration file (you still need to enable this with the -attribute mechanism, via `.gitattributes`). The following built in -patterns are available: +There are built-in patterns shipped as part of git itself. A more +advanced version of the `tex` pattern discussed above is one of them. + +For built-in patterns you do not need the "diff.tex.xfuncname" +discussed above in your configuration file, but if present it'll +override the built-in pattern.
The literal "diff.tex.xfuncname" now feels disconnected from what is being said, especially as it is preceded by a reference to generic "built-in patterns". Perhaps it would make sense to generalize it a bit to diff.<lang>.xfuncname. For instance:
For built-in patterns, you do not need diff.<lang>.xfuncname in your configuration file as discussed above, but if present, it will override a built-in pattern.
Documentation/gitattributes.txt backslashes; the pattern above picks a line that begins with a · line 805
Quoted 2 lines
Documentation/gitattributes.txt +2
-0+You still need to enable built-in patterns with the the attribute +mechanism, via `.gitattributes`).
s/the the/the/
Although you're simply re-using the existing text, it also now feels disconnected. Perhaps:
Nevertheless, you need to enable built-in patterns via .gitattributes for the pattern to take effect.
PATCH 15/20 gitattributes doc: document multi-line userdiff patterns
In reply to Ævar Arnfjörð BjarmasonDocument the multi-line userdiff patterns and how their matching and the negation syntax works.
These patterns have been supported since f258475a6e (Per-path attribute based hunk header selection., 2007-07-06), and have had their current semantics ever since 3d8dccd74a (diff: fix "multiple regexp" semantics to find hunk header comment, 2008-09-20).
But we had no documentation for them, let's fix that, and also add tests showing how some of the things being discussed here work.
--- Documentation/gitattributes.txt | 17 ++++++++++++++++ t/t4018/custom.sh | 35 +++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+)
Documentation/gitattributes.txt +17 -0
@@ -794,6 +794,23 @@ backslashes; the pattern above picks a line that begins with a backslash, and zero or more occurrences of `sub` followed by `section` followed by open brace, to the end of line. +Multiple patterns can be supplied by seperating them with +newlines. They will be matched one at a time and are compiled as +separate patterns, and thus the first capture in each such pattern is +`$1`, see further discussion of captures below. + +Patterns that begin with "!" are negated (to match a literal "!" at +the start of a line use e.g. "[!]"). A matching negated pattern will +cause the matching line to be skipped. Use it to blacklist otherwise +matching non-negated patterns. The last pattern must not be negated, +we'll error out if that's the case. + +If the pattern contains a `$1` capture it will be used instead of the +entire matching line (`$0`) to display the hunk header. This can be +used e.g. to strip whitespace from the beginning of the line, or to +only display the function name as part of a longer function +definition. + There are built-in patterns shipped as part of git itself. A more advanced version of the `tex` pattern discussed above is one of them.
t/t4018/custom.sh +35 -0
@@ -122,3 +122,38 @@ test_expect_success 'custom: teardown' ' test_unconfig diff.custom.funcname && test_unconfig diff.custom.xfuncname ' + +test_expect_success 'custom: negation syntax, ! is magic' ' + git config diff.custom.xfuncname "!negation +line" +' + +test_diff_funcname 'custom: config precedence' \ + 8<<\EOF_HUNK 9<<\EOF_TEST +line +EOF_HUNK +line +!negation + +ChangeMe + +baz +EOF_TEST + +test_expect_success 'custom: negation syntax, use [!] to override ! magic' ' + git config diff.custom.xfuncname "[!]negation +line" +' + +test_diff_funcname 'custom: config precedence' \ + 8<<\EOF_HUNK 9<<\EOF_TEST +!negation +EOF_HUNK +line +!negation + +ChangeMe + +baz +EOF_TEST +
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7
Re: [PATCH 15/20] gitattributes doc: document multi-line userdiff patterns
This is extremely trivial, just something to consider if you are already doing a reroll:
Documentation/gitattributes.txt backslashes; the pattern above picks a line that begins with a · line 800
Quoted 12 lines · Ævar Arnfjörð Bjarmason
Documentation/gitattributes.txt +4
-0@@ -794,6 +794,23 @@ backslashes; the pattern above picks a line that begins with a backslash, and zero or more occurrences of `sub` followed by `section` followed by open brace, to the end of line. +Multiple patterns can be supplied by seperating them with +newlines. They will be matched one at a time and are compiled as +separate patterns, and thus the first capture in each such pattern is +`$1`, see further discussion of captures below.
This is a comma splice (https://en.wikipedia.org/wiki/Comma_splice).
Use a period or semicolon to fix it.
(overall comment, haven't quite finished scanning the series yet but it looks good!)
Chris
Re: [PATCH 15/20] gitattributes doc: document multi-line userdiff patterns
In reply to Ævar Arnfjörð BjarmasonDocumentation/gitattributes.txt backslashes; the pattern above picks a line that begins with a · line 794
Quoted 8 lines · Ævar Arnfjörð Bjarmason
Document the multi-line userdiff patterns and how their matching and the negation syntax works.
[...]Signed-off-by Ævar Arnfjörð Bjarmason <[email protected]>---
Documentation/gitattributes.txt +1
-0@@ -794,6 +794,23 @@ backslashes; the pattern above picks a line that begins with a +Multiple patterns can be supplied by seperating them with
s/seperating/separating/
Documentation/gitattributes.txt backslashes; the pattern above picks a line that begins with a · line 800
Quoted 3 lines
Documentation/gitattributes.txt +3
-0+newlines. They will be matched one at a time and are compiled as +separate patterns, and thus the first capture in each such pattern is +`$1`, see further discussion of captures below.
I found the wording "separating them with newlines" ambiguous. I couldn't figure out if that meant that there must be a blank line between patterns. Would it be more accurate to say merely that the patterns must be listed one per line?
Documentation/gitattributes.txt backslashes; the pattern above picks a line that begins with a · line 806
Quoted 5 lines
Documentation/gitattributes.txt +5
-0+Patterns that begin with "!" are negated (to match a literal "!" at +the start of a line use e.g. "[!]"). A matching negated pattern will +cause the matching line to be skipped. Use it to blacklist otherwise +matching non-negated patterns. The last pattern must not be negated, +we'll error out if that's the case.
The parenthesized comment makes it difficult to follow the discussion. Moving the comment to the end of the paragraph would make it easier to grok:
Patterns that begin with "!" are negated. A matching... ...error out if that's the case. To match a literal "!" at the start of a line, use "[!]".
I think, also, you want s/matching line/matched line/.
Chris's comma-splice comment also seems applicable for the last sentence in this paragraph.
PATCH 16/20 userdiff tests: remove "funcname" from custom3 test
In reply to Ævar Arnfjörð BjarmasonWe can only have one "funcname" or "xfuncname", any later definition overrides the earlier one, so this configuration wasn't doing anything.
When this test was originally added in 3632cfc248 (Use compatibility regex library for OSX/Darwin, 2008-09-07) we had no such definition of two patters for this test. Back then this was setting the "diff.java.funcname" configuration variable.
The stage for that second pattern being set got set later. In 45d9414fa5 (diff.*.xfuncname which uses "extended" regex's for hunk header selection, 2008-09-18) the pattern got converted from "funcname" to "xfuncname".
Soon after in b19d288b4d (t4018-diff-funcname: demonstrate end of line funcname matching flaw, 2008-10-15) another test immediately preceding this one got added, using "diff.java.funcname" for its configuration.
Then f792a0b88e (t4018 (funcname patterns): make configuration easier to track, 2011-05-21) came along and codified this whole thing when converting the two tests from "git config" to "test_config".
Since this was never the intent of the test let's just remove this, the rationale in f792a0b88e for having some test for the clobbering behavior makes sense, but I'll do that in another follow-up test, not as a hard to read side-effect of this one.
--- t/t4018/custom.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
t/t4018/custom.sh +1 -1
@@ -51,7 +51,6 @@ public class Beer EOF_TEST test_expect_success 'custom: setup alternation in pattern' ' - git config diff.custom.funcname "Beer$" && git config diff.custom.xfuncname "^[ ]*((public|static).*)$" '
@@ -133,6 +132,7 @@ test_diff_funcname 'custom: config precedence' \ line EOF_HUNK line + !negation ChangeMe
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7
PATCH 17/20 userdiff tests: factor out test_diff_funcname() logic
In reply to Ævar Arnfjörð BjarmasonFactor out logic in test_diff_funcname() into two helper functions, these will be useful in a follow-up commit where we'll do this munging in more than one place.
--- t/t4018-diff-funcname.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
t/t4018-diff-funcname.sh +13 -3
@@ -47,6 +47,17 @@ test_expect_success 'last regexp must not be negated' ' test_i18ngrep ": Last expression must not be negated:" msg ' +do_change_me () { + file=$1 + sed -e "s/ChangeMe/IWasChanged/" <"$file" >tmp && + mv tmp "$file" +} + +last_diff_context_line () { + file=$1 + sed -n -e "s/^.*@@\( \|$\)//p" <$file +} + test_diff_funcname () { desc=$1 cat <&8 >arg.header &&
@@ -57,13 +68,12 @@ test_diff_funcname () { cp arg.test "$what" && cp arg.header expected && git add "$what" && - sed -e "s/ChangeMe/IWasChanged/" <"$what" >tmp && - mv tmp "$what" + do_change_me "$what" ' && test_expect_success "$desc" ' git diff -U1 "$what" >diff && - sed -n -e "s/^.*@@\( \|$\)//p" <diff >actual && + last_diff_context_line diff >actual && test_cmp expected actual ' }
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7
PATCH 18/20 userdiff tests: test hunk headers on accumulated files
In reply to Ævar Arnfjörð BjarmasonThe existing tests in "t/t4018/" are unrealistic in that they're all setting up small few-line isolated test cases with one thing we could match as a hunk header, right above the one change in the file.
Expand those tests by accumulating changes within the same file type in the "test_diff_funcname" function. So e.g. for "bash" we'll end up a "bash.acc" file with 15 s/ChangeMe/IWasChanged/ changes.
This stress tests whether the hunk header selection will "jump across" to an earlier change because the match for that is greedier.
As it turns out we had one false positive in "t/t4018/cpp.sh" and "t4018/matlab.sh" because of how the tests were structured, we must always give the "ChangeMe" line at least one line of separation from the header, since it was at the end of those tests we'd select the "wrong" header. Let's adjust the spacing to compensate.
So in the end we found nothing of interest here, regardless, I think it is useful to continue to test in this mode. It's likely to aid in finding bugs in combinations of our positive and negative matching as we add more built-in patterns.
--- t/t4018-diff-funcname.sh | 19 +++++++++++++++++++ t/t4018/cpp.sh | 1 + t/t4018/matlab.sh | 3 +++ 3 files changed, 23 insertions(+)
t/t4018-diff-funcname.sh +19 -0
@@ -71,10 +71,24 @@ test_diff_funcname () { do_change_me "$what" ' && + test_expect_success "setup: $desc (accumulated)" ' + cat arg.test >>arg.tests && + cp arg.tests "$what".acc && + git add "$what".acc && + do_change_me "$what".acc + ' && + test_expect_success "$desc" ' git diff -U1 "$what" >diff && last_diff_context_line diff >actual && test_cmp expected actual + ' && + + test_expect_success "$desc (accumulated)" ' + git diff -U1 "$what".acc >diff && + last_diff_context_line diff >actual.lines && + tail -n 1 actual.lines >actual && + test_cmp expected actual ' }
@@ -92,6 +106,11 @@ do echo "$what" >arg.what ' && + test_expect_success "setup: hunk header for $what (accumulated)" ' + >arg.tests && + echo "$what.acc diff=$what" >>.gitattributes + ' && + . "$test" done
t/t4018/cpp.sh +1 -0
@@ -206,6 +206,7 @@ void wrong() struct RIGHT_iterator_tag {}; int ChangeMe; + EOF_TEST test_diff_funcname 'cpp: template function definition' \
t/t4018/matlab.sh +3 -0
@@ -31,6 +31,7 @@ EOF_HUNK %%% RIGHT section # this is octave script ChangeMe = 1; + EOF_TEST test_diff_funcname 'matlab: octave section 2' \
@@ -40,6 +41,7 @@ EOF_HUNK ## RIGHT section # this is octave script ChangeMe = 1; + EOF_TEST test_diff_funcname 'matlab: section' \
@@ -49,4 +51,5 @@ EOF_HUNK %% RIGHT section % this is understood by both matlab and octave ChangeMe = 1; + EOF_TEST
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7
PATCH 19/20 userdiff tests: test hunk header selection with -U0
In reply to Ævar Arnfjörð BjarmasonThe userdiff tests have used a custom -U1 context since f12c66b9bb (userdiff/perl: anchor "sub" and "package" patterns on the left, 2011-05-21). Changing it to -U0 doesn't change the results for any of the tests, except one.
Let's test for this case explicitly. I.e. that we go "beyond" the selected context to find our hunk header. In many cases the desired hunk header is part of the diff itself under -U1.
--- t/t4018-diff-funcname.sh | 13 +++++++++++++ t/t4018/custom.sh | 1 + 2 files changed, 14 insertions(+)
t/t4018-diff-funcname.sh +13 -0
@@ -63,6 +63,7 @@ test_diff_funcname () { cat <&8 >arg.header && cat <&9 >arg.test && what=$(cat arg.what) && + arg_diff_U0=$2 && test_expect_success "setup: $desc" ' cp arg.test "$what" &&
@@ -84,6 +85,18 @@ test_diff_funcname () { test_cmp expected actual ' && + test_expect_success "$desc -U0" ' + git diff -U0 "$what" >diff && + last_diff_context_line diff >actual && + if test -n "$arg_diff_U0" + then + echo "$arg_diff_U0" >new-expected && + test_cmp new-expected actual + else + test_cmp expected actual + fi + ' && + test_expect_success "$desc (accumulated)" ' git diff -U1 "$what".acc >diff && last_diff_context_line diff >actual.lines &&
t/t4018/custom.sh +1 -0
@@ -10,6 +10,7 @@ test_expect_success 'custom: setup non-trivial custom' ' ' test_diff_funcname 'custom: non-trivial custom pattern' \ + 'System.out.print(x + " bottles of beer on the wall "' \ 8<<\EOF_HUNK 9<<\EOF_TEST int special, RIGHT; EOF_HUNK
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7
PATCH 20/20 userdiff tests: assert empty hunk header context on -U<large>
In reply to Ævar Arnfjörð BjarmasonAssert the existing behavior that under -U<large> we'll show no hunk header context, where <large> takes us past the potential hunk header we'd have extracted. I'm just picking a number over nine thousand as a really large number we're unlikely to exceed in these tests.
--- t/t4018-diff-funcname.sh | 8 ++++++++ 1 file changed, 8 insertions(+)
t/t4018-diff-funcname.sh +8 -0
@@ -103,6 +103,14 @@ test_diff_funcname () { tail -n 1 actual.lines >actual && test_cmp expected actual ' + + test_expect_success "$desc -U9001 (accumulated)" ' + git diff -U9001 "$what".acc >diff && + last_diff_context_line diff >actual.lines && + tail -n 1 actual.lines >actual && + echo >blank && + test_cmp blank actual + ' } for what in $diffpatterns
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7
Quoted 18 lines · Ævar Arnfjörð Bjarmason
Quoted 10 lines · Johannes Sixt
Am 14.02.21 um 02:41 schrieb Ævar Arnfjörð Bjarmason:
Quoted 4 lines
Just a cursory "git log -p -- lisp" in emacs.git with your patch shows e.g. lisp/thingatpt.el where forms in a "defun" aren't indented (before it selects the "defun", after with yours it's a "put" in the middle of the function).
Note that negative matches can be specified. We use the feature in the cpp case to exclude public:/protected:/private: and label: that happen to be not indented. Perhaps that can be useful here?
Quoted 5 lines
Oh, and BTW, what the patterns treat as "function" must not match what the language treats as function. The purpose of the hunk header is to spot a place in the source file easily. So, it does not hurt if eval-and-compile forms are captured (as was mentioned in the linked thread) if desired.
Quoted 7 lines
Right, so having lots of test-case is helpful, e.g. for elisp maybe you have a top-level defun, maybe not, maybe the top-level is a "(progn" so you'd like a second-level more meaningful context, or maybe not...
Obviously these userdiff patterns aren't a general parser and will always be hit-and-miss, it's just useful to at least eyeball them against in-the-wild test data to check their sanity & add some tests.
Our intent with this patch is to rely on a heuristic that works for most cases. There will always be some case that is not covered. This point was made explicit in the relevant emacs-devel thread.
Quoted 8 lines
My cursory glance at the emacs.git version v.s. what's being submitted here is that this one does a worse job in *very common* cases.
Quoted 5 lines
Quoted 5 lines
Yours also changes it from e.g.:
@@ -61,7 +61,7 @@ forward-thing to: @@ -61,7 +61,7 @@ (defun forward-thing (thing &optional n)Is this really desired in elisp?
I think this is a matter of perspective and indeed a valid reason for doing this in emacs.git first.
For my part, I find the verbose style more informative, especially when it captures the previous form instead of the one directly around the diffed lines.
Perhaps one could add to that Emacs' ability to use the same name for different things, e.g. a function and a variable, where verbosity of this sort can help with disambiguation. Granted, we should not really on such a heading style to aid us in that task, though it may be something to consider.
Quoted 9 lines
Quoted 3 lines
It's common practice to extract the entire line (sans indentation if applicable), not just the function name. Why would somebody want the latter? It doesn't carry as much information as could be possible.
Because I'm familiar with the codebase I'm editing and I just need to know that the diff I'm viewing is on the "main" function, not that it's "
main()", "intmain(int argv, char **argv)", "intmain(const int argv, const char *argv[])", or to either have a " {" or not at the end depending on the project's coding style.
Oftentimes we produce/read patches for projects that we are not necessarily acquainted with. This includes emacs.git and the multitude of Elisp packages in that milieu. An extra element of contextuality can do us good.
It is true that familiarity with the code base will always benefit from succinct headings, though I feel that whenever we are in doubt we should err on the side of caution: which means that we must not introduce such an assumption to the workings of this piece of functionality.
Quoted 4 lines
I know our own userdiff builtin patterns don't do this, but it would be very useful to retrofit this capability / maybe make it a configurable feature, i.e. have them capture the meaningful part of the line, and you could either print it all, or just that part.
It would be nice to have an option that toggles verbosity. Though I guess this lies outside the scope of the patch in question.
In conclusion, I think we should decide on the next step forward: if you think this should be applied to emacs.git before making its way to git itself, then we can move the discussion there.
Thanks for your time and efforts!
Protesilaos or "Prot"
Signature · 2 lines
Protesilaos Stavrou protesilaos.com
Quoted 24 lines · Protesilaos Stavrou
Quoted 22 lines · Ævar Arnfjörð Bjarmason
Quoted 10 lines · Johannes Sixt
Am 14.02.21 um 02:41 schrieb Ævar Arnfjörð Bjarmason:
Quoted 4 lines
Just a cursory "git log -p -- lisp" in emacs.git with your patch shows e.g. lisp/thingatpt.el where forms in a "defun" aren't indented (before it selects the "defun", after with yours it's a "put" in the middle of the function).
Note that negative matches can be specified. We use the feature in the cpp case to exclude public:/protected:/private: and label: that happen to be not indented. Perhaps that can be useful here?
Quoted 5 lines
Oh, and BTW, what the patterns treat as "function" must not match what the language treats as function. The purpose of the hunk header is to spot a place in the source file easily. So, it does not hurt if eval-and-compile forms are captured (as was mentioned in the linked thread) if desired.
Right, so having lots of test-case is helpful, e.g. for elisp maybe you have a top-level defun, maybe not, maybe the top-level is a "(progn" so you'd like a second-level more meaningful context, or maybe not...
Quoted 7 lines
Quoted 3 lines
Obviously these userdiff patterns aren't a general parser and will always be hit-and-miss, it's just useful to at least eyeball them against in-the-wild test data to check their sanity & add some tests.
Our intent with this patch is to rely on a heuristic that works for most cases. There will always be some case that is not covered. This point was made explicit in the relevant emacs-devel thread.
Yes these heuristics will always be bad in some cases. I'm just encouraging you to find some of the more common cases, make test-cases out of them, to say "this is what I want".
The most common difference I've seen is that by finding comments it means for changes like this:
(def foo ()
"..."
(some-code)
;; comments inside functions are often not indented
(blah))
(def bar ()
"..."
CHANGE_ME)Before we'd find "foo" as the context, now we find ";; comments inside functions are often not indented".
There's other cases where that comment rule does the right thing. E.g. finding the description of the file at the top, but we could also capture that with:
^(;;; [^.]+\.el ---.*)'
Then you'd get things like:
;;; button.el --- clickable buttons
Without overmatching any and all comments. Or maybe it isn't overmatching and is better in the common case. I don't know.
Another example is now we'll match "(progn", sometimes that's "right", sometimes "wrong". Perhaps even in cases where that's "right" the common "(progn" pattern doesn't provide much/any extra information, and we'd be better to skip past it with a negative rule to the next "(def" ?
I'm typing this in mu4e, but I wouldn't call myself deeply familiar with Elisp. My reading of the linked thread / blog posts it links to is that some other people came up with more narrow matching rules, presumably because they found some of these cases.
So all I'm suggesting is maybe pro-actively find those cases & loop those people in.
Quoted 16 lines
Quoted 8 lines
My cursory glance at the emacs.git version v.s. what's being submitted here is that this one does a worse job in *very common* cases.
Quoted 5 lines
Quoted 5 lines
Yours also changes it from e.g.:
@@ -61,7 +61,7 @@ forward-thing to: @@ -61,7 +61,7 @@ (defun forward-thing (thing &optional n)Is this really desired in elisp?
I think this is a matter of perspective and indeed a valid reason for doing this in emacs.git first.
For my part, I find the verbose style more informative, especially when it captures the previous form instead of the one directly around the diffed lines.
Quoted 5 lines
Perhaps one could add to that Emacs' ability to use the same name for different things, e.g. a function and a variable, where verbosity of this sort can help with disambiguation. Granted, we should not really on such a heading style to aid us in that task, though it may be something to consider.
I'm not saying it needs to be done in emacs.git first, just maybe coordinate with people who wrote/use that rule.
I think matching the whole line makes sense (sans leading whitespace), we do it for the rest of the git.git rules.
Quoted 20 lines
Quoted 9 lines
Quoted 3 lines
It's common practice to extract the entire line (sans indentation if applicable), not just the function name. Why would somebody want the latter? It doesn't carry as much information as could be possible.
Because I'm familiar with the codebase I'm editing and I just need to know that the diff I'm viewing is on the "main" function, not that it's "
main()", "intmain(int argv, char **argv)", "intmain(const int argv, const char *argv[])", or to either have a " {" or not at the end depending on the project's coding style.Oftentimes we produce/read patches for projects that we are not necessarily acquainted with. This includes emacs.git and the multitude of Elisp packages in that milieu. An extra element of contextuality can do us good.
It is true that familiarity with the code base will always benefit from succinct headings, though I feel that whenever we are in doubt we should err on the side of caution: which means that we must not introduce such an assumption to the workings of this piece of functionality.
Quoted 7 lines
Quoted 4 lines
I know our own userdiff builtin patterns don't do this, but it would be very useful to retrofit this capability / maybe make it a configurable feature, i.e. have them capture the meaningful part of the line, and you could either print it all, or just that part.
It would be nice to have an option that toggles verbosity. Though I guess this lies outside the scope of the patch in question.
Yes I agree that this is completely outside the scope of adding elisp support to userdiff.
I was just replying generally to Johaness on the topic of why someone would want a pattern to match $1 over $0, as most of our git.git patterns do (or if it's $1, it's the whole line anyway, sans leading whitespace).
Quoted 3 lines
In conclusion, I think we should decide on the next step forward: if you think this should be applied to emacs.git before making its way to git itself, then we can move the discussion there.
I think just applying a version to this to git.git is fine, and it should not wait for whatever 20-some patches test mechanism rewrite I started. I can rebase on top of this.
B.t.w. emacs.git also has a rule for *.texi, perhaps you'd be interested in hacking that up too? :)