# HG changeset patch # User Teemu Piippo # Date 1600451186 -10800 # Node ID 16dae12ac0f0b627ffbb763be914c30dd52818dd # Parent 43d6ed8515aba22a5741a170192e0dc1f5283a64 added bad line ending test diff -r 43d6ed8515ab -r 16dae12ac0f0 unittest.py --- a/unittest.py Fri Sep 18 20:41:33 2020 +0300 +++ b/unittest.py Fri Sep 18 20:46:26 2020 +0300 @@ -25,7 +25,7 @@ with open(unit_test_path, 'rb') as device: import re problem_types = set() - expecting = set() + expecting = None while True: pos = device.tell() line = bytes.decode(device.readline()) @@ -34,14 +34,18 @@ match = re.match('^0 Testing: (.+)', line) if match: set.update(problem_types, match.group(1).split()) + elif str.strip(line) == '0 Expecting: none': + expecting = set() else: match = re.match('^0 Expecting: (.+)', line) if match: + if not expecting: + expecting = set() set.update(expecting, map(parse_expectation, match.group(1).split())) else: device.seek(pos) break - if not problem_types or not expecting: + if not problem_types or expecting is None: raise ValueError(str.format( 'Unit test {name} does not have a proper manifest', name = name, diff -r 43d6ed8515ab -r 16dae12ac0f0 unittests/bad-line-endings-dos.test --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/unittests/bad-line-endings-dos.test Fri Sep 18 20:46:26 2020 +0300 @@ -0,0 +1,3 @@ +0 Testing: bad-line-endings +0 Expecting: none +1 16 0 0 0 1 0 0 0 1 0 0 0 1 box.dat diff -r 43d6ed8515ab -r 16dae12ac0f0 unittests/bad-line-endings-unix.test --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/unittests/bad-line-endings-unix.test Fri Sep 18 20:46:26 2020 +0300 @@ -0,0 +1,3 @@ +0 Testing: bad-line-endings +0 Expecting: bad-line-endings:1 +1 16 0 0 0 1 0 0 0 1 0 0 0 1 box.dat