git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] t4034: Test parsing words following newline

From
Lucian Poston <lucian.poston@gmail.com>
Date
Oct 27, 2015, 01:40 UTC
Message-ID
<1445910013-13382-2-git-send-email-lucian.poston@gmail.com>
In-Reply-To
<1445910013-13382-1-git-send-email-lucian.poston@gmail.com>

Add test that shows diff --word-diff's inconsistent placement of removed words. This occurs when both the removed word is first on its line and the previous line has a removed word.

Signed-off-by: Lucian Poston <lucian.poston@gmail.com>
---
 t/t4034-diff-words.sh | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
diff --git a/t/t4034-diff-words.sh b/t/t4034-diff-words.sh
index f2f55fc..8d9f1b7 100755
--- a/t/t4034-diff-words.sh
+++ b/t/t4034-diff-words.sh
@@ -265,6 +265,36 @@ test_expect_success 'test parsing words for newline' '
 	word_diff --color-words="a+"
 '
 
+test_expect_success 'test parsing words following newline' '
+	cat >pre <<-\EOF &&
+		11aa
+		11aa
+		
+		11aa
+		11aa
+	EOF
+	cat >post <<-\EOF &&
+		11aa
+		aa
+		
+		aa
+		aa
+	EOF
+	cat >expect <<-\EOF &&
+		<BOLD>diff --git a/pre b/post<RESET>
+		<BOLD>index 2e0acd4..f6e6721 100644<RESET>
+		<BOLD>--- a/pre<RESET>
+		<BOLD>+++ b/post<RESET>
+		<CYAN>@@ -1,5 +1,5 @@<RESET>
+		11aa<RESET>
+		<RED>11<RESET>aa
+		
+		<RED>11<RESET>aa
+		<RED>11<RESET>aa
+	EOF
+	word_diff --color-words="a+|1+"
+'
+
 test_expect_success 'test when words are only removed at the end' '
 	echo "(:" >pre &&
 	echo "(" >post &&
-- 
2.4.10
Previous: Lucian Poston
Message 2 of 2 in “[BUG] diff --word-diff inconsistently places removed words”
  1. Lucian PostonOct 27, 2015
  2. t4034: Test parsing words following newlineLucian Poston, Oct 27, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.