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 tests for array.prototype.groupToMap #3353

Merged
merged 2 commits into from
Sep 14, 2022
Merged

Conversation

polsevev
Copy link
Contributor

Added tests for proposal Array Grouping

CC @codehag

@polsevev polsevev force-pushed the groupByToMap branch 4 times, most recently from beb02e0 to eab650a Compare December 15, 2021 11:49
@rwaldron
Copy link
Contributor

Wow! This is a great head start here :) Let's wait until our video call on Friday to do a review together.

@rwaldron rwaldron added the valid and in progress Issue is valid, action in progress label Dec 15, 2021
@ljharb
Copy link
Member

ljharb commented Dec 15, 2021

Similarly to #3354, i think this could use some tests for throwing on a non-function callback, but otherwise it matches my polyfill's tests!

@ljharb ljharb requested a review from a team May 19, 2022 18:23
@jridgewell jridgewell changed the title add tests for array.prototype.groupByToMap add tests for array.prototype.groupToMap Sep 2, 2022
ptomato
ptomato previously approved these changes Sep 14, 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.

Awesome, thanks - I just have two nitpicks about things that probably slipped in when copying the new stuff from the group PR. I will fix these up and merge it right away.

test/built-ins/Array/prototype/groupToMap/map-instance.js Outdated Show resolved Hide resolved
test/built-ins/Array/prototype/groupToMap/sparse-array.js Outdated Show resolved Hide resolved
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.

Re-approving

ljharb
ljharb previously requested changes Sep 14, 2022

...
includes: [compareArray.js]
features: [array-grouping]
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
features: [array-grouping]
features: [array-grouping, Symbol.iterator, arrow-function, Map]

c. Let key be ? Call(callbackfn, thisArg, « kValue, 𝔽(k), O »).
e. Perform ! AddValueToKeyedGroup(groups, key, kValue).
...
features: [array-grouping]
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
features: [array-grouping]
features: [array-grouping, arrow-function, Map]

@@ -0,0 +1,24 @@
// Copyright (c) 2021 Ecma International. All rights reserved.
Copy link
Member

Choose a reason for hiding this comment

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

should all these change to 2022?

c. Let propertyKey be ? ToPropertyKey(? Call(callbackfn, thisArg, « kValue, 𝔽(k), O »)).

...
features: [array-grouping]
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
features: [array-grouping]
features: [array-grouping, Map]

b. Perform ! CreateDataPropertyOrThrow(map, g.[[Key]], elements).

...
features: [array-grouping]
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
features: [array-grouping]
features: [array-grouping, Map, arrow-function]


...
includes: [compareArray.js]
features: [array-grouping]
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
features: [array-grouping]
features: [array-grouping, Map, arrow-function]


...
includes: [compareArray.js]
features: [array-grouping]
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
features: [array-grouping]
features: [array-grouping, Map, arrow-function]


...
flags: [onlyStrict]
features: [array-grouping]
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
features: [array-grouping]
features: [array-grouping, Map]


...
flags: [noStrict]
features: [array-grouping]
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
features: [array-grouping]
features: [array-grouping, Map]


...
includes: [compareArray.js]
features: [array-grouping]
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
features: [array-grouping]
features: [array-grouping, Map, Symbol.iterator, arrow-function]


...
includes: [compareArray.js]
features: [array-grouping]
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
features: [array-grouping]
features: [array-grouping, Map, Symbol.iterator, arrow-function]

@ptomato
Copy link
Contributor

ptomato commented Sep 14, 2022

re. exhaustive features list, shrug; the documentation in features.txt says about stage 4 features:

Language features that have been included in a published version of the ECMA-262 specification. These flags are largely maintained for historical reasons, though their use for relatively new features (i.e. prior to availability across major implementations) is appreciated.

I don't think these are "relatively new" and it seems burdensome to contributors who just want to get their tests landed, for us to require them. Many of them can be added automatically anyway should anyone complain.

@ljharb
Copy link
Member

ljharb commented Sep 14, 2022

It's totally fine to land this without them, and i can add them to #3664.

However, if we want test262 to ever be usable on packages - which tend to have long lists of supported platforms - exhaustive feature lists are a critical thing to have to ensure that's achievable.

@ljharb ljharb dismissed their stale review September 14, 2022 18:34

review is nonblocking

@ptomato
Copy link
Contributor

ptomato commented Sep 14, 2022

Fair enough, I'd say we should avoid putting that burden on test contributors though 😄

Let's open an issue to review that documentation in features.txt and do something like add a pre-commit script that will automatically add as many features as possible.

@ptomato
Copy link
Contributor

ptomato commented Sep 14, 2022

Agreed, let's land this now as it's been waiting for a long time, and update #3664

@ptomato ptomato merged commit 9592077 into tc39:main Sep 14, 2022
@ljharb
Copy link
Member

ljharb commented Sep 14, 2022

Filed #3664.

ljharb added a commit that referenced this pull request Sep 14, 2022
catamorphism pushed a commit to catamorphism/test262 that referenced this pull request Oct 4, 2022
catamorphism pushed a commit to catamorphism/test262 that referenced this pull request Oct 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review valid and in progress Issue is valid, action in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants