Skip to content

Commit 30ca4ce

Browse files
committed
tests: add test for windows bug
1 parent 36684e4 commit 30ca4ce

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/test_mpy_cross.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,19 @@ def test_compile_with_syntax_error():
3737
assert mpy is None
3838

3939

40+
def test_windows_does_not_treat_binary_stdout_as_text():
41+
# 'Hello' creates a \n byte which Windows tries to convert to a \r\n if
42+
# the stdout is treated as text.
43+
p, mpy = mpy_cross_compile("test.py", "print('Hello')")
44+
p.check_returncode()
45+
assert mpy is not None
46+
47+
assert 0x0A in mpy, "Expected binary output to contain a newline byte"
48+
assert (
49+
0x0D not in mpy
50+
), "Expected binary output to not contain a carriage return byte"
51+
52+
4053
def test_version():
4154
ver = mpy_cross_version()
4255

0 commit comments

Comments
 (0)