Patchwork D3699: run-tests: follow-up on the test-case format

login
register
mail settings
Submitter phabricator
Date June 7, 2018, 11:48 p.m.
Message ID <7d2e556664371327a350c20a5bd46edd@localhost.localdomain>
Download mbox | patch
Permalink /patch/32024/
State Not Applicable
Headers show

Comments

phabricator - June 7, 2018, 11:48 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGf2e3196a34f9: run-tests: follow-up on the test-case format (authored by lothiraldan, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3699?vs=8991&id=8995

REVISION DETAIL
  https://phab.mercurial-scm.org/D3699

AFFECTED FILES
  tests/run-tests.py
  tests/test-run-tests.t

CHANGE DETAILS




To: lothiraldan, #hg-reviewers, indygreg
Cc: mercurial-devel

Patch

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
@@ -1617,7 +1617,7 @@ 
   python hash seed: * (glob)
   [1]
 
-Support running invalid test cases
+Support ignoring invalid test cases
 
   $ rt test-cases-abc.t#B test-cases-abc.t#D
   
@@ -1640,6 +1640,81 @@ 
   python hash seed: * (glob)
   [1]
 
+Support running complex test cases names
+
+  $ cat > test-cases-advanced-cases.t <<'EOF'
+  > #testcases simple case-with-dashes casewith!@#$%^&*()chars
+  >   $ echo $TESTCASE
+  >   simple
+  > EOF
+
+  $ cat test-cases-advanced-cases.t
+  #testcases simple case-with-dashes casewith!@#$%^&*()chars
+    $ echo $TESTCASE
+    simple
+
+  $ rt test-cases-advanced-cases.t
+  
+  --- $TESTTMP/anothertests/cases/test-cases-advanced-cases.t
+  +++ $TESTTMP/anothertests/cases/test-cases-advanced-cases.t.case-with-dashes.err
+  @@ -1,3 +1,3 @@
+   #testcases simple case-with-dashes casewith!@#$%^&*()chars
+     $ echo $TESTCASE
+  -  simple
+  +  case-with-dashes
+  
+  ERROR: test-cases-advanced-cases.t#case-with-dashes output changed
+  !
+  --- $TESTTMP/anothertests/cases/test-cases-advanced-cases.t
+  +++ $TESTTMP/anothertests/cases/test-cases-advanced-cases.t.casewith!@#$%^&*()chars.err
+  @@ -1,3 +1,3 @@
+   #testcases simple case-with-dashes casewith!@#$%^&*()chars
+     $ echo $TESTCASE
+  -  simple
+  +  casewith!@#$%^&*()chars
+  
+  ERROR: test-cases-advanced-cases.t#casewith!@#$%^&*()chars output changed
+  !.
+  Failed test-cases-advanced-cases.t#case-with-dashes: output changed
+  Failed test-cases-advanced-cases.t#casewith!@#$%^&*()chars: output changed
+  # Ran 3 tests, 0 skipped, 2 failed.
+  python hash seed: * (glob)
+  [1]
+
+  $ rt "test-cases-advanced-cases.t#case-with-dashes"
+  
+  --- $TESTTMP/anothertests/cases/test-cases-advanced-cases.t
+  +++ $TESTTMP/anothertests/cases/test-cases-advanced-cases.t.case-with-dashes.err
+  @@ -1,3 +1,3 @@
+   #testcases simple case-with-dashes casewith!@#$%^&*()chars
+     $ echo $TESTCASE
+  -  simple
+  +  case-with-dashes
+  
+  ERROR: test-cases-advanced-cases.t#case-with-dashes output changed
+  !
+  Failed test-cases-advanced-cases.t#case-with-dashes: output changed
+  # Ran 1 tests, 0 skipped, 1 failed.
+  python hash seed: * (glob)
+  [1]
+
+  $ rt "test-cases-advanced-cases.t#casewith!@#$%^&*()chars"
+  
+  --- $TESTTMP/anothertests/cases/test-cases-advanced-cases.t
+  +++ $TESTTMP/anothertests/cases/test-cases-advanced-cases.t.casewith!@#$%^&*()chars.err
+  @@ -1,3 +1,3 @@
+   #testcases simple case-with-dashes casewith!@#$%^&*()chars
+     $ echo $TESTCASE
+  -  simple
+  +  casewith!@#$%^&*()chars
+  
+  ERROR: test-cases-advanced-cases.t#casewith!@#$%^&*()chars output changed
+  !
+  Failed test-cases-advanced-cases.t#casewith!@#$%^&*()chars: output changed
+  # Ran 1 tests, 0 skipped, 1 failed.
+  python hash seed: * (glob)
+  [1]
+
 Test automatic pattern replacement
 ==================================
 
diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -120,7 +120,7 @@ 
         }
 
     class TestRunnerLexer(lexer.RegexLexer):
-        testpattern = r'[\w-]+\.(t|py)(#[\w-]+)?'
+        testpattern = r'[\w-]+\.(t|py)(#[^\s]+)?'
         tokens = {
             'root': [
                 (r'^Skipped', token.Generic.Skipped, 'skipped'),
@@ -2646,7 +2646,7 @@ 
                 expanded_args.append(arg)
         args = expanded_args
 
-        testcasepattern = re.compile(r'([\w-]+\.t|py)(#([\w-])+)')
+        testcasepattern = re.compile(r'([\w-]+\.t|py)(#([^\s]+))')
         tests = []
         for t in args:
             case = None