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

Commit

Permalink
added test_case
Browse files Browse the repository at this point in the history
  • Loading branch information
AshishMahendra committed Aug 16, 2024
1 parent b4526b8 commit c4f6183
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
File renamed without changes.
File renamed without changes.
31 changes: 31 additions & 0 deletions jaclang/tests/test_language.py
Original file line number Diff line number Diff line change
Expand Up @@ -948,3 +948,34 @@ def test_cls_method(self) -> None:
self.assertEqual("MyClass", stdout_value[0])
self.assertEqual("Hello, World1! Hello, World2!", stdout_value[1])
self.assertEqual("Hello, World! Hello, World22!", stdout_value[2])

def test_list_methods(self) -> None:
"""Test list_modules, list_walkers, list_nodes, and list_edges."""
captured_output = io.StringIO()
sys.stdout = captured_output

jac_import("foo", base_path=self.fixture_abs_path("."))

sys.stdout = sys.__stdout__
stdout_value = captured_output.getvalue()

self.assertIn(
"Module: jaclang.tests.fixtures.foo",
stdout_value,
)
self.assertIn(
"Module: jaclang.tests.fixtures.bar",
stdout_value,
)
self.assertIn(
"Walkers in jaclang.tests.fixtures.bar:\n - Walker: bar_walk",
stdout_value,
)
self.assertIn(
"Nodes in jaclang.tests.fixtures.bar:\n - Node: Item", stdout_value
)
self.assertIn(
"Edges in jaclang.tests.fixtures.bar:\n - Edge: Link", stdout_value
)
self.assertIn("Item value: 0", stdout_value)
self.assertIn("Created 5 items.", stdout_value)

0 comments on commit c4f6183

Please sign in to comment.