diff tests/test-fix-topology.t @ 37560:41ba336d9f1e

fix: use a portable python script instead of sed in test Differential Revision: https://phab.mercurial-scm.org/D2988
author Danny Hooper <hooper@google.com>
date Fri, 30 Mar 2018 17:01:12 -0700
parents ded5ea279a93
children e2506748b47f
line wrap: on
line diff
--- a/tests/test-fix-topology.t	Wed Apr 11 14:35:37 2018 +0530
+++ b/tests/test-fix-topology.t	Fri Mar 30 17:01:12 2018 -0700
@@ -1,3 +1,19 @@
+A script that implements uppercasing all letters in a file.
+
+  $ UPPERCASEPY="$TESTTMP/uppercase.py"
+  $ cat > $UPPERCASEPY <<EOF
+  > import sys
+  > from mercurial.utils.procutil import setbinary
+  > setbinary(sys.stdin)
+  > setbinary(sys.stdout)
+  > sys.stdout.write(sys.stdin.read().upper())
+  > EOF
+  $ TESTLINES="foo\nbar\nbaz\n"
+  $ printf $TESTLINES | $PYTHON $UPPERCASEPY
+  FOO
+  BAR
+  BAZ
+
 Tests for the fix extension's behavior around non-trivial history topologies.
 Looks for correct incremental fixing and reproduction of parent/child
 relationships. We indicate fixed file content by uppercasing it.
@@ -6,7 +22,7 @@
   > [extensions]
   > fix =
   > [fix]
-  > uppercase-whole-file:command=sed -e 's/.*/\U&/'
+  > uppercase-whole-file:command=$PYTHON $UPPERCASEPY
   > uppercase-whole-file:fileset=set:**
   > EOF