py3: replace file() with open() in test-eol.t
file() is not present in Python 3.
This patch also adds a b'' prefix to make sure we write bytes in Python 3.
Differential Revision: https://phab.mercurial-scm.org/D2129
--- a/tests/test-eol.t Sun Feb 11 17:13:11 2018 +0530
+++ b/tests/test-eol.t Sun Feb 11 17:14:00 2018 +0530
@@ -17,12 +17,12 @@
> msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
> except ImportError:
> pass
- > (old, new) = sys.argv[1] == 'LF' and ('\n', '\r\n') or ('\r\n', '\n')
+ > (old, new) = sys.argv[1] == 'LF' and (b'\n', b'\r\n') or (b'\r\n', b'\n')
> print("%% switching encoding from %r to %r" % (old, new))
> for path in sys.argv[2:]:
- > data = file(path, 'rb').read()
+ > data = open(path, 'rb').read()
> data = data.replace(old, new)
- > file(path, 'wb').write(data)
+ > open(path, 'wb').write(data)
> EOF
$ seteol () {