summaryrefslogtreecommitdiffstats
path: root/test/Scanner
diff options
context:
space:
mode:
Diffstat (limited to 'test/Scanner')
-rw-r--r--test/Scanner/dictionary.py12
-rw-r--r--test/Scanner/multi-env.py8
-rw-r--r--test/Scanner/source_scanner-dict.py20
-rw-r--r--test/Scanner/unicode.py21
4 files changed, 32 insertions, 29 deletions
diff --git a/test/Scanner/dictionary.py b/test/Scanner/dictionary.py
index f6f121e..c587098 100644
--- a/test/Scanner/dictionary.py
+++ b/test/Scanner/dictionary.py
@@ -146,9 +146,9 @@ expect_aaa = 'aaa.k1 1\nline 2\nxxx 1\ninclude2 yyy\ninclude3 zzz\nline 6\n'
expect_bbb = 'bbb.k2 1\nline 2\ninclude1 xxx\nyyy 1\ninclude3 zzz\nline 6\n'
expect_ccc = 'ccc.k3 1\nline 2\ninclude1 xxx\ninclude2 yyy\nzzz 1\nline 6\n'
-test.must_match('aaa', expect_aaa)
-test.must_match('bbb', expect_bbb)
-test.must_match('ccc', expect_ccc)
+test.must_match('aaa', expect_aaa, mode='r')
+test.must_match('bbb', expect_bbb, mode='r')
+test.must_match('ccc', expect_ccc, mode='r')
test.up_to_date(arguments = '.')
@@ -164,7 +164,7 @@ test.run(stdout=expect)
expect_ccc = 'ccc.k3 1\nline 2\ninclude1 xxx\ninclude2 yyy\nzzz 2\nline 6\n'
-test.must_match('bbb', expect_bbb)
+test.must_match('bbb', expect_bbb, mode='r')
@@ -178,7 +178,7 @@ test.run(stdout=expect)
expect_bbb = 'bbb.k2 1\nline 2\ninclude1 xxx\nyyy 2\ninclude3 zzz\nline 6\n'
-test.must_match('bbb', expect_bbb)
+test.must_match('bbb', expect_bbb, mode='r')
@@ -192,7 +192,7 @@ test.run(stdout=expect)
expect_aaa = 'aaa.k1 1\nline 2\nxxx 2\ninclude2 yyy\ninclude3 zzz\nline 6\n'
-test.must_match('bbb', expect_bbb)
+test.must_match('bbb', expect_bbb, mode='r')
diff --git a/test/Scanner/multi-env.py b/test/Scanner/multi-env.py
index 7cb052a..9cf86dc 100644
--- a/test/Scanner/multi-env.py
+++ b/test/Scanner/multi-env.py
@@ -99,8 +99,8 @@ expect = test.wrap_stdout("""\
test.run(arguments='.', stdout=expect)
-test.must_match('frog.1', 'croak\ninput sound2\n')
-test.must_match('frog.2', 'include sound1\nribbet\n')
+test.must_match('frog.1', 'croak\ninput sound2\n', mode='r')
+test.must_match('frog.2', 'include sound1\nribbet\n', mode='r')
test.write('sound2', 'rudeep\n')
@@ -110,8 +110,8 @@ expect = test.wrap_stdout("""\
test.run(arguments='.', stdout=expect)
-test.must_match('frog.1', 'croak\ninput sound2\n')
-test.must_match('frog.2', 'include sound1\nrudeep\n')
+test.must_match('frog.1', 'croak\ninput sound2\n', mode='r')
+test.must_match('frog.2', 'include sound1\nrudeep\n', mode='r')
test.pass_test()
diff --git a/test/Scanner/source_scanner-dict.py b/test/Scanner/source_scanner-dict.py
index bb12364..47773b8 100644
--- a/test/Scanner/source_scanner-dict.py
+++ b/test/Scanner/source_scanner-dict.py
@@ -155,10 +155,10 @@ expect_bbb = 'bbb.k2 1\nline 2\ninclude1 xxx\nyyy 1\ninclude3 zzz\nline 6\n'
expect_ccc = 'ccc.k3 1\nline 2\ninclude1 xxx\ninclude2 yyy\nzzz 1\nline 6\n'
expect_ddd = 'ddd.k4 1\nline 2\nline 3\n' + expect_aaa + expect_bbb + expect_ccc
-test.must_match('aaa', expect_aaa)
-test.must_match('bbb', expect_bbb)
-test.must_match('ccc', expect_ccc)
-test.must_match('ddd', expect_ddd)
+test.must_match('aaa', expect_aaa, mode='r')
+test.must_match('bbb', expect_bbb, mode='r')
+test.must_match('ccc', expect_ccc, mode='r')
+test.must_match('ddd', expect_ddd, mode='r')
test.up_to_date(arguments = '.')
@@ -176,8 +176,8 @@ test.run(stdout=expect)
expect_ccc = 'ccc.k3 1\nline 2\ninclude1 xxx\ninclude2 yyy\nzzz 2\nline 6\n'
expect_ddd = 'ddd.k4 1\nline 2\nline 3\n' + expect_aaa + expect_bbb + expect_ccc
-test.must_match('bbb', expect_bbb)
-test.must_match('ddd', expect_ddd)
+test.must_match('bbb', expect_bbb, mode='r')
+test.must_match('ddd', expect_ddd, mode='r')
@@ -193,8 +193,8 @@ test.run(stdout=expect)
expect_bbb = 'bbb.k2 1\nline 2\ninclude1 xxx\nyyy 2\ninclude3 zzz\nline 6\n'
expect_ddd = 'ddd.k4 1\nline 2\nline 3\n' + expect_aaa + expect_bbb + expect_ccc
-test.must_match('bbb', expect_bbb)
-test.must_match('ddd', expect_ddd)
+test.must_match('bbb', expect_bbb, mode='r')
+test.must_match('ddd', expect_ddd, mode='r')
@@ -210,8 +210,8 @@ test.run(stdout=expect)
expect_aaa = 'aaa.k1 1\nline 2\nxxx 2\ninclude2 yyy\ninclude3 zzz\nline 6\n'
expect_ddd = 'ddd.k4 1\nline 2\nline 3\n' + expect_aaa + expect_bbb + expect_ccc
-test.must_match('aaa', expect_aaa)
-test.must_match('ddd', expect_ddd)
+test.must_match('aaa', expect_aaa, mode='r')
+test.must_match('ddd', expect_ddd, mode='r')
diff --git a/test/Scanner/unicode.py b/test/Scanner/unicode.py
index c698532..96010de 100644
--- a/test/Scanner/unicode.py
+++ b/test/Scanner/unicode.py
@@ -50,14 +50,17 @@ import sys
def process(outfp, infile):
contents = open(infile, 'rb').read()
- if contents.startswith(codecs.BOM_UTF8):
+ if contents[:len(codecs.BOM_UTF8)] == codecs.BOM_UTF8:
contents = contents[len(codecs.BOM_UTF8):].decode('utf-8')
- elif contents.startswith(codecs.BOM_UTF16_LE):
+ elif contents[:len(codecs.BOM_UTF16_LE)] == codecs.BOM_UTF16_LE:
contents = contents[len(codecs.BOM_UTF16_LE):].decode('utf-16-le')
- elif contents.startswith(codecs.BOM_UTF16_BE):
+ elif contents[:len(codecs.BOM_UTF16_BE)] == codecs.BOM_UTF16_BE:
contents = contents[len(codecs.BOM_UTF16_BE):].decode('utf-16-be')
- else:
+ try:
contents = contents.decode('ascii')
+ except (UnicodeDecodeError, AttributeError) as e:
+ contents = contents
+
for line in contents.split('\n')[:-1]:
if line[:8] == 'include ':
process(outfp, line[8:])
@@ -156,7 +159,7 @@ utf16be.k 1 line 3
foo.k 1 line 4
"""
-test.must_match('foo', expect)
+test.must_match('foo', expect, mode='r')
test.up_to_date(arguments='foo')
@@ -183,7 +186,7 @@ utf16be.k 1 line 3
foo.k 1 line 4
"""
-test.must_match('foo', expect)
+test.must_match('foo', expect, mode='r')
test.up_to_date(arguments = 'foo')
@@ -210,7 +213,7 @@ utf16be.k 1 line 3
foo.k 1 line 4
"""
-test.must_match('foo', expect)
+test.must_match('foo', expect, mode='r')
test.up_to_date(arguments = 'foo')
@@ -237,7 +240,7 @@ utf16be.k 1 line 3
foo.k 1 line 4
"""
-test.must_match('foo', expect)
+test.must_match('foo', expect, mode='r')
test.up_to_date(arguments = 'foo')
@@ -264,7 +267,7 @@ utf16be.k 1 line 3
foo.k 1 line 4
"""
-test.must_match('foo', expect)
+test.must_match('foo', expect, mode='r')
test.up_to_date(arguments = 'foo')