changeset 36697:9a08f7d18c20 stable

test-annotate: rewrite sed with some python I hope this will fix the test failure seen on FreeBSD and Windows.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 04 Mar 2018 13:19:05 -0500
parents b394778b1a50
children 52b344e977b7
files tests/test-annotate.t
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-annotate.t	Sat Mar 03 22:29:24 2018 -0500
+++ b/tests/test-annotate.t	Sun Mar 04 13:19:05 2018 -0500
@@ -901,9 +901,12 @@
   $ hg init repo-cr
   $ cd repo-cr
 
-  $ substcr() {
-  > sed 's/\r/[CR]/g'
-  > }
+  $ cat <<'EOF' >> "$TESTTMP/substcr.py"
+  > import sys
+  > stdin = getattr(sys.stdin, 'buffer', sys.stdin)
+  > stdout = getattr(sys.stdout, 'buffer', sys.stdout)
+  > stdout.write(stdin.read().replace(b'\r', b'[CR]'))
+  > EOF
 
   >>> with open('a', 'wb') as f:
   ...     f.write(b'0a\r0b\r\n0c\r0d\r\n0e\n0f\n0g')
@@ -912,13 +915,13 @@
   ...     f.write(b'0a\r0b\r\n1c\r1d\r\n0e\n1f\n0g')
   $ hg ci -m1
 
-  $ hg annotate -r0 a | substcr
+  $ hg annotate -r0 a | $PYTHON "$TESTTMP/substcr.py"
   0: 0a[CR]0b[CR]
   0: 0c[CR]0d[CR]
   0: 0e
   0: 0f
   0: 0g
-  $ hg annotate -r1 a | substcr
+  $ hg annotate -r1 a | $PYTHON "$TESTTMP/substcr.py"
   0: 0a[CR]0b[CR]
   1: 1c[CR]1d[CR]
   0: 0e