summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Array/prototype/fill/fill-values-relative-start.js
blob: da7aa5f642343ed0471eb2d62f9e3a9ee8b5b667 (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
26
27
28
29
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-array.prototype.fill
description: >
  Fills all the elements from a with a custom start index.
info: |
  22.1.3.6 Array.prototype.fill (value [ , start [ , end ] ] )

  ...
  7. If relativeStart < 0, let k be max((len + relativeStart),0); else let k be
  min(relativeStart, len).
  ...
includes: [compareArray.js]
---*/

assert.compareArray([0, 0, 0].fill(8, 1), [0, 8, 8],
  '[0, 0, 0].fill(8, 1) must return [0, 8, 8]'
);

assert.compareArray([0, 0, 0].fill(8, 4), [0, 0, 0],
  '[0, 0, 0].fill(8, 4) must return [0, 0, 0]'
);

assert.compareArray([0, 0, 0].fill(8, -1), [0, 0, 8],
  '[0, 0, 0].fill(8, -1) must return [0, 0, 8]'
);

reportCompare(0, 0);