Commit f3758742 authored by Sebastian Graf's avatar Sebastian Graf

Changed the ast flag to --print-ast and properly save pretty-printed input files

parent 11983076
......@@ -106,7 +106,7 @@ class Environment:
mode_flag = {
TestMode.lexer: "--lextest",
TestMode.syntax: "--parsetest",
TestMode.ast: "--pretty-print"
TestMode.ast: "--print-ast"
}[mode]
cmd = [self.mj_run_cmd, mode_flag] + list(args)
return execute(cmd, timeout=self.timeout)
......@@ -117,4 +117,4 @@ class Environment:
:return: (out, err, return code)
"""
return execute([cmd] + list(args), timeout=self.timeout)
\ No newline at end of file
return execute([cmd] + list(args), timeout=self.timeout)
......@@ -85,8 +85,8 @@ class ASTPrettyPrintTest(BasicSyntaxTest):
def _pretty_print(self, input_file: str, output_file: str) -> Tuple[int, str, str]:
out, err, rtcode = self.env.run_mj_command(TestMode.ast, input_file)
with open(output_file, "w") as f:
print(out, file=f)
with open(output_file, "wb") as f:
f.write(out)
return rtcode, out.decode(), err.decode()
TestCase.TEST_CASE_CLASSES["ast"].append(ASTPrettyPrintTest)
\ No newline at end of file
TestCase.TEST_CASE_CLASSES["ast"].append(ASTPrettyPrintTest)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment