Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Commit

Permalink
test for print_py
Browse files Browse the repository at this point in the history
  • Loading branch information
Sivasuthan9 committed Jan 24, 2024
1 parent 3c9a50c commit 39e36d1
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions jaclang/utils/tests/test_lang_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,26 @@ def test_print(self) -> None:
passed += 1
self.assertGreater(passed, 10)

def test_print_py(self) -> None:
"""Testing for print_py AstTool."""
jac_py_directory = os.path.join(
os.path.dirname(jaclang.__file__), "../examples/reference/"
)
jac_py_files = [
f for f in os.listdir(jac_py_directory) if f.endswith((".jac", ".py"))
]
for file in jac_py_files:
msg = "error in " + file
out = AstTool().print_py([jac_py_directory + file])
if file.endswith(".jac"):
self.assertIn("+-- ", out, msg)
self.assertIsNotNone(out, msg=msg)
elif file.endswith(".py"):
if out == (" " * 20 + "\tModule\n"):
continue
self.assertIn("+-- ", out, msg)
self.assertIsNotNone(out, msg=msg)

def test_automated(self) -> None:
"""Testing for py, jac, md files for each content in Jac Grammer."""
lark_path = os.path.join(os.path.dirname(jaclang.__file__), "compiler/jac.lark")
Expand Down

0 comments on commit 39e36d1

Please sign in to comment.