2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-16 01:12:13 +00:00

Upgraded the tool for testing that a certain line exists in the given output support so that it now also knows how to test that a certain line does not exist in the given output.

[SVN r42513]
This commit is contained in:
Jurko Gospodnetić
2008-01-06 07:26:46 +00:00
parent 9cd751107a
commit 1bde777472

View File

@@ -611,7 +611,7 @@ class Tester(TestCmd.TestCmd):
self.unexpected_difference.pprint()
self.fail_test(1)
def _expect_line(self, content, expected):
def _expect_line(self, content, expected, expected_to_exist):
expected = expected.strip()
lines = content.splitlines()
found = 0
@@ -621,18 +621,23 @@ class Tester(TestCmd.TestCmd):
found = 1
break
if not found:
if expected_to_exist and not found:
annotation( "failure",
"Did not find expected line:\n%s\nin output:\n%s" %
(expected, content))
self.fail_test(1)
if not expected_to_exist and found:
annotation( "failure",
"Found an unexpected line:\n%s\nin output:\n%s" %
(expected, content))
self.fail_test(1)
def expect_output_line(self, line):
self._expect_line(self.stdout(), line)
def expect_output_line(self, line, expected_to_exist=True):
self._expect_line(self.stdout(), line, expected_to_exist)
def expect_content_line(self, name, line):
def expect_content_line(self, name, line, expected_to_exist=True):
content = self._read_file(name)
self._expect_line(content, line)
self._expect_line(content, line, expected_to_exist)
def _read_file(self, name, exact=0):
name = self.adjust_names(name)[0]