summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Array/prototype/reverse/array-has-one-entry.js
blob: 630ae1eb3f6751fde41e960a7d432d7c6cfd2e83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// 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();

reportCompare(0, 0);