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 Array.prototype.includes tests #95
Conversation
Needs to be updated with name to "includes". |
d87401e
to
e880726
Compare
Updated and pull request title renamed |
Added tests for %TypedArray%.prototype.includes. Review on them appreciated. |
LGTM, minor quibbles added as inline comments |
author: Domenic Denicola | ||
---*/ | ||
|
||
var taIncludes = Uint8Array.prototype.includes; |
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.
Probably want to use your helper to test each typed array here?
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.
Same as my response to @smikes on a similar comment, haha. We test that they are all === to each other, so in cases where we are not testing properties of a given typed array itself, there's no need to test them all.
Great tests @domenic. It's interesting that there aren't tests for garbage indexes on the prototype of typed arrays, but given that TA's can't have holes I'm not sure there is any need to test this... could I suppose ensure that prototype properties that are shadowed, at index -1, and at index length aren't ever considered? Are there proxy scenarios that are interesting here worth testing directly? Proxy of a typed array should throw due to not having the proper internal state. Easy to test, might be worth doing. |
I need to amend this PR a bit (there's some invalid YAML in the typed array tests apparently). But, my question is, will you accept it now that A.p.includes is stage 3? Or should I wait until later? |
I guess stage 3 is the right time to accept, since passing acceptance tests are required for stage 4. |
87e722b
to
9467eaa
Compare
Includes new testTypedArrays.js helper.
9467eaa
to
6b058db
Compare
Tests updated and ready to pull including unscopables change |
It would be great to set the es6id references too. |
/*--- | ||
description: > | ||
Array.prototype.includes should search the whole array, as the optional second argument fromIndex defaults to 0 | ||
author: Robert Kowalski |
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.
is this info correct? (also the same name is on the first line)
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.
Yes; why would it not be?
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.
just a safe check. We've had other PRs with wrong authorship info.
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.
Yes; why would it not be?
Because the name shown is not the name of the author of this commit—that's not an unreasonable inquiry.
@bterlson Do we have confirmation that the contributing author has signed http://tc39.github.io/test262-cla/ ?
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.
Update: I reviewed the CLA responses and there is no "Robert Kowalski". Please have the author sign http://tc39.github.io/test262-cla/
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.
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.
submitted! :)
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.
@robertkowalski confirmed—thank you very much!
I disagree; maintaining fragile section numbers is busywork. |
They are good to find a reference on the spec and check what is missing from the implementation if it breaks. The tests won't document why it should work on that way by themselves. The contributing file also says it's necessary to use the es5id/es6id frontmatter tags: https://github.com/tc39/test262/blob/master/CONTRIBUTING.md and https://github.com/tc39/test262/blob/master/CONTRIBUTING.md#es5id |
Actually, as a feature proposal for the next version of ECMAScript, Although I'm not arguing consistency for consistency's sake, though. I'm thinking of One practical solution would be (you guessed it) additional metadata--some way @goyakin @domenic @bterlson I'm interested to hear your thoughts about this. |
The agreement was stage 3 and up proposals go in test262. |
Thanks Domenic! From September 24th:
I still think there's value in a dedicated tag, though, especially considering the "run in a browser" use case that was discussed in that session. |
it's okay for test262 tests to fail when run in a browser (they always have, that's not anything new). I don't think there is an implementation on the market with a perfect test262 score |
What I have in mind is the "marketing feature" that Brian mentions in those minutes. You're right that it's not really an option now, but metadata like that would be a good step in that direction. |
@jugglinmike I agree that there needs to be a dedicated tag, even if it looks like:
(Or whatever, I'm not interested in bike shedding there) The value is that it will make it easier to identify the tests that need to be updated with their new section numbers, when the time comes to do so. |
I disagree with the division of tests into version numbers. The spec text will be in master soon. And that's what matters; spec version numbers are bulls hit. But anyway, feel free to modify these in any way you want while merging. I'm done here unless there are substantive technical comments. |
This has nothing to do with spec version numbers. There needs to be a way to correlate any given test file with the actual thing that's being tested within. The number part of "esNid" was necessary to indicate where to look in which version of the spec to understand what was being tested and why. This is critical for maintaining this large of a test suite. The request is not unreasonable.
This response is really surprising and lacks any sense of respect for the committee, community, maintainers and consumers of this test suite. Surely that's not your intention? I would appreciate it if you were more willing to cooperate, I think we agree that this endeavor will be more productive when everyone is cooperating to their fullest capability. Thanks in advance. |
@bterlson, I have a suggestion. This can be merged into a |
Thanks @domenic
*Update: on my first scan, I didn't notice that the file missing the front matter was actually a harness file, so this is not an issue. * I'm currently reviewing the contributor CLA responses, will post back as necessary. |
@@ -0,0 +1,21 @@ | |||
// Copyright (C) 2014 Domenic Denicola. All rights reserved. | |||
// This code is governed by the BSD license found in the LICENSE file. | |||
|
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.
Missing required frontmatter description
tag.
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.
This is not a test.
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.
Indeed, sorry for the confusion there, I was scanning through all of the files quickly. I'll update my main comment accordingly.
@robertkowalski thanks for the contribution to @domenic's Array.prototype.incudes test suite! If you would kindly sign the Ecma International, TC39 ECMAScript Conformance Test Suites Software Contribution Form, your tests will be 👍 for inclusion! |
author: Domenic Denicola | ||
---*/ | ||
|
||
assert.sameValue(Array.prototype.includes.length, 1, 'Expected Array.prototype.includes.length to be 1'); |
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.
Missing property verifications, eg. https://github.com/tc39/test262/blob/master/test/built-ins/Array/prototype/find/length.js
@domenic I don't appreciate your second guessing of test262 experts. esNid is important. Experts in this test suite are telling you so. The Stage 4 requirement for test262 test implies that those tests must be appropriate test262 tests - you don't get to dump whatever you want and force someone else to clean up your mess. Had I known of this debate yesterday I'd have made clear to you that your stage 4 approval is contingent upon writing tests the test262 project feels are appropriate. To me, es7id: pending is appropriate. I don't want a branch because I want it to be easy for implementers to run these tests along with the rest. |
---*/ | ||
|
||
assert.sameValue(Uint8Array.prototype.includes.name, 'includes', | ||
'Expected %TypedArray%.prototype.includes.name to be \'includes\''); |
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.
Missing property verifications, eg. https://github.com/tc39/test262/blob/master/test/built-ins/Array/prototype/find/name.js
To clarify, I am not saying your tests are a mess (they are overall very good!), just pointing out that it's important for champions to write tests acceptable to the test262 project contributors. I hope this makes sense. |
Superseded by gh-643. |
Passing in my local build of V8. Let's get 'em merged and then we can update V8's test262 tests and then we can rock and roll.