comparison tests/test-encoding-align.t @ 36052:af9cb761b5f3

py3: replace file() with open() in test-encoding-align.t file() is not present in Python 3. This patch also makes sure we write bytes in Python 3. Differential Revision: https://phab.mercurial-scm.org/D2131
author Pulkit Goyal <7895pulkit@gmail.com>
date Sun, 11 Feb 2018 17:15:45 +0530
parents 8e6f4939a69a
children 5abc47d4ca6b
comparison
equal deleted inserted replaced
36051:035af48b2903 36052:af9cb761b5f3
4 $ export HGENCODING 4 $ export HGENCODING
5 $ hg init t 5 $ hg init t
6 $ cd t 6 $ cd t
7 $ $PYTHON << EOF 7 $ $PYTHON << EOF
8 > # (byte, width) = (6, 4) 8 > # (byte, width) = (6, 4)
9 > s = "\xe7\x9f\xad\xe5\x90\x8d" 9 > s = b"\xe7\x9f\xad\xe5\x90\x8d"
10 > # (byte, width) = (7, 7): odd width is good for alignment test 10 > # (byte, width) = (7, 7): odd width is good for alignment test
11 > m = "MIDDLE_" 11 > m = b"MIDDLE_"
12 > # (byte, width) = (18, 12) 12 > # (byte, width) = (18, 12)
13 > l = "\xe9\x95\xb7\xe3\x81\x84\xe9\x95\xb7\xe3\x81\x84\xe5\x90\x8d\xe5\x89\x8d" 13 > l = b"\xe9\x95\xb7\xe3\x81\x84\xe9\x95\xb7\xe3\x81\x84\xe5\x90\x8d\xe5\x89\x8d"
14 > f = file('s', 'w'); f.write(s); f.close() 14 > f = open('s', 'wb'); f.write(s); f.close()
15 > f = file('m', 'w'); f.write(m); f.close() 15 > f = open('m', 'wb'); f.write(m); f.close()
16 > f = file('l', 'w'); f.write(l); f.close() 16 > f = open('l', 'wb'); f.write(l); f.close()
17 > # instant extension to show list of options 17 > # instant extension to show list of options
18 > f = file('showoptlist.py', 'w'); f.write("""# encoding: utf-8 18 > f = open('showoptlist.py', 'wb'); f.write(b"""# encoding: utf-8
19 > from mercurial import registrar 19 > from mercurial import registrar
20 > cmdtable = {} 20 > cmdtable = {}
21 > command = registrar.command(cmdtable) 21 > command = registrar.command(cmdtable)
22 > 22 >
23 > @command(b'showoptlist', 23 > @command(b'showoptlist',