The language should support a syntactic method for writing tests in the same file as the patterns. I'm not totally sure how this should be, will require some research.
Initial thoughts:
- use
--- to separate code from tests, multiple --- indicates multiple tests
- test blocks are just object property declarations, where the properties are the shape of a test object
- or maybe its just yaml?
- The test just runs the pattern with the given input, deep equals it to the expected output
- The test object may have some other fields to describe expectations like:
throws?: boolean | Pattern
matched?: boolean
done?: boolean
errors?: MachError[]
Letter = "a"-"z"
Main = Letter+
---
input: abc
expected: abc
---
input: abc1
expected: abc
matched: true
done: false
The language should support a syntactic method for writing tests in the same file as the patterns. I'm not totally sure how this should be, will require some research.
Initial thoughts:
---to separate code from tests, multiple---indicates multiple teststhrows?: boolean | Patternmatched?: booleandone?: booleanerrors?: MachError[]