##// END OF EJS Templates
tests: move handling of None "el" out of linematch()...
Martin von Zweigbergk -
r38570:5a20b609 default
parent child Browse files
Show More
@@ -1482,8 +1482,9 b' class TTest(Test):'
1482 1482
1483 1483 optional = []
1484 1484 for i, el in enumerate(els):
1485
1486 r = self.linematch(el, lout)
1485 r = False
1486 if el:
1487 r = self.linematch(el, lout)
1487 1488 if isinstance(r, str):
1488 1489 if r == '-glob':
1489 1490 lout = ''.join(el.rsplit(' (glob)', 1))
@@ -1606,41 +1607,40 b' class TTest(Test):'
1606 1607 return TTest.rematch(res, l)
1607 1608
1608 1609 def linematch(self, el, l):
1609 retry = False
1610 1610 if el == l: # perfect match (fast)
1611 1611 return True
1612 if el:
1613 if el.endswith(b" (?)\n"):
1614 retry = "retry"
1615 el = el[:-5] + b"\n"
1612 retry = False
1613 if el.endswith(b" (?)\n"):
1614 retry = "retry"
1615 el = el[:-5] + b"\n"
1616 else:
1617 m = optline.match(el)
1618 if m:
1619 conditions = [c for c in m.group(2).split(b' ')]
1620
1621 el = m.group(1) + b"\n"
1622 if not self._iftest(conditions):
1623 retry = "retry" # Not required by listed features
1624
1625 if el.endswith(b" (esc)\n"):
1626 if PYTHON3:
1627 el = el[:-7].decode('unicode_escape') + '\n'
1628 el = el.encode('utf-8')
1616 1629 else:
1617 m = optline.match(el)
1618 if m:
1619 conditions = [c for c in m.group(2).split(b' ')]
1620
1621 el = m.group(1) + b"\n"
1622 if not self._iftest(conditions):
1623 retry = "retry" # Not required by listed features
1624
1625 if el.endswith(b" (esc)\n"):
1626 if PYTHON3:
1627 el = el[:-7].decode('unicode_escape') + '\n'
1628 el = el.encode('utf-8')
1629 else:
1630 el = el[:-7].decode('string-escape') + '\n'
1631 if el == l or os.name == 'nt' and el[:-1] + b'\r\n' == l:
1630 el = el[:-7].decode('string-escape') + '\n'
1631 if el == l or os.name == 'nt' and el[:-1] + b'\r\n' == l:
1632 return True
1633 if el.endswith(b" (re)\n"):
1634 return TTest.rematch(el[:-6], l) or retry
1635 if el.endswith(b" (glob)\n"):
1636 # ignore '(glob)' added to l by 'replacements'
1637 if l.endswith(b" (glob)\n"):
1638 l = l[:-8] + b"\n"
1639 return TTest.globmatch(el[:-8], l) or retry
1640 if os.altsep:
1641 _l = l.replace(b'\\', b'/')
1642 if el == _l or os.name == 'nt' and el[:-1] + b'\r\n' == _l:
1632 1643 return True
1633 if el.endswith(b" (re)\n"):
1634 return TTest.rematch(el[:-6], l) or retry
1635 if el.endswith(b" (glob)\n"):
1636 # ignore '(glob)' added to l by 'replacements'
1637 if l.endswith(b" (glob)\n"):
1638 l = l[:-8] + b"\n"
1639 return TTest.globmatch(el[:-8], l) or retry
1640 if os.altsep:
1641 _l = l.replace(b'\\', b'/')
1642 if el == _l or os.name == 'nt' and el[:-1] + b'\r\n' == _l:
1643 return True
1644 1644 return retry
1645 1645
1646 1646 @staticmethod
General Comments 0
You need to be logged in to leave comments. Login now