changeset 40563:2ad56a9b983b

tests: work around `tac` not being portable Introduce a tac.py helper and use it. Sigh. Differential Revision: https://phab.mercurial-scm.org/D5238
author Augie Fackler <augie@google.com>
date Wed, 07 Nov 2018 12:15:36 -0500
parents e5ad3ef90aa1
children 0df4d93fdc27
files tests/test-fix.t
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-fix.t	Tue Nov 06 11:22:16 2018 -0500
+++ b/tests/test-fix.t	Wed Nov 07 12:15:36 2018 -0500
@@ -1,6 +1,11 @@
 A script that implements uppercasing of specific lines in a file. This
 approximates the behavior of code formatters well enough for our tests.
 
+  $ TAC="$TESTTMP/tac.py"
+  $ cat > $TAC <<EOF
+  > import sys
+  > print('\n'.join(sys.stdin.read().splitlines()[::-1]))
+  > EOF
   $ UPPERCASEPY="$TESTTMP/uppercase.py"
   $ cat > $UPPERCASEPY <<EOF
   > import sys
@@ -1117,7 +1122,7 @@
   $ printf "first\nsecond\n" > bar.txt
   $ hg add -q
   $ hg fix -w --config fix.sometool:fileset=bar.txt \
-  >           --config fix.sometool:command=tac
+  >           --config fix.sometool:command="$PYTHON $TAC"
   the fix.tool:fileset config name is deprecated; please rename it to fix.tool:pattern
 
   $ cat foo.whole