Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

romulocintra
Copy link
Member

Test normative change in tc39/ecma402#715

@romulocintra romulocintra requested a review from a team as a code owner September 30, 2022 11:44
@romulocintra romulocintra added the ECMA-402 ECMA-402 related PRs label Sep 30, 2022
Copy link
Contributor

@ptomato ptomato left a 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,
Copy link
Contributor

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.

Comment on lines -30 to -33
assert.throws(RangeError, () => {
new Intl.DateTimeFormat(
'en', { minute: "numeric", second: "numeric", fractionalSecondDigits: 0});
}, "fractionalSecondDigits 0 should throw RangeError for out of range");
Copy link
Contributor

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.

Comment on lines -34 to -42
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");
Copy link
Contributor

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(
Copy link
Contributor

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*.
Copy link
Contributor

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)

@ptomato ptomato added the awaiting consensus This needs committee consensus before it can be eligible to be merged. label Oct 10, 2022
@Ms2ger Ms2ger changed the title Test normative changes in #715 Test normative changes in ECMA-402 #715 Oct 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting author awaiting consensus This needs committee consensus before it can be eligible to be merged. ECMA-402 ECMA-402 related PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants