diff options
author | Gary Oberbrunner <garyo@oberbrunner.com> | 2012-04-07 23:03:57 (GMT) |
---|---|---|
committer | Gary Oberbrunner <garyo@oberbrunner.com> | 2012-04-07 23:03:57 (GMT) |
commit | 3f12a1c631ea102483cdafd8bd45364986fee825 (patch) | |
tree | a068e53380c92bfe47afeb39d217c4fe93c68970 | |
parent | 2c6ff299c6cc72fa9cd65791a1776b64d509c845 (diff) | |
parent | ee869fcc10bfd903b37606f45d324d7c5428f67e (diff) | |
download | SCons-3f12a1c631ea102483cdafd8bd45364986fee825.zip SCons-3f12a1c631ea102483cdafd8bd45364986fee825.tar.gz SCons-3f12a1c631ea102483cdafd8bd45364986fee825.tar.bz2 |
Merged in garyo/scons (pull request #18)
-rw-r--r-- | QMTest/TestCmd.py | 24 | ||||
-rw-r--r-- | test/explain/basic.py | 2 |
2 files changed, 26 insertions, 0 deletions
diff --git a/QMTest/TestCmd.py b/QMTest/TestCmd.py index 1d5e4d0..a27df27 100644 --- a/QMTest/TestCmd.py +++ b/QMTest/TestCmd.py @@ -128,6 +128,7 @@ There are a bunch of methods that let you do different things: test.match_exact("actual 1\nactual 2\n", "expected 1\nexpected 2\n") test.match_exact(["actual 1\n", "actual 2\n"], ["expected 1\n", "expected 2\n"]) + test.match_caseinsensitive("Actual 1\nACTUAL 2\n", "expected 1\nEXPECTED 2\n") test.match_re("actual 1\nactual 2\n", regex_string) test.match_re(["actual 1\n", "actual 2\n"], list_of_regexes) @@ -180,6 +181,8 @@ matching in the same way as the match_*() methods described above. test = TestCmd.TestCmd(match = TestCmd.match_exact) + test = TestCmd.TestCmd(match = TestCmd.match_caseinsensitive) + test = TestCmd.TestCmd(match = TestCmd.match_re) test = TestCmd.TestCmd(match = TestCmd.match_re_dotall) @@ -190,6 +193,8 @@ These functions are also available as static methods: test = TestCmd.TestCmd(match = TestCmd.TestCmd.match_exact) + test = TestCmd.TestCmd(match = TestCmd.TestCmd.match_caseinsensitive) + test = TestCmd.TestCmd(match = TestCmd.TestCmd.match_re) test = TestCmd.TestCmd(match = TestCmd.TestCmd.match_re_dotall) @@ -200,6 +205,8 @@ These static methods can be accessed by a string naming the method: test = TestCmd.TestCmd(match = 'match_exact') + test = TestCmd.TestCmd(match = 'match_caseinsensitive') + test = TestCmd.TestCmd(match = 'match_re') test = TestCmd.TestCmd(match = 'match_re_dotall') @@ -328,6 +335,7 @@ __all__ = [ 'no_result', 'pass_test', 'match_exact', + 'match_caseinsensitive', 'match_re', 'match_re_dotall', 'python', @@ -466,6 +474,20 @@ def match_exact(lines = None, matches = None): return return 1 +def match_caseinsensitive(lines = None, matches = None): + """ + """ + if not is_List(lines): + lines = lines.split("\n") + if not is_List(matches): + matches = matches.split("\n") + if len(lines) != len(matches): + return + for i in range(len(lines)): + if lines[i].lower() != matches[i].lower(): + return + return 1 + def match_re(lines = None, res = None): """ """ @@ -1127,6 +1149,8 @@ class TestCmd(object): match_exact = staticmethod(match_exact) + match_caseinsensitive = staticmethod(match_caseinsensitive) + match_re = staticmethod(match_re) match_re_dotall = staticmethod(match_re_dotall) diff --git a/test/explain/basic.py b/test/explain/basic.py index bca8436..1f0a16c 100644 --- a/test/explain/basic.py +++ b/test/explain/basic.py @@ -305,7 +305,9 @@ scons: rebuilding `file3' because `zzz' is a new dependency %(_python_)s %(cat_py)s file3 xxx yyy zzz """ % locals()) +test.set_match_function(TestSCons.match_caseinsensitive) test.run(chdir='src', arguments=args, stdout=expect) +test.set_match_function(TestSCons.match_exact) test.must_match(['src', 'file3'], "xxx 1\nyyy 2\nzzz 2\n") |