tact-lang / tree-sitter-tact

🌳 Tree-sitter grammar for the ⚡ Tact contract programming language
https://tact-lang.org
MIT License
18 stars 0 forks source link

Add intentionally erroneous tests #34

Open novusnota opened 3 months ago

novusnota commented 3 months ago

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 _.

anton-trunov commented 3 months ago

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.