-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,85 @@ | ||
| { | ||
| "date": [ | ||
| { "src": "{:date}", "exp": "{:date}", "errors": [{ "type": "bad-input" }] }, | ||
| { | ||
| "src": "{horse :date}", | ||
| "exp": "{|horse|}", | ||
| "errors": [{ "name": "RangeError" }] | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| }, | ||
| { "src": "{|2006-01-02| :date}", "exp": "1/2/06" }, | ||
| { "src": "{|2006-01-02T15:04:06| :date}", "exp": "1/2/06" }, | ||
| { "src": "{|2006-01-02| :date style=long}", "exp": "January 2, 2006" }, | ||
| { | ||
| "src": ".local $d = {|2006-01-02| :date style=long} {{{$d :date}}}", | ||
| "exp": "January 2, 2006" | ||
| }, | ||
| { | ||
| "src": ".local $t = {|2006-01-02T15:04:06| :time} {{{$t :date}}}", | ||
| "exp": "1/2/06" | ||
| } | ||
| ], | ||
| "time": [ | ||
| { "src": "{:time}", "exp": "{:time}", "errors": [{ "type": "bad-input" }] }, | ||
| { | ||
| "src": "{horse :time}", | ||
| "exp": "{|horse|}", | ||
| "errors": [{ "name": "RangeError" }] | ||
| }, | ||
| { "src": "{|2006-01-02T15:04:06| :time}", "exp": "3:04 PM" }, | ||
| { | ||
| "src": "{|2006-01-02T15:04:06| :time style=medium}", | ||
| "exp": "3:04:06 PM" | ||
| }, | ||
| { | ||
| "src": ".local $t = {|2006-01-02T15:04:06| :time style=medium} {{{$t :time}}}", | ||
| "exp": "3:04:06 PM" | ||
| }, | ||
| { | ||
| "src": ".local $d = {|2006-01-02T15:04:06| :date} {{{$d :time}}}", | ||
| "exp": "3:04 PM" | ||
| } | ||
| ], | ||
| "datetime": [ | ||
| { | ||
| "src": "{:datetime}", | ||
| "exp": "{:datetime}", | ||
| "errors": [{ "type": "bad-input" }] | ||
| }, | ||
| { | ||
| "src": "{$x :datetime}", | ||
| "exp": "{$x}", | ||
| "params": { "x": true }, | ||
| "errors": [{ "type": "bad-input" }] | ||
| }, | ||
| { | ||
| "src": "{horse :datetime}", | ||
| "exp": "{|horse|}", | ||
| "errors": [{ "name": "RangeError" }] | ||
| }, | ||
| { "src": "{|2006-01-02T15:04:06| :datetime}", "exp": "1/2/06, 3:04 PM" }, | ||
| { | ||
| "src": "{|2006-01-02T15:04:06| :datetime year=numeric month=|2-digit|}", | ||
| "exp": "01/2006" | ||
| }, | ||
| { | ||
| "src": "{|2006-01-02T15:04:06| :datetime dateStyle=long}", | ||
| "exp": "January 2, 2006" | ||
| }, | ||
| { | ||
| "src": "{|2006-01-02T15:04:06| :datetime timeStyle=medium}", | ||
| "exp": "3:04:06 PM" | ||
| }, | ||
| { | ||
| "src": "{$dt :datetime}", | ||
| "params": { "dt": "2006-01-02T15:04:06" }, | ||
| "exp": "1/2/06, 3:04 PM" | ||
| }, | ||
| { | ||
| "src": ".input {$dt :time style=medium} {{{$dt :datetime dateStyle=long}}}", | ||
| "params": { "dt": "2006-01-02T15:04:06" }, | ||
| "exp": "January 2, 2006 at 3:04:06 PM" | ||
| } | ||
| ], | ||
| "integer": [ | ||
| { "src": "hello {4.2 :integer}", "exp": "hello 4" }, | ||
| { "src": "hello {-4.20 :integer}", "exp": "hello -4" }, | ||
|
|
@@ -194,44 +275,26 @@ | |
| { | ||
| "src": ".match {$foo :ordinal} one {{st}} two {{nd}} few {{rd}} * {{th}}", | ||
| "params": { "foo": 1 }, | ||
| "exp": "st" | ||
| }, | ||
| { | ||
| "src": ".match {$foo :ordinal} one {{st}} two {{nd}} few {{rd}} * {{th}}", | ||
| "params": { "foo": 2 }, | ||
| "exp": "nd" | ||
| }, | ||
| { | ||
| "src": ".match {$foo :ordinal} one {{st}} two {{nd}} few {{rd}} * {{th}}", | ||
| "params": { "foo": 3 }, | ||
| "exp": "rd" | ||
| }, | ||
| { | ||
| "src": ".match {$foo :ordinal} one {{st}} two {{nd}} few {{rd}} * {{th}}", | ||
| "params": { "foo": 4 }, | ||
| "exp": "th" | ||
| "exp": "th", | ||
| "errors": [{ "type": "missing-func" }, { "type": "not-selectable" }] | ||
| }, | ||
| { | ||
| "src": "hello {42 :ordinal}", | ||
| "exp": "hello {|42|}", | ||
| "errors": [{ "type": "not-formattable" }] | ||
| "errors": [{ "type": "missing-func" }] | ||
| } | ||
| ], | ||
| "plural": [ | ||
| { | ||
| "src": ".match {$foo :plural} one {{one}} * {{other}}", | ||
| "params": { "foo": 1 }, | ||
| "exp": "one" | ||
| }, | ||
| { | ||
| "src": ".match {$foo :plural} one {{one}} * {{other}}", | ||
| "params": { "foo": 1.1 }, | ||
| "exp": "other" | ||
| "exp": "other", | ||
| "errors": [{ "type": "missing-func" }, { "type": "not-selectable" }] | ||
| }, | ||
| { | ||
| "src": "hello {42 :plural}", | ||
| "exp": "hello {|42|}", | ||
| "errors": [{ "type": "not-formattable" }] | ||
| "errors": [{ "type": "missing-func" }] | ||
| } | ||
| ], | ||
| "string": [ | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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".
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:
(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.