t7800: run --dir-diff tests with and without symlinks

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> Signed-off-by: Junio C Hamano <gitster@pobox.com>

John Keeping committed Mar 29, 2013 at 11:28 UTC e01afdb74b395e63a6ee8feb8cb3a6ee470e2085
1 file changed +19 -8
t/t7800-difftool.sh
+19 -8
@@ -318,28 +318,39 @@ test_expect_success PERL 'setup change in subdirectory' '
318 git commit -m "modified both"
319 '
320
321 -test_expect_success PERL 'difftool -d' '
322 - git difftool -d --extcmd ls branch >output &&
321 +run_dir_diff_test () {
322 + test_expect_success PERL "$1 --no-symlinks" "
323 + symlinks=--no-symlinks &&
324 + $2
325 + "
326 + test_expect_success PERL,SYMLINKS "$1 --symlinks" "
327 + symlinks=--symlinks &&
328 + $2
329 + "
330 +}
331 +
332 +run_dir_diff_test 'difftool -d' '
333 + git difftool -d $symlinks --extcmd ls branch >output &&
334 grep sub output &&
335 grep file output
336 '
337
327 -test_expect_success PERL 'difftool --dir-diff' '
328 - git difftool --dir-diff --extcmd ls branch >output &&
338 +run_dir_diff_test 'difftool --dir-diff' '
339 + git difftool --dir-diff $symlinks --extcmd ls branch >output &&
340 grep sub output &&
341 grep file output
342 '
343
333 -test_expect_success PERL 'difftool --dir-diff ignores --prompt' '
334 - git difftool --dir-diff --prompt --extcmd ls branch >output &&
344 +run_dir_diff_test 'difftool --dir-diff ignores --prompt' '
345 + git difftool --dir-diff $symlinks --prompt --extcmd ls branch >output &&
346 grep sub output &&
347 grep file output
348 '
349
339 -test_expect_success PERL 'difftool --dir-diff from subdirectory' '
350 +run_dir_diff_test 'difftool --dir-diff from subdirectory' '
351 (
352 cd sub &&
342 - git difftool --dir-diff --extcmd ls branch >output &&
353 + git difftool --dir-diff $symlinks --extcmd ls branch >output &&
354 grep sub output &&
355 grep file output
356 )