Patchwork D1959: testrunner: on error, color the "(case xxx)" part the same as filename

login
register
mail settings
Submitter phabricator
Date Feb. 1, 2018, 5:18 p.m.
Message ID <differential-rev-PHID-DREV-yxtfgnoz7eju5lmg5e36-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/27102/
State Superseded
Headers show

Comments

phabricator - Feb. 1, 2018, 5:18 p.m.
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  When using #testcases, the lines that read something like
  
    ERROR: test-split.t (case obsstore-off) output changed
  
  get colored red and the filename gets highlighted with a brighter
  red. This makes it harder to notice the "case obsstore-off" part, but
  it does seem important, so let's highlight it.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/run-tests.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -120,18 +120,19 @@ 
         }
 
     class TestRunnerLexer(lexer.RegexLexer):
+        testpattern = r'[\w-]+\.(t|py)( \(case [\w-]+\))?'
         tokens = {
             'root': [
                 (r'^Skipped', token.Generic.Skipped, 'skipped'),
                 (r'^Failed ', token.Generic.Failed, 'failed'),
                 (r'^ERROR: ', token.Generic.Failed, 'failed'),
             ],
             'skipped': [
-                (r'[\w-]+\.(t|py)', token.Generic.SName),
+                (testpattern, token.Generic.SName),
                 (r':.*', token.Generic.Skipped),
             ],
             'failed': [
-                (r'[\w-]+\.(t|py)', token.Generic.FName),
+                (testpattern, token.Generic.FName),
                 (r'(:| ).*', token.Generic.Failed),
             ]
         }