Possible copy by array test coverage gaps
I'm leveraging these unit tests to verify some "copy by array" polyfill implementations.
The tests appear to focus more on corner cases and less so on actual normal expected usage.
Some specific gaps I noticed:
- test/built-ins/Array/prototype/toSorted does not verify (also true of
TypedArray.prototype.toSorted):- The default comparator is the same as
Array.prototype.sort(e.g.assert.compareArray([11, 2].toSorted(), [11, 2])) - Custom comparators work (e.g.
assert.compareArray([11, 2].toSorted((a, b) => a - b), [2, 11]))
- The default comparator is the same as
- test/built-ins//TypedArray/prototype/toReversed does not verify:
- The output of the array is actually reversed
For other tests, the "happy path" is often not explicitly tested. Proper behavior is often verified while testing for different corner cases.
There seems to be a very specific format to the spec comments in the test files and the file naming convention--both of which I'm unfamiliar with--so I'm hesitant to offer to help fill these gaps.
If some guidance were provided on both these points, I'd be happy to help address these gaps.
Hi, and thanks for volunteering! We always welcome more complete test coverage. Guidance on the specific things you asked about should be in the CONTRIBUTING.md file, particularly:
Note that the spec comment is optional, though certainly preferred if the mechanism being tested is some non-obvious behaviour.