[PATCH] test-pager: add a test for pager with color enabled

Augie Fackler raf at durin42.com
Mon Mar 14 12:44:50 EDT 2016


# HG changeset patch
# User Augie Fackler <augie at google.com>
# Date 1457746489 18000
#      Fri Mar 11 20:34:49 2016 -0500
# Node ID 3b58750f9415a43942f73ff51f80f192b09eb30b
# Parent  3c90090320ad1c9017a9f14019a19f05442f8866
# EXP-Topic pager
test-pager: add a test for pager with color enabled

diff --git a/tests/test-pager.t b/tests/test-pager.t
--- a/tests/test-pager.t
+++ b/tests/test-pager.t
@@ -151,3 +151,27 @@ doesn't result in history being paged.
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     modify a 9
   
+
+Pager with color enabled allows colors to come through by default,
+even though stdout is no longer a tty.
+  $ cat >> $HGRCPATH <<EOF
+  > [extensions]
+  > color=
+  > EOF
+  $ hg log --limit 3
+  paged! '\x1b[0;33mchangeset:   10:46106edeeb38\x1b[0m\n'
+  paged! 'tag:         tip\n'
+  paged! 'user:        test\n'
+  paged! 'date:        Thu Jan 01 00:00:00 1970 +0000\n'
+  paged! 'summary:     modify a 10\n'
+  paged! '\n'
+  paged! '\x1b[0;33mchangeset:   9:6dd8ea7dd621\x1b[0m\n'
+  paged! 'user:        test\n'
+  paged! 'date:        Thu Jan 01 00:00:00 1970 +0000\n'
+  paged! 'summary:     modify a 9\n'
+  paged! '\n'
+  paged! '\x1b[0;33mchangeset:   8:cff05a6312fe\x1b[0m\n'
+  paged! 'user:        test\n'
+  paged! 'date:        Thu Jan 01 00:00:00 1970 +0000\n'
+  paged! 'summary:     modify a 8\n'
+  paged! '\n'


More information about the Mercurial-devel mailing list