##// END OF EJS Templates
tests: don't allow reodering of glob/re lines across non-glob/re lines...
Martin von Zweigbergk -
r38572:f83600ef default
parent child Browse files
Show More
@@ -1484,7 +1484,7 b' class TTest(Test):'
1484 for i, el in enumerate(els):
1484 for i, el in enumerate(els):
1485 r = False
1485 r = False
1486 if el:
1486 if el:
1487 r = self.linematch(el, lout)
1487 r, exact = self.linematch(el, lout)
1488 if isinstance(r, str):
1488 if isinstance(r, str):
1489 if r == '-glob':
1489 if r == '-glob':
1490 lout = ''.join(el.rsplit(' (glob)', 1))
1490 lout = ''.join(el.rsplit(' (glob)', 1))
@@ -1508,6 +1508,11 b' class TTest(Test):'
1508
1508
1509 if not self._iftest(conditions):
1509 if not self._iftest(conditions):
1510 optional.append(i)
1510 optional.append(i)
1511 if exact:
1512 # Don't allow line to be matches against a later
1513 # line in the output
1514 els.pop(i)
1515 break
1511
1516
1512 if r:
1517 if r:
1513 if r == "retry":
1518 if r == "retry":
@@ -1608,7 +1613,7 b' class TTest(Test):'
1608
1613
1609 def linematch(self, el, l):
1614 def linematch(self, el, l):
1610 if el == l: # perfect match (fast)
1615 if el == l: # perfect match (fast)
1611 return True
1616 return True, True
1612 retry = False
1617 retry = False
1613 if el.endswith(b" (?)\n"):
1618 if el.endswith(b" (?)\n"):
1614 retry = "retry"
1619 retry = "retry"
@@ -1629,19 +1634,19 b' class TTest(Test):'
1629 else:
1634 else:
1630 el = el[:-7].decode('string-escape') + '\n'
1635 el = el[:-7].decode('string-escape') + '\n'
1631 if el == l or os.name == 'nt' and el[:-1] + b'\r\n' == l:
1636 if el == l or os.name == 'nt' and el[:-1] + b'\r\n' == l:
1632 return True
1637 return True, True
1633 if el.endswith(b" (re)\n"):
1638 if el.endswith(b" (re)\n"):
1634 return TTest.rematch(el[:-6], l) or retry
1639 return (TTest.rematch(el[:-6], l) or retry), False
1635 if el.endswith(b" (glob)\n"):
1640 if el.endswith(b" (glob)\n"):
1636 # ignore '(glob)' added to l by 'replacements'
1641 # ignore '(glob)' added to l by 'replacements'
1637 if l.endswith(b" (glob)\n"):
1642 if l.endswith(b" (glob)\n"):
1638 l = l[:-8] + b"\n"
1643 l = l[:-8] + b"\n"
1639 return TTest.globmatch(el[:-8], l) or retry
1644 return (TTest.globmatch(el[:-8], l) or retry), False
1640 if os.altsep:
1645 if os.altsep:
1641 _l = l.replace(b'\\', b'/')
1646 _l = l.replace(b'\\', b'/')
1642 if el == _l or os.name == 'nt' and el[:-1] + b'\r\n' == _l:
1647 if el == _l or os.name == 'nt' and el[:-1] + b'\r\n' == _l:
1643 return True
1648 return True, True
1644 return retry
1649 return retry, True
1645
1650
1646 @staticmethod
1651 @staticmethod
1647 def parsehghaveoutput(lines):
1652 def parsehghaveoutput(lines):
@@ -40,7 +40,7 b' def lm(expected, output):'
40 assert not re.search(br'[^ \w\\/\r\n()*?]', expected + output), \
40 assert not re.search(br'[^ \w\\/\r\n()*?]', expected + output), \
41 b'single backslash or unknown char'
41 b'single backslash or unknown char'
42 test = run_tests.TTest(b'test-run-test.t', b'.', b'.')
42 test = run_tests.TTest(b'test-run-test.t', b'.', b'.')
43 match = test.linematch(expected, output)
43 match, exact = test.linematch(expected, output)
44 if isinstance(match, str):
44 if isinstance(match, str):
45 return 'special: ' + match
45 return 'special: ' + match
46 elif isinstance(match, bytes):
46 elif isinstance(match, bytes):
@@ -142,21 +142,18 b' test how multiple globs gets matched wit'
142
142
143 --- $TESTTMP/test-failure-globs.t
143 --- $TESTTMP/test-failure-globs.t
144 +++ $TESTTMP/test-failure-globs.t.err
144 +++ $TESTTMP/test-failure-globs.t.err
145 @@ -2,10 +2,10 @@
145 @@ -2,9 +2,9 @@
146 context
146 context
147 context
147 context
148 key: 1
148 key: 1
149 - value: a
149 - value: a
150 + value: * (glob)
150 + value: not a
151 key: 2
151 key: 2
152 - value: b
152 - value: b
153 + value: * (glob)
153 + value: not b
154 key: 3
154 key: 3
155 - value: * (glob)
155 value: * (glob)
156 + value: c
157 key: 4
156 key: 4
158 - value: * (glob)
159 + value: d
160
157
161 ERROR: test-failure-globs.t output changed
158 ERROR: test-failure-globs.t output changed
162 !
159 !
General Comments 0
You need to be logged in to leave comments. Login now