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

Add DateTimeFormat.prototype.formatToParts tests #734

Merged
merged 1 commit into from
Jul 28, 2016

Conversation

zbraniecki
Copy link
Member

This is a set of tests for tc39/ecma402#64 which we'd like to land in the spec soon.

I'd like to get the test262 tests for this change ready to land as part of the getting the proposal to stage 4.

I'm not sure how much more testing is required since most of the feature is tested in DateTimeFormat.prototype.format tests, and this is just a different representation of the output.

I'd like to get the PR to be ready to land once we land the feature in the spec, so would like to get it reviewed now.

@leobalter, @jugglinmike - can you review this?

@rwaldron
Copy link
Contributor

@jugglinmike @leobalter @tcare

Per TC39 discussion today, the formatToParts proposal needs this merged to finalize Stage 4. At the moment, @leobalter is reviewing (he's sitting next to me)

@leobalter
Copy link
Member

Ok, I think there are some minor coverage holes here. Due to willing to get this done quickly, I'm doing some coordinated work with @zbraniecki and we'll have @tcare to review it.

@leobalter
Copy link
Member

I've wrote some additional tests. There's something else I'll give feedback within the main.js file.

dtf.format(value),
reduce(dtf.formatToParts(value)),
`Expected the same value for value ${value},
locales: ${locales} and options: ${options}`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we avoid using DateTimeFormat#format to compare the values? In any other case, I believe it would be good to have a minimum check for type and value for each part.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can, but it's a useful shortcut I think.

Would you prefer me to compare all tests to a result Array?

@zbraniecki
Copy link
Member Author

@leobalter - I merged your changes, thank you!

1. If _x_ is not a finite Number, throw a *RangeError* exception.
---*/

Intl.DateTimeFormat.prototype.formatToParts
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unreferenced?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I slipped here, this line can be removed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but it passes! :) j.k., removed.

assert.sameValue(
typeof Intl.DateTimeFormat.prototype.formatToParts,
'function',
'`typeof Intl.DatetTimeFormat.prototype.formatToParts` is `function`'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: there's a typo here in DateTimeFormat (Datet).

@tcare
Copy link
Member

tcare commented Jul 28, 2016

Looks good.

@tcare
Copy link
Member

tcare commented Jul 28, 2016

@leobalter 2nd signoff and I'll merge?

@leobalter
Copy link
Member

Ok, +1.

I believe this can be improved with more static results but tests are already valid and the improvement can land afterwards.

@tcare
Copy link
Member

tcare commented Jul 28, 2016

Agreed, sufficient enough for stage 4. Merging.

@tcare tcare merged commit 1bf44eb into tc39:master Jul 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants