Mercurial > public > mercurial-scm > hg-stable
diff tests/test-run-tests.t @ 33420:e80041832eec
run-tests: add color to output if pygments is available
The output of run-tests has no formatting by default, which hampers readability.
This patch colors the diff output when pygments is available. To avoid coloring
even when pygments is available, use --color never.
author | Matthieu Laneuville <matthieu.laneuville@octobus.net> |
---|---|
date | Thu, 29 Jun 2017 20:45:12 +0900 |
parents | 573baab2a797 |
children | 9c6e64911de0 |
line wrap: on
line diff
--- a/tests/test-run-tests.t Thu Mar 30 00:33:00 2017 -0400 +++ b/tests/test-run-tests.t Thu Jun 29 20:45:12 2017 +0900 @@ -119,6 +119,43 @@ python hash seed: * (glob) [1] +test diff colorisation + + $ rt test-failure.t --color always + + \x1b[38;5;124m--- $TESTTMP/test-failure.t\x1b[39m (esc) + \x1b[38;5;34m+++ $TESTTMP/test-failure.t.err\x1b[39m (esc) + \x1b[38;5;90;01m@@ -1,3 +1,3 @@\x1b[39;00m (esc) + $ echo "bar-baz"; echo "bar-bad" + \x1b[38;5;34m+ bar*baz (glob)\x1b[39m (esc) + bar*bad (glob) + \x1b[38;5;124m- bar*baz (glob)\x1b[39m (esc) + + ERROR: test-failure.t output changed + ! + Failed test-failure.t: output changed + # Ran 1 tests, 0 skipped, 1 failed. + python hash seed: * (glob) + [1] + + $ rt test-failure.t 2> tmp.log + [1] + $ cat tmp.log + + --- $TESTTMP/test-failure.t + +++ $TESTTMP/test-failure.t.err + @@ -1,3 +1,3 @@ + $ echo "bar-baz"; echo "bar-bad" + + bar*baz (glob) + bar*bad (glob) + - bar*baz (glob) + + ERROR: test-failure.t output changed + ! + Failed test-failure.t: output changed + # Ran 1 tests, 0 skipped, 1 failed. + python hash seed: * (glob) + basic failing test $ cat > test-failure.t << EOF > $ echo babar