From dfe57db650c5cddb7ec78c587713a295310453b4 Mon Sep 17 00:00:00 2001 From: Stephan Seitz Date: Sat, 15 Mar 2025 19:05:40 +0100 Subject: [PATCH] ci: add Python test --- .github/workflows/ci.yml | 2 +- bindings/python/tests/test_import.py | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 bindings/python/tests/test_import.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7c32f2e3b..1e755bab5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: test-node: true test-python: true test-go: true - test-swift: false + test-swift: true - name: Parse Petalisp run: | git submodule init diff --git a/bindings/python/tests/test_import.py b/bindings/python/tests/test_import.py new file mode 100644 index 000000000..fe612a4ba --- /dev/null +++ b/bindings/python/tests/test_import.py @@ -0,0 +1,25 @@ +from unittest import TestCase + +import tree_sitter +import tree_sitter_commonlisp + + +class TestLanguage(TestCase): + def test_can_load_grammar(self): + try: + tree_sitter.Language(tree_sitter_commonlisp.language()) + except Exception: + self.fail("Error loading C++ grammar") + + def test_parse(self): + lang = tree_sitter.Language(tree_sitter_commonlisp.language()) + parser = tree_sitter.Parser(lang) + tree = parser.parse( + bytes( + """ + (+ 1 1) + """, + "utf8" + ) + ) + assert tree