STR-354: parse-unit: support concrete syntax for test results
Reported by Tiago:
What I would like to specify as an unit test is something like this:
2 + 3 + 4 -> (2 + 3) + 4
2 + 3 * 4 + 6 -> (2 + (3 * 4) ) + 6This would allow me to specify the ambiguities, have control of the output tree but not using directly the tree which can change without breaking the unit tests. Also, this kind of tests can be used as documentation, since it explains exactly what is being tested.
In my tests an unit test is just something like:
“2 + 3 + 4” -> succeeds
Which I believe is not very correct (I should improve my tests).
You can argue that using parenthesis is not sufficient generic, because sometimes we need to keep track where parenthesis were used in the code. I think this is true, but only when you want to pretty-print the AST, because in transformation it is more complicated to handle this case, and the tree has already been created with the right shape (That’s the only reason I could figure out but I believe that can be other reasons).
Submitted on 22 July 2005 at 15:56
Issue Log
Log in to post comments