summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Array/prototype/fill/fill-values-relative-start.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/Array/prototype/fill/fill-values-relative-start.js')
-rw-r--r--js/src/tests/test262/built-ins/Array/prototype/fill/fill-values-relative-start.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Array/prototype/fill/fill-values-relative-start.js b/js/src/tests/test262/built-ins/Array/prototype/fill/fill-values-relative-start.js
new file mode 100644
index 0000000000..da7aa5f642
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/prototype/fill/fill-values-relative-start.js
@@ -0,0 +1,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);