mirror of
https://github.com/tc39/test262.git
synced 2025-07-27 07:54:41 +02:00
Coverage: missing tests for Array.prototype.reverse method. Fixes gh-2902
This commit is contained in:
parent
96aff62fb2
commit
3b425c6da3
23
test/built-ins/Array/prototype/reverse/array-has-one-entry.js
vendored
Normal file
23
test/built-ins/Array/prototype/reverse/array-has-one-entry.js
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
// Copyright (c) 2020 Rick Waldron. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-array.prototype.reverse
|
||||||
|
description: Array.prototype.reverse should not iterate items if there is only one entry
|
||||||
|
info: |
|
||||||
|
Array.prototype.reverse ( )
|
||||||
|
|
||||||
|
Let O be ? ToObject(this value).
|
||||||
|
Let len be ? LengthOfArrayLike(O).
|
||||||
|
Let middle be floor(len / 2).
|
||||||
|
Let lower be 0.
|
||||||
|
Repeat, while lower ≠ middle,
|
||||||
|
...
|
||||||
|
Return O.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
let a = [1];
|
||||||
|
|
||||||
|
Object.freeze(a);
|
||||||
|
|
||||||
|
a.reverse();
|
Loading…
x
Reference in New Issue
Block a user