summaryrefslogtreecommitdiffstats
path: root/QMTest
diff options
context:
space:
mode:
authorWilliam Blevins <wblevins@gmail.com>2015-05-13 04:06:05 (GMT)
committerWilliam Blevins <wblevins@gmail.com>2015-05-13 04:06:05 (GMT)
commit654e4414d80324b2a4c2edf3c685a38feec514f6 (patch)
tree7737341f5fb8ae66270f595abe6ef3fa061dafb8 /QMTest
parentd152e4ce442ae724084c9304c9e36e882fa5850d (diff)
downloadSCons-654e4414d80324b2a4c2edf3c685a38feec514f6.zip
SCons-654e4414d80324b2a4c2edf3c685a38feec514f6.tar.gz
SCons-654e4414d80324b2a4c2edf3c685a38feec514f6.tar.bz2
Issue 2264: Added SWIG recursive dependency tests.
Diffstat (limited to 'QMTest')
-rw-r--r--QMTest/TestCommon.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/QMTest/TestCommon.py b/QMTest/TestCommon.py
index 4e90e16..275d4f2 100644
--- a/QMTest/TestCommon.py
+++ b/QMTest/TestCommon.py
@@ -36,6 +36,8 @@ provided by the TestCommon class:
test.must_contain('file', 'required text\n')
+ test.must_contain_all(output, lines, ['title', find])
+
test.must_contain_all_lines(output, lines, ['title', find])
test.must_contain_any_line(output, lines, ['title', find])
@@ -305,6 +307,36 @@ class TestCommon(TestCmd):
print file_contents
self.fail_test(not contains)
+ def must_contain_all(self, output, input, title=None, find=None):
+ """Ensures that the specified output string (first argument)
+ contains all of the specified input as a block (second argument).
+
+ An optional third argument can be used to describe the type
+ of output being searched, and only shows up in failure output.
+
+ An optional fourth argument can be used to supply a different
+ function, of the form "find(line, output), to use when searching
+ for lines in the output.
+ """
+ if find is None:
+ def find(o, i):
+ try:
+ return o.index(i)
+ except ValueError:
+ return None
+
+ if is_List(output):
+ output = os.newline.join(output)
+
+ if find(output, input) is None:
+ if title is None:
+ title = 'output'
+ print 'Missing expected input from %s:' % title
+ print input
+ print self.banner(title + ' ')
+ print output
+ self.fail_test()
+
def must_contain_all_lines(self, output, lines, title=None, find=None):
"""Ensures that the specified output string (first argument)
contains all of the specified lines (second argument).