🐐 print

This commit is contained in:
2026-04-01 11:30:38 +02:00
parent 83657f17f5
commit 74ad338b63
2 changed files with 102 additions and 12 deletions

View File

@@ -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 #####