Patchwork [1,of,4,V2] run-tests: prevent a (glob) declaration from reordering (?) lines

login
register
mail settings
Submitter Matt Harbison
Date April 7, 2017, 1:11 a.m.
Message ID <c0789426514615cd841a.1491527500@Envy>
Download mbox | patch
Permalink /patch/19978/
State Accepted
Headers show

Comments

Matt Harbison - April 7, 2017, 1:11 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1491444033 14400
#      Wed Apr 05 22:00:33 2017 -0400
# Node ID c0789426514615cd841a31f60688516f2cdeaae0
# Parent  81abd0d12c8641df666d356f6033d84cd55977a8
run-tests: prevent a (glob) declaration from reordering (?) lines

Previously, if a series of optional output lines marked with '(?)' had a (glob)
in one of the first lines, the output would be reordered such that it came last
if none of the lines were output.  The (re) declaration wasn't affected, which
was helpful in figuring this out.  There were no tests for '(re) (?)' so add
that to make sure everything plays nice.
Yuya Nishihara - April 7, 2017, 12:40 p.m.
On Thu, 06 Apr 2017 21:11:40 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1491444033 14400
> #      Wed Apr 05 22:00:33 2017 -0400
> # Node ID c0789426514615cd841a31f60688516f2cdeaae0
> # Parent  81abd0d12c8641df666d356f6033d84cd55977a8
> run-tests: prevent a (glob) declaration from reordering (?) lines

Queued the series, many thanks.

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -1385,7 +1385,7 @@ 
                 # ignore '(glob)' added to l by 'replacements'
                 if l.endswith(b" (glob)\n"):
                     l = l[:-8] + b"\n"
-                return TTest.globmatch(el[:-8], l)
+                return TTest.globmatch(el[:-8], l) or retry
             if os.altsep and l.replace(b'\\', b'/') == el:
                 return b'+glob'
         return retry
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
@@ -55,7 +55,10 @@ 
   >   $ echo babar
   >   babar
   >   $ echo xyzzy
+  >   dont_print (?)
+  >   nothing[42]line (re) (?)
   >   never*happens (glob) (?)
+  >   more_nothing (?)
   >   xyzzy
   >   nor this (?)
   >   $ printf 'abc\ndef\nxyz\n'
@@ -326,14 +329,14 @@ 
   *SALT* 2 0 (glob)
   + echo xyzzy
   xyzzy
-  + echo *SALT* 6 0 (glob)
-  *SALT* 6 0 (glob)
+  + echo *SALT* 9 0 (glob)
+  *SALT* 9 0 (glob)
   + printf *abc\ndef\nxyz\n* (glob)
   abc
   def
   xyz
-  + echo *SALT* 12 0 (glob)
-  *SALT* 12 0 (glob)
+  + echo *SALT* 15 0 (glob)
+  *SALT* 15 0 (glob)
   .
   # Ran 2 tests, 0 skipped, 0 warned, 0 failed.