The goal of this is faster testing cycles and more precise test cases than using transcripts. However, there is a bunch of background work to make it work. Most notably it
creates a unison-util-recursion package to unify the recursion-schemey code around the repo and
restructures the Doc data types to allow for more consistent annotation (using Cofree), so that it can be filtered out for the tests (like how Token is removed from the lexer tests).
Implementation notes
This takes more advantage of fixed-point operators to allow changing the structure more easily (dropping annotations for test cases).
The Doc restructuring also encodes more of the restrictions in types (which had previously been in comments). We don’t want to keep those restrictions, but they reflect what the parser is currently able to parse.
This PR also changes the lexer unit tests a bit to catch some failures that could previously be missed. E.g., since it dropped the first and last token of the actual result (to match the provided expected result), an Err lexeme could be dropped, making a failure look like a success when compared against an empty expected result, or at least obscuring the reason for a failure.
Interesting/controversial decisions
I don’t know … recursion schemes? Although they’re already used in a few places, like the ABTs.
Test coverage
This adds a bunch of new unit tests, but none of them are particularly interesting, just a few to justify the existence of the new test suite.
Loose ends
Moar tests in the suite, that focus on edge cases. But with upcoming changes like #5255, it seems premature to try to explore the boundaries of the current syntax.
Overview
The goal of this is faster testing cycles and more precise test cases than using transcripts. However, there is a bunch of background work to make it work. Most notably it
unison-util-recursion
package to unify the recursion-schemey code around the repo andToken
is removed from the lexer tests).Implementation notes
This takes more advantage of fixed-point operators to allow changing the structure more easily (dropping annotations for test cases).
The Doc restructuring also encodes more of the restrictions in types (which had previously been in comments). We don’t want to keep those restrictions, but they reflect what the parser is currently able to parse.
This PR also changes the lexer unit tests a bit to catch some failures that could previously be missed. E.g., since it dropped the first and last token of the actual result (to match the provided expected result), an
Err
lexeme could be dropped, making a failure look like a success when compared against an empty expected result, or at least obscuring the reason for a failure.Interesting/controversial decisions
I don’t know … recursion schemes? Although they’re already used in a few places, like the ABTs.
Test coverage
This adds a bunch of new unit tests, but none of them are particularly interesting, just a few to justify the existence of the new test suite.
Loose ends
Moar tests in the suite, that focus on edge cases. But with upcoming changes like #5255, it seems premature to try to explore the boundaries of the current syntax.