Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add intentionally erroneous tests #34

Open
novusnota opened this issue Jun 18, 2024 · 1 comment
Open

Add intentionally erroneous tests #34

novusnota opened this issue Jun 18, 2024 · 1 comment
Assignees
Labels
ci/cd & packaging NPM, Crates, etc. testing Running various tests for the grammar/parser and bindings

Comments

@novusnota
Copy link
Member

novusnota commented Jun 18, 2024

For that, use :error attribute in tests, see: https://tree-sitter.github.io/tree-sitter/creating-parsers

Alternatively (or additionally?), a simple check can be added to CI, which would take the contents of grammar/test-failed folder in Tact compiler repo and run the parser against them.

P.S.: Note, that tests related to identifiers starting with __gen and __tact won't fail in tree-sitter-tact as of now. There are no lookbehinds, so that's probably up to highlighting to check it via the queries. Same goes for _.

@novusnota novusnota added ci/cd & packaging NPM, Crates, etc. testing Running various tests for the grammar/parser and bindings labels Jun 18, 2024
@novusnota novusnota self-assigned this Jun 18, 2024
@anton-trunov
Copy link
Member

That would be so great! 👍

We could also use random testing to test against different parsers for Tact: you generate ASTs randomly, pretty-print them and make sure the parse trees of the produced source code are (kind of) the same. Also, you can introduce random changes to those ASTs or source code and check all the parsers either succeed or fail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci/cd & packaging NPM, Crates, etc. testing Running various tests for the grammar/parser and bindings
Projects
None yet
Development

No branches or pull requests

2 participants