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

Update iteration tests with respect to spec changes #1248

Merged
merged 1 commit into from
Sep 27, 2017

Conversation

caitp
Copy link
Contributor

@caitp caitp commented Sep 27, 2017

tc39/ecma262#988 changes the iteration protocol
such that the "next" method is only loaded from the iterator object once
during the prologue of iteration, rather than during each step.

@caitp
Copy link
Contributor Author

caitp commented Sep 27, 2017

picked out tests which need changing from https://chromium-review.googlesource.com/c/v8/v8/+/687997/4/test/test262/test262.status#544

I'll also add a PR for the async iteration tests which were affected seperately.

Copy link
Member

@leobalter leobalter left a comment

Choose a reason for hiding this comment

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

The contents looks good to me. We need to replace the es6id tag to reflect this is not es6 anymore.

Thanks!

@@ -3,39 +3,33 @@
/*---
es6id: 13.6.4.13 S5.c
Copy link
Member

Choose a reason for hiding this comment

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

can you replace this with the current esid? This test doesn't reflect the ES6 specs anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

✔️

};
Object.defineProperty(iterator, 'next', {
get: function() {
$ERROR('Should not access the `next` method after the iteration ' +
Copy link
Member

Choose a reason for hiding this comment

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

while you're here, would you mind to replace this $ERROR call to a throw new Test262Error?

This should not be a blocker.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

✔️

iterator.next = function() { return { value: 45, done: false }; };
iterationCount = 0;
invocationCount = 0;
iterator.next = function() {
Copy link
Member

Choose a reason for hiding this comment

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

maybe in a follow up PR - which I can do - or here if you're up to: defining this over a Object.defineProperty(iterator, 'next', get accessor should be better for catching it get's the method only once.

Again, this should not be a blocker.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this in addition to the defineProperty below, or on its own?

Copy link
Member

Choose a reason for hiding this comment

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

the changes you did sounds great already.

tc39/ecma262#988 changes the iteration protocol
such that the "next" method is only loaded from the iterator object once
during the prologue of iteration, rather than during each step.
@leobalter leobalter merged commit f3b5a1e into tc39:master Sep 27, 2017
@littledan
Copy link
Member

Is this the only test which changes due to the new iteration protocol? It might be a good follow-on to add some more tests, e.g., for spread, Array.from, Promise.all, and anyplace else that the iteration protocol is used. The parts of the spec updated in the patch could be a good guide.

@leobalter
Copy link
Member

Is this the only test which changes due to the new iteration protocol?

If the tests are correct there should be no blocker to merge them.

It might be a good follow-on to add some more tests, e.g., for spread, Array.from, Promise.all, and anyplace else that the iteration protocol is used.

We should probably find a list of all places this can also be observed. Are you interested to assemble this in a new issue?

Also, we have this extra coverage: #1250

The parts of the spec updated in the patch could be a good guide.

yes, fetch by GetIterator and IteratorNext calls are a good start

@littledan
Copy link
Member

If the tests are correct there should be no blocker to merge them.

I'm not trying to block anything, just giving an area for future tests to be written.

We should probably find a list of all places this can also be observed. Are you interested to assemble this in a new issue?

I'd recommend that whoever writes this patch goes through tc39/ecma262#988 and writes a test for each bunch of code affected. It's great that there are async iteration tests, but that's not the only place. I don't think I'll be able to do this anytime soon, unfortunately.

ossy-szeged added a commit to ossy-szeged/jerryscript that referenced this pull request Jan 26, 2021
Since ES2018 iterator's next method is called once during the prologue of iteration,
rather than during each step. The test is incorrect and stuck in an infinite loop.
tc39/test262#1248 fixed the test and it passes on test262-esnext.

Removing test/language/statements/for-of/iterator-next-reference.js from test262-es2015
is necessary, because it won't pass ever and only slow down testing.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác [email protected]
rerobika pushed a commit to jerryscript-project/jerryscript that referenced this pull request Jan 26, 2021
Since ES2018 iterator's next method is called once during the prologue of iteration,
rather than during each step. The test is incorrect and stuck in an infinite loop.
tc39/test262#1248 fixed the test and it passes on test262-esnext.

Removing test/language/statements/for-of/iterator-next-reference.js from test262-es2015
is necessary, because it won't pass ever and only slow down testing.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác [email protected]
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.

3 participants