--- a/tests/run-tests.py Fri Jun 14 17:39:16 2019 +0100
+++ b/tests/run-tests.py Fri Jun 14 17:50:04 2019 +0100
@@ -1306,6 +1306,11 @@
WARN_YES = 2
WARN_NO = 3
+MARK_OPTIONAL = b" (?)\n"
+
+def isoptional(line):
+ return line.endswith(MARK_OPTIONAL)
+
class TTest(Test):
"""A "t test" is a test backed by a .t file."""
@@ -1660,7 +1665,7 @@
els.pop(i)
break
if el:
- if el.endswith(b" (?)\n"):
+ if isoptional(el):
optional.append(i)
else:
m = optline.match(el)
@@ -1700,7 +1705,7 @@
while expected.get(pos, None):
el = expected[pos].pop(0)
if el:
- if not el.endswith(b" (?)\n"):
+ if not isoptional(el):
m = optline.match(el)
if m:
conditions = [c for c in m.group(2).split(b' ')]
@@ -1773,9 +1778,9 @@
if el == l: # perfect match (fast)
return True, True
retry = False
- if el.endswith(b" (?)\n"):
+ if isoptional(el):
retry = "retry"
- el = el[:-5] + b"\n"
+ el = el[:-len(MARK_OPTIONAL)] + b"\n"
else:
m = optline.match(el)
if m: