-
Notifications
You must be signed in to change notification settings - Fork 482
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
Test normative changes in ECMA-402 #715 #3679
base: main
Are you sure you want to change the base?
Conversation
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.
This looks good, thanks! I have a few recommendations about maintaining the same coverage for testing out-of-range values for fractionalSecondDigits
, and some questions about the spec text which I will post in the ECMA-402 PR.
@@ -21,11 +23,8 @@ const invalidOptions = [ | |||
"full", | |||
"numeric", | |||
-1, | |||
4, |
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 would recommend replacing the removed lines with new values that are still invalid. E.g. 10
, "10"
, and 9.000001
.
assert.throws(RangeError, () => { | ||
new Intl.DateTimeFormat( | ||
'en', { minute: "numeric", second: "numeric", fractionalSecondDigits: 0}); | ||
}, "fractionalSecondDigits 0 should throw RangeError for out of range"); |
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'd recommend keeping these out-of-range tests but changing the values from 0 and 4, to -1 and 10.
assert.throws(RangeError, () => { | ||
new Intl.DateTimeFormat( | ||
'en', { minute: "numeric", second: "numeric", fractionalSecondDigits: 0}); | ||
}, "fractionalSecondDigits 0 should throw RangeError for out of range"); | ||
|
||
assert.throws(RangeError, () => { | ||
new Intl.DateTimeFormat( | ||
'en', { minute: "numeric", second: "numeric", fractionalSecondDigits: 4}); | ||
}, "fractionalSecondDigits 4 should throw RangeError for out of range"); |
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.
Same, I'd recommend testing -1 and 10.
assert.throws(RangeError, () => { | ||
new Intl.DateTimeFormat( | ||
'en', { minute: "numeric", second: "numeric", fractionalSecondDigits: 4}); | ||
}, "fractionalSecondDigits 4 should throw RangeError for out of range"); | ||
|
||
let dtf = new Intl.DateTimeFormat( |
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.
Should this one test the same values that you're looping over in the other test files? (undefined, 0, "0", etc)
@@ -7,7 +8,8 @@ description: > | |||
Checks error cases for the options argument to the DateTimeFormat constructor. | |||
info: | | |||
InitializeDateTimeFormat ( dateTimeFormat, locales, options ) | |||
23. Let _opt_.[[FractionalSecondDigits]] be ? GetNumberOption(_options_, `"fractionalSecondDigits"`, 0, 3, 0). | |||
1. Let _value_ be ? GetNumberOption(_options_, *"fractionalSecondDigits"*, 0, 9, *undefined*). | |||
1. If _value_ is one of *"0"*, *"4"*, *"5"*, *"6"*, *"7"*, *"8"*, *"9"*, set _value_ to *undefined*. |
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.
(See my comment in the ECMA-402 PR about this line of the spec text)
Test normative change in tc39/ecma402#715