-
-
Notifications
You must be signed in to change notification settings - Fork 36
Add tests from [email protected] #696
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
{ | ||
"src": "{horse :date}", | ||
"exp": "{|horse|}", | ||
"errors": [{ "name": "RangeError" }] |
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 believe the spec says this should be an invalid expression error. Your code might call this a RangeError
. Fix?
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.
Ah, true. I currently don't add a wrapper for the built in JS RangeError that's the cause here, as the :number
spec requires.
"missing space {:func @bar@baz}", | ||
"missing space {:func @bar=42@baz}", | ||
"missing space {+reserved@bar}", | ||
"missing space {&private@bar}", |
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.
These don't seem like "missing space".
"missing space {:func @bar@baz}", | |
"missing space {:func @bar=42@baz}", | |
"missing space {+reserved@bar}", | |
"missing space {&private@bar}", | |
"missing equals {:func @bar@baz}", | |
"missing quotes {:func @bar=42@baz}", | |
"reserved {+reserved@bar}", | |
"private {&private@bar}", |
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.
All of those can be turned into valid syntax with the addition of a single space:
"missing space {:func @bar@baz}", | |
"missing space {:func @bar=42@baz}", | |
"missing space {+reserved@bar}", | |
"missing space {&private@bar}", | |
"missing space {:func @bar @baz}", | |
"missing space {:func @bar=42 @baz}", | |
"missing space {+reserved @bar}", | |
"missing space {&private @bar}", |
(the above is not intended as an actual suggestion, just to show a nice diff)
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.
Technically, though, they are invalid name tests. You created them by removing non-optional spaces, of course.
Suggestion (does not have to be in this PR): unify schemas? A good target would be the one used for functions. For example
And
|
Not really sure what you mean here. At least for now, all of the |
What I mean is that For example: [
...
"bad {:placeholder option=x option=x}",
...
".input {$foo} .input {$foo} {{_}}"
...
] vs. {
"syntax-errors": [
...
],
"data-model-errors": [
{
"src": "bad {:placeholder option=x option=x}",
"errors": [{ "type": "duplicate-option-name" }]
}
{
"src": ".input {$foo} .input {$foo} {{_}}",
"errors": [{ "type": "duplicate-declaration" }]
}
]
} The second benefit is that there is one single schema for all test files. |
@aphillips Could this be merged, so that further work on the tests can build on top of it, such as #707 and #708? I understood that to be the conclusion reached during the last call. |
Per our conversation, we were waiting on people not named @aphillips and @eemeli to review before merging. But we're holding up additional work by retaining this as a PR. |
Update the test suite with new and changed tests to match the latest spec, as a copy from https://github.com/messageformat/messageformat/tree/[email protected]/packages/mf2-messageformat/src/__fixtures.
These add tests for markup-close with options,
:date
,:time
, and:datetime
, as well as various corner cases encountered during development.