mtest: TAP: ignore empty lines

According to http://testanything.org/tap-specification.html

"Any output line that is not a version, a plan, a test line, a
diagnostic or a bail out is considered an “unknown” line. A TAP parser
is required to not consider an unknown line as an error but may
optionally choose to capture said line and hand it to the test
harness, which may have custom behavior attached [...] TAP::Harness
reports TAP syntax errors at the end of a test run".

(glib gtest can generate empty lines)
pull/5949/head
Marc-André Lureau 5 years ago committed by Jussi Pakkanen
parent 6b0c711c91
commit 6a12f3fc16
  1. 3
      mesonbuild/mtest.py
  2. 6
      run_unittests.py

@ -299,6 +299,9 @@ class TAPParser:
yield self.Version(version=version)
continue
if len(line) == 0:
continue
yield self.Error('unexpected input at line %d' % (lineno,))
if state == self._YAML:

@ -6730,6 +6730,12 @@ class TAPParserTests(unittest.TestCase):
self.assert_plan(events, count=1, late=True)
self.assert_last(events)
def test_empty_line(self):
events = self.parse_tap('1..1\n\nok 1')
self.assert_plan(events, count=1, late=False)
self.assert_test(events, number=1, name='', result=TestResult.OK)
self.assert_last(events)
def test_unexpected(self):
events = self.parse_tap('1..1\ninvalid\nok 1')
self.assert_plan(events, count=1, late=False)

Loading…
Cancel
Save