def main(): cwd = os.path.abspath('.') scm = detect_scm_system(cwd) cpplint.use_mozilla_styles() (args, flags) = cpplint.parse_arguments([]) for test in TESTS: with open(test["patch"]) as fh: patch = fh.read() with closing(StringIO.StringIO()) as output: cpplint.set_stream(output) checkmozstyle.process_patch(patch, cwd, cwd, scm) result = output.getvalue() with open(test["out"]) as fh: expected_output = fh.read() test_status = "PASSED" if result != expected_output: test_status = "FAILED" print("TEST " + test["patch"] + " " + test_status) print("Got result:\n" + result + "Expected:\n" + expected_output) else: print("TEST " + test["patch"] + " " + test_status)
def main(): has_failed = False cwd = os.path.abspath('.') cpplint.use_mozilla_styles() (args, flags) = cpplint.parse_arguments([]) for test in TESTS: patch = open(test["patch"]).read() cpplint.prepare_results_to_string() checkmozstyle.process_patch(patch, cwd) result = cpplint.get_results() expected_output = open(test["out"]).read() test_status = "PASSED" if result != expected_output: test_status = "FAILED" print "TEST " + test["patch"] + " " + test_status print "Got result:\n" + result + "Expected:\n" + expected_output has_failed = True else: print "TEST " + test["patch"] + " " + test_status