comparison tests/test-template-map.t @ 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 77ef3498ceb3
children 90b9a7e06c2c
comparison
equal deleted inserted replaced
41999:ba064f95175e 42000:a66965406528
671 671
672 test CBOR style: 672 test CBOR style:
673 673
674 $ cat <<'EOF' > "$TESTTMP/decodecborarray.py" 674 $ cat <<'EOF' > "$TESTTMP/decodecborarray.py"
675 > from __future__ import absolute_import 675 > from __future__ import absolute_import
676 > from mercurial import pycompat 676 > from mercurial import (
677 > dispatch,
678 > pycompat,
679 > )
677 > from mercurial.utils import ( 680 > from mercurial.utils import (
678 > cborutil, 681 > cborutil,
679 > stringutil, 682 > stringutil,
680 > ) 683 > )
684 > dispatch.initstdio()
681 > data = pycompat.stdin.read() 685 > data = pycompat.stdin.read()
682 > # our CBOR decoder doesn't support parsing indefinite-length arrays, 686 > # our CBOR decoder doesn't support parsing indefinite-length arrays,
683 > # but the log output is indefinite stream by nature. 687 > # but the log output is indefinite stream by nature.
684 > assert data[:1] == cborutil.BEGIN_INDEFINITE_ARRAY 688 > assert data[:1] == cborutil.BEGIN_INDEFINITE_ARRAY
685 > assert data[-1:] == cborutil.BREAK 689 > assert data[-1:] == cborutil.BREAK