diff options
author | Gary Oberbrunner <garyo@oberbrunner.com> | 2012-04-07 23:00:37 (GMT) |
---|---|---|
committer | Gary Oberbrunner <garyo@oberbrunner.com> | 2012-04-07 23:00:37 (GMT) |
commit | ee869fcc10bfd903b37606f45d324d7c5428f67e (patch) | |
tree | 6df7eb16b5a5faf7c5158136064ea545acb78a63 /QMTest | |
parent | bd7d123c420fb580b8339c976fec607ff93bfd8e (diff) | |
download | SCons-ee869fcc10bfd903b37606f45d324d7c5428f67e.zip SCons-ee869fcc10bfd903b37606f45d324d7c5428f67e.tar.gz SCons-ee869fcc10bfd903b37606f45d324d7c5428f67e.tar.bz2 |
Fix test failures in test/explain/basic.py on Windows due to drive-name case problems (C: vs. c:)
Added new test match function, match_caseinsensitive to handle this and
probably other similar cases.
Diffstat (limited to 'QMTest')
-rw-r--r-- | QMTest/TestCmd.py | 24 |
1 files changed, 24 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) |