-
Notifications
You must be signed in to change notification settings - Fork 468
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
Set union tests #3816
Set union tests #3816
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.
Looks good to me so far! Feel free to look at https://github.com/es-shims/Set.prototype.union in case there's any tests there you haven't covered.
I noticed that the e.g.
|
That's correct, pretty much every public API has a set of boilerplate tests that include tests for those steps. Here's a list that I keep in my notes of boilerplate tests, with links to examples:
|
Would these tests need to have a |
That's right. It looks like there isn't a feature defined in |
I'll add it here, then! Should I go for something generic |
Feature flags are generally per-proposal. |
Ok, I think these tests for |
I think that's mainly a question of what you prefer, as the test writer. Certainly it's OK to merge a PR that provides some but not all of the tests listed in #3738, as long as we keep track in that issue what's been done and what's left to do. |
Left a comment here on what I've implemented and not yet implemented (only 3 bullet points not implemented by this PR). I think I'll mark this as ready for review and can follow up on those 3 bullet points when I'm a little more clear on what I need to do on them. 👍 |
Hi there, @frehner! I see that you received some direction from Kevin over in gh-3738; did you want to incorporate that here in this patch? There's no rush--I just don't want to merge this prematurely. |
Yeah! I'll try to get to it hopefully this weekend, if that's ok. |
Ok I think I got it all now. 😅 |
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.
LGTM other than nit. Thanks!
Not sure what's with the failing CI check GraalJS ❯ Downloading https://github.com/oracle/graaljs/releases/download/vm-23.0.0/graaljs-23.0.0-linux-amd64.tar.gz
esvu ✖ Error: Got 404
at /home/circleci/test262/node_modules/esvu/src/installer.js:69:17
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Function.install (/home/circleci/test262/node_modules/esvu/src/installer.js:66:30)
at async installEngine (/home/circleci/test262/node_modules/esvu/src/bin.js:121:3)
at async main (/home/circleci/test262/node_modules/esvu/src/bin.js:168:7)
esvu ✖ Some engines were not installed. |
The graal failures are unrelated to this PR - at a glance, it looks like it's caused by that project switching from having their releases tagged like (Edit: opened esvu issue.) |
test/built-ins/Set/prototype/union/subclass-receiver-methods.js
Outdated
Show resolved
Hide resolved
I rebased the PR, and ran it against my set method polyfills, and everything's passing, as expected. |
Just a followup here: anything I need to do? |
Afraid not; the bottleneck at this point is maintainer availability for a review. Thanks @bakkot for also reviewing it, though; that's helpful! |
Co-authored-by: Kevin Gibbons <[email protected]>
Co-authored-by: Jordan Harband <[email protected]>
3f313f7
to
dfed700
Compare
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 requests for more test coverage can be deferred, but if you do, please add a checklist to the tracking issue.
test/built-ins/Set/prototype/union/union-function-properties.js
Outdated
Show resolved
Hide resolved
I can take this over so we can get this landed and engines can start shipping. |
Thanks - I currently don't have capacity to work on this at the moment, but would have time in perhaps a couple of months. |
Thanks for your thorough review @Ms2ger. I believe I've addressed all your comments. If this is approved I'll follow up with tests for the other methods. |
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
esid: sec-getsetrecord | ||
description: GetSetRecord if the Set-like object has a size of 'undefined' an error is thrown |
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.
description: GetSetRecord if the Set-like object has a size of 'undefined' an error is thrown | |
description: GetSetRecord throws an exception if the Set-like object has a size that is coerced to NaN |
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
esid: sec-getsetrecord | ||
description: GetSetRecord if the Set-like object's 'has' property is not callable an error is thrown |
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.
description: GetSetRecord if the Set-like object's 'has' property is not callable an error is thrown | |
description: GetSetRecord throws an exception if the Set-like object's 'has' property is not callable |
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
esid: sec-getsetrecord | ||
description: GetSetRecord if the Set-like object's 'keys' property is not callable an error is thrown |
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.
description: GetSetRecord if the Set-like object's 'keys' property is not callable an error is thrown | |
description: GetSetRecord throws an exception if the Set-like object's 'keys' property is not callable |
function () { | ||
s1.union(s2); | ||
}, | ||
"GetSetRecord throws an error when has is not callable" |
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.
"GetSetRecord throws an error when has is not callable" | |
"GetSetRecord throws an error when has is undefined" |
function () { | ||
s1.union(s2); | ||
}, | ||
"GetSetRecord throws an error when keys is not callable" |
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.
"GetSetRecord throws an error when keys is not callable" | |
"GetSetRecord throws an error when keys is undefined" |
const s2 = { | ||
size: 2, | ||
has: function () { | ||
throw new Test262Error("Set.prototype.union should not invoke .has on its argument"); | ||
}, | ||
keys: function* keys() { | ||
yield 2; | ||
yield 3; | ||
}, | ||
}; |
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'm afraid you went a bit too far here - this is now basically a duplicate of test/built-ins/Set/prototype/union/allows-set-like-object.js
, while the file name suggests that it should cover a class
const evilSetLike = { | ||
size: 2, | ||
get has() { | ||
baseSet.add("q"); |
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 be
baseSet.add("q"); | |
baseSet.delete("q"); |
?
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.
Ah, actually I meant to use add
but change the expectations for the resulting sets. Not sure how I made that mistake...
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
esid: sec-set.prototype.union | ||
description: Set.prototype.union function properties |
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.
description: Set.prototype.union function properties | |
description: Set.prototype.union length property |
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
esid: sec-set.prototype.union | ||
description: Set.prototype.union name properties |
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.
description: Set.prototype.union name properties | |
description: Set.prototype.union name property |
@Ms2ger Done. |
Hello! First time code contributor here, so please feel free to correct anything and everything that I'm doing. I appreciate your time. ❤️
This is the very beginnings of helping with #3738 . I'm hoping that I can be helpful here, but there are still quite a bit that I'm missing and unsure on how to do.
If it helps, there's also an associated engine262 PR here engine262/engine262#212 where I've done a basic implementation of the spec and have been using it to validate these tests so far.
In any case, I figured this was a good place to stop and get feedback before moving on further. I want to make sure that I'm not doing something wrong or using patterns that are incorrect.
Thanks again!