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

[PATCH 1/3] t7800-difftool.sh: Simplify the --extcmd test

From
David Aguilar <davvid@gmail.com>
Date
Jan 15, 2010, 07:16 UTC
Message-ID
<1263539762-8269-1-git-send-email-davvid@gmail.com>

Instead of running 'grep', 'echo', and 'wc' we simply compare git-difftool's output against a known good value.

Signed-off-by: David Aguilar <davvid@gmail.com>
---
 t/t7800-difftool.sh |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
index 8ee186a..1d9e07b 100755
--- a/t/t7800-difftool.sh
+++ b/t/t7800-difftool.sh
@@ -15,6 +15,9 @@ if ! test_have_prereq PERL; then
 	test_done
 fi
 
+LF='
+'
+
 remove_config_vars()
 {
 	# Unset all config variables used by git-difftool
@@ -219,19 +222,13 @@ test_expect_success 'difftool.<tool>.path' '
 	restore_test_defaults
 '
 
-test_expect_success 'difftool --extcmd=...' '
+test_expect_success 'difftool --extcmd=cat' '
 	diff=$(git difftool --no-prompt --extcmd=cat branch) &&
+	test "$diff" = branch"$LF"master
 
-	lines=$(echo "$diff" | wc -l) &&
-	test "$lines" -eq 2 &&
 
-	lines=$(echo "$diff" | grep master | wc -l) &&
-	test "$lines" -eq 1 &&
 
-	lines=$(echo "$diff" | grep branch | wc -l) &&
-	test "$lines" -eq 1 &&
 
-	restore_test_defaults
 '
 
 test_done
-- 
1.6.6.6.g627fb.dirty
Next: David Aguilar
Message 1 of 9 in “t7800-difftool.sh: Simplify the --extcmd test”
  1. 1/3 t7800-difftool.sh: Simplify the --extcmd testDavid Aguilar, Jan 15, 2010
  2. 2/3 difftool: Add '-x' and as an alias for '--extcmd'David Aguilar, Jan 15, 2010
  3. Junio C HamanoJan 15, 2010
  4. Bill LearJan 15, 2010
  5. Junio C HamanoJan 16, 2010
  6. Bill LearJan 16, 2010
  7. 3/3 difftool: Use eval to expand '--extcmd' expressionsDavid Aguilar, Jan 15, 2010
  8. Johannes SixtJan 15, 2010
  9. David AguilarJan 15, 2010

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.