This commit is contained in:
24
tests.py
24
tests.py
@@ -51,19 +51,19 @@ def run_test(self, source, target_nodes, target_value, target_output="", input_l
|
||||
self.assertEqual(captured.getvalue(), target_output, "Output test")
|
||||
|
||||
##########################
|
||||
###### Printer Test ###### (commented out — no print() on AST nodes yet)
|
||||
###### Printer Test ######
|
||||
##########################
|
||||
# try:
|
||||
# new_text = program.print()
|
||||
# new_tokens = Lexer().get_lexer().lex(new_text + "\n")
|
||||
# new_nodes = Parser().parse(new_tokens)
|
||||
# except Exception as e:
|
||||
# raise Exception(f"###Printer test###\n{new_text}") from e
|
||||
# self.assertEqual(
|
||||
# program,
|
||||
# new_nodes,
|
||||
# f"Printer test\n{source}\n{new_text}"
|
||||
# )
|
||||
try:
|
||||
new_text = program.print()
|
||||
new_tokens = Lexer().get_lexer().lex(new_text + "\n")
|
||||
new_nodes = Parser().parse(new_tokens)
|
||||
except Exception as e:
|
||||
raise Exception(f"###Printer test###\n{new_text}") from e
|
||||
self.assertEqual(
|
||||
program,
|
||||
new_nodes,
|
||||
f"Printer test\n{source}\n{new_text}"
|
||||
)
|
||||
|
||||
##########################
|
||||
###### Compiler Test #####
|
||||
|
||||
Reference in New Issue
Block a user