Coverage: missing tests for Array.prototype.reverse method. Fixes gh-2902

This commit is contained in:
Rick Waldron 2020-12-02 15:15:23 -05:00
parent 96aff62fb2
commit 3b425c6da3
1 changed files with 23 additions and 0 deletions

View 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();