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

[PATCH 5/5] t7800: run --dir-diff tests with and without symlinks

From
John Keeping <john@keeping.me.uk>
Date
Mar 29, 2013, 11:28 UTC
Message-ID
<d5998552e411600b51f86155aa61b8491b3d6fcb.1364555970.git.john@keeping.me.uk>
In-Reply-To
<cover.1364555970.git.john@keeping.me.uk>

Currently the difftool --dir-diff tests may or may not use symlinks depending on the operating system on which they are run. In one case this has caused a test failure to be noticed only on Windows when the test also fails on Linux when difftool is invoked with --no-symlinks.

Rewrite these tests so that they do not depend on the environment but run explicitly with both --symlinks and --no-symlinks, protecting the --symlinks version with a SYMLINKS prerequisite.

Signed-off-by: John Keeping <john@keeping.me.uk>
---
 t/t7800-difftool.sh | 27 +++++++++++++++++++--------
 1 file changed, 19 insertions(+), 8 deletions(-)
diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
index df443a9..a6bd99e 100755
--- a/t/t7800-difftool.sh
+++ b/t/t7800-difftool.sh
@@ -318,28 +318,39 @@ test_expect_success PERL 'setup change in subdirectory' '
 	git commit -m "modified both"
 '
 
-test_expect_success PERL 'difftool -d' '
-	git difftool -d --extcmd ls branch >output &&
+run_dir_diff_test () {
+	test_expect_success PERL "$1 --no-symlinks" "
+		symlinks=--no-symlinks &&
+		$2
+	"
+	test_expect_success PERL,SYMLINKS "$1 --symlinks" "
+		symlinks=--symlinks &&
+		$2
+	"
+}
+
+run_dir_diff_test 'difftool -d' '
+	git difftool -d $symlinks --extcmd ls branch >output &&
 	grep sub output &&
 	grep file output
 '
 
-test_expect_success PERL 'difftool --dir-diff' '
-	git difftool --dir-diff --extcmd ls branch >output &&
+run_dir_diff_test 'difftool --dir-diff' '
+	git difftool --dir-diff $symlinks --extcmd ls branch >output &&
 	grep sub output &&
 	grep file output
 '
 
-test_expect_success PERL 'difftool --dir-diff ignores --prompt' '
-	git difftool --dir-diff --prompt --extcmd ls branch >output &&
+run_dir_diff_test 'difftool --dir-diff ignores --prompt' '
+	git difftool --dir-diff $symlinks --prompt --extcmd ls branch >output &&
 	grep sub output &&
 	grep file output
 '
 
-test_expect_success PERL 'difftool --dir-diff from subdirectory' '
+run_dir_diff_test 'difftool --dir-diff from subdirectory' '
 	(
 		cd sub &&
-		git difftool --dir-diff --extcmd ls branch >output &&
+		git difftool --dir-diff $symlinks --extcmd ls branch >output &&
 		grep sub output &&
 		grep file output
 	)
-- 
1.8.2.411.g65a544e
Previous: John Keeping
Message 9 of 9 in “difftool improvements”
  1. 0/5 difftool improvementsJohn Keeping, Mar 29, 2013
  2. 1/5 t7800: move '--symlinks' specific test to the endJohn Keeping, Mar 29, 2013
  3. 2/5 difftool: don't overwrite modified filesJohn Keeping, Mar 29, 2013
  4. Junio C HamanoMar 29, 2013
  5. John KeepingMar 29, 2013
  6. 2/5 difftool: don't overwrite modified filesJohn Keeping, Mar 29, 2013
  7. 3/5 t7800: don't hide grep outputJohn Keeping, Mar 29, 2013
  8. 4/5 t7800: fix tests when difftool uses --no-symlinksJohn Keeping, Mar 29, 2013
  9. 5/5 t7800: run --dir-diff tests with and without symlinksJohn Keeping, Mar 29, 2013

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.