Gary Oberbrunner avatar Gary Oberbrunner committed e17ac82

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.

Comments (0)

Files changed (2)

QMTest/TestCmd.py

     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)
 
     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)
 
     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)
 
     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')
     'no_result',
     'pass_test',
     'match_exact',
+    'match_caseinsensitive',
     'match_re',
     'match_re_dotall',
     'python',
             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):
     """
     """
 
     match_exact = staticmethod(match_exact)
 
+    match_caseinsensitive = staticmethod(match_caseinsensitive)
+
     match_re = staticmethod(match_re)
 
     match_re_dotall = staticmethod(match_re_dotall)

test/explain/basic.py

 %(_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")
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.