Lightweight pattern testing facility
Pattern writers need to test their patterns and it makes sense to automate this. I propose starting with a lightweight testing capability that checks patterns against sample input and looks for only accepts and rejects outcomes. (In future, more information about a match could be tested.)
Design ideas:
- Let the pattern writer put tests into their rpl files as comments (see below)
- Implement a
rosie test <filename>
command that parses the tests out of an rpl file and runs them - When reporting results, a test should be considered a failure if there were leftover characters
- Many features could be added, but at this stage it is more important to keep it very simple
E.g. rpl file snippet:
common.word = [:alpha:]+
— common.word accepts “foo”
— common.word rejects “12356”, " ", "#!"