Patchwork [4,of,5] test-extdiff: enable a previously failing test on Windows

login
register
mail settings
Submitter Matt Harbison
Date May 7, 2017, 5:07 a.m.
Message ID <edc212b7be4c621f3941.1494133633@Envy>
Download mbox | patch
Permalink /patch/20514/
State Accepted
Headers show

Comments

Matt Harbison - May 7, 2017, 5:07 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1494125286 14400
#      Sat May 06 22:48:06 2017 -0400
# Node ID edc212b7be4c621f39412055affab33f45973e9e
# Parent  92c8d644b608273f7e189878d5a1edb98c4a0f46
test-extdiff: enable a previously failing test on Windows

Patch

diff --git a/tests/test-extdiff.t b/tests/test-extdiff.t
--- a/tests/test-extdiff.t
+++ b/tests/test-extdiff.t
@@ -331,11 +331,19 @@ 
 #if execbit
   $ chmod +x dir/tool.sh
 #endif
-  $ tool=`pwd`/dir/tool.sh
 
-TODO: Fix this on Windows.  It currently tries to run 'tl a.* a', instead of
-falling back to tool.sh
-#if no-windows
+Windows can't run *.sh directly, so create a shim executable that can be.
+Without something executable, the next hg command will try to run `tl` instead
+of $tool (and fail).
+#if windows
+  $ cat > dir/tool.bat <<EOF
+  > @sh -c "`pwd`/dir/tool.sh %1 %2"
+  > EOF
+  $ tool=`pwd`/dir/tool.bat
+#else
+  $ tool=`pwd`/dir/tool.sh
+#endif
+
   $ hg --debug tl --config extdiff.tl= --config merge-tools.tl.executable=$tool
   making snapshot of 2 files from rev * (glob)
     a
@@ -343,11 +351,11 @@ 
   making snapshot of 2 files from working directory
     a
     b
-  running '$TESTTMP/a/dir/tool.sh a.* a' in */extdiff.* (glob)
+  running '$TESTTMP/a/dir/tool.bat a.* a' in */extdiff.* (glob) (windows !)
+  running '$TESTTMP/a/dir/tool.sh a.* a' in */extdiff.* (glob) (no-windows !)
   ** custom diff **
   cleaning up temp directory
   [1]
-#endif
 
   $ cd ..