[PATCH] run-tests: fix -i when testcases are used

Jun Wu quark at fb.com
Wed Jun 21 04:45:43 UTC 2017


# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1498019662 25200
#      Tue Jun 20 21:34:22 2017 -0700
# Node ID 30a98655ab27976c2020e20909093e2cb678758b
# Parent  0ce2cbebd74964ffe61e79de8941461bccc9371b
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r 30a98655ab27
run-tests: fix -i when testcases are used

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -1592,5 +1592,5 @@ class TestResult(unittest._TextTestResul
                 answer = sys.stdin.readline().strip()
                 if answer.lower() in ('y', 'yes'):
-                    if test.name.endswith('.t'):
+                    if test.path.endswith(b'.t'):
                         rename(test.errpath, test.path)
                     else:
diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t
--- a/tests/test-run-tests.t
+++ b/tests/test-run-tests.t
@@ -642,4 +642,33 @@ Accept the fix
     saved backup bundle to $TESTTMP/*.hg (glob)<
 
+With testcases
+
+  $ cat >> test-failure.t <<EOF
+  > #testcases a
+  > #if a
+  >   $ echo 1
+  > #endif
+  > EOF
+
+  $ echo 'y' | rt -i 2>&1
+  
+  --- $TESTTMP/test-failure.t
+  +++ $TESTTMP/test-failure.t.a.err
+  @@ -17,4 +17,5 @@
+   #testcases a
+   #if a
+     $ echo 1
+  +  1
+   #endif
+  Accept this change? [n] ..
+  # Ran 2 tests, 0 skipped, 0 failed.
+
+  $ tail -5 test-failure.t
+  #testcases a
+  #if a
+    $ echo 1
+    1
+  #endif
+
 (reinstall)
   $ mv backup test-failure.t


More information about the Mercurial-devel mailing list