Open novusnota opened 5 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.
For that, use
:error
attribute in tests, see: https://tree-sitter.github.io/tree-sitter/creating-parsersAlternatively (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_
.