diff tests/test-pager.t @ 32541:3b569745af6c

cat: do not start pager if output will be written to file
author Yuya Nishihara <yuya@tcha.org>
date Sat, 27 May 2017 18:52:46 +0900
parents 46ba2cdda476
children 75be14993fda
line wrap: on
line diff
--- a/tests/test-pager.t	Sat May 27 18:50:05 2017 +0900
+++ b/tests/test-pager.t	Sat May 27 18:52:46 2017 +0900
@@ -1,7 +1,11 @@
   $ cat >> fakepager.py <<EOF
   > import sys
+  > printed = False
   > for line in sys.stdin:
   >     sys.stdout.write('paged! %r\n' % line)
+  >     printed = True
+  > if not printed:
+  >     sys.stdout.write('paged empty output!\n')
   > EOF
 
 Enable ui.formatted because pager won't fire without it, and set up
@@ -281,6 +285,15 @@
    9: a 9
   10: a 10
 
+A command with --output option:
+
+  $ hg cat -r0 a
+  paged! 'a\n'
+  $ hg cat -r0 a --output=-
+  paged! 'a\n'
+  $ hg cat -r0 a --output=out
+  $ rm out
+
 Put annotate in the ignore list for pager:
   $ cat >> $HGRCPATH <<EOF
   > [pager]