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 <j...@keeping.me.uk>
---
 t/t7800-difftool.sh | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
index 1eed439..4a70508 100755
--- a/t/t7800-difftool.sh
+++ b/t/t7800-difftool.sh
@@ -318,25 +318,36 @@ test_expect_success PERL 'setup change in subdirectory' '
        git commit -m "modified both"
 '
 
-test_expect_success PERL 'difftool -d' '
+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 --extcmd ls branch >.git/output &&
        grep sub .git/output &&
        grep file .git/output
 '
 
-test_expect_success PERL 'difftool --dir-diff' '
+run_dir_diff_test 'difftool --dir-diff' '
        git difftool --dir-diff --extcmd ls branch >.git/output &&
        grep sub .git/output &&
        grep file .git/output
 '
 
-test_expect_success PERL 'difftool --dir-diff ignores --prompt' '
+run_dir_diff_test 'difftool --dir-diff ignores --prompt' '
        git difftool --dir-diff --prompt --extcmd ls branch >.git/output &&
        grep sub .git/output &&
        grep file .git/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 >../.git/output &&
-- 
1.8.2.324.ga64ebd9

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to