Patchwork test-pager: add a test for pager with color enabled

login
register
mail settings
Submitter Augie Fackler
Date March 14, 2016, 4:44 p.m.
Message ID <3b58750f9415a43942f7.1457973890@arthedain.pit.corp.google.com>
Download mbox | patch
Permalink /patch/13880/
State Accepted
Headers show

Comments

Augie Fackler - March 14, 2016, 4:44 p.m.
# HG changeset patch
# User Augie Fackler <augie@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
Yuya Nishihara - March 15, 2016, 3:16 p.m.
On Mon, 14 Mar 2016 12:44:50 -0400, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <augie@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

Queued this, thanks.

> 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=

I've copied mode=ansi bits from test-status-color.t to avoid possible Windows
issue.

  > [color]
  > mode = ansi

Patch

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'