feat: add parser visitor for Tamil keywords

This commit is contained in:
2026-05-03 12:55:30 -05:00
parent b06bfe7727
commit 14c95ee3d1
2 changed files with 126 additions and 0 deletions

44
tests/test_parser.py Normal file
View File

@@ -0,0 +1,44 @@
"""Test parser functionality."""
import pytest
from src.tampy.transpiler import TamilParser
def test_parse_simple_python():
"""Test parsing simple Python code."""
code = "print('hello')"
keywords = {"print": "இருப்பு"}
parser = TamilParser(keywords)
tree = parser.parse(code)
assert isinstance(tree, ast.Module)
def test_parse_import_statement():
"""Test parsing import statement."""
code = "import sys"
keywords = {"import": "மேற்கோள்கள்"}
parser = TamilParser(keywords)
tree = parser.parse(code)
assert isinstance(tree, ast.Module)
def test_parse_function_definition():
"""Test parsing function definition."""
code = "def foo(): pass"
keywords = {"def": "வரையறை"}
parser = TamilParser(keywords)
tree = parser.parse(code)
assert isinstance(tree, ast.Module)
if __name__ == "__main__":
test_parse_simple_python()
test_parse_import_statement()
test_parse_function_definition()
print("All tests passed")