-
Notifications
You must be signed in to change notification settings - Fork 80
Introduce behavior and structure testing #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
1ca87ba to
6fdda60
Compare
| } | ||
| } | ||
|
|
||
| function getErrorMessage(code, args) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The list of errors comes from https://github.com/projectfluent/fluent-rs/blob/master/src/syntax/errors/list.rs. It's a first draft and I'm sure the list will change and expand as we start writing more tests.
| } | ||
|
|
||
| addSpan(start, end) { | ||
| this.span = new Span(start, end); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I filed projectfluent/fluent#40 for ASDL changes.
Behavior Tests
FTL files which may include special markup with the information about the
expected error. The test runner uses a preprocessor to parse and remove the
error annotation from the file. If there is no error annotation, the file is
expected to parse without errors.
Structure Tests
FTL + JSON AST pairs. JSON files are generated via `make fixtures` and reviewed
by a human. The test runner compares the output of the parser against the saved
AST.
Pike
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To leave the comment here that I did in real life.
I made the test fail, and compared that to how the similar test infrastructure in mercurial fails. The nice feature there is that you see the failure in the format that the test is written in.
Stas' is working on reworking the details of the behavior tests to serialize the annotation data into the format in the test, instead of parsing the comment into an annotation subset object.
Behavior Tests
FTL files which may include special markup with the information about the expected error. The test runner uses a preprocessor to parse and remove the error annotation from the file. If there is no error annotation, the file is expected to parse without errors.
Structure Tests
FTL + JSON AST pairs. JSON files are generated via
make fixturesand reviewed by a human. The test runner compares the output of the parser against the saved AST.