Thread (158 messages) 158 messages, 7 authors, 2021-04-09

Re: [PATCH 07/20] userdiff tests: match full hunk headers

flat view

From: Eric Sunshine <hidden>
Date: 2021-02-15 01:36:37

On Sun, Feb 14, 2021 at 7:56 PM Ævar Arnfjörð Bjarmason
[off-list ref] wrote:
quoted hunk ↗ jump to hunk
[...]
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 <redacted>
---
diff --git a/t/t4018-diff-funcname.sh b/t/t4018-diff-funcname.sh
@@ -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...
quoted hunk ↗ jump to hunk
diff --git a/t/t4018/README b/t/t4018/README
@@ -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?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help