--- a/tests/test-run-tests.py Sat Oct 05 10:29:34 2019 -0400
+++ b/tests/test-run-tests.py Sun Oct 06 09:45:02 2019 -0400
@@ -8,11 +8,13 @@
import doctest
import os
import re
+
# this is hack to make sure no escape characters are inserted into the output
if 'TERM' in os.environ:
del os.environ['TERM']
run_tests = __import__('run-tests')
+
def prn(ex):
m = ex.args[0]
if isinstance(m, str):
@@ -20,6 +22,7 @@
else:
print(m.decode('utf-8'))
+
def lm(expected, output):
r"""check if output matches expected
@@ -35,10 +38,12 @@
... except AssertionError as ex: prn(ex)
single backslash or unknown char
"""
- assert (expected.endswith(b'\n')
- and output.endswith(b'\n')), 'missing newline'
- assert not re.search(br'[^ \w\\/\r\n()*?]', expected + output), (
- b'single backslash or unknown char')
+ assert expected.endswith(b'\n') and output.endswith(
+ b'\n'
+ ), 'missing newline'
+ assert not re.search(
+ br'[^ \w\\/\r\n()*?]', expected + output
+ ), b'single backslash or unknown char'
test = run_tests.TTest(b'test-run-test.t', b'.', b'.')
match, exact = test.linematch(expected, output)
if isinstance(match, str):
@@ -46,7 +51,8 @@
elif isinstance(match, bytes):
return 'special: ' + match.decode('utf-8')
else:
- return bool(match) # do not return match object
+ return bool(match) # do not return match object
+
def wintests():
r"""test matching like running on windows
@@ -77,6 +83,7 @@
"""
pass
+
def otherostests():
r"""test matching like running on non-windows os
@@ -104,5 +111,6 @@
"""
pass
+
if __name__ == '__main__':
doctest.testmod()