summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaweł Tomulik <ptomulik@meil.pw.edu.pl>2018-10-05 12:35:41 (GMT)
committerPaweł Tomulik <ptomulik@meil.pw.edu.pl>2018-10-05 12:44:38 (GMT)
commit0846483714b5f94bd8f346333479a32b39c90e4f (patch)
tree1599ba5628f00104313ed58412870ecc7e54b332
parentf03ff1b92efbffd410d744869a3b5327f5d211be (diff)
downloadSCons-0846483714b5f94bd8f346333479a32b39c90e4f.zip
SCons-0846483714b5f94bd8f346333479a32b39c90e4f.tar.gz
SCons-0846483714b5f94bd8f346333479a32b39c90e4f.tar.bz2
fixed bugs in must_[not_]_contain()
-rw-r--r--src/CHANGES.txt3
-rw-r--r--testing/framework/TestCommon.py11
2 files changed, 8 insertions, 6 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index 6359560..72ba123 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -6,6 +6,9 @@
RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE
+ From Paweł Tomulik:
+ - Fixed must_contain() and must_not_contain() to work with substrings
+ located at zero offset in a file.
From Daniel Moody:
- Updated FS.py to handle removal of splitunc function from python 3.7
diff --git a/testing/framework/TestCommon.py b/testing/framework/TestCommon.py
index e55b491..53c0388 100644
--- a/testing/framework/TestCommon.py
+++ b/testing/framework/TestCommon.py
@@ -292,14 +292,13 @@ class TestCommon(TestCmd):
return o.index(l)
except ValueError:
return None
- contains = find(file_contents, required)
- if not contains:
+ if find(file_contents, required) is None:
print("File `%s' does not contain required string." % file)
print(self.banner('Required string '))
print(required)
print(self.banner('%s contents ' % file))
print(file_contents)
- self.fail_test(not contains)
+ self.fail_test()
def must_contain_all(self, output, input, title=None, find=None):
"""Ensures that the specified output string (first argument)
@@ -514,14 +513,14 @@ class TestCommon(TestCmd):
return o.index(l)
except ValueError:
return None
- contains = find(file_contents, banned)
- if contains:
+
+ if find(file_contents, banned) is not None:
print("File `%s' contains banned string." % file)
print(self.banner('Banned string '))
print(banned)
print(self.banner('%s contents ' % file))
print(file_contents)
- self.fail_test(contains)
+ self.fail_test()
def must_not_contain_any_line(self, output, lines, title=None, find=None):
"""Ensures that the specified output string (first argument)