changeset 42000:a66965406528

test-template: fix stdio mode on Windows Otherwise, CBOR data would be corrupted. Spotted by Matt Harbison.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 23 Mar 2019 20:59:07 +0900
parents ba064f95175e
children 624d6683c705
files tests/test-template-functions.t tests/test-template-map.t
diffstat 2 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-template-functions.t	Fri Mar 22 12:30:05 2019 -0400
+++ b/tests/test-template-functions.t	Sat Mar 23 20:59:07 2019 +0900
@@ -1499,11 +1499,15 @@
 
   $ cat <<'EOF' > "$TESTTMP/decodecbor.py"
   > from __future__ import absolute_import
-  > from mercurial import pycompat
+  > from mercurial import (
+  >     dispatch,
+  >     pycompat,
+  > )
   > from mercurial.utils import (
   >     cborutil,
   >     stringutil,
   > )
+  > dispatch.initstdio()
   > items = cborutil.decodeall(pycompat.stdin.read())
   > pycompat.stdout.write(stringutil.pprint(items, indent=1) + b'\n')
   > EOF
--- a/tests/test-template-map.t	Fri Mar 22 12:30:05 2019 -0400
+++ b/tests/test-template-map.t	Sat Mar 23 20:59:07 2019 +0900
@@ -673,11 +673,15 @@
 
   $ cat <<'EOF' > "$TESTTMP/decodecborarray.py"
   > from __future__ import absolute_import
-  > from mercurial import pycompat
+  > from mercurial import (
+  >     dispatch,
+  >     pycompat,
+  > )
   > from mercurial.utils import (
   >     cborutil,
   >     stringutil,
   > )
+  > dispatch.initstdio()
   > data = pycompat.stdin.read()
   > # our CBOR decoder doesn't support parsing indefinite-length arrays,
   > # but the log output is indefinite stream by nature.