summaryrefslogtreecommitdiff
path: root/test/built-ins/TypedArray/prototype
diff options
context:
space:
mode:
Diffstat (limited to 'test/built-ins/TypedArray/prototype')
-rw-r--r--test/built-ins/TypedArray/prototype/Symbol.iterator.js2
-rw-r--r--test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/detached-buffer.js21
-rw-r--r--test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/invoked-as-accessor.js20
-rw-r--r--test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/invoked-as-func.js21
-rw-r--r--test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/length.js32
-rw-r--r--test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/name.js29
-rw-r--r--test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/prop-desc.js28
-rw-r--r--test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/return-typedarrayname.js21
-rw-r--r--test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/this-has-no-typedarrayname-internal.js29
-rw-r--r--test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/this-is-not-object.js27
-rw-r--r--test/built-ins/TypedArray/prototype/Symbol.toStringTag/invoked-as-accessor.js2
-rw-r--r--test/built-ins/TypedArray/prototype/Symbol.toStringTag/invoked-as-func.js2
-rw-r--r--test/built-ins/TypedArray/prototype/Symbol.toStringTag/length.js2
-rw-r--r--test/built-ins/TypedArray/prototype/Symbol.toStringTag/name.js2
-rw-r--r--test/built-ins/TypedArray/prototype/Symbol.toStringTag/prop-desc.js2
-rw-r--r--test/built-ins/TypedArray/prototype/buffer/BigInt/detached-buffer.js21
-rw-r--r--test/built-ins/TypedArray/prototype/buffer/BigInt/return-buffer.js22
-rw-r--r--test/built-ins/TypedArray/prototype/buffer/invoked-as-accessor.js2
-rw-r--r--test/built-ins/TypedArray/prototype/buffer/invoked-as-func.js2
-rw-r--r--test/built-ins/TypedArray/prototype/buffer/length.js3
-rw-r--r--test/built-ins/TypedArray/prototype/buffer/name.js3
-rw-r--r--test/built-ins/TypedArray/prototype/buffer/prop-desc.js3
-rw-r--r--test/built-ins/TypedArray/prototype/buffer/return-buffer.js2
-rw-r--r--test/built-ins/TypedArray/prototype/buffer/this-has-no-typedarrayname-internal.js1
-rw-r--r--test/built-ins/TypedArray/prototype/buffer/this-is-not-object.js2
-rw-r--r--test/built-ins/TypedArray/prototype/byteLength/BigInt/detached-buffer.js21
-rw-r--r--test/built-ins/TypedArray/prototype/byteLength/BigInt/return-bytelength.js24
-rw-r--r--test/built-ins/TypedArray/prototype/byteLength/invoked-as-accessor.js2
-rw-r--r--test/built-ins/TypedArray/prototype/byteLength/invoked-as-func.js2
-rw-r--r--test/built-ins/TypedArray/prototype/byteLength/length.js3
-rw-r--r--test/built-ins/TypedArray/prototype/byteLength/name.js3
-rw-r--r--test/built-ins/TypedArray/prototype/byteLength/prop-desc.js3
-rw-r--r--test/built-ins/TypedArray/prototype/byteLength/return-bytelength.js2
-rw-r--r--test/built-ins/TypedArray/prototype/byteLength/this-has-no-typedarrayname-internal.js1
-rw-r--r--test/built-ins/TypedArray/prototype/byteLength/this-is-not-object.js2
-rw-r--r--test/built-ins/TypedArray/prototype/byteOffset/BigInt/detached-buffer.js22
-rw-r--r--test/built-ins/TypedArray/prototype/byteOffset/BigInt/return-byteoffset.js31
-rw-r--r--test/built-ins/TypedArray/prototype/byteOffset/invoked-as-accessor.js2
-rw-r--r--test/built-ins/TypedArray/prototype/byteOffset/invoked-as-func.js2
-rw-r--r--test/built-ins/TypedArray/prototype/byteOffset/length.js3
-rw-r--r--test/built-ins/TypedArray/prototype/byteOffset/name.js3
-rw-r--r--test/built-ins/TypedArray/prototype/byteOffset/prop-desc.js3
-rw-r--r--test/built-ins/TypedArray/prototype/byteOffset/return-byteoffset.js2
-rw-r--r--test/built-ins/TypedArray/prototype/byteOffset/this-has-no-typedarrayname-internal.js1
-rw-r--r--test/built-ins/TypedArray/prototype/byteOffset/this-is-not-object.js2
-rw-r--r--test/built-ins/TypedArray/prototype/constructor.js3
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-end.js77
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-start.js92
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-target.js92
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/detached-buffer.js34
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/get-length-ignores-length-prop.js49
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/invoked-as-func.js29
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/invoked-as-method.js29
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/length.js30
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/name.js27
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-end.js95
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-end.js111
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-start.js93
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-target.js61
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-start.js77
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-target.js53
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-end.js54
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-target-and-start.js74
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-and-start.js50
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-start-and-end.js73
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/prop-desc.js19
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-end-is-symbol.js36
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-end.js39
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-start-is-symbol.js35
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-start.js45
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-target-is-symbol.js35
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-target.js39
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-this.js36
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/this-is-not-object.js50
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/this-is-not-typedarray-instance.js42
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/undefined-end.js45
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/bit-precision.js2
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/coerced-values-end.js2
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/coerced-values-start.js2
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/coerced-values-target.js2
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/get-length-ignores-length-prop.js1
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/invoked-as-func.js2
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/invoked-as-method.js2
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/length.js3
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/name.js3
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/negative-end.js2
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-end.js2
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-start.js2
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-target.js2
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/negative-start.js2
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/negative-target.js2
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-end.js2
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-target-and-start.js2
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-and-start.js2
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-start-and-end.js2
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/prop-desc.js3
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-end-is-symbol.js1
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-end.js1
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-start-is-symbol.js1
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-start.js1
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-target-is-symbol.js1
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-target.js1
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/return-this.js1
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/undefined-end.js2
-rw-r--r--test/built-ins/TypedArray/prototype/entries/BigInt/detached-buffer.js27
-rw-r--r--test/built-ins/TypedArray/prototype/entries/BigInt/iter-prototype.js24
-rw-r--r--test/built-ins/TypedArray/prototype/entries/BigInt/return-itor.js34
-rw-r--r--test/built-ins/TypedArray/prototype/entries/invoked-as-func.js2
-rw-r--r--test/built-ins/TypedArray/prototype/entries/invoked-as-method.js2
-rw-r--r--test/built-ins/TypedArray/prototype/entries/iter-prototype.js1
-rw-r--r--test/built-ins/TypedArray/prototype/entries/length.js3
-rw-r--r--test/built-ins/TypedArray/prototype/entries/name.js3
-rw-r--r--test/built-ins/TypedArray/prototype/entries/prop-desc.js3
-rw-r--r--test/built-ins/TypedArray/prototype/entries/return-itor.js3
-rw-r--r--test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-arguments-with-thisarg.js56
-rw-r--r--test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-arguments-without-thisarg.js54
-rw-r--r--test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-detachbuffer.js44
-rw-r--r--test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-no-interaction-over-non-integer.js41
-rw-r--r--test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-not-callable-throws.js69
-rw-r--r--test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-not-called-on-empty.js36
-rw-r--r--test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-return-does-not-change-instance.js38
-rw-r--r--test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-returns-abrupt.js35
-rw-r--r--test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-set-value-during-interaction.js58
-rw-r--r--test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-this.js59
-rw-r--r--test/built-ins/TypedArray/prototype/every/BigInt/detached-buffer.js32
-rw-r--r--test/built-ins/TypedArray/prototype/every/BigInt/get-length-uses-internal-arraylength.js47
-rw-r--r--test/built-ins/TypedArray/prototype/every/BigInt/invoked-as-func.js29
-rw-r--r--test/built-ins/TypedArray/prototype/every/BigInt/invoked-as-method.js29
-rw-r--r--test/built-ins/TypedArray/prototype/every/BigInt/length.js30
-rw-r--r--test/built-ins/TypedArray/prototype/every/BigInt/name.js27
-rw-r--r--test/built-ins/TypedArray/prototype/every/BigInt/prop-desc.js19
-rw-r--r--test/built-ins/TypedArray/prototype/every/BigInt/returns-false-if-any-cb-returns-false.js46
-rw-r--r--test/built-ins/TypedArray/prototype/every/BigInt/returns-true-if-every-cb-returns-true.js46
-rw-r--r--test/built-ins/TypedArray/prototype/every/BigInt/this-is-not-object.js51
-rw-r--r--test/built-ins/TypedArray/prototype/every/BigInt/this-is-not-typedarray-instance.js43
-rw-r--r--test/built-ins/TypedArray/prototype/every/BigInt/values-are-not-cached.js42
-rw-r--r--test/built-ins/TypedArray/prototype/every/callbackfn-detachbuffer.js1
-rw-r--r--test/built-ins/TypedArray/prototype/every/invoked-as-func.js2
-rw-r--r--test/built-ins/TypedArray/prototype/every/invoked-as-method.js2
-rw-r--r--test/built-ins/TypedArray/prototype/every/length.js3
-rw-r--r--test/built-ins/TypedArray/prototype/every/name.js3
-rw-r--r--test/built-ins/TypedArray/prototype/every/prop-desc.js3
-rw-r--r--test/built-ins/TypedArray/prototype/fill/BigInt/coerced-indexes.js104
-rw-r--r--test/built-ins/TypedArray/prototype/fill/BigInt/detached-buffer.js34
-rw-r--r--test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-once.js27
-rw-r--r--test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-operations-consistent-nan.js70
-rw-r--r--test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-operations.js56
-rw-r--r--test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-custom-start-and-end.js42
-rw-r--r--test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-non-numeric.js72
-rw-r--r--test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-end.js53
-rw-r--r--test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-start.js51
-rw-r--r--test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-symbol-throws.js47
-rw-r--r--test/built-ins/TypedArray/prototype/fill/BigInt/fill-values.js44
-rw-r--r--test/built-ins/TypedArray/prototype/fill/BigInt/get-length-ignores-length-prop.js51
-rw-r--r--test/built-ins/TypedArray/prototype/fill/BigInt/invoked-as-func.js29
-rw-r--r--test/built-ins/TypedArray/prototype/fill/BigInt/invoked-as-method.js29
-rw-r--r--test/built-ins/TypedArray/prototype/fill/BigInt/length.js30
-rw-r--r--test/built-ins/TypedArray/prototype/fill/BigInt/name.js27
-rw-r--r--test/built-ins/TypedArray/prototype/fill/BigInt/prop-desc.js19
-rw-r--r--test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-end-as-symbol.js38
-rw-r--r--test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-end.js42
-rw-r--r--test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-set-value.js50
-rw-r--r--test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-start-as-symbol.js37
-rw-r--r--test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-start.js41
-rw-r--r--test/built-ins/TypedArray/prototype/fill/BigInt/return-this.js20
-rw-r--r--test/built-ins/TypedArray/prototype/fill/BigInt/this-is-not-object.js50
-rw-r--r--test/built-ins/TypedArray/prototype/fill/BigInt/this-is-not-typedarray-instance.js42
-rw-r--r--test/built-ins/TypedArray/prototype/fill/coerced-indexes.js2
-rw-r--r--test/built-ins/TypedArray/prototype/fill/fill-values-conversion-operations-consistent-nan.js2
-rw-r--r--test/built-ins/TypedArray/prototype/fill/fill-values-conversion-operations.js2
-rw-r--r--test/built-ins/TypedArray/prototype/fill/fill-values-custom-start-and-end.js2
-rw-r--r--test/built-ins/TypedArray/prototype/fill/fill-values-non-numeric.js7
-rw-r--r--test/built-ins/TypedArray/prototype/fill/fill-values-relative-end.js2
-rw-r--r--test/built-ins/TypedArray/prototype/fill/fill-values-relative-start.js2
-rw-r--r--test/built-ins/TypedArray/prototype/fill/fill-values-symbol-throws.js1
-rw-r--r--test/built-ins/TypedArray/prototype/fill/fill-values.js2
-rw-r--r--test/built-ins/TypedArray/prototype/fill/get-length-ignores-length-prop.js1
-rw-r--r--test/built-ins/TypedArray/prototype/fill/invoked-as-func.js2
-rw-r--r--test/built-ins/TypedArray/prototype/fill/invoked-as-method.js2
-rw-r--r--test/built-ins/TypedArray/prototype/fill/length.js3
-rw-r--r--test/built-ins/TypedArray/prototype/fill/name.js3
-rw-r--r--test/built-ins/TypedArray/prototype/fill/prop-desc.js3
-rw-r--r--test/built-ins/TypedArray/prototype/fill/return-abrupt-from-end-as-symbol.js1
-rw-r--r--test/built-ins/TypedArray/prototype/fill/return-abrupt-from-end.js1
-rw-r--r--test/built-ins/TypedArray/prototype/fill/return-abrupt-from-set-value.js1
-rw-r--r--test/built-ins/TypedArray/prototype/fill/return-abrupt-from-start-as-symbol.js1
-rw-r--r--test/built-ins/TypedArray/prototype/fill/return-abrupt-from-start.js1
-rw-r--r--test/built-ins/TypedArray/prototype/fill/return-this.js1
-rw-r--r--test/built-ins/TypedArray/prototype/filter/BigInt/arraylength-internal.js39
-rw-r--r--test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-arguments-with-thisarg.js46
-rw-r--r--test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-arguments-without-thisarg.js44
-rw-r--r--test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-called-before-ctor.js39
-rw-r--r--test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-called-before-species.js39
-rw-r--r--test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-detachbuffer.js35
-rw-r--r--test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-no-iteration-over-non-integer.js38
-rw-r--r--test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-not-callable-throws.js58
-rw-r--r--test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-not-called-on-empty.js27
-rw-r--r--test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-return-does-not-change-instance.js23
-rw-r--r--test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-returns-abrupt.js27
-rw-r--r--test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-set-value-during-iteration.js47
-rw-r--r--test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-this.js48
-rw-r--r--test/built-ins/TypedArray/prototype/filter/BigInt/detached-buffer.js32
-rw-r--r--test/built-ins/TypedArray/prototype/filter/BigInt/invoked-as-func.js30
-rw-r--r--test/built-ins/TypedArray/prototype/filter/BigInt/invoked-as-method.js30
-rw-r--r--test/built-ins/TypedArray/prototype/filter/BigInt/length.js30
-rw-r--r--test/built-ins/TypedArray/prototype/filter/BigInt/name.js27
-rw-r--r--test/built-ins/TypedArray/prototype/filter/BigInt/prop-desc.js19
-rw-r--r--test/built-ins/TypedArray/prototype/filter/BigInt/result-does-not-share-buffer.js27
-rw-r--r--test/built-ins/TypedArray/prototype/filter/BigInt/result-empty-callbackfn-returns-false.js36
-rw-r--r--test/built-ins/TypedArray/prototype/filter/BigInt/result-full-callbackfn-returns-true.js38
-rw-r--r--test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor-abrupt.js43
-rw-r--r--test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor-inherited.js64
-rw-r--r--test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor-returns-throws.js65
-rw-r--r--test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor.js54
-rw-r--r--test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-abrupt.js45
-rw-r--r--test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-invocation.js59
-rw-r--r--test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-length-throws.js41
-rw-r--r--test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-length.js46
-rw-r--r--test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js54
-rw-r--r--test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-throws.js46
-rw-r--r--test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor.js56
-rw-r--r--test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-returns-throws.js66
-rw-r--r--test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-use-default-ctor.js54
-rw-r--r--test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species.js46
-rw-r--r--test/built-ins/TypedArray/prototype/filter/BigInt/this-is-not-object.js53
-rw-r--r--test/built-ins/TypedArray/prototype/filter/BigInt/this-is-not-typedarray-instance.js45
-rw-r--r--test/built-ins/TypedArray/prototype/filter/BigInt/values-are-not-cached.js31
-rw-r--r--test/built-ins/TypedArray/prototype/filter/BigInt/values-are-set.js30
-rw-r--r--test/built-ins/TypedArray/prototype/filter/callbackfn-detachbuffer.js1
-rw-r--r--test/built-ins/TypedArray/prototype/filter/invoked-as-func.js2
-rw-r--r--test/built-ins/TypedArray/prototype/filter/invoked-as-method.js2
-rw-r--r--test/built-ins/TypedArray/prototype/filter/length.js3
-rw-r--r--test/built-ins/TypedArray/prototype/filter/name.js3
-rw-r--r--test/built-ins/TypedArray/prototype/filter/prop-desc.js3
-rw-r--r--test/built-ins/TypedArray/prototype/find/BigInt/detached-buffer.js32
-rw-r--r--test/built-ins/TypedArray/prototype/find/BigInt/get-length-ignores-length-prop.js54
-rw-r--r--test/built-ins/TypedArray/prototype/find/BigInt/invoked-as-func.js29
-rw-r--r--test/built-ins/TypedArray/prototype/find/BigInt/invoked-as-method.js29
-rw-r--r--test/built-ins/TypedArray/prototype/find/BigInt/length.js30
-rw-r--r--test/built-ins/TypedArray/prototype/find/BigInt/name.js27
-rw-r--r--test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-changes-value.js78
-rw-r--r--test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-parameters.js62
-rw-r--r--test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-this-non-strict.js59
-rw-r--r--test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-this-strict.js53
-rw-r--r--test/built-ins/TypedArray/prototype/find/BigInt/predicate-is-not-callable-throws.js66
-rw-r--r--test/built-ins/TypedArray/prototype/find/BigInt/predicate-may-detach-buffer.js58
-rw-r--r--test/built-ins/TypedArray/prototype/find/BigInt/predicate-not-called-on-empty-array.js49
-rw-r--r--test/built-ins/TypedArray/prototype/find/BigInt/prop-desc.js19
-rw-r--r--test/built-ins/TypedArray/prototype/find/BigInt/return-abrupt-from-predicate-call.js40
-rw-r--r--test/built-ins/TypedArray/prototype/find/BigInt/return-found-value-predicate-result-is-true.js65
-rw-r--r--test/built-ins/TypedArray/prototype/find/BigInt/return-undefined-if-predicate-returns-false-value.js60
-rw-r--r--test/built-ins/TypedArray/prototype/find/BigInt/this-is-not-object.js51
-rw-r--r--test/built-ins/TypedArray/prototype/find/BigInt/this-is-not-typedarray-instance.js43
-rw-r--r--test/built-ins/TypedArray/prototype/find/get-length-ignores-length-prop.js1
-rw-r--r--test/built-ins/TypedArray/prototype/find/invoked-as-func.js2
-rw-r--r--test/built-ins/TypedArray/prototype/find/invoked-as-method.js2
-rw-r--r--test/built-ins/TypedArray/prototype/find/length.js3
-rw-r--r--test/built-ins/TypedArray/prototype/find/name.js3
-rw-r--r--test/built-ins/TypedArray/prototype/find/predicate-call-changes-value.js2
-rw-r--r--test/built-ins/TypedArray/prototype/find/predicate-call-parameters.js1
-rw-r--r--test/built-ins/TypedArray/prototype/find/predicate-call-this-non-strict.js1
-rw-r--r--test/built-ins/TypedArray/prototype/find/predicate-call-this-strict.js1
-rw-r--r--test/built-ins/TypedArray/prototype/find/predicate-is-not-callable-throws.js1
-rw-r--r--test/built-ins/TypedArray/prototype/find/predicate-may-detach-buffer.js1
-rw-r--r--test/built-ins/TypedArray/prototype/find/predicate-not-called-on-empty-array.js1
-rw-r--r--test/built-ins/TypedArray/prototype/find/prop-desc.js3
-rw-r--r--test/built-ins/TypedArray/prototype/find/return-abrupt-from-predicate-call.js1
-rw-r--r--test/built-ins/TypedArray/prototype/find/return-found-value-predicate-result-is-true.js1
-rw-r--r--test/built-ins/TypedArray/prototype/find/return-undefined-if-predicate-returns-false-value.js1
-rw-r--r--test/built-ins/TypedArray/prototype/findIndex/BigInt/detached-buffer.js32
-rw-r--r--test/built-ins/TypedArray/prototype/findIndex/BigInt/get-length-ignores-length-prop.js52
-rw-r--r--test/built-ins/TypedArray/prototype/findIndex/BigInt/invoked-as-func.js29
-rw-r--r--test/built-ins/TypedArray/prototype/findIndex/BigInt/invoked-as-method.js29
-rw-r--r--test/built-ins/TypedArray/prototype/findIndex/BigInt/length.js30
-rw-r--r--test/built-ins/TypedArray/prototype/findIndex/BigInt/name.js27
-rw-r--r--test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-changes-value.js67
-rw-r--r--test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-parameters.js60
-rw-r--r--test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-this-non-strict.js57
-rw-r--r--test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-this-strict.js51
-rw-r--r--test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-is-not-callable-throws.js64
-rw-r--r--test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-may-detach-buffer.js51
-rw-r--r--test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-not-called-on-empty-array.js48
-rw-r--r--test/built-ins/TypedArray/prototype/findIndex/BigInt/prop-desc.js19
-rw-r--r--test/built-ins/TypedArray/prototype/findIndex/BigInt/return-abrupt-from-predicate-call.js38
-rw-r--r--test/built-ins/TypedArray/prototype/findIndex/BigInt/return-index-predicate-result-is-true.js65
-rw-r--r--test/built-ins/TypedArray/prototype/findIndex/BigInt/return-negative-one-if-predicate-returns-false-value.js58
-rw-r--r--test/built-ins/TypedArray/prototype/findIndex/BigInt/this-is-not-object.js51
-rw-r--r--test/built-ins/TypedArray/prototype/findIndex/BigInt/this-is-not-typedarray-instance.js43
-rw-r--r--test/built-ins/TypedArray/prototype/findIndex/get-length-ignores-length-prop.js1
-rw-r--r--test/built-ins/TypedArray/prototype/findIndex/invoked-as-func.js2
-rw-r--r--test/built-ins/TypedArray/prototype/findIndex/invoked-as-method.js2
-rw-r--r--test/built-ins/TypedArray/prototype/findIndex/length.js3
-rw-r--r--test/built-ins/TypedArray/prototype/findIndex/name.js3
-rw-r--r--test/built-ins/TypedArray/prototype/findIndex/predicate-call-changes-value.js4
-rw-r--r--test/built-ins/TypedArray/prototype/findIndex/predicate-call-parameters.js1
-rw-r--r--test/built-ins/TypedArray/prototype/findIndex/predicate-call-this-non-strict.js1
-rw-r--r--test/built-ins/TypedArray/prototype/findIndex/predicate-call-this-strict.js1
-rw-r--r--test/built-ins/TypedArray/prototype/findIndex/predicate-is-not-callable-throws.js1
-rw-r--r--test/built-ins/TypedArray/prototype/findIndex/predicate-may-detach-buffer.js1
-rw-r--r--test/built-ins/TypedArray/prototype/findIndex/predicate-not-called-on-empty-array.js1
-rw-r--r--test/built-ins/TypedArray/prototype/findIndex/prop-desc.js3
-rw-r--r--test/built-ins/TypedArray/prototype/findIndex/return-abrupt-from-predicate-call.js1
-rw-r--r--test/built-ins/TypedArray/prototype/findIndex/return-index-predicate-result-is-true.js1
-rw-r--r--test/built-ins/TypedArray/prototype/findIndex/return-negative-one-if-predicate-returns-false-value.js1
-rw-r--r--test/built-ins/TypedArray/prototype/forEach/BigInt/arraylength-internal.js47
-rw-r--r--test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-arguments-with-thisarg.js55
-rw-r--r--test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-arguments-without-thisarg.js53
-rw-r--r--test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-detachbuffer.js43
-rw-r--r--test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-is-not-callable.js54
-rw-r--r--test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-no-interaction-over-non-integer.js41
-rw-r--r--test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-not-called-on-empty.js36
-rw-r--r--test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-return-does-not-change-instance.js30
-rw-r--r--test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-returns-abrupt.js36
-rw-r--r--test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-set-value-during-interaction.js47
-rw-r--r--test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-this.js57
-rw-r--r--test/built-ins/TypedArray/prototype/forEach/BigInt/detached-buffer.js32
-rw-r--r--test/built-ins/TypedArray/prototype/forEach/BigInt/invoked-as-func.js29
-rw-r--r--test/built-ins/TypedArray/prototype/forEach/BigInt/invoked-as-method.js29
-rw-r--r--test/built-ins/TypedArray/prototype/forEach/BigInt/length.js30
-rw-r--r--test/built-ins/TypedArray/prototype/forEach/BigInt/name.js27
-rw-r--r--test/built-ins/TypedArray/prototype/forEach/BigInt/prop-desc.js19
-rw-r--r--test/built-ins/TypedArray/prototype/forEach/BigInt/returns-undefined.js33
-rw-r--r--test/built-ins/TypedArray/prototype/forEach/BigInt/this-is-not-object.js51
-rw-r--r--test/built-ins/TypedArray/prototype/forEach/BigInt/this-is-not-typedarray-instance.js43
-rw-r--r--test/built-ins/TypedArray/prototype/forEach/BigInt/values-are-not-cached.js31
-rw-r--r--test/built-ins/TypedArray/prototype/forEach/callbackfn-detachbuffer.js1
-rw-r--r--test/built-ins/TypedArray/prototype/forEach/invoked-as-func.js2
-rw-r--r--test/built-ins/TypedArray/prototype/forEach/invoked-as-method.js2
-rw-r--r--test/built-ins/TypedArray/prototype/forEach/length.js3
-rw-r--r--test/built-ins/TypedArray/prototype/forEach/name.js3
-rw-r--r--test/built-ins/TypedArray/prototype/forEach/prop-desc.js3
-rw-r--r--test/built-ins/TypedArray/prototype/includes/BigInt/detached-buffer.js28
-rw-r--r--test/built-ins/TypedArray/prototype/includes/BigInt/fromIndex-equal-or-greater-length-returns-false.js36
-rw-r--r--test/built-ins/TypedArray/prototype/includes/BigInt/fromIndex-infinity.js44
-rw-r--r--test/built-ins/TypedArray/prototype/includes/BigInt/fromIndex-minus-zero.js34
-rw-r--r--test/built-ins/TypedArray/prototype/includes/BigInt/get-length-uses-internal-arraylength.js33
-rw-r--r--test/built-ins/TypedArray/prototype/includes/BigInt/invoked-as-func.js29
-rw-r--r--test/built-ins/TypedArray/prototype/includes/BigInt/invoked-as-method.js29
-rw-r--r--test/built-ins/TypedArray/prototype/includes/BigInt/length-zero-returns-false.js39
-rw-r--r--test/built-ins/TypedArray/prototype/includes/BigInt/length.js30
-rw-r--r--test/built-ins/TypedArray/prototype/includes/BigInt/name.js27
-rw-r--r--test/built-ins/TypedArray/prototype/includes/BigInt/prop-desc.js19
-rw-r--r--test/built-ins/TypedArray/prototype/includes/BigInt/return-abrupt-tointeger-fromindex-symbol.js33
-rw-r--r--test/built-ins/TypedArray/prototype/includes/BigInt/return-abrupt-tointeger-fromindex.js37
-rw-r--r--test/built-ins/TypedArray/prototype/includes/BigInt/search-found-returns-true.js44
-rw-r--r--test/built-ins/TypedArray/prototype/includes/BigInt/search-not-found-returns-false.js42
-rw-r--r--test/built-ins/TypedArray/prototype/includes/BigInt/this-is-not-object.js50
-rw-r--r--test/built-ins/TypedArray/prototype/includes/BigInt/this-is-not-typedarray-instance.js42
-rw-r--r--test/built-ins/TypedArray/prototype/includes/BigInt/tointeger-fromindex.js65
-rw-r--r--test/built-ins/TypedArray/prototype/includes/length.js1
-rw-r--r--test/built-ins/TypedArray/prototype/includes/name.js1
-rw-r--r--test/built-ins/TypedArray/prototype/includes/prop-desc.js1
-rw-r--r--test/built-ins/TypedArray/prototype/includes/this-is-not-object.js1
-rw-r--r--test/built-ins/TypedArray/prototype/indexOf/BigInt/detached-buffer.js28
-rw-r--r--test/built-ins/TypedArray/prototype/indexOf/BigInt/fromIndex-equal-or-greater-length-returns-minus-one.js30
-rw-r--r--test/built-ins/TypedArray/prototype/indexOf/BigInt/fromIndex-infinity.js39
-rw-r--r--test/built-ins/TypedArray/prototype/indexOf/BigInt/fromIndex-minus-zero.js30
-rw-r--r--test/built-ins/TypedArray/prototype/indexOf/BigInt/get-length-uses-internal-arraylength.js32
-rw-r--r--test/built-ins/TypedArray/prototype/indexOf/BigInt/invoked-as-func.js29
-rw-r--r--test/built-ins/TypedArray/prototype/indexOf/BigInt/invoked-as-method.js29
-rw-r--r--test/built-ins/TypedArray/prototype/indexOf/BigInt/length-zero-returns-minus-one.js37
-rw-r--r--test/built-ins/TypedArray/prototype/indexOf/BigInt/length.js30
-rw-r--r--test/built-ins/TypedArray/prototype/indexOf/BigInt/name.js27
-rw-r--r--test/built-ins/TypedArray/prototype/indexOf/BigInt/prop-desc.js19
-rw-r--r--test/built-ins/TypedArray/prototype/indexOf/BigInt/return-abrupt-tointeger-fromindex-symbol.js32
-rw-r--r--test/built-ins/TypedArray/prototype/indexOf/BigInt/return-abrupt-tointeger-fromindex.js36
-rw-r--r--test/built-ins/TypedArray/prototype/indexOf/BigInt/search-found-returns-index.js46
-rw-r--r--test/built-ins/TypedArray/prototype/indexOf/BigInt/search-not-found-returns-minus-one.js38
-rw-r--r--test/built-ins/TypedArray/prototype/indexOf/BigInt/this-is-not-object.js50
-rw-r--r--test/built-ins/TypedArray/prototype/indexOf/BigInt/this-is-not-typedarray-instance.js42
-rw-r--r--test/built-ins/TypedArray/prototype/indexOf/BigInt/tointeger-fromindex.js57
-rw-r--r--test/built-ins/TypedArray/prototype/indexOf/invoked-as-func.js2
-rw-r--r--test/built-ins/TypedArray/prototype/indexOf/invoked-as-method.js2
-rw-r--r--test/built-ins/TypedArray/prototype/indexOf/length.js3
-rw-r--r--test/built-ins/TypedArray/prototype/indexOf/name.js3
-rw-r--r--test/built-ins/TypedArray/prototype/indexOf/prop-desc.js3
-rw-r--r--test/built-ins/TypedArray/prototype/join/BigInt/custom-separator-result-from-tostring-on-each-simple-value.js78
-rw-r--r--test/built-ins/TypedArray/prototype/join/BigInt/detached-buffer.js34
-rw-r--r--test/built-ins/TypedArray/prototype/join/BigInt/empty-instance-empty-string.js29
-rw-r--r--test/built-ins/TypedArray/prototype/join/BigInt/get-length-uses-internal-arraylength.js45
-rw-r--r--test/built-ins/TypedArray/prototype/join/BigInt/invoked-as-func.js29
-rw-r--r--test/built-ins/TypedArray/prototype/join/BigInt/invoked-as-method.js29
-rw-r--r--test/built-ins/TypedArray/prototype/join/BigInt/length.js30
-rw-r--r--test/built-ins/TypedArray/prototype/join/BigInt/name.js27
-rw-r--r--test/built-ins/TypedArray/prototype/join/BigInt/prop-desc.js19
-rw-r--r--test/built-ins/TypedArray/prototype/join/BigInt/result-from-tostring-on-each-simple-value.js37
-rw-r--r--test/built-ins/TypedArray/prototype/join/BigInt/return-abrupt-from-separator-symbol.js32
-rw-r--r--test/built-ins/TypedArray/prototype/join/BigInt/return-abrupt-from-separator.js36
-rw-r--r--test/built-ins/TypedArray/prototype/join/BigInt/this-is-not-object.js50
-rw-r--r--test/built-ins/TypedArray/prototype/join/BigInt/this-is-not-typedarray-instance.js42
-rw-r--r--test/built-ins/TypedArray/prototype/join/invoked-as-func.js2
-rw-r--r--test/built-ins/TypedArray/prototype/join/invoked-as-method.js2
-rw-r--r--test/built-ins/TypedArray/prototype/join/length.js3
-rw-r--r--test/built-ins/TypedArray/prototype/join/name.js3
-rw-r--r--test/built-ins/TypedArray/prototype/join/prop-desc.js3
-rw-r--r--test/built-ins/TypedArray/prototype/keys/BigInt/detached-buffer.js27
-rw-r--r--test/built-ins/TypedArray/prototype/keys/BigInt/invoked-as-func.js30
-rw-r--r--test/built-ins/TypedArray/prototype/keys/BigInt/invoked-as-method.js30
-rw-r--r--test/built-ins/TypedArray/prototype/keys/BigInt/iter-prototype.js25
-rw-r--r--test/built-ins/TypedArray/prototype/keys/BigInt/length.js30
-rw-r--r--test/built-ins/TypedArray/prototype/keys/BigInt/name.js27
-rw-r--r--test/built-ins/TypedArray/prototype/keys/BigInt/prop-desc.js19
-rw-r--r--test/built-ins/TypedArray/prototype/keys/BigInt/return-itor.js37
-rw-r--r--test/built-ins/TypedArray/prototype/keys/BigInt/this-is-not-object.js52
-rw-r--r--test/built-ins/TypedArray/prototype/keys/BigInt/this-is-not-typedarray-instance.js44
-rw-r--r--test/built-ins/TypedArray/prototype/keys/invoked-as-func.js2
-rw-r--r--test/built-ins/TypedArray/prototype/keys/invoked-as-method.js2
-rw-r--r--test/built-ins/TypedArray/prototype/keys/length.js3
-rw-r--r--test/built-ins/TypedArray/prototype/keys/name.js3
-rw-r--r--test/built-ins/TypedArray/prototype/keys/prop-desc.js3
-rw-r--r--test/built-ins/TypedArray/prototype/keys/return-itor.js2
-rw-r--r--test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/detached-buffer.js28
-rw-r--r--test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/fromIndex-infinity.js32
-rw-r--r--test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/fromIndex-minus-zero.js30
-rw-r--r--test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/get-length-uses-internal-arraylength.js32
-rw-r--r--test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/invoked-as-func.js29
-rw-r--r--test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/invoked-as-method.js29
-rw-r--r--test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/length-zero-returns-minus-one.js37
-rw-r--r--test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/length.js30
-rw-r--r--test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/name.js27
-rw-r--r--test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/prop-desc.js19
-rw-r--r--test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/return-abrupt-tointeger-fromindex-symbol.js32
-rw-r--r--test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/return-abrupt-tointeger-fromindex.js36
-rw-r--r--test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/search-found-returns-index.js57
-rw-r--r--test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/search-not-found-returns-minus-one.js42
-rw-r--r--test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/this-is-not-object.js50
-rw-r--r--test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/this-is-not-typedarray-instance.js42
-rw-r--r--test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/tointeger-fromindex.js57
-rw-r--r--test/built-ins/TypedArray/prototype/lastIndexOf/invoked-as-func.js2
-rw-r--r--test/built-ins/TypedArray/prototype/lastIndexOf/invoked-as-method.js2
-rw-r--r--test/built-ins/TypedArray/prototype/lastIndexOf/length.js3
-rw-r--r--test/built-ins/TypedArray/prototype/lastIndexOf/name.js3
-rw-r--r--test/built-ins/TypedArray/prototype/lastIndexOf/prop-desc.js3
-rw-r--r--test/built-ins/TypedArray/prototype/length/BigInt/detached-buffer.js21
-rw-r--r--test/built-ins/TypedArray/prototype/length/BigInt/invoked-as-accessor.js23
-rw-r--r--test/built-ins/TypedArray/prototype/length/BigInt/invoked-as-func.js23
-rw-r--r--test/built-ins/TypedArray/prototype/length/BigInt/length.js32
-rw-r--r--test/built-ins/TypedArray/prototype/length/BigInt/name.js29
-rw-r--r--test/built-ins/TypedArray/prototype/length/BigInt/prop-desc.js24
-rw-r--r--test/built-ins/TypedArray/prototype/length/BigInt/return-length.js28
-rw-r--r--test/built-ins/TypedArray/prototype/length/BigInt/this-has-no-typedarrayname-internal.js41
-rw-r--r--test/built-ins/TypedArray/prototype/length/BigInt/this-is-not-object.js49
-rw-r--r--test/built-ins/TypedArray/prototype/length/invoked-as-accessor.js2
-rw-r--r--test/built-ins/TypedArray/prototype/length/invoked-as-func.js2
-rw-r--r--test/built-ins/TypedArray/prototype/length/length.js3
-rw-r--r--test/built-ins/TypedArray/prototype/length/name.js3
-rw-r--r--test/built-ins/TypedArray/prototype/length/prop-desc.js3
-rw-r--r--test/built-ins/TypedArray/prototype/map/BigInt/arraylength-internal.js45
-rw-r--r--test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-arguments-with-thisarg.js48
-rw-r--r--test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-arguments-without-thisarg.js46
-rw-r--r--test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-detachbuffer.js36
-rw-r--r--test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-is-not-callable.js47
-rw-r--r--test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-no-interaction-over-non-integer-properties.js41
-rw-r--r--test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-not-called-on-empty.js28
-rw-r--r--test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-return-affects-returned-object.js31
-rw-r--r--test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-return-does-not-change-instance.js25
-rw-r--r--test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-return-does-not-copy-non-integer-properties.js42
-rw-r--r--test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-returns-abrupt.js22
-rw-r--r--test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-set-value-during-interaction.js43
-rw-r--r--test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-this.js50
-rw-r--r--test/built-ins/TypedArray/prototype/map/BigInt/detached-buffer.js32
-rw-r--r--test/built-ins/TypedArray/prototype/map/BigInt/invoked-as-func.js30
-rw-r--r--test/built-ins/TypedArray/prototype/map/BigInt/invoked-as-method.js30
-rw-r--r--test/built-ins/TypedArray/prototype/map/BigInt/length.js30
-rw-r--r--test/built-ins/TypedArray/prototype/map/BigInt/name.js27
-rw-r--r--test/built-ins/TypedArray/prototype/map/BigInt/prop-desc.js19
-rw-r--r--test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-conversion-operation-consistent-nan.js62
-rw-r--r--test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-conversion-operation.js52
-rw-r--r--test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-from-empty-length.js38
-rw-r--r--test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-from-positive-length.js34
-rw-r--r--test/built-ins/TypedArray/prototype/map/BigInt/this-is-not-object.js51
-rw-r--r--test/built-ins/TypedArray/prototype/map/BigInt/this-is-not-typedarray-instance.js43
-rw-r--r--test/built-ins/TypedArray/prototype/map/BigInt/values-are-not-cached.js28
-rw-r--r--test/built-ins/TypedArray/prototype/map/arraylength-internal.js2
-rw-r--r--test/built-ins/TypedArray/prototype/map/callbackfn-arguments-with-thisarg.js1
-rw-r--r--test/built-ins/TypedArray/prototype/map/callbackfn-arguments-without-thisarg.js1
-rw-r--r--test/built-ins/TypedArray/prototype/map/callbackfn-detachbuffer.js2
-rw-r--r--test/built-ins/TypedArray/prototype/map/callbackfn-no-interaction-over-non-integer-properties.js1
-rw-r--r--test/built-ins/TypedArray/prototype/map/callbackfn-set-value-during-interaction.js1
-rw-r--r--test/built-ins/TypedArray/prototype/map/invoked-as-func.js2
-rw-r--r--test/built-ins/TypedArray/prototype/map/invoked-as-method.js2
-rw-r--r--test/built-ins/TypedArray/prototype/map/length.js3
-rw-r--r--test/built-ins/TypedArray/prototype/map/name.js3
-rw-r--r--test/built-ins/TypedArray/prototype/map/prop-desc.js3
-rw-r--r--test/built-ins/TypedArray/prototype/map/return-new-typedarray-conversion-operation-consistent-nan.js1
-rw-r--r--test/built-ins/TypedArray/prototype/map/return-new-typedarray-conversion-operation.js1
-rw-r--r--test/built-ins/TypedArray/prototype/map/values-are-not-cached.js2
-rw-r--r--test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-arguments-custom-accumulator.js58
-rw-r--r--test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-arguments-default-accumulator.js59
-rw-r--r--test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-detachbuffer.js44
-rw-r--r--test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-is-not-callable-throws.js67
-rw-r--r--test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-no-iteration-over-non-integer-properties.js48
-rw-r--r--test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-not-called-on-empty.js39
-rw-r--r--test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-return-does-not-change-instance.js21
-rw-r--r--test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-returns-abrupt.js43
-rw-r--r--test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-set-value-during-iteration.js49
-rw-r--r--test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-this.js44
-rw-r--r--test/built-ins/TypedArray/prototype/reduce/BigInt/detached-buffer.js32
-rw-r--r--test/built-ins/TypedArray/prototype/reduce/BigInt/empty-instance-return-initialvalue.js41
-rw-r--r--test/built-ins/TypedArray/prototype/reduce/BigInt/empty-instance-with-no-initialvalue-throws.js34
-rw-r--r--test/built-ins/TypedArray/prototype/reduce/BigInt/get-length-uses-internal-arraylength.js46
-rw-r--r--test/built-ins/TypedArray/prototype/reduce/BigInt/invoked-as-func.js30
-rw-r--r--test/built-ins/TypedArray/prototype/reduce/BigInt/invoked-as-method.js30
-rw-r--r--test/built-ins/TypedArray/prototype/reduce/BigInt/length.js30
-rw-r--r--test/built-ins/TypedArray/prototype/reduce/BigInt/name.js27
-rw-r--r--test/built-ins/TypedArray/prototype/reduce/BigInt/prop-desc.js19
-rw-r--r--test/built-ins/TypedArray/prototype/reduce/BigInt/result-is-last-callbackfn-return.js59
-rw-r--r--test/built-ins/TypedArray/prototype/reduce/BigInt/result-of-any-type.js67
-rw-r--r--test/built-ins/TypedArray/prototype/reduce/BigInt/return-first-value-without-callbackfn.js42
-rw-r--r--test/built-ins/TypedArray/prototype/reduce/BigInt/this-is-not-object.js51
-rw-r--r--test/built-ins/TypedArray/prototype/reduce/BigInt/this-is-not-typedarray-instance.js43
-rw-r--r--test/built-ins/TypedArray/prototype/reduce/BigInt/values-are-not-cached.js41
-rw-r--r--test/built-ins/TypedArray/prototype/reduce/callbackfn-detachbuffer.js1
-rw-r--r--test/built-ins/TypedArray/prototype/reduce/invoked-as-func.js2
-rw-r--r--test/built-ins/TypedArray/prototype/reduce/invoked-as-method.js2
-rw-r--r--test/built-ins/TypedArray/prototype/reduce/length.js3
-rw-r--r--test/built-ins/TypedArray/prototype/reduce/name.js3
-rw-r--r--test/built-ins/TypedArray/prototype/reduce/prop-desc.js3
-rw-r--r--test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-arguments-custom-accumulator.js59
-rw-r--r--test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-arguments-default-accumulator.js62
-rw-r--r--test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-detachbuffer.js44
-rw-r--r--test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-is-not-callable-throws.js67
-rw-r--r--test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-no-iteration-over-non-integer-properties.js49
-rw-r--r--test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-not-called-on-empty.js40
-rw-r--r--test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-return-does-not-change-instance.js21
-rw-r--r--test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-returns-abrupt.js43
-rw-r--r--test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-set-value-during-iteration.js49
-rw-r--r--test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-this.js45
-rw-r--r--test/built-ins/TypedArray/prototype/reduceRight/BigInt/detached-buffer.js32
-rw-r--r--test/built-ins/TypedArray/prototype/reduceRight/BigInt/empty-instance-return-initialvalue.js42
-rw-r--r--test/built-ins/TypedArray/prototype/reduceRight/BigInt/empty-instance-with-no-initialvalue-throws.js34
-rw-r--r--test/built-ins/TypedArray/prototype/reduceRight/BigInt/get-length-uses-internal-arraylength.js46
-rw-r--r--test/built-ins/TypedArray/prototype/reduceRight/BigInt/invoked-as-func.js30
-rw-r--r--test/built-ins/TypedArray/prototype/reduceRight/BigInt/invoked-as-method.js30
-rw-r--r--test/built-ins/TypedArray/prototype/reduceRight/BigInt/length.js30
-rw-r--r--test/built-ins/TypedArray/prototype/reduceRight/BigInt/name.js27
-rw-r--r--test/built-ins/TypedArray/prototype/reduceRight/BigInt/prop-desc.js19
-rw-r--r--test/built-ins/TypedArray/prototype/reduceRight/BigInt/result-is-last-callbackfn-return.js61
-rw-r--r--test/built-ins/TypedArray/prototype/reduceRight/BigInt/result-of-any-type.js69
-rw-r--r--test/built-ins/TypedArray/prototype/reduceRight/BigInt/return-first-value-without-callbackfn.js43
-rw-r--r--test/built-ins/TypedArray/prototype/reduceRight/BigInt/this-is-not-object.js51
-rw-r--r--test/built-ins/TypedArray/prototype/reduceRight/BigInt/this-is-not-typedarray-instance.js43
-rw-r--r--test/built-ins/TypedArray/prototype/reduceRight/BigInt/values-are-not-cached.js42
-rw-r--r--test/built-ins/TypedArray/prototype/reduceRight/callbackfn-detachbuffer.js1
-rw-r--r--test/built-ins/TypedArray/prototype/reduceRight/invoked-as-func.js2
-rw-r--r--test/built-ins/TypedArray/prototype/reduceRight/invoked-as-method.js2
-rw-r--r--test/built-ins/TypedArray/prototype/reduceRight/length.js3
-rw-r--r--test/built-ins/TypedArray/prototype/reduceRight/name.js3
-rw-r--r--test/built-ins/TypedArray/prototype/reduceRight/prop-desc.js3
-rw-r--r--test/built-ins/TypedArray/prototype/reverse/BigInt/detached-buffer.js28
-rw-r--r--test/built-ins/TypedArray/prototype/reverse/BigInt/get-length-uses-internal-arraylength.js42
-rw-r--r--test/built-ins/TypedArray/prototype/reverse/BigInt/invoked-as-func.js30
-rw-r--r--test/built-ins/TypedArray/prototype/reverse/BigInt/invoked-as-method.js30
-rw-r--r--test/built-ins/TypedArray/prototype/reverse/BigInt/length.js30
-rw-r--r--test/built-ins/TypedArray/prototype/reverse/BigInt/name.js27
-rw-r--r--test/built-ins/TypedArray/prototype/reverse/BigInt/preserves-non-numeric-properties.js35
-rw-r--r--test/built-ins/TypedArray/prototype/reverse/BigInt/prop-desc.js19
-rw-r--r--test/built-ins/TypedArray/prototype/reverse/BigInt/returns-original-object.js39
-rw-r--r--test/built-ins/TypedArray/prototype/reverse/BigInt/reverts.js57
-rw-r--r--test/built-ins/TypedArray/prototype/reverse/BigInt/this-is-not-object.js50
-rw-r--r--test/built-ins/TypedArray/prototype/reverse/BigInt/this-is-not-typedarray-instance.js42
-rw-r--r--test/built-ins/TypedArray/prototype/reverse/invoked-as-func.js2
-rw-r--r--test/built-ins/TypedArray/prototype/reverse/invoked-as-method.js2
-rw-r--r--test/built-ins/TypedArray/prototype/reverse/length.js3
-rw-r--r--test/built-ins/TypedArray/prototype/reverse/name.js3
-rw-r--r--test/built-ins/TypedArray/prototype/reverse/prop-desc.js3
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/array-arg-negative-integer-offset-throws.js35
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/array-arg-offset-tointeger.js95
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-get-length.js33
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-get-value.js48
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-length-symbol.js30
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-length.js46
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-tonumber-value-symbol.js44
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-tonumber-value.js48
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-tointeger-offset-symbol.js27
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-tointeger-offset.js41
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-toobject-offset.js30
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/array-arg-set-values-in-order.js72
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/array-arg-set-values.js63
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-tonumber-value-conversions.js31
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-tonumber-value-type-conversions.js49
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-values-are-not-cached.js47
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/array-arg-target-arraylength-internal.js41
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/array-arg-targetbuffer-detached-on-get-src-value-throws.js45
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/array-arg-targetbuffer-detached-on-tointeger-offset-throws.js39
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/array-arg-targetbuffer-detached-throws.js43
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/bit-precision.js35
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/invoked-as-func.js21
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/invoked-as-method.js21
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/length.js30
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/name.js27
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/prop-desc.js19
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/this-is-not-object.js75
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/this-is-not-typedarray-instance.js56
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-negative-integer-offset-throws.js33
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-offset-tointeger.js93
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-return-abrupt-from-tointeger-offset-symbol.js26
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-return-abrupt-from-tointeger-offset.js40
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-conversions-sab.js51
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-conversions.js38
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-sab.js107
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type.js48
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-same-type-sab.js107
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-same-type.js50
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-same-buffer-same-type-sab.js51
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-same-buffer-same-type.js53
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-src-arraylength-internal.js41
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-src-byteoffset-internal.js45
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-src-range-greather-than-target-throws-rangeerror.js51
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-srcbuffer-detached-during-tointeger-offset-throws.js39
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-target-arraylength-internal.js42
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-target-byteoffset-internal.js44
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-targetbuffer-detached-during-tointeger-offset-throws.js39
-rw-r--r--test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-get-value.js24
-rw-r--r--test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-tonumber-value-symbol.js16
-rw-r--r--test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-tonumber-value.js24
-rw-r--r--test/built-ins/TypedArray/prototype/set/array-arg-src-tonumber-value-conversions.js1
-rw-r--r--test/built-ins/TypedArray/prototype/set/array-arg-src-tonumber-value-type-conversions.js32
-rw-r--r--test/built-ins/TypedArray/prototype/set/bit-precision.js4
-rw-r--r--test/built-ins/TypedArray/prototype/set/invoked-as-func.js2
-rw-r--r--test/built-ins/TypedArray/prototype/set/invoked-as-method.js2
-rw-r--r--test/built-ins/TypedArray/prototype/set/length.js3
-rw-r--r--test/built-ins/TypedArray/prototype/set/name.js3
-rw-r--r--test/built-ins/TypedArray/prototype/set/prop-desc.js3
-rw-r--r--test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-other-type-conversions.js1
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/arraylength-internal.js38
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/bit-precision.js39
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-custom-ctor-other-targettype.js38
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-custom-ctor-same-targettype.js34
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-get-ctor.js33
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-speciesctor-get-species-custom-ctor-throws.js43
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-zero-count-custom-ctor-other-targettype.js48
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-zero-count-custom-ctor-same-targettype.js45
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer.js33
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/infinity.js29
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/invoked-as-func.js30
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/invoked-as-method.js30
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/length.js30
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/minus-zero.js31
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/name.js27
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/prop-desc.js19
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/result-does-not-copy-ordinary-properties.js22
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/results-with-different-length.js53
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/results-with-empty-length.js52
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/results-with-same-length.js32
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/return-abrupt-from-end-symbol.js25
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/return-abrupt-from-end.js39
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/return-abrupt-from-start-symbol.js24
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/return-abrupt-from-start.js38
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/set-values-from-different-ctor-type.js47
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor-abrupt.js41
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor-inherited.js62
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor-returns-throws.js63
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor.js54
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-abrupt.js45
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-invocation.js59
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-length-throws.js41
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-length.js46
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js53
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-throws.js47
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor.js54
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-returns-throws.js66
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-use-default-ctor.js54
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species.js46
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/this-is-not-object.js52
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/this-is-not-typedarray-instance.js44
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/tointeger-end.js48
-rw-r--r--test/built-ins/TypedArray/prototype/slice/BigInt/tointeger-start.js48
-rw-r--r--test/built-ins/TypedArray/prototype/slice/bit-precision.js2
-rw-r--r--test/built-ins/TypedArray/prototype/slice/invoked-as-func.js2
-rw-r--r--test/built-ins/TypedArray/prototype/slice/invoked-as-method.js2
-rw-r--r--test/built-ins/TypedArray/prototype/slice/length.js3
-rw-r--r--test/built-ins/TypedArray/prototype/slice/name.js3
-rw-r--r--test/built-ins/TypedArray/prototype/slice/prop-desc.js3
-rw-r--r--test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-arguments-with-thisarg.js57
-rw-r--r--test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-arguments-without-thisarg.js55
-rw-r--r--test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-detachbuffer.js43
-rw-r--r--test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-no-interaction-over-non-integer.js40
-rw-r--r--test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-not-callable-throws.js69
-rw-r--r--test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-not-called-on-empty.js36
-rw-r--r--test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-return-does-not-change-instance.js38
-rw-r--r--test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-returns-abrupt.js35
-rw-r--r--test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-set-value-during-interaction.js56
-rw-r--r--test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-this.js57
-rw-r--r--test/built-ins/TypedArray/prototype/some/BigInt/detached-buffer.js32
-rw-r--r--test/built-ins/TypedArray/prototype/some/BigInt/get-length-uses-internal-arraylength.js46
-rw-r--r--test/built-ins/TypedArray/prototype/some/BigInt/invoked-as-func.js29
-rw-r--r--test/built-ins/TypedArray/prototype/some/BigInt/invoked-as-method.js29
-rw-r--r--test/built-ins/TypedArray/prototype/some/BigInt/length.js30
-rw-r--r--test/built-ins/TypedArray/prototype/some/BigInt/name.js27
-rw-r--r--test/built-ins/TypedArray/prototype/some/BigInt/prop-desc.js19
-rw-r--r--test/built-ins/TypedArray/prototype/some/BigInt/returns-false-if-every-cb-returns-false.js43
-rw-r--r--test/built-ins/TypedArray/prototype/some/BigInt/returns-true-if-any-cb-returns-true.js59
-rw-r--r--test/built-ins/TypedArray/prototype/some/BigInt/this-is-not-object.js51
-rw-r--r--test/built-ins/TypedArray/prototype/some/BigInt/this-is-not-typedarray-instance.js43
-rw-r--r--test/built-ins/TypedArray/prototype/some/BigInt/values-are-not-cached.js40
-rw-r--r--test/built-ins/TypedArray/prototype/some/callbackfn-detachbuffer.js1
-rw-r--r--test/built-ins/TypedArray/prototype/some/invoked-as-func.js2
-rw-r--r--test/built-ins/TypedArray/prototype/some/invoked-as-method.js2
-rw-r--r--test/built-ins/TypedArray/prototype/some/length.js3
-rw-r--r--test/built-ins/TypedArray/prototype/some/name.js3
-rw-r--r--test/built-ins/TypedArray/prototype/some/prop-desc.js3
-rw-r--r--test/built-ins/TypedArray/prototype/sort/BigInt/arraylength-internal.js39
-rw-r--r--test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-call-throws.js42
-rw-r--r--test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-calls.js42
-rw-r--r--test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-nonfunction-call-throws.js55
-rw-r--r--test/built-ins/TypedArray/prototype/sort/BigInt/detached-buffer-comparefn.js38
-rw-r--r--test/built-ins/TypedArray/prototype/sort/BigInt/detached-buffer.js31
-rw-r--r--test/built-ins/TypedArray/prototype/sort/BigInt/invoked-as-func.js35
-rw-r--r--test/built-ins/TypedArray/prototype/sort/BigInt/invoked-as-method.js35
-rw-r--r--test/built-ins/TypedArray/prototype/sort/BigInt/length.js30
-rw-r--r--test/built-ins/TypedArray/prototype/sort/BigInt/name.js27
-rw-r--r--test/built-ins/TypedArray/prototype/sort/BigInt/prop-desc.js19
-rw-r--r--test/built-ins/TypedArray/prototype/sort/BigInt/return-same-instance.js25
-rw-r--r--test/built-ins/TypedArray/prototype/sort/BigInt/sortcompare-with-no-tostring.js27
-rw-r--r--test/built-ins/TypedArray/prototype/sort/BigInt/sorted-values-nan.js38
-rw-r--r--test/built-ins/TypedArray/prototype/sort/BigInt/sorted-values.js53
-rw-r--r--test/built-ins/TypedArray/prototype/sort/BigInt/this-is-not-object.js51
-rw-r--r--test/built-ins/TypedArray/prototype/sort/BigInt/this-is-not-typedarray-instance.js43
-rw-r--r--test/built-ins/TypedArray/prototype/sort/invoked-as-func.js2
-rw-r--r--test/built-ins/TypedArray/prototype/sort/invoked-as-method.js2
-rw-r--r--test/built-ins/TypedArray/prototype/sort/length.js3
-rw-r--r--test/built-ins/TypedArray/prototype/sort/name.js3
-rw-r--r--test/built-ins/TypedArray/prototype/sort/prop-desc.js3
-rw-r--r--test/built-ins/TypedArray/prototype/subarray/BigInt/detached-buffer.js65
-rw-r--r--test/built-ins/TypedArray/prototype/subarray/BigInt/infinity.js31
-rw-r--r--test/built-ins/TypedArray/prototype/subarray/BigInt/invoked-as-func.js24
-rw-r--r--test/built-ins/TypedArray/prototype/subarray/BigInt/invoked-as-method.js24
-rw-r--r--test/built-ins/TypedArray/prototype/subarray/BigInt/length.js30
-rw-r--r--test/built-ins/TypedArray/prototype/subarray/BigInt/minus-zero.js31
-rw-r--r--test/built-ins/TypedArray/prototype/subarray/BigInt/name.js27
-rw-r--r--test/built-ins/TypedArray/prototype/subarray/BigInt/prop-desc.js19
-rw-r--r--test/built-ins/TypedArray/prototype/subarray/BigInt/result-does-not-copy-ordinary-properties.js27
-rw-r--r--test/built-ins/TypedArray/prototype/subarray/BigInt/result-is-new-instance-from-same-ctor.js31
-rw-r--r--test/built-ins/TypedArray/prototype/subarray/BigInt/result-is-new-instance-with-shared-buffer.js35
-rw-r--r--test/built-ins/TypedArray/prototype/subarray/BigInt/results-with-different-length.js58
-rw-r--r--test/built-ins/TypedArray/prototype/subarray/BigInt/results-with-empty-length.js57
-rw-r--r--test/built-ins/TypedArray/prototype/subarray/BigInt/results-with-same-length.js37
-rw-r--r--test/built-ins/TypedArray/prototype/subarray/BigInt/return-abrupt-from-begin-symbol.js24
-rw-r--r--test/built-ins/TypedArray/prototype/subarray/BigInt/return-abrupt-from-begin.js38
-rw-r--r--test/built-ins/TypedArray/prototype/subarray/BigInt/return-abrupt-from-end-symbol.js25
-rw-r--r--test/built-ins/TypedArray/prototype/subarray/BigInt/return-abrupt-from-end.js39
-rw-r--r--test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor-abrupt.js40
-rw-r--r--test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor-inherited.js61
-rw-r--r--test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor-returns-throws.js62
-rw-r--r--test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor.js53
-rw-r--r--test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-abrupt.js44
-rw-r--r--test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor-invocation.js61
-rw-r--r--test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js52
-rw-r--r--test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor-throws.js46
-rw-r--r--test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor.js53
-rw-r--r--test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-returns-throws.js65
-rw-r--r--test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-use-default-ctor.js53
-rw-r--r--test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species.js45
-rw-r--r--test/built-ins/TypedArray/prototype/subarray/BigInt/this-is-not-object.js47
-rw-r--r--test/built-ins/TypedArray/prototype/subarray/BigInt/this-is-not-typedarray-instance.js39
-rw-r--r--test/built-ins/TypedArray/prototype/subarray/BigInt/tointeger-begin.js48
-rw-r--r--test/built-ins/TypedArray/prototype/subarray/BigInt/tointeger-end.js48
-rw-r--r--test/built-ins/TypedArray/prototype/subarray/invoked-as-func.js2
-rw-r--r--test/built-ins/TypedArray/prototype/subarray/invoked-as-method.js2
-rw-r--r--test/built-ins/TypedArray/prototype/subarray/length.js3
-rw-r--r--test/built-ins/TypedArray/prototype/subarray/name.js3
-rw-r--r--test/built-ins/TypedArray/prototype/subarray/prop-desc.js3
-rw-r--r--test/built-ins/TypedArray/prototype/toLocaleString/BigInt/calls-tolocalestring-from-each-value.js52
-rw-r--r--test/built-ins/TypedArray/prototype/toLocaleString/BigInt/calls-tostring-from-each-value.js58
-rw-r--r--test/built-ins/TypedArray/prototype/toLocaleString/BigInt/calls-valueof-from-each-value.js55
-rw-r--r--test/built-ins/TypedArray/prototype/toLocaleString/BigInt/detached-buffer.js28
-rw-r--r--test/built-ins/TypedArray/prototype/toLocaleString/BigInt/empty-instance-returns-empty-string.js26
-rw-r--r--test/built-ins/TypedArray/prototype/toLocaleString/BigInt/get-length-uses-internal-arraylength.js42
-rw-r--r--test/built-ins/TypedArray/prototype/toLocaleString/BigInt/invoked-as-func.js31
-rw-r--r--test/built-ins/TypedArray/prototype/toLocaleString/BigInt/invoked-as-method.js31
-rw-r--r--test/built-ins/TypedArray/prototype/toLocaleString/BigInt/length.js30
-rw-r--r--test/built-ins/TypedArray/prototype/toLocaleString/BigInt/name.js27
-rw-r--r--test/built-ins/TypedArray/prototype/toLocaleString/BigInt/prop-desc.js19
-rw-r--r--test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-firstelement-tolocalestring.js41
-rw-r--r--test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-firstelement-tostring.js53
-rw-r--r--test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-firstelement-valueof.js54
-rw-r--r--test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-nextelement-tolocalestring.js44
-rw-r--r--test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-nextelement-tostring.js55
-rw-r--r--test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-nextelement-valueof.js56
-rw-r--r--test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-result.js45
-rw-r--r--test/built-ins/TypedArray/prototype/toLocaleString/BigInt/this-is-not-object.js50
-rw-r--r--test/built-ins/TypedArray/prototype/toLocaleString/BigInt/this-is-not-typedarray-instance.js42
-rw-r--r--test/built-ins/TypedArray/prototype/toLocaleString/calls-tostring-from-each-value.js2
-rw-r--r--test/built-ins/TypedArray/prototype/toLocaleString/calls-valueof-from-each-value.js2
-rw-r--r--test/built-ins/TypedArray/prototype/toLocaleString/get-length-uses-internal-arraylength.js2
-rw-r--r--test/built-ins/TypedArray/prototype/toLocaleString/invoked-as-func.js2
-rw-r--r--test/built-ins/TypedArray/prototype/toLocaleString/invoked-as-method.js2
-rw-r--r--test/built-ins/TypedArray/prototype/toLocaleString/length.js3
-rw-r--r--test/built-ins/TypedArray/prototype/toLocaleString/name.js3
-rw-r--r--test/built-ins/TypedArray/prototype/toLocaleString/prop-desc.js3
-rw-r--r--test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-tolocalestring.js2
-rw-r--r--test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-tostring.js2
-rw-r--r--test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-valueof.js2
-rw-r--r--test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-tolocalestring.js2
-rw-r--r--test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-tostring.js2
-rw-r--r--test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-valueof.js2
-rw-r--r--test/built-ins/TypedArray/prototype/toLocaleString/return-result.js2
-rw-r--r--test/built-ins/TypedArray/prototype/toString.js3
-rw-r--r--test/built-ins/TypedArray/prototype/toString/BigInt/detached-buffer.js32
-rw-r--r--test/built-ins/TypedArray/prototype/values/BigInt/detached-buffer.js27
-rw-r--r--test/built-ins/TypedArray/prototype/values/BigInt/invoked-as-func.js30
-rw-r--r--test/built-ins/TypedArray/prototype/values/BigInt/invoked-as-method.js30
-rw-r--r--test/built-ins/TypedArray/prototype/values/BigInt/iter-prototype.js25
-rw-r--r--test/built-ins/TypedArray/prototype/values/BigInt/length.js30
-rw-r--r--test/built-ins/TypedArray/prototype/values/BigInt/name.js27
-rw-r--r--test/built-ins/TypedArray/prototype/values/BigInt/prop-desc.js19
-rw-r--r--test/built-ins/TypedArray/prototype/values/BigInt/return-itor.js35
-rw-r--r--test/built-ins/TypedArray/prototype/values/BigInt/this-is-not-object.js52
-rw-r--r--test/built-ins/TypedArray/prototype/values/BigInt/this-is-not-typedarray-instance.js44
-rw-r--r--test/built-ins/TypedArray/prototype/values/invoked-as-func.js2
-rw-r--r--test/built-ins/TypedArray/prototype/values/invoked-as-method.js2
-rw-r--r--test/built-ins/TypedArray/prototype/values/iter-prototype.js2
-rw-r--r--test/built-ins/TypedArray/prototype/values/length.js3
-rw-r--r--test/built-ins/TypedArray/prototype/values/name.js3
-rw-r--r--test/built-ins/TypedArray/prototype/values/prop-desc.js3
-rw-r--r--test/built-ins/TypedArray/prototype/values/return-itor.js2
817 files changed, 23481 insertions, 282 deletions
diff --git a/test/built-ins/TypedArray/prototype/Symbol.iterator.js b/test/built-ins/TypedArray/prototype/Symbol.iterator.js
index e488e08df..67179b62a 100644
--- a/test/built-ins/TypedArray/prototype/Symbol.iterator.js
+++ b/test/built-ins/TypedArray/prototype/Symbol.iterator.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.30
+esid: sec-%typedarray%.prototype-@@iterator
description: >
Initial state of the Symbol.iterator property
info: |
diff --git a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/detached-buffer.js
new file mode 100644
index 000000000..3bfba3440
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/detached-buffer.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-%typedarray%.prototype-@@tostringtag
+description: The getter method does not throw with a detached buffer
+info: |
+ 22.2.3.32 get %TypedArray%.prototype [ @@toStringTag ]
+
+ ...
+ 4. Let name be the value of O's [[TypedArrayName]] internal slot.
+ 5. Assert: name is a String value.
+ 6. Return name.
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, Symbol.toStringTag, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+ $DETACHBUFFER(sample.buffer);
+ assert.sameValue(sample[Symbol.toStringTag], TA.name);
+});
diff --git a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/invoked-as-accessor.js b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/invoked-as-accessor.js
new file mode 100644
index 000000000..e2852b8f3
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/invoked-as-accessor.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-%typedarray%.prototype-@@tostringtag
+description: >
+ Return undefined if this value does not have a [[TypedArrayName]] internal slot
+info: |
+ 22.2.3.31 get %TypedArray%.prototype [ @@toStringTag ]
+
+ 1. Let O be the this value.
+ ...
+ 3. If O does not have a [[TypedArrayName]] internal slot, return undefined.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol.toStringTag, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+assert.sameValue(TypedArrayPrototype[Symbol.toStringTag], undefined);
diff --git a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/invoked-as-func.js
new file mode 100644
index 000000000..33aa05dac
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/invoked-as-func.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-%typedarray%.prototype-@@tostringtag
+description: If this value is not Object, return undefined.
+info: |
+ 22.2.3.31 get %TypedArray%.prototype [ @@toStringTag ]
+
+ 1. Let O be the this value.
+ 2. If Type(O) is not Object, return undefined.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol.toStringTag, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+var getter = Object.getOwnPropertyDescriptor(
+ TypedArrayPrototype, Symbol.toStringTag
+).get;
+
+assert.sameValue(getter(), undefined);
diff --git a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/length.js b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/length.js
new file mode 100644
index 000000000..13e4e9e17
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/length.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-get-%typedarray%.prototype-@@tostringtag
+description: >
+ get %TypedArray%.prototype [ @@toStringTag ].length is 0.
+info: |
+ get %TypedArray%.prototype [ @@toStringTag ]
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, has a length
+ property whose value is an integer. Unless otherwise specified, this
+ value is equal to the largest number of named arguments shown in the
+ subclause headings for the function description, including optional
+ parameters. However, rest parameters shown using the form “...name”
+ are not included in the default argument count.
+
+ Unless otherwise specified, the length property of a built-in Function
+ object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, Symbol.toStringTag]
+---*/
+
+var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, Symbol.toStringTag);
+
+assert.sameValue(desc.get.length, 0);
+
+verifyNotEnumerable(desc.get, "length");
+verifyNotWritable(desc.get, "length");
+verifyConfigurable(desc.get, "length");
diff --git a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/name.js b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/name.js
new file mode 100644
index 000000000..1004ce463
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/name.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-get-%typedarray%.prototype-@@tostringtag
+description: >
+ get %TypedArray%.prototype [ @@toStringTag ].name is "get [Symbol.toStringTag]".
+info: |
+ get %TypedArray%.prototype [ @@toStringTag ]
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, that is not
+ identified as an anonymous function has a name property whose value
+ is a String.
+
+ Unless otherwise specified, the name property of a built-in Function
+ object, if it exists, has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, Symbol.toStringTag]
+---*/
+
+var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, Symbol.toStringTag);
+
+assert.sameValue(desc.get.name, "get [Symbol.toStringTag]");
+
+verifyNotEnumerable(desc.get, "name");
+verifyNotWritable(desc.get, "name");
+verifyConfigurable(desc.get, "name");
diff --git a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/prop-desc.js
new file mode 100644
index 000000000..23f76220b
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/prop-desc.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-%typedarray%.prototype-@@tostringtag
+description: >
+ "@@toStringTag" property of TypedArrayPrototype
+info: |
+ 22.2.3.31 get %TypedArray%.prototype [ @@toStringTag ]
+
+ %TypedArray%.prototype[@@toStringTag] is an accessor property whose set
+ accessor function is undefined.
+ ...
+
+ This property has the attributes { [[Enumerable]]: false, [[Configurable]]:
+ true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, Symbol.toStringTag]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+var desc = Object.getOwnPropertyDescriptor(
+ TypedArrayPrototype, Symbol.toStringTag
+);
+
+assert.sameValue(desc.set, undefined);
+assert.sameValue(typeof desc.get, 'function');
+verifyNotEnumerable(TypedArrayPrototype, Symbol.toStringTag);
+verifyConfigurable(TypedArrayPrototype, Symbol.toStringTag);
diff --git a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/return-typedarrayname.js b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/return-typedarrayname.js
new file mode 100644
index 000000000..80a3116b8
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/return-typedarrayname.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-%typedarray%.prototype-@@tostringtag
+description: >
+ Return value from the [[TypedArrayName]] internal slot
+info: |
+ 22.2.3.32 get %TypedArray%.prototype [ @@toStringTag ]
+
+ ...
+ 4. Let name be the value of O's [[TypedArrayName]] internal slot.
+ 5. Assert: name is a String value.
+ 6. Return name.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol.toStringTag, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var ta = new TA();
+ assert.sameValue(ta[Symbol.toStringTag], TA.name, "property value");
+});
diff --git a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/this-has-no-typedarrayname-internal.js b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/this-has-no-typedarrayname-internal.js
new file mode 100644
index 000000000..9414c2d00
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/this-has-no-typedarrayname-internal.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-%typedarray%.prototype-@@tostringtag
+description: >
+ Return undefined when `this` does not have a [[TypedArrayName]] internal slot
+info: |
+ 22.2.3.32 get %TypedArray%.prototype [ @@toStringTag ]
+
+ 1. Let O be the this value.
+ ...
+ 3. If O does not have a [[TypedArrayName]] internal slot, return undefined.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol.toStringTag, DataView, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+var getter = Object.getOwnPropertyDescriptor(
+ TypedArrayPrototype, Symbol.toStringTag
+).get;
+
+assert.sameValue(getter.call({}), undefined);
+assert.sameValue(getter.call([]), undefined);
+assert.sameValue(getter.call(new ArrayBuffer(8)), undefined);
+
+var ab = new ArrayBuffer(8);
+var dv = new DataView(ab, 0, 1);
+assert.sameValue(getter.call(dv), undefined);
diff --git a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/this-is-not-object.js
new file mode 100644
index 000000000..1ae3cf292
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/this-is-not-object.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-%typedarray%.prototype-@@tostringtag
+description: Return undefined when `this` is not Object
+info: |
+ 22.2.3.32 get %TypedArray%.prototype [ @@toStringTag ]
+
+ 1. Let O be the this value.
+ 2. If Type(O) is not Object, return undefined.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, Symbol.toStringTag, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+var getter = Object.getOwnPropertyDescriptor(
+ TypedArrayPrototype, Symbol.toStringTag
+).get;
+
+assert.sameValue(getter.call(undefined), undefined, "this is undefined");
+assert.sameValue(getter.call(42), undefined, "this is 42");
+assert.sameValue(getter.call("foo"), undefined, "this is a string");
+assert.sameValue(getter.call(true), undefined, "this is true");
+assert.sameValue(getter.call(false), undefined, "this is false");
+assert.sameValue(getter.call(Symbol("s")), undefined, "this is a Symbol");
+assert.sameValue(getter.call(null), undefined, "this is null");
diff --git a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/invoked-as-accessor.js b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/invoked-as-accessor.js
index 252c9cfcb..a6fcea836 100644
--- a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/invoked-as-accessor.js
+++ b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/invoked-as-accessor.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.31
+esid: sec-get-%typedarray%.prototype-@@tostringtag
description: >
Return undefined if this value does not have a [[TypedArrayName]] internal slot
info: |
diff --git a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/invoked-as-func.js b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/invoked-as-func.js
index 60e2f84f9..3c89cc5cd 100644
--- a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/invoked-as-func.js
+++ b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/invoked-as-func.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.31
+esid: sec-get-%typedarray%.prototype-@@tostringtag
description: If this value is not Object, return undefined.
info: |
22.2.3.31 get %TypedArray%.prototype [ @@toStringTag ]
diff --git a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/length.js b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/length.js
index faa887b93..37b6d2aaf 100644
--- a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/length.js
+++ b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/length.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.31
+esid: sec-get-%typedarray%.prototype-@@tostringtag
description: >
get %TypedArray%.prototype [ @@toStringTag ].length is 0.
info: |
diff --git a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/name.js b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/name.js
index f39dc9eaa..fef03e767 100644
--- a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/name.js
+++ b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/name.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.31
+esid: sec-get-%typedarray%.prototype-@@tostringtag
description: >
get %TypedArray%.prototype [ @@toStringTag ].name is "get [Symbol.toStringTag]".
info: |
diff --git a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/prop-desc.js b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/prop-desc.js
index 75c827fae..62c84434b 100644
--- a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/prop-desc.js
+++ b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/prop-desc.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.31
+esid: sec-get-%typedarray%.prototype-@@tostringtag
description: >
"@@toStringTag" property of TypedArrayPrototype
info: |
diff --git a/test/built-ins/TypedArray/prototype/buffer/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/buffer/BigInt/detached-buffer.js
new file mode 100644
index 000000000..3332f1a6c
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/buffer/BigInt/detached-buffer.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-%typedarray%.prototype.buffer
+description: The getter method does not throw with a detached buffer
+info: |
+ 22.2.3.1 get %TypedArray%.prototype.buffer
+
+ ...
+ 4. Let buffer be the value of O's [[ViewedArrayBuffer]] internal slot.
+ 5. Return buffer.
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var buffer = new ArrayBuffer(8);
+ var sample = new TA(buffer, 0, 1);
+ $DETACHBUFFER(sample.buffer);
+ assert.sameValue(sample.buffer, buffer);
+}, [BigInt64Array, BigUint64Array]);
diff --git a/test/built-ins/TypedArray/prototype/buffer/BigInt/return-buffer.js b/test/built-ins/TypedArray/prototype/buffer/BigInt/return-buffer.js
new file mode 100644
index 000000000..7630425eb
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/buffer/BigInt/return-buffer.js
@@ -0,0 +1,22 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-%typedarray%.prototype.buffer
+description: >
+ Return buffer from [[ViewedArrayBuffer]] internal slot
+info: |
+ 22.2.3.1 get %TypedArray%.prototype.buffer
+
+ ...
+ 4. Let buffer be the value of O's [[ViewedArrayBuffer]] internal slot.
+ 5. Return buffer.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var buffer = new ArrayBuffer(TA.BYTES_PER_ELEMENT);
+ var ta = new TA(buffer);
+
+ assert.sameValue(ta.buffer, buffer);
+}, [BigInt64Array, BigUint64Array]);
diff --git a/test/built-ins/TypedArray/prototype/buffer/invoked-as-accessor.js b/test/built-ins/TypedArray/prototype/buffer/invoked-as-accessor.js
index 46e9206a8..6c8241122 100644
--- a/test/built-ins/TypedArray/prototype/buffer/invoked-as-accessor.js
+++ b/test/built-ins/TypedArray/prototype/buffer/invoked-as-accessor.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.1
+esid: sec-get-%typedarray%.prototype.buffer
description: >
Requires this value to have a [[ViewedArrayBuffer]] internal slot
info: |
diff --git a/test/built-ins/TypedArray/prototype/buffer/invoked-as-func.js b/test/built-ins/TypedArray/prototype/buffer/invoked-as-func.js
index 249511110..d962e2d58 100644
--- a/test/built-ins/TypedArray/prototype/buffer/invoked-as-func.js
+++ b/test/built-ins/TypedArray/prototype/buffer/invoked-as-func.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.1
+esid: sec-get-%typedarray%.prototype.buffer
description: Throws a TypeError exception when invoked as a function
info: |
22.2.3.1 get %TypedArray%.prototype.buffer
diff --git a/test/built-ins/TypedArray/prototype/buffer/length.js b/test/built-ins/TypedArray/prototype/buffer/length.js
index 72e488c11..1ddb20c4e 100644
--- a/test/built-ins/TypedArray/prototype/buffer/length.js
+++ b/test/built-ins/TypedArray/prototype/buffer/length.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.1
+esid: sec-get-%typedarray%.prototype.buffer
description: >
get %TypedArray%.prototype.buffer.length is 0.
info: |
@@ -20,6 +20,7 @@ info: |
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
[[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, "buffer");
diff --git a/test/built-ins/TypedArray/prototype/buffer/name.js b/test/built-ins/TypedArray/prototype/buffer/name.js
index bbd1b6f37..d52454a7f 100644
--- a/test/built-ins/TypedArray/prototype/buffer/name.js
+++ b/test/built-ins/TypedArray/prototype/buffer/name.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.1
+esid: sec-get-%typedarray%.prototype.buffer
description: >
get %TypedArray%.prototype.buffer.name is "get buffer".
info: |
@@ -17,6 +17,7 @@ info: |
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, "buffer");
diff --git a/test/built-ins/TypedArray/prototype/buffer/prop-desc.js b/test/built-ins/TypedArray/prototype/buffer/prop-desc.js
index f666062a7..dee44b2fe 100644
--- a/test/built-ins/TypedArray/prototype/buffer/prop-desc.js
+++ b/test/built-ins/TypedArray/prototype/buffer/prop-desc.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.1
+esid: sec-get-%typedarray%.prototype.buffer
description: >
"buffer" property of TypedArrayPrototype
info: |
@@ -11,6 +11,7 @@ info: |
Section 17: Every accessor property described in clauses 18 through 26 and in
Annex B.2 has the attributes {[[Enumerable]]: false, [[Configurable]]: true }
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
var TypedArrayPrototype = TypedArray.prototype;
diff --git a/test/built-ins/TypedArray/prototype/buffer/return-buffer.js b/test/built-ins/TypedArray/prototype/buffer/return-buffer.js
index 82420a6df..fe01f785b 100644
--- a/test/built-ins/TypedArray/prototype/buffer/return-buffer.js
+++ b/test/built-ins/TypedArray/prototype/buffer/return-buffer.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.1
+esid: sec-get-%typedarray%.prototype.buffer
description: >
Return buffer from [[ViewedArrayBuffer]] internal slot
info: |
diff --git a/test/built-ins/TypedArray/prototype/buffer/this-has-no-typedarrayname-internal.js b/test/built-ins/TypedArray/prototype/buffer/this-has-no-typedarrayname-internal.js
index 9b6b28db8..65dace14a 100644
--- a/test/built-ins/TypedArray/prototype/buffer/this-has-no-typedarrayname-internal.js
+++ b/test/built-ins/TypedArray/prototype/buffer/this-has-no-typedarrayname-internal.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-get-%typedarray%.prototype.buffer
-es6id: 22.2.3.1
description: >
Throws a TypeError exception when `this` does not have a [[TypedArrayName]]
internal slot
diff --git a/test/built-ins/TypedArray/prototype/buffer/this-is-not-object.js b/test/built-ins/TypedArray/prototype/buffer/this-is-not-object.js
index 0292bd502..29a455566 100644
--- a/test/built-ins/TypedArray/prototype/buffer/this-is-not-object.js
+++ b/test/built-ins/TypedArray/prototype/buffer/this-is-not-object.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.1
+esid: sec-get-%typedarray%.prototype.buffer
description: Throws a TypeError exception when `this` is not Object
info: |
22.2.3.1 get %TypedArray%.prototype.buffer
diff --git a/test/built-ins/TypedArray/prototype/byteLength/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/byteLength/BigInt/detached-buffer.js
new file mode 100644
index 000000000..16cfcd434
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/byteLength/BigInt/detached-buffer.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-%typedarray%.prototype.bytelength
+description: Returns 0 if the instance has a detached buffer
+info: |
+ 22.2.3.2 get %TypedArray%.prototype.byteLength
+
+ ...
+ 4. Let buffer be the value of O's [[ViewedArrayBuffer]] internal slot.
+ 5. If IsDetachedBuffer(buffer) is true, return 0.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+ $DETACHBUFFER(sample.buffer);
+ assert.sameValue(sample.byteLength, 0);
+});
diff --git a/test/built-ins/TypedArray/prototype/byteLength/BigInt/return-bytelength.js b/test/built-ins/TypedArray/prototype/byteLength/BigInt/return-bytelength.js
new file mode 100644
index 000000000..381bc7c2d
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/byteLength/BigInt/return-bytelength.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-%typedarray%.prototype.bytelength
+description: >
+ Return value from [[ByteLength]] internal slot
+info: |
+ 22.2.3.2 get %TypedArray%.prototype.byteLength
+
+ ...
+ 6. Let size be the value of O's [[ByteLength]] internal slot.
+ 7. Return size.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var bytesPerElement = TA.BYTES_PER_ELEMENT;
+ var ta1 = new TA();
+ assert.sameValue(ta1.byteLength, 0);
+
+ var ta2 = new TA(42);
+ assert.sameValue(ta2.byteLength, 42 * bytesPerElement);
+});
diff --git a/test/built-ins/TypedArray/prototype/byteLength/invoked-as-accessor.js b/test/built-ins/TypedArray/prototype/byteLength/invoked-as-accessor.js
index e46b08e37..9838344e4 100644
--- a/test/built-ins/TypedArray/prototype/byteLength/invoked-as-accessor.js
+++ b/test/built-ins/TypedArray/prototype/byteLength/invoked-as-accessor.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.2
+esid: sec-get-%typedarray%.prototype.bytelength
description: >
Requires this value to have a [[ViewedArrayBuffer]] internal slot
info: |
diff --git a/test/built-ins/TypedArray/prototype/byteLength/invoked-as-func.js b/test/built-ins/TypedArray/prototype/byteLength/invoked-as-func.js
index 71ee4d577..f9189895e 100644
--- a/test/built-ins/TypedArray/prototype/byteLength/invoked-as-func.js
+++ b/test/built-ins/TypedArray/prototype/byteLength/invoked-as-func.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.2
+esid: sec-get-%typedarray%.prototype.bytelength
description: Throws a TypeError exception when invoked as a function
info: |
22.2.3.2 get %TypedArray%.prototype.byteLength
diff --git a/test/built-ins/TypedArray/prototype/byteLength/length.js b/test/built-ins/TypedArray/prototype/byteLength/length.js
index ab0d0cf87..4252cd5d9 100644
--- a/test/built-ins/TypedArray/prototype/byteLength/length.js
+++ b/test/built-ins/TypedArray/prototype/byteLength/length.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.2
+esid: sec-get-%typedarray%.prototype.bytelength
description: >
get %TypedArray%.prototype.byteLength.length is 0.
info: |
@@ -20,6 +20,7 @@ info: |
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
[[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, "byteLength");
diff --git a/test/built-ins/TypedArray/prototype/byteLength/name.js b/test/built-ins/TypedArray/prototype/byteLength/name.js
index 4dfc681d1..a70cc87bb 100644
--- a/test/built-ins/TypedArray/prototype/byteLength/name.js
+++ b/test/built-ins/TypedArray/prototype/byteLength/name.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.2
+esid: sec-get-%typedarray%.prototype.bytelength
description: >
get %TypedArray%.prototype.byteLength.name is "get byteLength".
info: |
@@ -17,6 +17,7 @@ info: |
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, "byteLength");
diff --git a/test/built-ins/TypedArray/prototype/byteLength/prop-desc.js b/test/built-ins/TypedArray/prototype/byteLength/prop-desc.js
index da1aedd28..64a1388b4 100644
--- a/test/built-ins/TypedArray/prototype/byteLength/prop-desc.js
+++ b/test/built-ins/TypedArray/prototype/byteLength/prop-desc.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.2
+esid: sec-get-%typedarray%.prototype.bytelength
description: >
"byteLength" property of TypedArrayPrototype
info: |
@@ -11,6 +11,7 @@ info: |
Section 17: Every accessor property described in clauses 18 through 26 and in
Annex B.2 has the attributes {[[Enumerable]]: false, [[Configurable]]: true }
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
var TypedArrayPrototype = TypedArray.prototype;
diff --git a/test/built-ins/TypedArray/prototype/byteLength/return-bytelength.js b/test/built-ins/TypedArray/prototype/byteLength/return-bytelength.js
index f801c9ac3..51e0556a7 100644
--- a/test/built-ins/TypedArray/prototype/byteLength/return-bytelength.js
+++ b/test/built-ins/TypedArray/prototype/byteLength/return-bytelength.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.2
+esid: sec-get-%typedarray%.prototype.bytelength
description: >
Return value from [[ByteLength]] internal slot
info: |
diff --git a/test/built-ins/TypedArray/prototype/byteLength/this-has-no-typedarrayname-internal.js b/test/built-ins/TypedArray/prototype/byteLength/this-has-no-typedarrayname-internal.js
index f8c050544..0cac912ca 100644
--- a/test/built-ins/TypedArray/prototype/byteLength/this-has-no-typedarrayname-internal.js
+++ b/test/built-ins/TypedArray/prototype/byteLength/this-has-no-typedarrayname-internal.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-get-%typedarray%.prototype.bytelength
-es6id: 22.2.3.2
description: >
Throws a TypeError exception when `this` does not have a [[TypedArrayName]]
internal slot
diff --git a/test/built-ins/TypedArray/prototype/byteLength/this-is-not-object.js b/test/built-ins/TypedArray/prototype/byteLength/this-is-not-object.js
index a59d22646..7144a74c3 100644
--- a/test/built-ins/TypedArray/prototype/byteLength/this-is-not-object.js
+++ b/test/built-ins/TypedArray/prototype/byteLength/this-is-not-object.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.2
+esid: sec-get-%typedarray%.prototype.bytelength
description: Throws a TypeError exception when `this` is not Object
info: |
22.2.3.2 get %TypedArray%.prototype.byteLength
diff --git a/test/built-ins/TypedArray/prototype/byteOffset/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/byteOffset/BigInt/detached-buffer.js
new file mode 100644
index 000000000..74710e488
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/byteOffset/BigInt/detached-buffer.js
@@ -0,0 +1,22 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-%typedarray%.prototype.byteoffset
+description: Returns 0 if the instance has a detached buffer
+info: |
+ 22.2.3.3 get %TypedArray%.prototype.byteOffset
+
+ ...
+ 4. Let buffer be the value of O's [[ViewedArrayBuffer]] internal slot.
+ 5. If IsDetachedBuffer(buffer) is true, return 0.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var buffer = new ArrayBuffer(128);
+ var sample = new TA(buffer, 8, 1);
+ $DETACHBUFFER(sample.buffer);
+ assert.sameValue(sample.byteOffset, 0);
+});
diff --git a/test/built-ins/TypedArray/prototype/byteOffset/BigInt/return-byteoffset.js b/test/built-ins/TypedArray/prototype/byteOffset/BigInt/return-byteoffset.js
new file mode 100644
index 000000000..5799aea59
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/byteOffset/BigInt/return-byteoffset.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-%typedarray%.prototype.byteoffset
+description: >
+ Return value from [[ByteOffset]] internal slot
+info: |
+ 22.2.3.3 get %TypedArray%.prototype.byteOffset
+
+ ...
+ 6. Let offset be the value of O's [[ByteOffset]] internal slot.
+ 7. Return size.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var ta1 = new TA();
+ assert.sameValue(ta1.byteOffset, 0, "Regular typedArray");
+
+ var offset = 4 * TA.BYTES_PER_ELEMENT;
+
+ var buffer1 = new ArrayBuffer(8 * TA.BYTES_PER_ELEMENT);
+ var ta2 = new TA(buffer1, offset);
+ assert.sameValue(ta2.byteOffset, offset, "TA(buffer, offset)");
+
+ var buffer2 = new ArrayBuffer(8 * TA.BYTES_PER_ELEMENT);
+ var sample = new TA(buffer2, offset);
+ var ta3 = new TA(sample);
+ assert.sameValue(ta3.byteOffset, 0, "TA(typedArray)");
+});
diff --git a/test/built-ins/TypedArray/prototype/byteOffset/invoked-as-accessor.js b/test/built-ins/TypedArray/prototype/byteOffset/invoked-as-accessor.js
index ba155d2b5..4daaebdcb 100644
--- a/test/built-ins/TypedArray/prototype/byteOffset/invoked-as-accessor.js
+++ b/test/built-ins/TypedArray/prototype/byteOffset/invoked-as-accessor.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.3
+esid: sec-get-%typedarray%.prototype.byteoffset
description: >
Requires this value to have a [[ViewedArrayBuffer]] internal slot
info: |
diff --git a/test/built-ins/TypedArray/prototype/byteOffset/invoked-as-func.js b/test/built-ins/TypedArray/prototype/byteOffset/invoked-as-func.js
index 426b3143e..78c3607a6 100644
--- a/test/built-ins/TypedArray/prototype/byteOffset/invoked-as-func.js
+++ b/test/built-ins/TypedArray/prototype/byteOffset/invoked-as-func.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.3
+esid: sec-get-%typedarray%.prototype.byteoffset
description: Throws a TypeError exception when invoked as a function
info: |
22.2.3.3 get %TypedArray%.prototype.byteOffset
diff --git a/test/built-ins/TypedArray/prototype/byteOffset/length.js b/test/built-ins/TypedArray/prototype/byteOffset/length.js
index 9710c0018..71c9b31c8 100644
--- a/test/built-ins/TypedArray/prototype/byteOffset/length.js
+++ b/test/built-ins/TypedArray/prototype/byteOffset/length.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.3
+esid: sec-get-%typedarray%.prototype.byteoffset
description: >
get %TypedArray%.prototype.byteOffset.length is 0.
info: |
@@ -20,6 +20,7 @@ info: |
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
[[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, "byteOffset");
diff --git a/test/built-ins/TypedArray/prototype/byteOffset/name.js b/test/built-ins/TypedArray/prototype/byteOffset/name.js
index af0f98c17..5b5a2ecab 100644
--- a/test/built-ins/TypedArray/prototype/byteOffset/name.js
+++ b/test/built-ins/TypedArray/prototype/byteOffset/name.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.3
+esid: sec-get-%typedarray%.prototype.byteoffset
description: >
get %TypedArray%.prototype.byteOffset.name is "get byteOffset".
info: |
@@ -17,6 +17,7 @@ info: |
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, "byteOffset");
diff --git a/test/built-ins/TypedArray/prototype/byteOffset/prop-desc.js b/test/built-ins/TypedArray/prototype/byteOffset/prop-desc.js
index 2c2bd81cb..9960cf289 100644
--- a/test/built-ins/TypedArray/prototype/byteOffset/prop-desc.js
+++ b/test/built-ins/TypedArray/prototype/byteOffset/prop-desc.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.3
+esid: sec-get-%typedarray%.prototype.byteoffset
description: >
"byteOffset" property of TypedArrayPrototype
info: |
@@ -11,6 +11,7 @@ info: |
Section 17: Every accessor property described in clauses 18 through 26 and in
Annex B.2 has the attributes {[[Enumerable]]: false, [[Configurable]]: true }
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
var TypedArrayPrototype = TypedArray.prototype;
diff --git a/test/built-ins/TypedArray/prototype/byteOffset/return-byteoffset.js b/test/built-ins/TypedArray/prototype/byteOffset/return-byteoffset.js
index 1663d4797..44502e06e 100644
--- a/test/built-ins/TypedArray/prototype/byteOffset/return-byteoffset.js
+++ b/test/built-ins/TypedArray/prototype/byteOffset/return-byteoffset.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.3
+esid: sec-get-%typedarray%.prototype.byteoffset
description: >
Return value from [[ByteOffset]] internal slot
info: |
diff --git a/test/built-ins/TypedArray/prototype/byteOffset/this-has-no-typedarrayname-internal.js b/test/built-ins/TypedArray/prototype/byteOffset/this-has-no-typedarrayname-internal.js
index dbd36a027..2e03fc820 100644
--- a/test/built-ins/TypedArray/prototype/byteOffset/this-has-no-typedarrayname-internal.js
+++ b/test/built-ins/TypedArray/prototype/byteOffset/this-has-no-typedarrayname-internal.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-get-%typedarray%.prototype.byteoffset
-es6id: 22.2.3.3
description: >
Throws a TypeError exception when `this` does not have a [[TypedArrayName]]
internal slot
diff --git a/test/built-ins/TypedArray/prototype/byteOffset/this-is-not-object.js b/test/built-ins/TypedArray/prototype/byteOffset/this-is-not-object.js
index 4ea526ac9..e8aba85f7 100644
--- a/test/built-ins/TypedArray/prototype/byteOffset/this-is-not-object.js
+++ b/test/built-ins/TypedArray/prototype/byteOffset/this-is-not-object.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.3
+esid: sec-get-%typedarray%.prototype.byteoffset
description: Throws a TypeError exception when `this` is not Object
info: |
22.2.3.3 get %TypedArray%.prototype.byteOffset
diff --git a/test/built-ins/TypedArray/prototype/constructor.js b/test/built-ins/TypedArray/prototype/constructor.js
index 453eaf3f4..bcd7f6c67 100644
--- a/test/built-ins/TypedArray/prototype/constructor.js
+++ b/test/built-ins/TypedArray/prototype/constructor.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.4
+esid: sec-%typedarray%.prototype.constructor
description: >
Initial state of the constructor property
info: |
@@ -11,6 +11,7 @@ info: |
Per ES6 section 17, the method should exist on the %TypedArray% prototype, and it
should be writable and configurable, but not enumerable.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.constructor, TypedArray);
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-end.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-end.js
new file mode 100644
index 000000000..6060fab6e
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-end.js
@@ -0,0 +1,77 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ end argument is coerced to an integer values.
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+
+ 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] )
+
+ ...
+ 7. If end is undefined, let relativeEnd be len; else let relativeEnd be ?
+ ToInteger(end).
+ ...
+includes: [compareArray.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, null),
+ [0n, 1n, 2n, 3n]
+ ),
+ 'null value coerced to 0'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, NaN),
+ [0n, 1n, 2n, 3n]
+ ),
+ 'NaN value coerced to 0'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, false),
+ [0n, 1n, 2n, 3n]
+ ),
+ 'false value coerced to 0'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, true),
+ [0n, 0n, 2n, 3n]
+ ),
+ 'true value coerced to 1'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, '-2'),
+ [0n, 0n, 1n, 3n]
+ ),
+ 'string "-2" value coerced to integer -2'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, -2.5),
+ [0n, 0n, 1n, 3n]
+ ),
+ 'float -2.5 value coerced to integer -2'
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-start.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-start.js
new file mode 100644
index 000000000..6cd12a381
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-start.js
@@ -0,0 +1,92 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ start argument is coerced to an integer value.
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+
+ 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] )
+
+ ...
+ 5. Let relativeStart be ? ToInteger(start).
+ ...
+includes: [compareArray.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(1, undefined),
+ [0n, 0n, 1n, 2n]
+ ),
+ 'undefined value coerced to 0'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(1, false),
+ [0n, 0n, 1n, 2n]
+ ),
+ 'false value coerced to 0'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(1, NaN),
+ [0n, 0n, 1n, 2n]
+ ),
+ 'NaN value coerced to 0'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(1, null),
+ [0n, 0n, 1n, 2n]
+ ),
+ 'null value coerced to 0'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(0, true),
+ [1n, 2n, 3n, 3n]
+ ),
+ 'true value coerced to 1'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(0, '1'),
+ [1n, 2n, 3n, 3n]
+ ),
+ 'string "1" value coerced to 1'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0.5),
+ [0n, 0n, 1n, 2n]
+ ),
+ '0.5 float value coerced to integer 0'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(0, 1.5),
+ [1n, 2n, 3n, 3n]
+ ),
+ '1.5 float value coerced to integer 1'
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-target.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-target.js
new file mode 100644
index 000000000..92d409a46
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-target.js
@@ -0,0 +1,92 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ target argument is coerced to an integer value.
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+
+ 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] )
+
+ ...
+ 3. Let relativeTarget be ? ToInteger(target).
+ ...
+includes: [compareArray.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(undefined, 1),
+ [1n, 2n, 3n, 3n]
+ ),
+ 'undefined value coerced to 0'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(false, 1),
+ [1n, 2n, 3n, 3n]
+ ),
+ 'false value coerced to 0'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(NaN, 1),
+ [1n, 2n, 3n, 3n]
+ ),
+ 'NaN value coerced to 0'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(null, 1),
+ [1n, 2n, 3n, 3n]
+ ),
+ 'null value coerced to 0'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(true, 0),
+ [0n, 0n, 1n, 2n]
+ ),
+ 'true value coerced to 1'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin('1', 0),
+ [0n, 0n, 1n, 2n]
+ ),
+ 'string "1" value coerced to 1'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(0.5, 1),
+ [1n, 2n, 3n, 3n]
+ ),
+ '0.5 float value coerced to integer 0'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(1.5, 0),
+ [0n, 0n, 1n, 2n]
+ ),
+ '1.5 float value coerced to integer 1'
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/detached-buffer.js
new file mode 100644
index 000000000..0014ea674
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/detached-buffer.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: Throws a TypeError if this has a detached buffer
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [, end ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ ...
+ 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+var obj = {
+ valueOf: function() {
+ throw new Test262Error();
+ }
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+ $DETACHBUFFER(sample.buffer);
+ assert.throws(TypeError, function() {
+ sample.copyWithin(obj, obj);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/get-length-ignores-length-prop.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/get-length-ignores-length-prop.js
new file mode 100644
index 000000000..0de142b60
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/get-length-ignores-length-prop.js
@@ -0,0 +1,49 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ Unreachable abrupt from Get(O, "length") as [[ArrayLength]] is returned.
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+
+ 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] )
+
+ 1. Let O be ? ToObject(this value).
+ 2. Let len be ? ToLength(? Get(O, "length")).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+Object.defineProperty(TypedArray.prototype, "length", {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ Object.defineProperty(TA.prototype, "length", {
+ get: function() {
+ throw new Test262Error();
+ }
+ });
+
+ var sample = new TA();
+ Object.defineProperty(sample, "length", {
+ get: function() {
+ throw new Test262Error();
+ }
+ });
+
+ assert.sameValue(sample.copyWithin(0, 0), sample);
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/invoked-as-func.js
new file mode 100644
index 000000000..7559361e1
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/invoked-as-func.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: Throws a TypeError exception when invoked as a function
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [, end ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var copyWithin = TypedArray.prototype.copyWithin;
+
+assert.sameValue(typeof copyWithin, 'function');
+
+assert.throws(TypeError, function() {
+ copyWithin();
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/invoked-as-method.js
new file mode 100644
index 000000000..5a40d48c9
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/invoked-as-method.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: Requires a [[TypedArrayName]] internal slot.
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [, end ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+assert.sameValue(typeof TypedArrayPrototype.copyWithin, 'function');
+
+assert.throws(TypeError, function() {
+ TypedArrayPrototype.copyWithin();
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/length.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/length.js
new file mode 100644
index 000000000..7c635e69c
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/length.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ %TypedArray%.prototype.copyWithin.length is 2.
+info: |
+ %TypedArray%.prototype.copyWithin (target, start [, end ] )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, has a length
+ property whose value is an integer. Unless otherwise specified, this
+ value is equal to the largest number of named arguments shown in the
+ subclause headings for the function description, including optional
+ parameters. However, rest parameters shown using the form “...name”
+ are not included in the default argument count.
+
+ Unless otherwise specified, the length property of a built-in Function
+ object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.copyWithin.length, 2);
+
+verifyNotEnumerable(TypedArray.prototype.copyWithin, "length");
+verifyNotWritable(TypedArray.prototype.copyWithin, "length");
+verifyConfigurable(TypedArray.prototype.copyWithin, "length");
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/name.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/name.js
new file mode 100644
index 000000000..902c628c4
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/name.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ %TypedArray%.prototype.copyWithin.name is "copyWithin".
+info: |
+ %TypedArray%.prototype.copyWithin (target, start [, end ] )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, that is not
+ identified as an anonymous function has a name property whose value
+ is a String.
+
+ Unless otherwise specified, the name property of a built-in Function
+ object, if it exists, has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.copyWithin.name, "copyWithin");
+
+verifyNotEnumerable(TypedArray.prototype.copyWithin, "name");
+verifyNotWritable(TypedArray.prototype.copyWithin, "name");
+verifyConfigurable(TypedArray.prototype.copyWithin, "name");
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-end.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-end.js
new file mode 100644
index 000000000..78a8c9c9a
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-end.js
@@ -0,0 +1,95 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ Set values with negative end argument.
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+
+ 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] )
+
+ ...
+ 7. If end is undefined, let relativeEnd be len; else let relativeEnd be ?
+ ToInteger(end).
+ 8. If relativeEnd < 0, let final be max((len + relativeEnd), 0); else let
+ final be min(relativeEnd, len).
+ ...
+includes: [compareArray.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(0, 1, -1),
+ [1n, 2n, 2n, 3n]
+ ),
+ '[0, 1, 2, 3].copyWithin(0, 1, -1) -> [1, 2, 2, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(2, 0, -1),
+ [0n, 1n, 0n, 1n, 2n]
+ ),
+ '[0, 1, 2, 3, 4].copyWithin(2, 0, -1) -> [0, 1, 0, 1, 2]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(1, 2, -2),
+ [0n, 2n, 2n, 3n, 4n]
+ ),
+ '[0, 1, 2, 3, 4].copyWithin(1, 2, -2) -> [0, 2, 2, 3, 4]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(0, -2, -1),
+ [2n, 1n, 2n, 3n]
+ ),
+ '[0, 1, 2, 3].copyWithin(0, -2, -1) -> [2, 1, 2, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(2, -2, -1),
+ [0n, 1n, 3n, 3n, 4n]
+ ),
+ '[0, 1, 2, 3, 4].copyWithin(2, -2, 1) -> [0, 1, 3, 3, 4]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(-3, -2, -1),
+ [0n, 2n, 2n, 3n]
+ ),
+ '[0, 1, 2, 3].copyWithin(-3, -2, -1) -> [0, 2, 2, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(-2, -3, -1),
+ [0n, 1n, 2n, 2n, 3n]
+ ),
+ '[0, 1, 2, 3, 4].copyWithin(-2, -3, -1) -> [0, 1, 2, 2, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(-5, -2, -1),
+ [3n, 1n, 2n, 3n, 4n]
+ ),
+ '[0, 1, 2, 3, 4].copyWithin(-5, -2, -1) -> [3, 1, 2, 3, 4]'
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-end.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-end.js
new file mode 100644
index 000000000..ae1309824
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-end.js
@@ -0,0 +1,111 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ Set values with negative out of bounds end argument.
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+
+ 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] )
+
+ ...
+ 7. If end is undefined, let relativeEnd be len; else let relativeEnd be ?
+ ToInteger(end).
+ 8. If relativeEnd < 0, let final be max((len + relativeEnd), 0); else let
+ final be min(relativeEnd, len).
+ ...
+includes: [compareArray.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(0, 1, -10),
+ [0n, 1n, 2n, 3n]
+ ),
+ '[0, 1, 2, 3].copyWithin(0, 1, -10) -> [0, 1, 2, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(0, 1, -Infinity),
+ [1n, 2n, 3n, 4n, 5n]
+ ),
+ '[1, 2, 3, 4, 5].copyWithin(0, 1, -Infinity) -> [1, 2, 3, 4, 5]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(0, -2, -10),
+ [0n, 1n, 2n, 3n]
+ ),
+ '[0, 1, 2, 3].copyWithin(0, -2, -10) -> [0, 1, 2, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(0, -2, -Infinity),
+ [1n, 2n, 3n, 4n, 5n]
+ ),
+ '[1, 2, 3, 4, 5].copyWithin(0, -2, -Infinity) -> [1, 2, 3, 4, 5]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(0, -9, -10),
+ [0n, 1n, 2n, 3n]
+ ),
+ '[0, 1, 2, 3].copyWithin(0, -9, -10) -> [0, 1, 2, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(0, -9, -Infinity),
+ [1n, 2n, 3n, 4n, 5n]
+ ),
+ '[1, 2, 3, 4, 5].copyWithin(0, -9, -Infinity) -> [1, 2, 3, 4, 5]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(-3, -2, -10),
+ [0n, 1n, 2n, 3n]
+ ),
+ '[0, 1, 2, 3].copyWithin(-3, -2, -10) -> [0, 1, 2, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(-3, -2, -Infinity),
+ [1n, 2n, 3n, 4n, 5n]
+ ),
+ '[1, 2, 3, 4, 5].copyWithin(-3, -2, -Infinity) -> [1, 2, 3, 4, 5]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(-7, -8, -9),
+ [0n, 1n, 2n, 3n]
+ ),
+ '[0, 1, 2, 3].copyWithin(-7, -8, -9) -> [0, 1, 2, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(-7, -8, -Infinity),
+ [1n, 2n, 3n, 4n, 5n]
+ ),
+ '[1, 2, 3, 4, 5].copyWithin(-7, -8, -Infinity) -> [1, 2, 3, 4, 5]'
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-start.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-start.js
new file mode 100644
index 000000000..06ec98f34
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-start.js
@@ -0,0 +1,93 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ Set values with out of bounds negative start argument.
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+
+ 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] )
+
+ ...
+ 6. If relativeStart < 0, let from be max((len + relativeStart), 0); else let
+ from be min(relativeStart, len).
+ ...
+includes: [compareArray.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(0, -10),
+ [0n, 1n, 2n, 3n]
+ ),
+ '[0, 1, 2, 3]).copyWithin(0, -10) -> [0, 1, 2, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(0, -Infinity),
+ [1n, 2n, 3n, 4n, 5n]
+ ),
+ '[1, 2, 3, 4, 5]).copyWithin(0, -Infinity) -> [1, 2, 3, 4, 5]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(2, -10),
+ [0n, 1n, 0n, 1n, 2n]
+ ),
+ '[0, 1, 2, 3, 4]).copyWithin(2, -2) -> [0, 1, 0, 1, 2]'
+ );
+
+ assert(
+ compareArray(
+ new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(2, -Infinity),
+ [1n, 2n, 1n, 2n, 3n]
+ ),
+ '[1, 2, 3, 4, 5]).copyWithin(2, -Infinity) -> [1, 2, 1, 2, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(10, -10),
+ [0n, 1n, 2n, 3n, 4n]
+ ),
+ '[0, 1, 2, 3, 4]).copyWithin(10, -10) -> [0, 1, 2, 3, 4]'
+ );
+
+ assert(
+ compareArray(
+ new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(10, -Infinity),
+ [1n, 2n, 3n, 4n, 5n]
+ ),
+ '[1, 2, 3, 4, 5]).copyWithin(10, -Infinity) -> [1, 2, 3, 4, 5]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(-9, -10),
+ [0n, 1n, 2n, 3n]
+ ),
+ '[0, 1, 2, 3].copyWithin(-9, -10) -> [0, 1, 2, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(-9, -Infinity),
+ [1n, 2n, 3n, 4n, 5n]
+ ),
+ '[1, 2, 3, 4, 5].copyWithin(-9, -Infinity) -> [1, 2, 3, 4, 5]'
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-target.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-target.js
new file mode 100644
index 000000000..91e2b0e5b
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-target.js
@@ -0,0 +1,61 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ Set values with out of bounds negative target argument.
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+
+ 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] )
+
+ ...
+ 4. If relativeTarget < 0, let to be max((len + relativeTarget), 0); else let
+ to be min(relativeTarget, len).
+ ...
+includes: [compareArray.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(-10, 0),
+ [0n, 1n, 2n, 3n]
+ ),
+ '[0, 1, 2, 3].copyWithin(-10, 0) -> [0, 1, 2, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(-Infinity, 0),
+ [1n, 2n, 3n, 4n, 5n]
+ ),
+ '[1, 2, 3, 4, 5].copyWithin(-Infinity, 0) -> [1, 2, 3, 4, 5]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(-10, 2),
+ [2n, 3n, 4n, 3n, 4n]
+ ),
+ '[0, 1, 2, 3, 4].copyWithin(-10, 2) -> [2, 3, 4, 3, 4]'
+ );
+
+ assert(
+ compareArray(
+ new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(-Infinity, 2),
+ [3n, 4n, 5n, 4n, 5n]
+ ),
+ '[1, 2, 3, 4, 5].copyWithin(-Infinity, 2) -> [3, 4, 5, 4, 5]'
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-start.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-start.js
new file mode 100644
index 000000000..36d5f2226
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-start.js
@@ -0,0 +1,77 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ Set values with negative start argument.
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+
+ 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] )
+
+ ...
+ 6. If relativeStart < 0, let from be max((len + relativeStart), 0); else let
+ from be min(relativeStart, len).
+ ...
+includes: [compareArray.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(0, -1),
+ [3n, 1n, 2n, 3n]
+ ),
+ '[0, 1, 2, 3].copyWithin(0, -1) -> [3, 1, 2, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(2, -2),
+ [0n, 1n, 3n, 4n, 4n]
+ ),
+ '[0, 1, 2, 3, 4].copyWithin(2, -2) -> [0, 1, 3, 4, 4]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(1, -2),
+ [0n, 3n, 4n, 3n, 4n]
+ ),
+ '[0, 1, 2, 3, 4].copyWithin(1, -2) -> [0, 3, 4, 3, 4]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(-1, -2),
+ [0n, 1n, 2n, 2n]
+ ),
+ '[0, 1, 2, 3].copyWithin(-1, -2) -> [ 0, 1, 2, 2 ]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(-2, -3),
+ [0n, 1n, 2n, 2n, 3n]
+ ),
+ '[0, 1, 2, 3, 4].copyWithin(-2, -3) -> [0, 1, 2, 2, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(-5, -2),
+ [3n, 4n, 2n, 3n, 4n]
+ ),
+ '[0, 1, 2, 3, 4].copyWithin(-5, -2) -> [3, 4, 2, 3, 4]'
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-target.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-target.js
new file mode 100644
index 000000000..ec6adaedb
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-target.js
@@ -0,0 +1,53 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ Set values with negative target argument.
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+
+ 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] )
+
+ ...
+ 4. If relativeTarget < 0, let to be max((len + relativeTarget), 0); else let
+ to be min(relativeTarget, len).
+ ...
+includes: [compareArray.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(-1, 0),
+ [0n, 1n, 2n, 0n]
+ ),
+ '[0, 1, 2, 3].copyWithin(-1, 0) -> [0, 1, 2, 0]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(-2, 2),
+ [0n, 1n, 2n, 2n, 3n]
+ ),
+ '[0, 1, 2, 3, 4].copyWithin(-2, 2) -> [0, 1, 2, 2, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(-1, 2),
+ [0n, 1n, 2n, 2n]
+ ),
+ '[0, 1, 2, 3].copyWithin(-1, 2) -> [0, 1, 2, 2]'
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-end.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-end.js
new file mode 100644
index 000000000..16d68d51b
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-end.js
@@ -0,0 +1,54 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ Max value of end position is the this.length.
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+includes: [compareArray.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(0, 1, 6),
+ [1n, 2n, 3n, 3n]
+ ),
+ '[0, 1, 2, 3].copyWithin(0, 1, 6) -> [1, 2, 3, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(0, 1, Infinity),
+ [2n, 3n, 4n, 5n, 5n]
+ ),
+ '[1, 2, 3, 4, 5].copyWithin(0, 1, Infinity) -> [2, 3, 4, 5, 5]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(1, 3, 6),
+ [0n, 3n, 4n, 5n, 4n, 5n]
+ ),
+ '[0, 1, 2, 3, 4, 5].copyWithin(1, 3, 6) -> [0, 3, 4, 5, 4, 5]'
+ );
+
+ assert(
+ compareArray(
+ new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(1, 3, Infinity),
+ [1n, 4n, 5n, 4n, 5n]
+ ),
+ '[1, 2, 3, 4, 5].copyWithin(1, 3, Infinity) -> [1, 4, 5, 4, 5]'
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-target-and-start.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-target-and-start.js
new file mode 100644
index 000000000..fcb603491
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-target-and-start.js
@@ -0,0 +1,74 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ Max values of target and start positions are this.length.
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+includes: [compareArray.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(6, 0),
+ [0n, 1n, 2n, 3n, 4n, 5n]
+ )
+ );
+
+ assert(
+ compareArray(
+ new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(Infinity, 0),
+ [1n, 2n, 3n, 4n, 5n]
+ ),
+ '[1, 2, 3, 4, 5].copyWithin(Infinity, 0) -> [1, 2, 3, 4, 5]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(0, 6),
+ [0n, 1n, 2n, 3n, 4n, 5n]
+ )
+ );
+
+ assert(
+ compareArray(
+ new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(0, Infinity),
+ [1n, 2n, 3n, 4n, 5n]
+ ),
+ '[1, 2, 3, 4, 5].copyWithin(0, Infinity) -> [1, 2, 3, 4, 5]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(6, 6),
+ [0n, 1n, 2n, 3n, 4n, 5n]
+ )
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(10, 10),
+ [0n, 1n, 2n, 3n, 4n, 5n]
+ )
+ );
+
+ assert(
+ compareArray(
+ new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(Infinity, Infinity),
+ [1n, 2n, 3n, 4n, 5n]
+ ),
+ '[1, 2, 3, 4, 5].copyWithin(Infinity, Infinity) -> [1, 2, 3, 4, 5]'
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-and-start.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-and-start.js
new file mode 100644
index 000000000..27385c45e
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-and-start.js
@@ -0,0 +1,50 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ Copy values with non-negative target and start positions.
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+includes: [compareArray.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert(
+ compareArray(
+ new TA([1n, 2n, 3n, 4n, 5n, 6n]).copyWithin(0, 0),
+ [1n, 2n, 3n, 4n, 5n, 6n]
+ )
+ );
+
+ assert(
+ compareArray(
+ new TA([1n, 2n, 3n, 4n, 5n, 6n]).copyWithin(0, 2),
+ [3n, 4n, 5n, 6n, 5n, 6n]
+ )
+ );
+
+ assert(
+ compareArray(
+ new TA([1n, 2n, 3n, 4n, 5n, 6n]).copyWithin(3, 0),
+ [1n, 2n, 3n, 1n, 2n, 3n]
+ )
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(1, 4),
+ [0n, 4n, 5n, 3n, 4n, 5n]
+ )
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-start-and-end.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-start-and-end.js
new file mode 100644
index 000000000..befa6e752
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-start-and-end.js
@@ -0,0 +1,73 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ Copy values with non-negative target, start and end positions.
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+includes: [compareArray.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(0, 0, 0),
+ [0n, 1n, 2n, 3n]
+ ),
+ '[0, 1, 2, 3].copyWithin(0, 0, 0) -> [0, 1, 2, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(0, 0, 2),
+ [0n, 1n, 2n, 3n]
+ ),
+ '[0, 1, 2, 3].copyWithin(0, 0, 2) -> [0, 1, 2, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(0, 1, 2),
+ [1n, 1n, 2n, 3n]
+ ),
+ '[0, 1, 2, 3].copyWithin(0, 1, 2) -> [1, 1, 2, 3]'
+ );
+
+ /*
+ * 10. If from<to and to<from+count, then
+ * a. Let direction be - 1.
+ * b. Let from be from + count - 1.
+ * c. Let to be to + count - 1.
+ *
+ * 0 < 1, 1 < 0 + 2
+ * direction = -1
+ * from = 0 + 2 - 1
+ * to = 1 + 2 - 1
+ */
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, 2),
+ [0n, 0n, 1n, 3n]
+ ),
+ '[0, 1, 2, 3].copyWithin(1, 0, 2) -> [0, 0, 1, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(1, 3, 5),
+ [0n, 3n, 4n, 3n, 4n, 5n]
+ ),
+ '[0, 1, 2, 3, 4, 5].copyWithin(1, 3, 5) -> [0, 3, 4, 3, 4, 5]'
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/prop-desc.js
new file mode 100644
index 000000000..d75e27ac0
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/prop-desc.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ "copyWithin" property of TypedArrayPrototype
+info: |
+ ES6 section 17: Every other data property described in clauses 18 through 26
+ and in Annex B.2 has the attributes { [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+verifyNotEnumerable(TypedArrayPrototype, 'copyWithin');
+verifyWritable(TypedArrayPrototype, 'copyWithin');
+verifyConfigurable(TypedArrayPrototype, 'copyWithin');
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-end-is-symbol.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-end-is-symbol.js
new file mode 100644
index 000000000..cb06fdfda
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-end-is-symbol.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ Return abrupt if end is a Symbol.
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+
+ 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] )
+
+ ...
+ 7. If end is undefined, let relativeEnd be len; else let relativeEnd be ?
+ ToInteger(end).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var s = Symbol(1);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA();
+ assert.throws(TypeError, function() {
+ sample.copyWithin(0, 0, s);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-end.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-end.js
new file mode 100644
index 000000000..6e7a39fb4
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-end.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ Return abrupt from ToInteger(end).
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+
+ 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] )
+
+ ...
+ 7. If end is undefined, let relativeEnd be len; else let relativeEnd be ?
+ ToInteger(end).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var o1 = {
+ valueOf: function() {
+ throw new Test262Error();
+ }
+ };
+ var sample = new TA();
+ assert.throws(Test262Error, function() {
+ sample.copyWithin(0, 0, o1);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-start-is-symbol.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-start-is-symbol.js
new file mode 100644
index 000000000..d0b8b75f1
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-start-is-symbol.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ Return abrupt if start is a Symbol.
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+
+ 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] )
+
+ ...
+ 5. Let relativeStart be ? ToInteger(start).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var s = Symbol(1);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA();
+ assert.throws(TypeError, function() {
+ sample.copyWithin(0, s);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-start.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-start.js
new file mode 100644
index 000000000..a8bb5d5b5
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-start.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ Return abrupt from ToInteger(start).
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+
+ 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] )
+
+ ...
+ 5. Let relativeStart be ? ToInteger(start).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var o = {
+ valueOf: function() {
+ throw new Test262Error();
+ }
+};
+
+var err = {
+ valueOf: function() {
+ throw new Error("ToInteger(start) runs before ToInteger(end)");
+ }
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA();
+ assert.throws(Test262Error, function() {
+ sample.copyWithin(0, o, err);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-target-is-symbol.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-target-is-symbol.js
new file mode 100644
index 000000000..305e9234e
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-target-is-symbol.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ Return abrupt if target is a Symbol.
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+
+ 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] )
+
+ ...
+ 3. Let relativeTarget be ? ToInteger(target).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var s = Symbol(1);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA();
+ assert.throws(TypeError, function() {
+ sample.copyWithin(s, 0);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-target.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-target.js
new file mode 100644
index 000000000..76d035b0a
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-target.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ Return abrupt from ToInteger(target).
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+
+ 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] )
+
+ ...
+ 3. Let relativeTarget be ? ToInteger(target).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var o = {
+ valueOf: function() {
+ throw new Test262Error();
+ }
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA();
+ assert.throws(Test262Error, function() {
+ sample.copyWithin(o);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-this.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-this.js
new file mode 100644
index 000000000..2e5c40fa4
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-this.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ Returns `this`.
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+
+ 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] )
+
+ 13. Return O.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample1 = new TA();
+ var result1 = sample1.copyWithin(0, 0);
+
+ assert.sameValue(result1, sample1);
+
+ var sample2 = new TA([1n, 2n, 3n]);
+ var result2 = sample2.copyWithin(1, 0);
+
+ assert.sameValue(result2, sample2);
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/this-is-not-object.js
new file mode 100644
index 000000000..3c1b7c435
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/this-is-not-object.js
@@ -0,0 +1,50 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: Throws a TypeError exception when `this` is not Object
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var copyWithin = TypedArray.prototype.copyWithin;
+
+assert.throws(TypeError, function() {
+ copyWithin.call(undefined, 0, 0);
+}, "this is undefined");
+
+assert.throws(TypeError, function() {
+ copyWithin.call(null, 0, 0);
+}, "this is null");
+
+assert.throws(TypeError, function() {
+ copyWithin.call(42, 0, 0);
+}, "this is 42");
+
+assert.throws(TypeError, function() {
+ copyWithin.call("1", 0, 0);
+}, "this is a string");
+
+assert.throws(TypeError, function() {
+ copyWithin.call(true, 0, 0);
+}, "this is true");
+
+assert.throws(TypeError, function() {
+ copyWithin.call(false, 0, 0);
+}, "this is false");
+
+var s = Symbol("s");
+assert.throws(TypeError, function() {
+ copyWithin.call(s, 0, 0);
+}, "this is a Symbol");
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/this-is-not-typedarray-instance.js
new file mode 100644
index 000000000..95d9bfd12
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/this-is-not-typedarray-instance.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ Throws a TypeError exception when `this` is not a TypedArray instance
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var copyWithin = TypedArray.prototype.copyWithin;
+
+assert.throws(TypeError, function() {
+ copyWithin.call({}, 0, 0);
+}, "this is an Object");
+
+assert.throws(TypeError, function() {
+ copyWithin.call([], 0, 0);
+}, "this is an Array");
+
+var ab = new ArrayBuffer(8);
+assert.throws(TypeError, function() {
+ copyWithin.call(ab, 0, 0);
+}, "this is an ArrayBuffer instance");
+
+var dv = new DataView(new ArrayBuffer(8), 0, 1);
+assert.throws(TypeError, function() {
+ copyWithin.call(dv, 0, 0);
+}, "this is a DataView instance");
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/undefined-end.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/undefined-end.js
new file mode 100644
index 000000000..360d3125f
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/undefined-end.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ If `end` is undefined, set final position to `this.length`.
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+
+ 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] )
+
+ ...
+ 7. If end is undefined, let relativeEnd be len; else let relativeEnd be ?
+ ToInteger(end).
+ ...
+includes: [compareArray.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(0, 1, undefined),
+ [1n, 2n, 3n, 3n]
+ ),
+ '[0, 1, 2, 3].copyWithin(0, 1, undefined) -> [1, 2, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(0, 1),
+ [1n, 2n, 3n, 3n]
+ ),
+ '[0, 1, 2, 3].copyWithin(0, 1) -> [1, 2, 3, 3]'
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/bit-precision.js b/test/built-ins/TypedArray/prototype/copyWithin/bit-precision.js
index f2725a242..215f01f4a 100644
--- a/test/built-ins/TypedArray/prototype/copyWithin/bit-precision.js
+++ b/test/built-ins/TypedArray/prototype/copyWithin/bit-precision.js
@@ -3,7 +3,6 @@
/*---
esid: sec-%typedarray%.prototype.copywithin
-es6id: 22.2.3.5
description: Preservation of bit-level encoding
info: |
Array.prototype.copyWithin (target, start [ , end ] )
@@ -14,6 +13,7 @@ info: |
i. Let fromVal be ? Get(O, fromKey).
ii. Perform ? Set(O, toKey, fromVal, true).
includes: [nans.js, compareArray.js, testTypedArray.js]
+features: [TypedArray]
---*/
function body(FloatArray) {
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-end.js b/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-end.js
index 1cd62be56..225f52cea 100644
--- a/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-end.js
+++ b/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-end.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.copywithin
-es6id: 22.2.3.5
description: >
end argument is coerced to an integer values.
info: |
@@ -24,6 +23,7 @@ info: |
ToInteger(end).
...
includes: [compareArray.js, testTypedArray.js]
+features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-start.js b/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-start.js
index 96819e395..45aa223aa 100644
--- a/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-start.js
+++ b/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-start.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.copywithin
-es6id: 22.2.3.5
description: >
start argument is coerced to an integer value.
info: |
@@ -23,6 +22,7 @@ info: |
5. Let relativeStart be ? ToInteger(start).
...
includes: [compareArray.js, testTypedArray.js]
+features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-target.js b/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-target.js
index 8d0c2816d..1f20f4ecf 100644
--- a/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-target.js
+++ b/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-target.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.copywithin
-es6id: 22.2.3.5
description: >
target argument is coerced to an integer value.
info: |
@@ -23,6 +22,7 @@ info: |
3. Let relativeTarget be ? ToInteger(target).
...
includes: [compareArray.js, testTypedArray.js]
+features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/get-length-ignores-length-prop.js b/test/built-ins/TypedArray/prototype/copyWithin/get-length-ignores-length-prop.js
index f5d89ea2a..852ccfbd9 100644
--- a/test/built-ins/TypedArray/prototype/copyWithin/get-length-ignores-length-prop.js
+++ b/test/built-ins/TypedArray/prototype/copyWithin/get-length-ignores-length-prop.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.copywithin
-es6id: 22.2.3.5
description: >
Unreachable abrupt from Get(O, "length") as [[ArrayLength]] is returned.
info: |
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/invoked-as-func.js b/test/built-ins/TypedArray/prototype/copyWithin/invoked-as-func.js
index f191a5a7c..92611443e 100644
--- a/test/built-ins/TypedArray/prototype/copyWithin/invoked-as-func.js
+++ b/test/built-ins/TypedArray/prototype/copyWithin/invoked-as-func.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.5
+esid: sec-%typedarray%.prototype.copywithin
description: Throws a TypeError exception when invoked as a function
info: |
22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [, end ] )
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/invoked-as-method.js b/test/built-ins/TypedArray/prototype/copyWithin/invoked-as-method.js
index cfbb192c5..07271dbbe 100644
--- a/test/built-ins/TypedArray/prototype/copyWithin/invoked-as-method.js
+++ b/test/built-ins/TypedArray/prototype/copyWithin/invoked-as-method.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.5
+esid: sec-%typedarray%.prototype.copywithin
description: Requires a [[TypedArrayName]] internal slot.
info: |
22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [, end ] )
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/length.js b/test/built-ins/TypedArray/prototype/copyWithin/length.js
index c6fb4ac91..63c37c4ff 100644
--- a/test/built-ins/TypedArray/prototype/copyWithin/length.js
+++ b/test/built-ins/TypedArray/prototype/copyWithin/length.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.5
+esid: sec-%typedarray%.prototype.copywithin
description: >
%TypedArray%.prototype.copyWithin.length is 2.
info: |
@@ -20,6 +20,7 @@ info: |
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
[[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.copyWithin.length, 2);
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/name.js b/test/built-ins/TypedArray/prototype/copyWithin/name.js
index 313a71035..068057df3 100644
--- a/test/built-ins/TypedArray/prototype/copyWithin/name.js
+++ b/test/built-ins/TypedArray/prototype/copyWithin/name.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.5
+esid: sec-%typedarray%.prototype.copywithin
description: >
%TypedArray%.prototype.copyWithin.name is "copyWithin".
info: |
@@ -17,6 +17,7 @@ info: |
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.copyWithin.name, "copyWithin");
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/negative-end.js b/test/built-ins/TypedArray/prototype/copyWithin/negative-end.js
index 96c9823f8..cc97dacf1 100644
--- a/test/built-ins/TypedArray/prototype/copyWithin/negative-end.js
+++ b/test/built-ins/TypedArray/prototype/copyWithin/negative-end.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.copywithin
-es6id: 22.2.3.5
description: >
Set values with negative end argument.
info: |
@@ -26,6 +25,7 @@ info: |
final be min(relativeEnd, len).
...
includes: [compareArray.js, testTypedArray.js]
+features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-end.js b/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-end.js
index 7c55118aa..6f77a75cd 100644
--- a/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-end.js
+++ b/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-end.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.copywithin
-es6id: 22.2.3.5
description: >
Set values with negative out of bounds end argument.
info: |
@@ -26,6 +25,7 @@ info: |
final be min(relativeEnd, len).
...
includes: [compareArray.js, testTypedArray.js]
+features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-start.js b/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-start.js
index 4fdc4eb12..456f3ed44 100644
--- a/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-start.js
+++ b/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-start.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.copywithin
-es6id: 22.2.3.5
description: >
Set values with out of bounds negative start argument.
info: |
@@ -24,6 +23,7 @@ info: |
from be min(relativeStart, len).
...
includes: [compareArray.js, testTypedArray.js]
+features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-target.js b/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-target.js
index dc46906d3..2ec06c368 100644
--- a/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-target.js
+++ b/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-target.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.copywithin
-es6id: 22.2.3.5
description: >
Set values with out of bounds negative target argument.
info: |
@@ -24,6 +23,7 @@ info: |
to be min(relativeTarget, len).
...
includes: [compareArray.js, testTypedArray.js]
+features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/negative-start.js b/test/built-ins/TypedArray/prototype/copyWithin/negative-start.js
index df73879d4..4035db6c2 100644
--- a/test/built-ins/TypedArray/prototype/copyWithin/negative-start.js
+++ b/test/built-ins/TypedArray/prototype/copyWithin/negative-start.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.copywithin
-es6id: 22.2.3.5
description: >
Set values with negative start argument.
info: |
@@ -24,6 +23,7 @@ info: |
from be min(relativeStart, len).
...
includes: [compareArray.js, testTypedArray.js]
+features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/negative-target.js b/test/built-ins/TypedArray/prototype/copyWithin/negative-target.js
index dfc252b1e..f6cde1f61 100644
--- a/test/built-ins/TypedArray/prototype/copyWithin/negative-target.js
+++ b/test/built-ins/TypedArray/prototype/copyWithin/negative-target.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.copywithin
-es6id: 22.2.3.5
description: >
Set values with negative target argument.
info: |
@@ -24,6 +23,7 @@ info: |
to be min(relativeTarget, len).
...
includes: [compareArray.js, testTypedArray.js]
+features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-end.js b/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-end.js
index 9767106c0..f37b8a02b 100644
--- a/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-end.js
+++ b/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-end.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.copywithin
-es6id: 22.2.3.5
description: >
Max value of end position is the this.length.
info: |
@@ -17,6 +16,7 @@ info: |
...
includes: [compareArray.js, testTypedArray.js]
+features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-target-and-start.js b/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-target-and-start.js
index f1cc0504a..3862d7b7d 100644
--- a/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-target-and-start.js
+++ b/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-target-and-start.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.copywithin
-es6id: 22.2.3.5
description: >
Max values of target and start positions are this.length.
info: |
@@ -17,6 +16,7 @@ info: |
...
includes: [compareArray.js, testTypedArray.js]
+features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-and-start.js b/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-and-start.js
index 4dec6eff8..0cfd34c5e 100644
--- a/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-and-start.js
+++ b/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-and-start.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.copywithin
-es6id: 22.2.3.5
description: >
Copy values with non-negative target and start positions.
info: |
@@ -17,6 +16,7 @@ info: |
...
includes: [compareArray.js, testTypedArray.js]
+features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-start-and-end.js b/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-start-and-end.js
index c8cd09f17..5ce98d35e 100644
--- a/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-start-and-end.js
+++ b/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-start-and-end.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.copywithin
-es6id: 22.2.3.5
description: >
Copy values with non-negative target, start and end positions.
info: |
@@ -17,6 +16,7 @@ info: |
...
includes: [compareArray.js, testTypedArray.js]
+features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/prop-desc.js b/test/built-ins/TypedArray/prototype/copyWithin/prop-desc.js
index ef94eaab6..1d4c0f7b7 100644
--- a/test/built-ins/TypedArray/prototype/copyWithin/prop-desc.js
+++ b/test/built-ins/TypedArray/prototype/copyWithin/prop-desc.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.5
+esid: sec-%typedarray%.prototype.copywithin
description: >
"copyWithin" property of TypedArrayPrototype
info: |
@@ -9,6 +9,7 @@ info: |
and in Annex B.2 has the attributes { [[Writable]]: true,
[[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
var TypedArrayPrototype = TypedArray.prototype;
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-end-is-symbol.js b/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-end-is-symbol.js
index 1aba14215..2f935bf93 100644
--- a/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-end-is-symbol.js
+++ b/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-end-is-symbol.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.copywithin
-es6id: 22.2.3.5
description: >
Return abrupt if end is a Symbol.
info: |
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-end.js b/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-end.js
index 301ed81ce..eeb3d8256 100644
--- a/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-end.js
+++ b/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-end.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.copywithin
-es6id: 22.2.3.5
description: >
Return abrupt from ToInteger(end).
info: |
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-start-is-symbol.js b/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-start-is-symbol.js
index 47e8687cc..c508e66be 100644
--- a/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-start-is-symbol.js
+++ b/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-start-is-symbol.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.copywithin
-es6id: 22.2.3.5
description: >
Return abrupt if start is a Symbol.
info: |
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-start.js b/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-start.js
index 89e71980e..08e24b260 100644
--- a/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-start.js
+++ b/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-start.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.copywithin
-es6id: 22.2.3.5
description: >
Return abrupt from ToInteger(start).
info: |
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-target-is-symbol.js b/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-target-is-symbol.js
index 063825661..9c8acb987 100644
--- a/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-target-is-symbol.js
+++ b/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-target-is-symbol.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.copywithin
-es6id: 22.2.3.5
description: >
Return abrupt if target is a Symbol.
info: |
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-target.js b/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-target.js
index 3386bbfd2..ba9a4b2f2 100644
--- a/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-target.js
+++ b/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-target.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.copywithin
-es6id: 22.2.3.5
description: >
Return abrupt from ToInteger(target).
info: |
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/return-this.js b/test/built-ins/TypedArray/prototype/copyWithin/return-this.js
index c6ab41ced..2ecaa1974 100644
--- a/test/built-ins/TypedArray/prototype/copyWithin/return-this.js
+++ b/test/built-ins/TypedArray/prototype/copyWithin/return-this.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.copywithin
-es6id: 22.2.3.5
description: >
Returns `this`.
info: |
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/undefined-end.js b/test/built-ins/TypedArray/prototype/copyWithin/undefined-end.js
index bd011026f..672878806 100644
--- a/test/built-ins/TypedArray/prototype/copyWithin/undefined-end.js
+++ b/test/built-ins/TypedArray/prototype/copyWithin/undefined-end.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.copywithin
-es6id: 22.2.3.5
description: >
If `end` is undefined, set final position to `this.length`.
info: |
@@ -24,6 +23,7 @@ info: |
ToInteger(end).
...
includes: [compareArray.js, testTypedArray.js]
+features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
diff --git a/test/built-ins/TypedArray/prototype/entries/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/entries/BigInt/detached-buffer.js
new file mode 100644
index 000000000..ead1ec4bf
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/entries/BigInt/detached-buffer.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.entries
+description: Throws a TypeError if this has a detached buffer
+info: |
+ 22.2.3.6 %TypedArray%.prototype.entries ( )
+
+ 1. Let O be the this value.
+ 2. Perform ? ValidateTypedArray(O).
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ ...
+ 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+ $DETACHBUFFER(sample.buffer);
+ assert.throws(TypeError, function() {
+ sample.entries();
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/entries/BigInt/iter-prototype.js b/test/built-ins/TypedArray/prototype/entries/BigInt/iter-prototype.js
new file mode 100644
index 000000000..40e4f8f5f
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/entries/BigInt/iter-prototype.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.entries
+description: >
+ The prototype of the returned iterator is ArrayIteratorPrototype
+info: |
+ 22.2.3.6 %TypedArray%.prototype.entries ( )
+
+ ...
+ 3. Return CreateArrayIterator(O, "key+value").
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol.iterator, TypedArray]
+---*/
+
+var ArrayIteratorProto = Object.getPrototypeOf([][Symbol.iterator]());
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([0n, 42n, 64n]);
+ var iter = sample.entries();
+
+ assert.sameValue(Object.getPrototypeOf(iter), ArrayIteratorProto);
+});
diff --git a/test/built-ins/TypedArray/prototype/entries/BigInt/return-itor.js b/test/built-ins/TypedArray/prototype/entries/BigInt/return-itor.js
new file mode 100644
index 000000000..b5e3a5f02
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/entries/BigInt/return-itor.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.entries
+description: Return an iterator for the entries.
+info: |
+ 22.2.3.6 %TypedArray%.prototype.entries ( )
+
+ ...
+ 3. Return CreateArrayIterator(O, "key+value").
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var typedArray = new TA([0n, 42n, 64n]);
+ var itor = typedArray.entries();
+
+ var next = itor.next();
+ assert(compareArray(next.value, [0, 0n]));
+ assert.sameValue(next.done, false);
+
+ next = itor.next();
+ assert(compareArray(next.value, [1, 42n]));
+ assert.sameValue(next.done, false);
+
+ next = itor.next();
+ assert(compareArray(next.value, [2, 64n]));
+ assert.sameValue(next.done, false);
+
+ next = itor.next();
+ assert.sameValue(next.value, undefined);
+ assert.sameValue(next.done, true);
+});
diff --git a/test/built-ins/TypedArray/prototype/entries/invoked-as-func.js b/test/built-ins/TypedArray/prototype/entries/invoked-as-func.js
index b539f44c7..0408b7cbb 100644
--- a/test/built-ins/TypedArray/prototype/entries/invoked-as-func.js
+++ b/test/built-ins/TypedArray/prototype/entries/invoked-as-func.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.6
+esid: sec-%typedarray%.prototype.entries
description: Throws a TypeError exception when invoked as a function
info: |
22.2.3.6 %TypedArray%.prototype.entries ( )
diff --git a/test/built-ins/TypedArray/prototype/entries/invoked-as-method.js b/test/built-ins/TypedArray/prototype/entries/invoked-as-method.js
index 39388b184..de2a001c7 100644
--- a/test/built-ins/TypedArray/prototype/entries/invoked-as-method.js
+++ b/test/built-ins/TypedArray/prototype/entries/invoked-as-method.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.6
+esid: sec-%typedarray%.prototype.entries
description: Requires a [[TypedArrayName]] internal slot.
info: |
22.2.3.6 %TypedArray%.prototype.entries ( )
diff --git a/test/built-ins/TypedArray/prototype/entries/iter-prototype.js b/test/built-ins/TypedArray/prototype/entries/iter-prototype.js
index f8635fe57..0fae10faf 100644
--- a/test/built-ins/TypedArray/prototype/entries/iter-prototype.js
+++ b/test/built-ins/TypedArray/prototype/entries/iter-prototype.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.6
esid: sec-%typedarray%.prototype.entries
description: >
The prototype of the returned iterator is ArrayIteratorPrototype
diff --git a/test/built-ins/TypedArray/prototype/entries/length.js b/test/built-ins/TypedArray/prototype/entries/length.js
index 7c7f800af..a72e7706c 100644
--- a/test/built-ins/TypedArray/prototype/entries/length.js
+++ b/test/built-ins/TypedArray/prototype/entries/length.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.6
+esid: sec-%typedarray%.prototype.entries
description: >
%TypedArray%.prototype.entries.length is 0.
info: |
@@ -20,6 +20,7 @@ info: |
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
[[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.entries.length, 0);
diff --git a/test/built-ins/TypedArray/prototype/entries/name.js b/test/built-ins/TypedArray/prototype/entries/name.js
index 9f7ab0dd2..9647c66c5 100644
--- a/test/built-ins/TypedArray/prototype/entries/name.js
+++ b/test/built-ins/TypedArray/prototype/entries/name.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.6
+esid: sec-%typedarray%.prototype.entries
description: >
%TypedArray%.prototype.entries.name is "entries".
info: |
@@ -17,6 +17,7 @@ info: |
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.entries.name, "entries");
diff --git a/test/built-ins/TypedArray/prototype/entries/prop-desc.js b/test/built-ins/TypedArray/prototype/entries/prop-desc.js
index 8ab8609e1..b6be2f048 100644
--- a/test/built-ins/TypedArray/prototype/entries/prop-desc.js
+++ b/test/built-ins/TypedArray/prototype/entries/prop-desc.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.6
+esid: sec-%typedarray%.prototype.entries
description: >
"entries" property of TypedArrayPrototype
info: |
@@ -9,6 +9,7 @@ info: |
and in Annex B.2 has the attributes { [[Writable]]: true,
[[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
var TypedArrayPrototype = TypedArray.prototype;
diff --git a/test/built-ins/TypedArray/prototype/entries/return-itor.js b/test/built-ins/TypedArray/prototype/entries/return-itor.js
index a69d4404e..a3da9e9f9 100644
--- a/test/built-ins/TypedArray/prototype/entries/return-itor.js
+++ b/test/built-ins/TypedArray/prototype/entries/return-itor.js
@@ -1,7 +1,6 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.6
esid: sec-%typedarray%.prototype.entries
description: Return an iterator for the entries.
info: |
@@ -13,7 +12,7 @@ includes: [testTypedArray.js, compareArray.js]
features: [TypedArray]
---*/
-var sample = new Int8Array([0, 42, 64]);
+var sample = [0, 42, 64];
testWithTypedArrayConstructors(function(TA) {
var typedArray = new TA(sample);
diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-arguments-with-thisarg.js b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-arguments-with-thisarg.js
new file mode 100644
index 000000000..18ee71106
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-arguments-with-thisarg.js
@@ -0,0 +1,56 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.every
+description: >
+ thisArg does not affect callbackfn arguments
+info: |
+ 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] )
+
+ %TypedArray%.prototype.every is a distinct function that implements the same
+ algorithm as Array.prototype.every as defined in 22.1.3.5 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length".
+
+ 22.1.3.5 Array.prototype.every ( callbackfn [ , thisArg ] )
+
+ ...
+ 6. Repeat, while k < len
+ ...
+ c. If kPresent is true, then
+ i. Let kValue be ? Get(O, Pk).
+ ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n, 44n]);
+
+ var results = [];
+ var thisArg = ["test262", 0, "ecma262", 0];
+
+ sample.every(function() {
+ results.push(arguments);
+ return true;
+ }, thisArg);
+
+ assert.sameValue(results.length, 3, "results.length");
+ assert.sameValue(thisArg.length, 4, "thisArg.length");
+
+ assert.sameValue(results[0].length, 3, "results[0].length");
+ assert.sameValue(results[0][0], 42n, "results[0][0] - kValue");
+ assert.sameValue(results[0][1], 0, "results[0][1] - k");
+ assert.sameValue(results[0][2], sample, "results[0][2] - this");
+
+ assert.sameValue(results[1].length, 3, "results[1].length");
+ assert.sameValue(results[1][0], 43n, "results[1][0] - kValue");
+ assert.sameValue(results[1][1], 1, "results[1][1] - k");
+ assert.sameValue(results[1][2], sample, "results[1][2] - this");
+
+ assert.sameValue(results[2].length, 3, "results[2].length");
+ assert.sameValue(results[2][0], 44n, "results[2][0] - kValue");
+ assert.sameValue(results[2][1], 2, "results[2][1] - k");
+ assert.sameValue(results[2][2], sample, "results[2][2] - this");
+});
diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-arguments-without-thisarg.js b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-arguments-without-thisarg.js
new file mode 100644
index 000000000..2a69123a2
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-arguments-without-thisarg.js
@@ -0,0 +1,54 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.every
+description: >
+ callbackfn arguments
+info: |
+ 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] )
+
+ %TypedArray%.prototype.every is a distinct function that implements the same
+ algorithm as Array.prototype.every as defined in 22.1.3.5 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length".
+
+ 22.1.3.5 Array.prototype.every ( callbackfn [ , thisArg ] )
+
+ ...
+ 6. Repeat, while k < len
+ ...
+ c. If kPresent is true, then
+ i. Let kValue be ? Get(O, Pk).
+ ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n, 44n]);
+
+ var results = [];
+
+ sample.every(function() {
+ results.push(arguments);
+ return true;
+ });
+
+ assert.sameValue(results.length, 3, "results.length");
+
+ assert.sameValue(results[0].length, 3, "results[0].length");
+ assert.sameValue(results[0][0], 42n, "results[0][0] - kValue");
+ assert.sameValue(results[0][1], 0, "results[0][1] - k");
+ assert.sameValue(results[0][2], sample, "results[0][2] - this");
+
+ assert.sameValue(results[1].length, 3, "results[1].length");
+ assert.sameValue(results[1][0], 43n, "results[1][0] - kValue");
+ assert.sameValue(results[1][1], 1, "results[1][1] - k");
+ assert.sameValue(results[1][2], sample, "results[1][2] - this");
+
+ assert.sameValue(results[2].length, 3, "results[2].length");
+ assert.sameValue(results[2][0], 44n, "results[2][0] - kValue");
+ assert.sameValue(results[2][1], 2, "results[2][1] - k");
+ assert.sameValue(results[2][2], sample, "results[2][2] - this");
+});
diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-detachbuffer.js
new file mode 100644
index 000000000..144798687
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-detachbuffer.js
@@ -0,0 +1,44 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.every
+description: >
+ Instance buffer can be detached during loop
+info: |
+ 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] )
+
+ %TypedArray%.prototype.every is a distinct function that implements the same
+ algorithm as Array.prototype.every as defined in 22.1.3.5 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length".
+
+ 22.1.3.5 Array.prototype.every ( callbackfn [ , thisArg ] )
+
+ ...
+ 6. Repeat, while k < len
+ ...
+ c. If kPresent is true, then
+ i. Let kValue be ? Get(O, Pk).
+ ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)).
+ ...
+includes: [detachArrayBuffer.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var loops = 0;
+ var sample = new TA(2);
+
+ assert.throws(TypeError, function() {
+ sample.every(function() {
+ if (loops === 1) {
+ throw new Test262Error("callbackfn called twice");
+ }
+ $DETACHBUFFER(sample.buffer);
+ loops++;
+ return true;
+ });
+ });
+
+ assert.sameValue(loops, 1);
+});
diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-no-interaction-over-non-integer.js b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-no-interaction-over-non-integer.js
new file mode 100644
index 000000000..1a838503d
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-no-interaction-over-non-integer.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.every
+description: >
+ Does not interact over non-integer properties
+info: |
+ 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] )
+
+ ...
+ 6. Repeat, while k < len
+ ...
+ c. If kPresent is true, then
+ i. Let kValue be ? Get(O, Pk).
+ ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([7n, 8n]);
+
+ var results = [];
+
+ sample.foo = 42;
+ sample[Symbol("1")] = 43;
+
+ sample.every(function() {
+ results.push(arguments);
+ return true;
+ });
+
+ assert.sameValue(results.length, 2, "results.length");
+
+ assert.sameValue(results[0][1], 0, "results[0][1] - key");
+ assert.sameValue(results[1][1], 1, "results[1][1] - key");
+
+ assert.sameValue(results[0][0], 7n, "results[0][0] - value");
+ assert.sameValue(results[1][0], 8n, "results[1][0] - value");
+});
diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-not-callable-throws.js b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-not-callable-throws.js
new file mode 100644
index 000000000..49827a5ca
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-not-callable-throws.js
@@ -0,0 +1,69 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.every
+description: Throws a TypeError if callbackfn is not callable
+info: |
+ 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] )
+
+ %TypedArray%.prototype.every is a distinct function that implements the same
+ algorithm as Array.prototype.every as defined in 22.1.3.5 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length".
+
+ 22.1.3.5 Array.prototype.every ( callbackfn [ , thisArg ] )
+
+ ...
+ 3. If IsCallable(callbackfn) is false, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(2);
+
+ assert.throws(TypeError, function() {
+ sample.every();
+ }, "no args");
+
+ assert.throws(TypeError, function() {
+ sample.every(null);
+ }, "null");
+
+ assert.throws(TypeError, function() {
+ sample.every(undefined);
+ }, "undefined");
+
+ assert.throws(TypeError, function() {
+ sample.every("abc");
+ }, "string");
+
+ assert.throws(TypeError, function() {
+ sample.every(1);
+ }, "number");
+
+ assert.throws(TypeError, function() {
+ sample.every(NaN);
+ }, "NaN");
+
+ assert.throws(TypeError, function() {
+ sample.every(false);
+ }, "false");
+
+ assert.throws(TypeError, function() {
+ sample.every(true);
+ }, "true");
+
+ assert.throws(TypeError, function() {
+ sample.every({});
+ }, "{}");
+
+ assert.throws(TypeError, function() {
+ sample.every(sample);
+ }, "same typedArray instance");
+
+ assert.throws(TypeError, function() {
+ sample.every(Symbol("1"));
+ }, "symbol");
+});
diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-not-called-on-empty.js b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-not-called-on-empty.js
new file mode 100644
index 000000000..07c599fd7
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-not-called-on-empty.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.every
+description: >
+ callbackfn is not called on empty instances
+info: |
+ 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] )
+
+ %TypedArray%.prototype.every is a distinct function that implements the same
+ algorithm as Array.prototype.every as defined in 22.1.3.5 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length".
+
+ 22.1.3.5 Array.prototype.every ( callbackfn [ , thisArg ] )
+
+ ...
+ 6. Repeat, while k < len
+ ..
+ c. If kPresent is true, then
+ i. Let kValue be ? Get(O, Pk).
+ ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var called = 0;
+
+ new TA().every(function() {
+ called++;
+ });
+
+ assert.sameValue(called, 0);
+});
diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-return-does-not-change-instance.js b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-return-does-not-change-instance.js
new file mode 100644
index 000000000..a6396cd4d
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-return-does-not-change-instance.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.every
+description: >
+ The callbackfn return does not change the instance
+info: |
+ 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] )
+
+ %TypedArray%.prototype.every is a distinct function that implements the same
+ algorithm as Array.prototype.every as defined in 22.1.3.5 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length".
+
+ 22.1.3.5 Array.prototype.every ( callbackfn [ , thisArg ] )
+
+ ...
+ 6. Repeat, while k < len
+ ..
+ c. If kPresent is true, then
+ i. Let kValue be ? Get(O, Pk).
+ ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([40n, 41n, 42n]);
+
+ sample.every(function() {
+ return 43;
+ });
+
+ assert.sameValue(sample[0], 40n, "[0] == 40");
+ assert.sameValue(sample[1], 41n, "[1] == 41");
+ assert.sameValue(sample[2], 42n, "[2] == 42");
+});
diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-returns-abrupt.js b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-returns-abrupt.js
new file mode 100644
index 000000000..d165d7be7
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-returns-abrupt.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.every
+description: Returns abrupt from callbackfn
+info: |
+ 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] )
+
+ %TypedArray%.prototype.every is a distinct function that implements the same
+ algorithm as Array.prototype.every as defined in 22.1.3.5 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length".
+
+ 22.1.3.5 Array.prototype.every ( callbackfn [ , thisArg ] )
+
+ ...
+ 6. Repeat, while k < len
+ ..
+ c. If kPresent is true, then
+ i. Let kValue be ? Get(O, Pk).
+ ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(3);
+
+ assert.throws(Test262Error, function() {
+ sample.every(function() {
+ throw new Test262Error();
+ });
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-set-value-during-interaction.js b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-set-value-during-interaction.js
new file mode 100644
index 000000000..74ce8659e
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-set-value-during-interaction.js
@@ -0,0 +1,58 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.every
+description: >
+ Integer indexed values changed during iteration
+info: |
+ 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] )
+
+ %TypedArray%.prototype.every is a distinct function that implements the same
+ algorithm as Array.prototype.every as defined in 22.1.3.5 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length".
+
+ 22.1.3.5 Array.prototype.every ( callbackfn [ , thisArg ] )
+
+ ...
+ 6. Repeat, while k < len
+ ..
+ c. If kPresent is true, then
+ i. Let kValue be ? Get(O, Pk).
+ ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Reflect.set, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n, 44n]);
+ var newVal = 0n;
+
+ sample.every(function(val, i) {
+ if (i > 0) {
+ assert.sameValue(
+ sample[i - 1], newVal - 1n,
+ "get the changed value during the loop"
+ );
+ assert.sameValue(
+ Reflect.set(sample, 0, 7n),
+ true,
+ "re-set a value for sample[0]"
+ );
+ }
+ assert.sameValue(
+ Reflect.set(sample, i, newVal),
+ true,
+ "set value during iteration"
+ );
+
+ newVal++;
+
+ return true;
+ });
+
+ assert.sameValue(sample[0], 7n, "changed values after iteration [0] == 7");
+ assert.sameValue(sample[1], 1n, "changed values after iteration [1] == 1");
+ assert.sameValue(sample[2], 2n, "changed values after iteration [2] == 2");
+});
diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-this.js b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-this.js
new file mode 100644
index 000000000..589cfec30
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-this.js
@@ -0,0 +1,59 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.every
+description: >
+ callbackfn `this` value
+info: |
+ 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] )
+
+ %TypedArray%.prototype.every is a distinct function that implements the same
+ algorithm as Array.prototype.every as defined in 22.1.3.5 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length".
+
+ 22.1.3.5 Array.prototype.every ( callbackfn [ , thisArg ] )
+
+ ...
+ 4. If thisArg was supplied, let T be thisArg; else let T be undefined.
+ ...
+ 6. Repeat, while k < len
+ ...
+ c. If kPresent is true, then
+ ...
+ ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var expected = (function() { return this; })();
+var thisArg = {};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(3);
+
+ var results1 = [];
+
+ sample.every(function() {
+ results1.push(this);
+ return true;
+ });
+
+ assert.sameValue(results1.length, 3, "results1");
+ assert.sameValue(results1[0], expected, "without thisArg - [0]");
+ assert.sameValue(results1[1], expected, "without thisArg - [1]");
+ assert.sameValue(results1[2], expected, "without thisArg - [2]");
+
+ var results2 = [];
+
+ sample.every(function() {
+ results2.push(this);
+ return true;
+ }, thisArg);
+
+ assert.sameValue(results2.length, 3, "results2");
+ assert.sameValue(results2[0], thisArg, "using thisArg - [0]");
+ assert.sameValue(results2[1], thisArg, "using thisArg - [1]");
+ assert.sameValue(results2[2], thisArg, "using thisArg - [2]");
+});
diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/every/BigInt/detached-buffer.js
new file mode 100644
index 000000000..5c622dc6a
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/every/BigInt/detached-buffer.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.every
+description: Throws a TypeError if this has a detached buffer
+info: |
+ 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ ...
+ 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+var callbackfn = function() {
+ throw new Test262Error();
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+ $DETACHBUFFER(sample.buffer);
+ assert.throws(TypeError, function() {
+ sample.every(callbackfn);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/every/BigInt/get-length-uses-internal-arraylength.js
new file mode 100644
index 000000000..1dc89c06c
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/every/BigInt/get-length-uses-internal-arraylength.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.every
+description: Get "length" uses internal ArrayLength
+info: |
+ 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] )
+
+ %TypedArray%.prototype.every is a distinct function that implements the same
+ algorithm as Array.prototype.every as defined in 22.1.3.5 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length".
+
+ 22.1.3.5 Array.prototype.every ( callbackfn [ , thisArg ] )
+
+ 1. Let O be ? ToObject(this value).
+ 2. Let len be ? ToLength(? Get(O, "length")).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var getCalls = 0;
+var desc = {
+ get: function getLen() {
+ getCalls++;
+ return 0;
+ }
+};
+
+Object.defineProperty(TypedArray.prototype, "length", desc);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n]);
+ var calls = 0;
+
+ Object.defineProperty(TA.prototype, "length", desc);
+ Object.defineProperty(sample, "length", desc);
+
+ sample.every(function() {
+ calls++;
+ return true;
+ });
+
+ assert.sameValue(getCalls, 0, "ignores length properties");
+ assert.sameValue(calls, 2, "iterations are not affected by custom length");
+});
diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/every/BigInt/invoked-as-func.js
new file mode 100644
index 000000000..83d64511c
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/every/BigInt/invoked-as-func.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.every
+description: Throws a TypeError exception when invoked as a function
+info: |
+ 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var every = TypedArray.prototype.every;
+
+assert.sameValue(typeof every, 'function');
+
+assert.throws(TypeError, function() {
+ every();
+});
diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/every/BigInt/invoked-as-method.js
new file mode 100644
index 000000000..2b99d4c68
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/every/BigInt/invoked-as-method.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.every
+description: Requires a [[TypedArrayName]] internal slot.
+info: |
+ 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+assert.sameValue(typeof TypedArrayPrototype.every, 'function');
+
+assert.throws(TypeError, function() {
+ TypedArrayPrototype.every();
+});
diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/length.js b/test/built-ins/TypedArray/prototype/every/BigInt/length.js
new file mode 100644
index 000000000..cbe40ceaa
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/every/BigInt/length.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.every
+description: >
+ %TypedArray%.prototype.every.length is 1.
+info: |
+ %TypedArray%.prototype.every ( callbackfn [ , thisArg ] )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, has a length
+ property whose value is an integer. Unless otherwise specified, this
+ value is equal to the largest number of named arguments shown in the
+ subclause headings for the function description, including optional
+ parameters. However, rest parameters shown using the form “...name”
+ are not included in the default argument count.
+
+ Unless otherwise specified, the length property of a built-in Function
+ object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.every.length, 1);
+
+verifyNotEnumerable(TypedArray.prototype.every, "length");
+verifyNotWritable(TypedArray.prototype.every, "length");
+verifyConfigurable(TypedArray.prototype.every, "length");
diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/name.js b/test/built-ins/TypedArray/prototype/every/BigInt/name.js
new file mode 100644
index 000000000..c7fb7d764
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/every/BigInt/name.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.every
+description: >
+ %TypedArray%.prototype.every.name is "every".
+info: |
+ %TypedArray%.prototype.every ( callbackfn [ , thisArg ] )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, that is not
+ identified as an anonymous function has a name property whose value
+ is a String.
+
+ Unless otherwise specified, the name property of a built-in Function
+ object, if it exists, has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.every.name, "every");
+
+verifyNotEnumerable(TypedArray.prototype.every, "name");
+verifyNotWritable(TypedArray.prototype.every, "name");
+verifyConfigurable(TypedArray.prototype.every, "name");
diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/every/BigInt/prop-desc.js
new file mode 100644
index 000000000..d1c570ca1
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/every/BigInt/prop-desc.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.every
+description: >
+ "every" property of TypedArrayPrototype
+info: |
+ ES6 section 17: Every other data property described in clauses 18 through 26
+ and in Annex B.2 has the attributes { [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+verifyNotEnumerable(TypedArrayPrototype, 'every');
+verifyWritable(TypedArrayPrototype, 'every');
+verifyConfigurable(TypedArrayPrototype, 'every');
diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/returns-false-if-any-cb-returns-false.js b/test/built-ins/TypedArray/prototype/every/BigInt/returns-false-if-any-cb-returns-false.js
new file mode 100644
index 000000000..8271e5109
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/every/BigInt/returns-false-if-any-cb-returns-false.js
@@ -0,0 +1,46 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.every
+description: >
+ Returns false if any callbackfn call returns a coerced false.
+info: |
+ 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] )
+
+ %TypedArray%.prototype.every is a distinct function that implements the same
+ algorithm as Array.prototype.every as defined in 22.1.3.5 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length".
+
+ 22.1.3.5 Array.prototype.every ( callbackfn [ , thisArg ] )
+
+ ...
+ 7. Return true.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(42);
+
+ [
+ false,
+ "",
+ 0,
+ -0,
+ NaN,
+ undefined,
+ null
+ ].forEach(function(val) {
+ var called = 0;
+ var result = sample.every(function() {
+ called++;
+ if (called === 1) {
+ return true;
+ }
+ return val;
+ });
+ assert.sameValue(called, 2, "callbackfn called until it returned " + val);
+ assert.sameValue(result, false, "result is false when it returned " + val);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/returns-true-if-every-cb-returns-true.js b/test/built-ins/TypedArray/prototype/every/BigInt/returns-true-if-every-cb-returns-true.js
new file mode 100644
index 000000000..761b8784b
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/every/BigInt/returns-true-if-every-cb-returns-true.js
@@ -0,0 +1,46 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.every
+description: >
+ Returns true if every callbackfn returns a coerced true.
+info: |
+ 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] )
+
+ %TypedArray%.prototype.every is a distinct function that implements the same
+ algorithm as Array.prototype.every as defined in 22.1.3.5 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length".
+
+ 22.1.3.5 Array.prototype.every ( callbackfn [ , thisArg ] )
+
+ ...
+ 7. Return true.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var called = 0;
+ var values = [
+ true,
+ 1,
+ "test262",
+ Symbol("1"),
+ {},
+ [],
+ -1,
+ Infinity,
+ -Infinity,
+ 0.1,
+ -0.1
+ ];
+ var sample = new TA(values.length);
+ var result = sample.every(function() {
+ called++;
+ return values.unshift();
+ });
+
+ assert.sameValue(called, sample.length, "callbackfn called for each index");
+ assert.sameValue(result, true, "return is true");
+});
diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/every/BigInt/this-is-not-object.js
new file mode 100644
index 000000000..af9557ea0
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/every/BigInt/this-is-not-object.js
@@ -0,0 +1,51 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.every
+description: Throws a TypeError exception when `this` is not Object
+info: |
+ 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var every = TypedArray.prototype.every;
+var callbackfn = function() {};
+
+assert.throws(TypeError, function() {
+ every.call(undefined, callbackfn);
+}, "this is undefined");
+
+assert.throws(TypeError, function() {
+ every.call(null, callbackfn);
+}, "this is null");
+
+assert.throws(TypeError, function() {
+ every.call(42, callbackfn);
+}, "this is 42");
+
+assert.throws(TypeError, function() {
+ every.call("1", callbackfn);
+}, "this is a string");
+
+assert.throws(TypeError, function() {
+ every.call(true, callbackfn);
+}, "this is true");
+
+assert.throws(TypeError, function() {
+ every.call(false, callbackfn);
+}, "this is false");
+
+var s = Symbol("s");
+assert.throws(TypeError, function() {
+ every.call(s, callbackfn);
+}, "this is a Symbol");
diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/every/BigInt/this-is-not-typedarray-instance.js
new file mode 100644
index 000000000..21ff576b5
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/every/BigInt/this-is-not-typedarray-instance.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.every
+description: >
+ Throws a TypeError exception when `this` is not a TypedArray instance
+info: |
+ 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var every = TypedArray.prototype.every;
+var callbackfn = function() {};
+
+assert.throws(TypeError, function() {
+ every.call({}, callbackfn);
+}, "this is an Object");
+
+assert.throws(TypeError, function() {
+ every.call([], callbackfn);
+}, "this is an Array");
+
+var ab = new ArrayBuffer(8);
+assert.throws(TypeError, function() {
+ every.call(ab, callbackfn);
+}, "this is an ArrayBuffer instance");
+
+var dv = new DataView(new ArrayBuffer(8), 0, 1);
+assert.throws(TypeError, function() {
+ every.call(dv, callbackfn);
+}, "this is a DataView instance");
diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/values-are-not-cached.js b/test/built-ins/TypedArray/prototype/every/BigInt/values-are-not-cached.js
new file mode 100644
index 000000000..7eb35f741
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/every/BigInt/values-are-not-cached.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.every
+description: >
+ Integer indexed values are not cached before iteration
+info: |
+ 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] )
+
+ %TypedArray%.prototype.every is a distinct function that implements the same
+ algorithm as Array.prototype.every as defined in 22.1.3.5 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length".
+
+ 22.1.3.5 Array.prototype.every ( callbackfn [ , thisArg ] )
+
+ ...
+ 6. Repeat, while k < len
+ ..
+ c. If kPresent is true, then
+ i. Let kValue be ? Get(O, Pk).
+ ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n, 44n]);
+
+ sample.every(function(v, i) {
+ if (i < sample.length - 1) {
+ sample[i+1] = 42n;
+ }
+
+ assert.sameValue(
+ v, 42n, "method does not cache values before callbackfn calls"
+ );
+ return true;
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/every/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/every/callbackfn-detachbuffer.js
index 3deb25f8d..8032d06bf 100644
--- a/test/built-ins/TypedArray/prototype/every/callbackfn-detachbuffer.js
+++ b/test/built-ins/TypedArray/prototype/every/callbackfn-detachbuffer.js
@@ -22,6 +22,7 @@ info: |
ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)).
...
includes: [detachArrayBuffer.js, testTypedArray.js]
+features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
diff --git a/test/built-ins/TypedArray/prototype/every/invoked-as-func.js b/test/built-ins/TypedArray/prototype/every/invoked-as-func.js
index ed64993c8..b861fa914 100644
--- a/test/built-ins/TypedArray/prototype/every/invoked-as-func.js
+++ b/test/built-ins/TypedArray/prototype/every/invoked-as-func.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.7
+esid: sec-%typedarray%.prototype.every
description: Throws a TypeError exception when invoked as a function
info: |
22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] )
diff --git a/test/built-ins/TypedArray/prototype/every/invoked-as-method.js b/test/built-ins/TypedArray/prototype/every/invoked-as-method.js
index 491821d69..d70fa2346 100644
--- a/test/built-ins/TypedArray/prototype/every/invoked-as-method.js
+++ b/test/built-ins/TypedArray/prototype/every/invoked-as-method.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.7
+esid: sec-%typedarray%.prototype.every
description: Requires a [[TypedArrayName]] internal slot.
info: |
22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] )
diff --git a/test/built-ins/TypedArray/prototype/every/length.js b/test/built-ins/TypedArray/prototype/every/length.js
index 64b41dbb1..2f5bf8961 100644
--- a/test/built-ins/TypedArray/prototype/every/length.js
+++ b/test/built-ins/TypedArray/prototype/every/length.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.7
+esid: sec-%typedarray%.prototype.every
description: >
%TypedArray%.prototype.every.length is 1.
info: |
@@ -20,6 +20,7 @@ info: |
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
[[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.every.length, 1);
diff --git a/test/built-ins/TypedArray/prototype/every/name.js b/test/built-ins/TypedArray/prototype/every/name.js
index f43fbf927..4d216dd9d 100644
--- a/test/built-ins/TypedArray/prototype/every/name.js
+++ b/test/built-ins/TypedArray/prototype/every/name.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.7
+esid: sec-%typedarray%.prototype.every
description: >
%TypedArray%.prototype.every.name is "every".
info: |
@@ -17,6 +17,7 @@ info: |
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.every.name, "every");
diff --git a/test/built-ins/TypedArray/prototype/every/prop-desc.js b/test/built-ins/TypedArray/prototype/every/prop-desc.js
index 6e581c16e..0f252fb72 100644
--- a/test/built-ins/TypedArray/prototype/every/prop-desc.js
+++ b/test/built-ins/TypedArray/prototype/every/prop-desc.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.7
+esid: sec-%typedarray%.prototype.every
description: >
"every" property of TypedArrayPrototype
info: |
@@ -9,6 +9,7 @@ info: |
and in Annex B.2 has the attributes { [[Writable]]: true,
[[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
var TypedArrayPrototype = TypedArray.prototype;
diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/coerced-indexes.js b/test/built-ins/TypedArray/prototype/fill/BigInt/coerced-indexes.js
new file mode 100644
index 000000000..5467a89cd
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/fill/BigInt/coerced-indexes.js
@@ -0,0 +1,104 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.fill
+description: >
+ Fills elements from coerced to Integer `start` and `end` values
+info: |
+ 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] )
+
+ %TypedArray%.prototype.fill is a distinct function that implements the same
+ algorithm as Array.prototype.fill as defined in 22.1.3.6 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length". The implementation of the algorithm may be optimized with
+ the knowledge that the this value is an object that has a fixed length and
+ whose integer indexed properties are not sparse. However, such optimization
+ must not introduce any observable changes in the specified behaviour of the
+ algorithm.
+
+ ...
+
+ 22.1.3.6 Array.prototype.fill (value [ , start [ , end ] ] )
+
+ ...
+ 3. Let relativeStart be ? ToInteger(start).
+ 4. If relativeStart < 0, let k be max((len + relativeStart), 0); else let k be
+ min(relativeStart, len).
+ 5. If end is undefined, let relativeEnd be len; else let relativeEnd be ?
+ ToInteger(end).
+ ...
+includes: [compareArray.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert(
+ compareArray(new TA([0n, 0n]).fill(1n, undefined), [1n, 1n]),
+ '`undefined` start coerced to 0'
+ );
+
+ assert(
+ compareArray(new TA([0n, 0n]).fill(1n, 0, undefined), [1n, 1n]),
+ 'If end is undefined, let relativeEnd be len'
+ );
+
+ assert(
+ compareArray(new TA([0n, 0n]).fill(1n, null), [1n, 1n]),
+ '`null` start coerced to 0'
+ );
+
+ assert(
+ compareArray(new TA([0n, 0n]).fill(1n, 0, null), [0n, 0n]),
+ '`null` end coerced to 0'
+ );
+
+ assert(
+ compareArray(new TA([0n, 0n]).fill(1n, true), [0n, 1n]),
+ '`true` start coerced to 1'
+ );
+
+ assert(
+ compareArray(new TA([0n, 0n]).fill(1n, 0, true), [1n, 0n]),
+ '`true` end coerced to 1'
+ );
+
+ assert(
+ compareArray(new TA([0n, 0n]).fill(1n, false), [1n, 1n]),
+ '`false` start coerced to 0'
+ );
+
+ assert(
+ compareArray(new TA([0n, 0n]).fill(1n, 0, false), [0n, 0n]),
+ '`false` end coerced to 0'
+ );
+
+ assert(
+ compareArray(new TA([0n, 0n]).fill(1n, NaN), [1n, 1n]),
+ '`NaN` start coerced to 0'
+ );
+
+ assert(
+ compareArray(new TA([0n, 0n]).fill(1n, 0, NaN), [0n, 0n]),
+ '`NaN` end coerced to 0'
+ );
+
+ assert(
+ compareArray(new TA([0n, 0n]).fill(1n, '1'), [0n, 1n]),
+ 'string start coerced'
+ );
+
+ assert(
+ compareArray(new TA([0n, 0n]).fill(1n, 0, '1'), [1n, 0n]),
+ 'string end coerced'
+ );
+
+ assert(
+ compareArray(new TA([0n, 0n]).fill(1n, 1.5), [0n, 1n]),
+ 'start as a float number coerced'
+ );
+
+ assert(
+ compareArray(new TA([0n, 0n]).fill(1n, 0, 1.5), [1n, 0n]),
+ 'end as a float number coerced'
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/fill/BigInt/detached-buffer.js
new file mode 100644
index 000000000..96e7980ac
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/fill/BigInt/detached-buffer.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.fill
+description: Throws a TypeError if this has a detached buffer
+info: |
+ 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ ...
+ 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+var obj = {
+ valueOf: function() {
+ throw new Test262Error();
+ }
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+ $DETACHBUFFER(sample.buffer);
+ assert.throws(TypeError, function() {
+ sample.fill(obj);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-once.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-once.js
new file mode 100644
index 000000000..c87b864f9
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-once.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2017 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.fill
+description: >
+ Fills all the elements with non numeric values values.
+info: |
+ 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] )
+
+ ...
+ 3. Let _value_ be ? ToNumber(_value_).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(2);
+
+ var n = 1n;
+ sample.fill({ valueOf() { return n++; } });
+
+ assert.sameValue(n, 2n, "additional unexpected ToNumber() calls");
+ assert.sameValue(sample[0], 1n, "incorrect ToNumber result in index 0");
+ assert.sameValue(sample[1], 1n, "incorrect ToNumber result in index 1");
+});
+
diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-operations-consistent-nan.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-operations-consistent-nan.js
new file mode 100644
index 000000000..5db1cfcae
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-operations-consistent-nan.js
@@ -0,0 +1,70 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.fill
+description: Consistent canonicalization of NaN values
+info: |
+ 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] )
+
+ %TypedArray%.prototype.fill is a distinct function that implements the same
+ algorithm as Array.prototype.fill as defined in 22.1.3.6 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length". The implementation of the algorithm may be optimized with
+ the knowledge that the this value is an object that has a fixed length and
+ whose integer indexed properties are not sparse. However, such optimization
+ must not introduce any observable changes in the specified behaviour of the
+ algorithm.
+
+ ...
+
+ 22.1.3.6 Array.prototype.fill (value [ , start [ , end ] ] )
+
+ ...
+ 7. Repeat, while k < final
+ a. Let Pk be ! ToString(k).
+ b. Perform ? Set(O, Pk, value, true).
+ ...
+
+ 24.1.1.6 SetValueInBuffer ( arrayBuffer, byteIndex, type, value [ ,
+ isLittleEndian ] )
+
+ ...
+ 8. If type is "Float32", then
+ a. Set rawBytes to a List containing the 4 bytes that are the result
+ of converting value to IEEE 754-2008 binary32 format using “Round to
+ nearest, ties to even” rounding mode. If isLittleEndian is false, the
+ bytes are arranged in big endian order. Otherwise, the bytes are
+ arranged in little endian order. If value is NaN, rawValue may be set
+ to any implementation chosen IEEE 754-2008 binary64 format Not-a-Number
+ encoding. An implementation must always choose the same encoding for
+ each implementation distinguishable NaN value.
+ 9. Else, if type is "Float64", then
+ a. Set rawBytes to a List containing the 8 bytes that are the IEEE
+ 754-2008 binary64 format encoding of value. If isLittleEndian is false,
+ the bytes are arranged in big endian order. Otherwise, the bytes are
+ arranged in little endian order. If value is NaN, rawValue may be set
+ to any implementation chosen IEEE 754-2008 binary32 format Not-a-Number
+ encoding. An implementation must always choose the same encoding for
+ each implementation distinguishable NaN value.
+ ...
+includes: [nans.js, testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+function body(FloatArray) {
+ var sample = new FloatArray(3);
+ var control, idx, someNaN, sampleBytes, controlBytes;
+
+ for (idx = 0; idx < distinctNaNs.length; ++idx) {
+ someNaN = distinctNaNs[idx];
+ control = new FloatArray([someNaN, someNaN, someNaN]);
+
+ sample.fill(someNaN);
+
+ sampleBytes = new Uint8Array(sample.buffer);
+ controlBytes = new Uint8Array(control.buffer);
+ assert(compareArray(sampleBytes, controlBytes), 'NaN value #' + idx);
+ }
+}
+
+testWithBigIntTypedArrayConstructors(body, [Float32Array, Float64Array]);
diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-operations.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-operations.js
new file mode 100644
index 000000000..676d18f86
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-operations.js
@@ -0,0 +1,56 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.fill
+description: >
+ Fills all the elements with non numeric values values.
+info: |
+ 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] )
+
+ %TypedArray%.prototype.fill is a distinct function that implements the same
+ algorithm as Array.prototype.fill as defined in 22.1.3.6 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length". The implementation of the algorithm may be optimized with
+ the knowledge that the this value is an object that has a fixed length and
+ whose integer indexed properties are not sparse. However, such optimization
+ must not introduce any observable changes in the specified behaviour of the
+ algorithm.
+
+ ...
+
+ 22.1.3.6 Array.prototype.fill (value [ , start [ , end ] ] )
+
+ ...
+ 7. Repeat, while k < final
+ a. Let Pk be ! ToString(k).
+ b. Perform ? Set(O, Pk, value, true).
+ ...
+
+ 24.1.1.6 SetValueInBuffer ( arrayBuffer, byteIndex, type, value [ ,
+ isLittleEndian ] )
+
+ ...
+ 8. If type is "Float32", then
+ ...
+ 9. Else, if type is "Float64", then
+ ...
+ 10. Else,
+ ...
+ b. Let convOp be the abstract operation named in the Conversion Operation
+ column in Table 50 for Element Type type.
+ c. Let intValue be convOp(value).
+ d. If intValue ≥ 0, then
+ ...
+ e. Else,
+ ...
+includes: [byteConversionValues.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testTypedArrayConversions(byteConversionValues, function(TA, value, expected, initial) {
+ var sample = new TA([initial]);
+
+ sample.fill(value);
+
+ assert.sameValue(sample[0], expected, value + " converts to " + expected);
+});
diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-custom-start-and-end.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-custom-start-and-end.js
new file mode 100644
index 000000000..a981ab00b
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-custom-start-and-end.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.fill
+description: >
+ Fills all the elements from a with a custom start and end indexes.
+info: |
+ 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] )
+
+ %TypedArray%.prototype.fill is a distinct function that implements the same
+ algorithm as Array.prototype.fill as defined in 22.1.3.6 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length". The implementation of the algorithm may be optimized with
+ the knowledge that the this value is an object that has a fixed length and
+ whose integer indexed properties are not sparse. However, such optimization
+ must not introduce any observable changes in the specified behaviour of the
+ algorithm.
+
+ ...
+
+ 22.1.3.6 Array.prototype.fill (value [ , start [ , end ] ] )
+
+ ...
+ 3. Let relativeStart be ? ToInteger(start).
+ 4. If relativeStart < 0, let k be max((len + relativeStart), 0); else let k be
+ min(relativeStart, len).
+ 5. If end is undefined, let relativeEnd be len; else let relativeEnd be ?
+ ToInteger(end).
+ 6. If relativeEnd < 0, let final be max((len + relativeEnd), 0); else let
+ final be min(relativeEnd, len).
+ ...
+includes: [compareArray.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert(compareArray(new TA([0n, 0n, 0n]).fill(8n, 1, 2), [0n, 8n, 0n]));
+ assert(compareArray(new TA([0n, 0n, 0n, 0n, 0n]).fill(8n, -3, 4), [0n, 0n, 8n, 8n, 0n]));
+ assert(compareArray(new TA([0n, 0n, 0n, 0n, 0n]).fill(8n, -2, -1), [0n, 0n, 0n, 8n, 0n]));
+ assert(compareArray(new TA([0n, 0n, 0n, 0n, 0n]).fill(8n, -1, -3), [0n, 0n, 0n, 0n, 0n]));
+ assert(compareArray(new TA([0n, 0n, 0n, 0n, 0n]).fill(8n, 1, 3), [0n, 8n, 8n, 0n, 0n]));
+});
diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-non-numeric.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-non-numeric.js
new file mode 100644
index 000000000..4719ac67e
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-non-numeric.js
@@ -0,0 +1,72 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.fill
+description: >
+ Fills all the elements with non numeric values values.
+info: |
+ 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] )
+
+ %TypedArray%.prototype.fill is a distinct function that implements the same
+ algorithm as Array.prototype.fill as defined in 22.1.3.6 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length". The implementation of the algorithm may be optimized with
+ the knowledge that the this value is an object that has a fixed length and
+ whose integer indexed properties are not sparse. However, such optimization
+ must not introduce any observable changes in the specified behaviour of the
+ algorithm.
+
+ ...
+
+ 22.1.3.6 Array.prototype.fill (value [ , start [ , end ] ] )
+
+ ...
+ 7. Repeat, while k < final
+ a. Let Pk be ! ToString(k).
+ b. Perform ? Set(O, Pk, value, true).
+ ...
+
+ 9.4.5.9 IntegerIndexedElementSet ( O, index, value )
+
+ ...
+ 3. Let numValue be ? ToNumber(value).
+ ...
+
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample;
+
+ sample = new TA([42n]);
+ sample.fill(false);
+ assert.sameValue(sample[0], 0n, "false => 0");
+
+ sample = new TA([42n]);
+ sample.fill(true);
+ assert.sameValue(sample[0], 1n, "true => 1");
+
+ sample = new TA([42n]);
+ sample.fill("7");
+ assert.sameValue(sample[0], 7n, "string conversion");
+
+ sample = new TA([42n]);
+ sample.fill({
+ toString: function() {
+ return "1";
+ },
+ valueOf: function() {
+ return 7n;
+ }
+ });
+ assert.sameValue(sample[0], 7n, "object valueOf conversion before toString");
+
+ sample = new TA([42n]);
+ sample.fill({
+ toString: function() {
+ return "7";
+ }
+ });
+ assert.sameValue(sample[0], 7n, "object toString when valueOf is absent");
+});
diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-end.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-end.js
new file mode 100644
index 000000000..a4cac9ffb
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-end.js
@@ -0,0 +1,53 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.fill
+description: >
+ Fills all the elements from a with a custom end index.
+info: |
+ 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] )
+
+ %TypedArray%.prototype.fill is a distinct function that implements the same
+ algorithm as Array.prototype.fill as defined in 22.1.3.6 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length". The implementation of the algorithm may be optimized with
+ the knowledge that the this value is an object that has a fixed length and
+ whose integer indexed properties are not sparse. However, such optimization
+ must not introduce any observable changes in the specified behaviour of the
+ algorithm.
+
+ ...
+
+ 22.1.3.6 Array.prototype.fill (value [ , start [ , end ] ] )
+
+ ...
+ 5. If end is undefined, let relativeEnd be len; else let relativeEnd be ?
+ ToInteger(end).
+ 6. If relativeEnd < 0, let final be max((len + relativeEnd), 0); else let
+ final be min(relativeEnd, len).
+ ...
+includes: [compareArray.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert(
+ compareArray(new TA([0n, 0n, 0n]).fill(8n, 0, 1), [8n, 0n, 0n]),
+ "Fill elements from custom end position"
+ );
+
+ assert(
+ compareArray(new TA([0n, 0n, 0n]).fill(8n, 0, -1), [8n, 8n, 0n]),
+ "negative end sets final position to max((length + relativeEnd), 0)"
+ );
+
+ assert(
+ compareArray(new TA([0n, 0n, 0n]).fill(8n, 0, 5), [8n, 8n, 8n]),
+ "end position is never higher than of length"
+ );
+
+ assert(
+ compareArray(new TA([0n, 0n, 0n]).fill(8n, 0, -4), [0n, 0n, 0n]),
+ "end position is 0 when (len + relativeEnd) < 0"
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-start.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-start.js
new file mode 100644
index 000000000..790d1a5f2
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-start.js
@@ -0,0 +1,51 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.fill
+description: >
+ Fills all the elements from a with a custom start index.
+info: |
+ 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] )
+
+ %TypedArray%.prototype.fill is a distinct function that implements the same
+ algorithm as Array.prototype.fill as defined in 22.1.3.6 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length". The implementation of the algorithm may be optimized with
+ the knowledge that the this value is an object that has a fixed length and
+ whose integer indexed properties are not sparse. However, such optimization
+ must not introduce any observable changes in the specified behaviour of the
+ algorithm.
+
+ ...
+
+ 22.1.3.6 Array.prototype.fill (value [ , start [ , end ] ] )
+
+ ...
+ 4. If relativeStart < 0, let k be max((len + relativeStart), 0); else let k be
+ min(relativeStart, len).
+ ...
+includes: [compareArray.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert(
+ compareArray(new TA([0n, 0n, 0n]).fill(8n, 1), [0n, 8n, 8n]),
+ "Fill elements from custom start position"
+ );
+
+ assert(
+ compareArray(new TA([0n, 0n, 0n]).fill(8n, 4), [0n, 0n, 0n]),
+ "start position is never higher than length"
+ );
+
+ assert(
+ compareArray(new TA([0n, 0n, 0n]).fill(8n, -1), [0n, 0n, 8n]),
+ "start < 0 sets initial position to max((len + relativeStart), 0)"
+ );
+
+ assert(
+ compareArray(new TA([0n, 0n, 0n]).fill(8n, -5), [8n, 8n, 8n]),
+ "start position is 0 when (len + relativeStart) < 0"
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-symbol-throws.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-symbol-throws.js
new file mode 100644
index 000000000..dddad60fa
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-symbol-throws.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.fill
+description: >
+ Throws a TypeError if value is a Symbol
+info: |
+ 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] )
+
+ %TypedArray%.prototype.fill is a distinct function that implements the same
+ algorithm as Array.prototype.fill as defined in 22.1.3.6 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length". The implementation of the algorithm may be optimized with
+ the knowledge that the this value is an object that has a fixed length and
+ whose integer indexed properties are not sparse. However, such optimization
+ must not introduce any observable changes in the specified behaviour of the
+ algorithm.
+
+ ...
+
+ 22.1.3.6 Array.prototype.fill (value [ , start [ , end ] ] )
+
+ ...
+ 7. Repeat, while k < final
+ a. Let Pk be ! ToString(k).
+ b. Perform ? Set(O, Pk, value, true).
+ ...
+
+ 9.4.5.9 IntegerIndexedElementSet ( O, index, value )
+
+ ...
+ 3. Let numValue be ? ToNumber(value).
+ ...
+
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var s = Symbol('1');
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+
+ assert.throws(TypeError, function() {
+ sample.fill(s);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values.js
new file mode 100644
index 000000000..ec390d28b
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values.js
@@ -0,0 +1,44 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.fill
+description: >
+ Fills all the elements with `value` from a default start and index.
+info: |
+ 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] )
+
+ %TypedArray%.prototype.fill is a distinct function that implements the same
+ algorithm as Array.prototype.fill as defined in 22.1.3.6 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length". The implementation of the algorithm may be optimized with
+ the knowledge that the this value is an object that has a fixed length and
+ whose integer indexed properties are not sparse. However, such optimization
+ must not introduce any observable changes in the specified behaviour of the
+ algorithm.
+
+ ...
+
+ 22.1.3.6 Array.prototype.fill (value [ , start [ , end ] ] )
+
+ ...
+ 7. Repeat, while k < final
+ a. Let Pk be ! ToString(k).
+ b. Perform ? Set(O, Pk, value, true).
+includes: [compareArray.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert(
+ compareArray(
+ new TA().fill(8n),
+ []
+ ),
+ "does not fill an empty instance"
+ );
+
+ assert(
+ compareArray(new TA([0n, 0n, 0n]).fill(8n), [8n, 8n, 8n]),
+ "Default start and end indexes are 0 and this.length"
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/get-length-ignores-length-prop.js b/test/built-ins/TypedArray/prototype/fill/BigInt/get-length-ignores-length-prop.js
new file mode 100644
index 000000000..ec7637bc5
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/fill/BigInt/get-length-ignores-length-prop.js
@@ -0,0 +1,51 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.fill
+description: >
+ Unreachable abrupt from Get(O, "length") as [[ArrayLength]] is returned.
+info: |
+ 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] )
+
+ %TypedArray%.prototype.fill is a distinct function that implements the same
+ algorithm as Array.prototype.fill as defined in 22.1.3.6 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length". The implementation of the algorithm may be optimized with
+ the knowledge that the this value is an object that has a fixed length and
+ whose integer indexed properties are not sparse. However, such optimization
+ must not introduce any observable changes in the specified behaviour of the
+ algorithm.
+
+ ...
+
+ 22.1.3.6 Array.prototype.fill (value [ , start [ , end ] ] )
+
+ 1. Let O be ? ToObject(this value).
+ 2. Let len be ? ToLength(? Get(O, "length")).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+Object.defineProperty(TypedArray.prototype, "length", {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ Object.defineProperty(TA.prototype, "length", {
+ get: function() {
+ throw new Test262Error();
+ }
+ });
+
+ var sample = new TA(1);
+ Object.defineProperty(sample, "length", {
+ get: function() {
+ throw new Test262Error();
+ }
+ });
+
+ assert.sameValue(sample.fill(1n, 0), sample);
+});
diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/fill/BigInt/invoked-as-func.js
new file mode 100644
index 000000000..f7f0936d1
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/fill/BigInt/invoked-as-func.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.fill
+description: Throws a TypeError exception when invoked as a function
+info: |
+ 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var fill = TypedArray.prototype.fill;
+
+assert.sameValue(typeof fill, 'function');
+
+assert.throws(TypeError, function() {
+ fill();
+});
diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/fill/BigInt/invoked-as-method.js
new file mode 100644
index 000000000..897c2164b
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/fill/BigInt/invoked-as-method.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.fill
+description: Requires a [[TypedArrayName]] internal slot.
+info: |
+ 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+assert.sameValue(typeof TypedArrayPrototype.fill, 'function');
+
+assert.throws(TypeError, function() {
+ TypedArrayPrototype.fill();
+});
diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/length.js b/test/built-ins/TypedArray/prototype/fill/BigInt/length.js
new file mode 100644
index 000000000..6bf1feff5
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/fill/BigInt/length.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.fill
+description: >
+ %TypedArray%.prototype.fill.length is 1.
+info: |
+ %TypedArray%.prototype.fill (value [ , start [ , end ] ] )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, has a length
+ property whose value is an integer. Unless otherwise specified, this
+ value is equal to the largest number of named arguments shown in the
+ subclause headings for the function description, including optional
+ parameters. However, rest parameters shown using the form “...name”
+ are not included in the default argument count.
+
+ Unless otherwise specified, the length property of a built-in Function
+ object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.fill.length, 1);
+
+verifyNotEnumerable(TypedArray.prototype.fill, "length");
+verifyNotWritable(TypedArray.prototype.fill, "length");
+verifyConfigurable(TypedArray.prototype.fill, "length");
diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/name.js b/test/built-ins/TypedArray/prototype/fill/BigInt/name.js
new file mode 100644
index 000000000..82e72227a
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/fill/BigInt/name.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.fill
+description: >
+ %TypedArray%.prototype.fill.name is "fill".
+info: |
+ %TypedArray%.prototype.fill (value [ , start [ , end ] ] )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, that is not
+ identified as an anonymous function has a name property whose value
+ is a String.
+
+ Unless otherwise specified, the name property of a built-in Function
+ object, if it exists, has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.fill.name, "fill");
+
+verifyNotEnumerable(TypedArray.prototype.fill, "name");
+verifyNotWritable(TypedArray.prototype.fill, "name");
+verifyConfigurable(TypedArray.prototype.fill, "name");
diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/fill/BigInt/prop-desc.js
new file mode 100644
index 000000000..752b7a282
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/fill/BigInt/prop-desc.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.fill
+description: >
+ "fill" property of TypedArrayPrototype
+info: |
+ ES6 section 17: Every other data property described in clauses 18 through 26
+ and in Annex B.2 has the attributes { [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+verifyNotEnumerable(TypedArrayPrototype, 'fill');
+verifyWritable(TypedArrayPrototype, 'fill');
+verifyConfigurable(TypedArrayPrototype, 'fill');
diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-end-as-symbol.js b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-end-as-symbol.js
new file mode 100644
index 000000000..084c9ac1e
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-end-as-symbol.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.fill
+description: >
+ Return abrupt if end is a Symbol.
+info: |
+ 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] )
+
+ %TypedArray%.prototype.fill is a distinct function that implements the same
+ algorithm as Array.prototype.fill as defined in 22.1.3.6 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length". The implementation of the algorithm may be optimized with
+ the knowledge that the this value is an object that has a fixed length and
+ whose integer indexed properties are not sparse. However, such optimization
+ must not introduce any observable changes in the specified behaviour of the
+ algorithm.
+
+ ...
+
+ 22.1.3.6 Array.prototype.fill (value [ , start [ , end ] ] )
+
+ ...
+ 5. If end is undefined, let relativeEnd be len; else let relativeEnd be ?
+ ToInteger(end).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var end = Symbol(1);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA();
+ assert.throws(TypeError, function() {
+ sample.fill(1, 0, end);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-end.js b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-end.js
new file mode 100644
index 000000000..9dd7dd553
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-end.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.fill
+description: >
+ Return abrupt from ToInteger(end).
+info: |
+ 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] )
+
+ %TypedArray%.prototype.fill is a distinct function that implements the same
+ algorithm as Array.prototype.fill as defined in 22.1.3.6 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length". The implementation of the algorithm may be optimized with
+ the knowledge that the this value is an object that has a fixed length and
+ whose integer indexed properties are not sparse. However, such optimization
+ must not introduce any observable changes in the specified behaviour of the
+ algorithm.
+
+ ...
+
+ 22.1.3.6 Array.prototype.fill (value [ , start [ , end ] ] )
+
+ ...
+ 5. If end is undefined, let relativeEnd be len; else let relativeEnd be ?
+ ToInteger(end).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var end = {
+ valueOf: function() {
+ throw new Test262Error();
+ }
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA();
+ assert.throws(Test262Error, function() {
+ sample.fill(1n, 0, end);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-set-value.js b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-set-value.js
new file mode 100644
index 000000000..c30cbf097
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-set-value.js
@@ -0,0 +1,50 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.fill
+description: >
+ Returns abrupt from value set
+info: |
+ 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] )
+
+ %TypedArray%.prototype.fill is a distinct function that implements the same
+ algorithm as Array.prototype.fill as defined in 22.1.3.6 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length". The implementation of the algorithm may be optimized with
+ the knowledge that the this value is an object that has a fixed length and
+ whose integer indexed properties are not sparse. However, such optimization
+ must not introduce any observable changes in the specified behaviour of the
+ algorithm.
+
+ ...
+
+ 22.1.3.6 Array.prototype.fill (value [ , start [ , end ] ] )
+
+ ...
+ 7. Repeat, while k < final
+ a. Let Pk be ! ToString(k).
+ b. Perform ? Set(O, Pk, value, true).
+ ...
+
+ 9.4.5.9 IntegerIndexedElementSet ( O, index, value )
+
+ ...
+ 3. Let numValue be ? ToNumber(value).
+ ...
+
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n]);
+ var obj = {
+ valueOf: function() {
+ throw new Test262Error();
+ }
+ };
+
+ assert.throws(Test262Error, function() {
+ sample.fill(obj);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-start-as-symbol.js b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-start-as-symbol.js
new file mode 100644
index 000000000..d95c9a30d
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-start-as-symbol.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.fill
+description: >
+ Return abrupt from ToInteger(start) as a Symbol.
+info: |
+ 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] )
+
+ %TypedArray%.prototype.fill is a distinct function that implements the same
+ algorithm as Array.prototype.fill as defined in 22.1.3.6 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length". The implementation of the algorithm may be optimized with
+ the knowledge that the this value is an object that has a fixed length and
+ whose integer indexed properties are not sparse. However, such optimization
+ must not introduce any observable changes in the specified behaviour of the
+ algorithm.
+
+ ...
+
+ 22.1.3.6 Array.prototype.fill (value [ , start [ , end ] ] )
+
+ ...
+ 3. Let relativeStart be ? ToInteger(start).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var start = Symbol(1);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA();
+ assert.throws(TypeError, function() {
+ sample.fill(1, start);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-start.js b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-start.js
new file mode 100644
index 000000000..c5731f2f5
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-start.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.fill
+description: >
+ Return abrupt from ToInteger(start).
+info: |
+ 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] )
+
+ %TypedArray%.prototype.fill is a distinct function that implements the same
+ algorithm as Array.prototype.fill as defined in 22.1.3.6 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length". The implementation of the algorithm may be optimized with
+ the knowledge that the this value is an object that has a fixed length and
+ whose integer indexed properties are not sparse. However, such optimization
+ must not introduce any observable changes in the specified behaviour of the
+ algorithm.
+
+ ...
+
+ 22.1.3.6 Array.prototype.fill (value [ , start [ , end ] ] )
+
+ ...
+ 3. Let relativeStart be ? ToInteger(start).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var start = {
+ valueOf: function() {
+ throw new Test262Error();
+ }
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA();
+ assert.throws(Test262Error, function() {
+ sample.fill(1n, start);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/return-this.js b/test/built-ins/TypedArray/prototype/fill/BigInt/return-this.js
new file mode 100644
index 000000000..83895854f
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/fill/BigInt/return-this.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.fill
+description: >
+ Returns `this`.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample1 = new TA();
+ var result1 = sample1.fill(1n);
+
+ assert.sameValue(result1, sample1);
+
+ var sample2 = new TA(42);
+ var result2 = sample2.fill(7n);
+ assert.sameValue(result2, sample2);
+});
diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/fill/BigInt/this-is-not-object.js
new file mode 100644
index 000000000..5846bbcae
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/fill/BigInt/this-is-not-object.js
@@ -0,0 +1,50 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.fill
+description: Throws a TypeError exception when `this` is not Object
+info: |
+ 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var fill = TypedArray.prototype.fill;
+
+assert.throws(TypeError, function() {
+ fill.call(undefined, 0);
+}, "this is undefined");
+
+assert.throws(TypeError, function() {
+ fill.call(null, 0);
+}, "this is null");
+
+assert.throws(TypeError, function() {
+ fill.call(42, 0);
+}, "this is 42");
+
+assert.throws(TypeError, function() {
+ fill.call("1", 0);
+}, "this is a string");
+
+assert.throws(TypeError, function() {
+ fill.call(true, 0);
+}, "this is true");
+
+assert.throws(TypeError, function() {
+ fill.call(false, 0);
+}, "this is false");
+
+var s = Symbol("s");
+assert.throws(TypeError, function() {
+ fill.call(s, 0);
+}, "this is a Symbol");
diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/fill/BigInt/this-is-not-typedarray-instance.js
new file mode 100644
index 000000000..8cb012108
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/fill/BigInt/this-is-not-typedarray-instance.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.fill
+description: >
+ Throws a TypeError exception when `this` is not a TypedArray instance
+info: |
+ 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var fill = TypedArray.prototype.fill;
+
+assert.throws(TypeError, function() {
+ fill.call({}, 0);
+}, "this is an Object");
+
+assert.throws(TypeError, function() {
+ fill.call([], 0);
+}, "this is an Array");
+
+var ab = new ArrayBuffer(8);
+assert.throws(TypeError, function() {
+ fill.call(ab, 0);
+}, "this is an ArrayBuffer instance");
+
+var dv = new DataView(new ArrayBuffer(8), 0, 1);
+assert.throws(TypeError, function() {
+ fill.call(dv, 0);
+}, "this is a DataView instance");
diff --git a/test/built-ins/TypedArray/prototype/fill/coerced-indexes.js b/test/built-ins/TypedArray/prototype/fill/coerced-indexes.js
index 352a91d1a..2d512bae5 100644
--- a/test/built-ins/TypedArray/prototype/fill/coerced-indexes.js
+++ b/test/built-ins/TypedArray/prototype/fill/coerced-indexes.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.fill
-es6id: 22.2.3.8
description: >
Fills elements from coerced to Integer `start` and `end` values
info: |
@@ -29,6 +28,7 @@ info: |
ToInteger(end).
...
includes: [compareArray.js, testTypedArray.js]
+features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values-conversion-operations-consistent-nan.js b/test/built-ins/TypedArray/prototype/fill/fill-values-conversion-operations-consistent-nan.js
index e16bd5c26..80e435b2e 100644
--- a/test/built-ins/TypedArray/prototype/fill/fill-values-conversion-operations-consistent-nan.js
+++ b/test/built-ins/TypedArray/prototype/fill/fill-values-conversion-operations-consistent-nan.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.fill
-es6id: 22.2.3.8
description: Consistent canonicalization of NaN values
info: |
22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] )
@@ -49,6 +48,7 @@ info: |
each implementation distinguishable NaN value.
...
includes: [nans.js, testTypedArray.js, compareArray.js]
+features: [TypedArray]
---*/
function body(FloatArray) {
diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values-conversion-operations.js b/test/built-ins/TypedArray/prototype/fill/fill-values-conversion-operations.js
index 91def14f2..057b33afc 100644
--- a/test/built-ins/TypedArray/prototype/fill/fill-values-conversion-operations.js
+++ b/test/built-ins/TypedArray/prototype/fill/fill-values-conversion-operations.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.fill
-es6id: 22.2.3.8
description: >
Fills all the elements with non numeric values values.
info: |
@@ -45,6 +44,7 @@ info: |
e. Else,
...
includes: [byteConversionValues.js, testTypedArray.js]
+features: [TypedArray]
---*/
testTypedArrayConversions(byteConversionValues, function(TA, value, expected, initial) {
diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values-custom-start-and-end.js b/test/built-ins/TypedArray/prototype/fill/fill-values-custom-start-and-end.js
index 8db9082d4..2a332b54f 100644
--- a/test/built-ins/TypedArray/prototype/fill/fill-values-custom-start-and-end.js
+++ b/test/built-ins/TypedArray/prototype/fill/fill-values-custom-start-and-end.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.fill
-es6id: 22.2.3.8
description: >
Fills all the elements from a with a custom start and end indexes.
info: |
@@ -31,6 +30,7 @@ info: |
final be min(relativeEnd, len).
...
includes: [compareArray.js, testTypedArray.js]
+features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values-non-numeric.js b/test/built-ins/TypedArray/prototype/fill/fill-values-non-numeric.js
index 1d8cd4b6a..b2735c770 100644
--- a/test/built-ins/TypedArray/prototype/fill/fill-values-non-numeric.js
+++ b/test/built-ins/TypedArray/prototype/fill/fill-values-non-numeric.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.fill
-es6id: 22.2.3.8
description: >
Fills all the elements with non numeric values values.
info: |
@@ -59,10 +58,10 @@ testWithTypedArrayConstructors(function(TA) {
sample = new TA([42]);
sample.fill({
toString: function() {
- return 1;
+ return "1";
},
valueOf: function() {
- return 7;
+ return 7;
}
});
assert.sameValue(sample[0], 7, "object valueOf conversion before toString");
@@ -70,7 +69,7 @@ testWithTypedArrayConstructors(function(TA) {
sample = new TA([42]);
sample.fill({
toString: function() {
- return 7;
+ return "7";
}
});
assert.sameValue(sample[0], 7, "object toString when valueOf is absent");
diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values-relative-end.js b/test/built-ins/TypedArray/prototype/fill/fill-values-relative-end.js
index fe0b82d75..4926fdb57 100644
--- a/test/built-ins/TypedArray/prototype/fill/fill-values-relative-end.js
+++ b/test/built-ins/TypedArray/prototype/fill/fill-values-relative-end.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.fill
-es6id: 22.2.3.8
description: >
Fills all the elements from a with a custom end index.
info: |
@@ -28,6 +27,7 @@ info: |
final be min(relativeEnd, len).
...
includes: [compareArray.js, testTypedArray.js]
+features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values-relative-start.js b/test/built-ins/TypedArray/prototype/fill/fill-values-relative-start.js
index 68ca82f00..cb89c951f 100644
--- a/test/built-ins/TypedArray/prototype/fill/fill-values-relative-start.js
+++ b/test/built-ins/TypedArray/prototype/fill/fill-values-relative-start.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.fill
-es6id: 22.2.3.8
description: >
Fills all the elements from a with a custom start index.
info: |
@@ -26,6 +25,7 @@ info: |
min(relativeStart, len).
...
includes: [compareArray.js, testTypedArray.js]
+features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values-symbol-throws.js b/test/built-ins/TypedArray/prototype/fill/fill-values-symbol-throws.js
index 79707d644..be5ca9b5e 100644
--- a/test/built-ins/TypedArray/prototype/fill/fill-values-symbol-throws.js
+++ b/test/built-ins/TypedArray/prototype/fill/fill-values-symbol-throws.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.fill
-es6id: 22.2.3.8
description: >
Throws a TypeError if value is a Symbol
info: |
diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values.js b/test/built-ins/TypedArray/prototype/fill/fill-values.js
index 70da31da6..7d0faa44f 100644
--- a/test/built-ins/TypedArray/prototype/fill/fill-values.js
+++ b/test/built-ins/TypedArray/prototype/fill/fill-values.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.fill
-es6id: 22.2.3.8
description: >
Fills all the elements with `value` from a default start and index.
info: |
@@ -26,6 +25,7 @@ info: |
a. Let Pk be ! ToString(k).
b. Perform ? Set(O, Pk, value, true).
includes: [compareArray.js, testTypedArray.js]
+features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
diff --git a/test/built-ins/TypedArray/prototype/fill/get-length-ignores-length-prop.js b/test/built-ins/TypedArray/prototype/fill/get-length-ignores-length-prop.js
index d3d9723d2..3d5a2340a 100644
--- a/test/built-ins/TypedArray/prototype/fill/get-length-ignores-length-prop.js
+++ b/test/built-ins/TypedArray/prototype/fill/get-length-ignores-length-prop.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.fill
-es6id: 22.2.3.8
description: >
Unreachable abrupt from Get(O, "length") as [[ArrayLength]] is returned.
info: |
diff --git a/test/built-ins/TypedArray/prototype/fill/invoked-as-func.js b/test/built-ins/TypedArray/prototype/fill/invoked-as-func.js
index 200caa130..0215e90fe 100644
--- a/test/built-ins/TypedArray/prototype/fill/invoked-as-func.js
+++ b/test/built-ins/TypedArray/prototype/fill/invoked-as-func.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.8
+esid: sec-%typedarray%.prototype.fill
description: Throws a TypeError exception when invoked as a function
info: |
22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] )
diff --git a/test/built-ins/TypedArray/prototype/fill/invoked-as-method.js b/test/built-ins/TypedArray/prototype/fill/invoked-as-method.js
index b3eb9760a..32d15fce4 100644
--- a/test/built-ins/TypedArray/prototype/fill/invoked-as-method.js
+++ b/test/built-ins/TypedArray/prototype/fill/invoked-as-method.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.8
+esid: sec-%typedarray%.prototype.fill
description: Requires a [[TypedArrayName]] internal slot.
info: |
22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] )
diff --git a/test/built-ins/TypedArray/prototype/fill/length.js b/test/built-ins/TypedArray/prototype/fill/length.js
index 38b5b348c..b6c737535 100644
--- a/test/built-ins/TypedArray/prototype/fill/length.js
+++ b/test/built-ins/TypedArray/prototype/fill/length.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.8
+esid: sec-%typedarray%.prototype.fill
description: >
%TypedArray%.prototype.fill.length is 1.
info: |
@@ -20,6 +20,7 @@ info: |
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
[[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.fill.length, 1);
diff --git a/test/built-ins/TypedArray/prototype/fill/name.js b/test/built-ins/TypedArray/prototype/fill/name.js
index 510c54526..69820f96a 100644
--- a/test/built-ins/TypedArray/prototype/fill/name.js
+++ b/test/built-ins/TypedArray/prototype/fill/name.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.8
+esid: sec-%typedarray%.prototype.fill
description: >
%TypedArray%.prototype.fill.name is "fill".
info: |
@@ -17,6 +17,7 @@ info: |
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.fill.name, "fill");
diff --git a/test/built-ins/TypedArray/prototype/fill/prop-desc.js b/test/built-ins/TypedArray/prototype/fill/prop-desc.js
index d0175e2e5..8cc26d79b 100644
--- a/test/built-ins/TypedArray/prototype/fill/prop-desc.js
+++ b/test/built-ins/TypedArray/prototype/fill/prop-desc.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.8
+esid: sec-%typedarray%.prototype.fill
description: >
"fill" property of TypedArrayPrototype
info: |
@@ -9,6 +9,7 @@ info: |
and in Annex B.2 has the attributes { [[Writable]]: true,
[[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
var TypedArrayPrototype = TypedArray.prototype;
diff --git a/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-end-as-symbol.js b/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-end-as-symbol.js
index 0df2df135..f1a27370b 100644
--- a/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-end-as-symbol.js
+++ b/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-end-as-symbol.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.fill
-es6id: 22.2.3.8
description: >
Return abrupt if end is a Symbol.
info: |
diff --git a/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-end.js b/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-end.js
index 7a90c2888..14646ab64 100644
--- a/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-end.js
+++ b/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-end.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.fill
-es6id: 22.2.3.8
description: >
Return abrupt from ToInteger(end).
info: |
diff --git a/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-set-value.js b/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-set-value.js
index d57b5189c..5702d4e6b 100644
--- a/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-set-value.js
+++ b/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-set-value.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.fill
-es6id: 22.2.3.8
description: >
Returns abrupt from value set
info: |
diff --git a/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-start-as-symbol.js b/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-start-as-symbol.js
index 1eda6669b..e50be1fea 100644
--- a/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-start-as-symbol.js
+++ b/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-start-as-symbol.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.fill
-es6id: 22.2.3.8
description: >
Return abrupt from ToInteger(start) as a Symbol.
info: |
diff --git a/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-start.js b/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-start.js
index 5e4ac67a1..d55177f72 100644
--- a/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-start.js
+++ b/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-start.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.fill
-es6id: 22.2.3.8
description: >
Return abrupt from ToInteger(start).
info: |
diff --git a/test/built-ins/TypedArray/prototype/fill/return-this.js b/test/built-ins/TypedArray/prototype/fill/return-this.js
index 38c91d71a..95ce81f93 100644
--- a/test/built-ins/TypedArray/prototype/fill/return-this.js
+++ b/test/built-ins/TypedArray/prototype/fill/return-this.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.fill
-es6id: 22.2.3.8
description: >
Returns `this`.
includes: [testTypedArray.js]
diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/arraylength-internal.js b/test/built-ins/TypedArray/prototype/filter/BigInt/arraylength-internal.js
new file mode 100644
index 000000000..ecd36aa8a
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/filter/BigInt/arraylength-internal.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.filter
+description: Uses internal ArrayLength instead of length property
+info: |
+ 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )
+
+ ...
+ 3. Let len be the value of O's [[ArrayLength]] internal slot.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var getCalls = 0;
+var desc = {
+ get: function getLen() {
+ getCalls++;
+ return 0;
+ }
+};
+
+Object.defineProperty(TypedArray.prototype, "length", desc);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(4);
+ var calls = 0;
+
+ Object.defineProperty(TA.prototype, "length", desc);
+ Object.defineProperty(sample, "length", desc);
+
+ sample.filter(function() {
+ calls++;
+ });
+
+ assert.sameValue(getCalls, 0, "ignores length properties");
+ assert.sameValue(calls, 4, "interactions are not affected by custom length");
+});
diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-arguments-with-thisarg.js b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-arguments-with-thisarg.js
new file mode 100644
index 000000000..2d32a8a78
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-arguments-with-thisarg.js
@@ -0,0 +1,46 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.filter
+description: >
+ thisArg does not affect callbackfn arguments
+info: |
+ 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )
+
+ ...
+ 9. Repeat, while k < len
+ ...
+ c. Let selected be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n, 44n]);
+
+ var results = [];
+ var thisArg = ["test262", 0, "ecma262", 0];
+
+ sample.filter(function() {
+ results.push(arguments);
+ }, thisArg);
+
+ assert.sameValue(results.length, 3, "results.length");
+ assert.sameValue(thisArg.length, 4, "thisArg.length");
+
+ assert.sameValue(results[0].length, 3, "results[0].length");
+ assert.sameValue(results[0][0], 42n, "results[0][0] - kValue");
+ assert.sameValue(results[0][1], 0, "results[0][1] - k");
+ assert.sameValue(results[0][2], sample, "results[0][2] - this");
+
+ assert.sameValue(results[1].length, 3, "results[1].length");
+ assert.sameValue(results[1][0], 43n, "results[1][0] - kValue");
+ assert.sameValue(results[1][1], 1, "results[1][1] - k");
+ assert.sameValue(results[1][2], sample, "results[1][2] - this");
+
+ assert.sameValue(results[2].length, 3, "results[2].length");
+ assert.sameValue(results[2][0], 44n, "results[2][0] - kValue");
+ assert.sameValue(results[2][1], 2, "results[2][1] - k");
+ assert.sameValue(results[2][2], sample, "results[2][2] - this");
+});
diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-arguments-without-thisarg.js b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-arguments-without-thisarg.js
new file mode 100644
index 000000000..5c9d91b6d
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-arguments-without-thisarg.js
@@ -0,0 +1,44 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.filter
+description: >
+ callbackfn arguments
+info: |
+ 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )
+
+ ...
+ 9. Repeat, while k < len
+ ...
+ c. Let selected be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n, 44n]);
+
+ var results = [];
+
+ sample.filter(function() {
+ results.push(arguments);
+ });
+
+ assert.sameValue(results.length, 3, "results.length");
+
+ assert.sameValue(results[0].length, 3, "results[0].length");
+ assert.sameValue(results[0][0], 42n, "results[0][0] - kValue");
+ assert.sameValue(results[0][1], 0, "results[0][1] - k");
+ assert.sameValue(results[0][2], sample, "results[0][2] - this");
+
+ assert.sameValue(results[1].length, 3, "results[1].length");
+ assert.sameValue(results[1][0], 43n, "results[1][0] - kValue");
+ assert.sameValue(results[1][1], 1, "results[1][1] - k");
+ assert.sameValue(results[1][2], sample, "results[1][2] - this");
+
+ assert.sameValue(results[2].length, 3, "results[2].length");
+ assert.sameValue(results[2][0], 44n, "results[2][0] - kValue");
+ assert.sameValue(results[2][1], 2, "results[2][1] - k");
+ assert.sameValue(results[2][2], sample, "results[2][2] - this");
+});
diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-called-before-ctor.js b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-called-before-ctor.js
new file mode 100644
index 000000000..56c07c040
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-called-before-ctor.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.filter
+description: callbackfn is called for each item before TypedArraySpeciesCreate
+info: |
+ 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )
+
+ ...
+ 9. Repeat, while k < len
+ ...
+ c. Let selected be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)).
+ ...
+ 10. Let A be ? TypedArraySpeciesCreate(O, « captured »).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol.species, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var length = 42;
+ var sample = new TA(length);
+ var calls = 0;
+ var before = false;
+
+ sample.constructor = {};
+ Object.defineProperty(sample, "constructor", {
+ get: function() {
+ before = calls === length;
+ }
+ });
+
+ sample.filter(function() {
+ calls++;
+ });
+
+ assert.sameValue(calls, 42, "callbackfn called for each item");
+ assert.sameValue(before, true, "all callbackfn called before");
+});
diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-called-before-species.js b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-called-before-species.js
new file mode 100644
index 000000000..e99e1b715
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-called-before-species.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.filter
+description: callbackfn is called for each item before TypedArraySpeciesCreate
+info: |
+ 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )
+
+ ...
+ 9. Repeat, while k < len
+ ...
+ c. Let selected be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)).
+ ...
+ 10. Let A be ? TypedArraySpeciesCreate(O, « captured »).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol.species, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var length = 42;
+ var sample = new TA(length);
+ var calls = 0;
+ var before = false;
+
+ sample.constructor = {};
+ Object.defineProperty(sample.constructor, Symbol.species, {
+ get: function() {
+ before = calls === length;
+ }
+ });
+
+ sample.filter(function() {
+ calls++;
+ });
+
+ assert.sameValue(calls, 42, "callbackfn called for each item");
+ assert.sameValue(before, true, "all callbackfn called before");
+});
diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-detachbuffer.js
new file mode 100644
index 000000000..c5bba7c92
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-detachbuffer.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.filter
+description: >
+ Instance buffer can be detached during loop
+info: |
+ 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )
+
+ ...
+ 9. Repeat, while k < len
+ ...
+ b. Let kValue be ? Get(O, Pk).
+ c. Let selected be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)).
+ ...
+includes: [detachArrayBuffer.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var loops = 0;
+ var sample = new TA(2);
+
+ assert.throws(TypeError, function() {
+ sample.filter(function() {
+ if (loops === 1) {
+ throw new Test262Error("callbackfn called twice");
+ }
+ $DETACHBUFFER(sample.buffer);
+ loops++;
+ });
+ });
+
+ assert.sameValue(loops, 1);
+});
diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-no-iteration-over-non-integer.js b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-no-iteration-over-non-integer.js
new file mode 100644
index 000000000..2162cbe16
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-no-iteration-over-non-integer.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.filter
+description: >
+ Does not iterate over non-integer properties
+info: |
+ 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )
+
+ ...
+ 9. Repeat, while k < len
+ ...
+ c. Let selected be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([7n, 8n]);
+
+ var results = [];
+
+ sample.foo = 42;
+ sample[Symbol("1")] = 43;
+
+ sample.filter(function() {
+ results.push(arguments);
+ });
+
+ assert.sameValue(results.length, 2, "results.length");
+
+ assert.sameValue(results[0][1], 0, "results[0][1] - k");
+ assert.sameValue(results[1][1], 1, "results[1][1] - k");
+
+ assert.sameValue(results[0][0], 7n, "results[0][0] - kValue");
+ assert.sameValue(results[1][0], 8n, "results[1][0] - kValue");
+});
diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-not-callable-throws.js b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-not-callable-throws.js
new file mode 100644
index 000000000..6d2c4a71a
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-not-callable-throws.js
@@ -0,0 +1,58 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.filter
+description: Throws TypeError if callbackfn is not callable
+info: |
+ 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )
+
+ ...
+ 4. If IsCallable(callbackfn) is false, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(4);
+
+ assert.throws(TypeError, function() {
+ sample.filter();
+ }, "no arg");
+
+ assert.throws(TypeError, function() {
+ sample.filter(undefined);
+ }, "undefined");
+
+ assert.throws(TypeError, function() {
+ sample.filter(null);
+ }, "null");
+
+ assert.throws(TypeError, function() {
+ sample.filter(true);
+ }, "true");
+
+ assert.throws(TypeError, function() {
+ sample.filter(false);
+ }, "false");
+
+ assert.throws(TypeError, function() {
+ sample.filter({});
+ }, "{}");
+
+ assert.throws(TypeError, function() {
+ sample.filter([]);
+ }, "[]");
+
+ assert.throws(TypeError, function() {
+ sample.filter(1);
+ }, "Number");
+
+ assert.throws(TypeError, function() {
+ sample.filter(Symbol(""));
+ }, "symbol");
+
+ assert.throws(TypeError, function() {
+ sample.filter("");
+ }, "string");
+});
diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-not-called-on-empty.js b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-not-called-on-empty.js
new file mode 100644
index 000000000..47cc032e0
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-not-called-on-empty.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.filter
+description: >
+ callbackfn is not called on empty instances
+info: |
+ 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )
+
+ ...
+ 9. Repeat, while k < len
+ ...
+ c. Let selected be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var called = 0;
+
+ new TA().filter(function() {
+ called++;
+ });
+
+ assert.sameValue(called, 0);
+});
diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-return-does-not-change-instance.js b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-return-does-not-change-instance.js
new file mode 100644
index 000000000..4ace9cecc
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-return-does-not-change-instance.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.filter
+description: >
+ The callbackfn return does not change the instance
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample1 = new TA(3);
+
+ sample1[1] = 1n;
+
+ sample1.filter(function() {
+ return 42;
+ });
+
+ assert.sameValue(sample1[0], 0n, "[0] == 0");
+ assert.sameValue(sample1[1], 1n, "[1] == 1");
+ assert.sameValue(sample1[2], 0n, "[2] == 0");
+});
diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-returns-abrupt.js b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-returns-abrupt.js
new file mode 100644
index 000000000..411b5ef8c
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-returns-abrupt.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.filter
+description: >
+ Returns abrupt from callbackfn
+info: |
+ 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )
+
+ ...
+ 9. Repeat, while k < len
+ ...
+ c. Let selected be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(3);
+
+ assert.throws(Test262Error, function() {
+ sample.filter(function() {
+ throw new Test262Error();
+ });
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-set-value-during-iteration.js b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-set-value-during-iteration.js
new file mode 100644
index 000000000..dbf09b798
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-set-value-during-iteration.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.filter
+description: >
+ Integer indexed values changed during iteration
+info: |
+ 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )
+
+ ...
+ 9. Repeat, while k < len
+ ...
+ c. Let selected be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Reflect.set, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n, 44n]);
+ var newVal = 0n;
+
+ sample.filter(function(val, i) {
+ if (i > 0) {
+ assert.sameValue(
+ sample[i - 1], newVal - 1n,
+ "get the changed value during the loop"
+ );
+ assert.sameValue(
+ Reflect.set(sample, 0, 7n),
+ true,
+ "re-set a value for sample[0]"
+ );
+ }
+ assert.sameValue(
+ Reflect.set(sample, i, newVal),
+ true,
+ "set value during interaction"
+ );
+
+ newVal++;
+ });
+
+ assert.sameValue(sample[0], 7n, "changed values after interaction [0] == 7");
+ assert.sameValue(sample[1], 1n, "changed values after interaction [1] == 1");
+ assert.sameValue(sample[2], 2n, "changed values after interaction [2] == 2");
+});
diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-this.js b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-this.js
new file mode 100644
index 000000000..fc7e0bccb
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-this.js
@@ -0,0 +1,48 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.filter
+description: >
+ callbackfn `this` value
+info: |
+ 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )
+
+ ...
+ 5. If thisArg was supplied, let T be thisArg; else let T be undefined.
+ ...
+ 9. Repeat, while k < len
+ ...
+ c. Let selected be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var expected = (function() { return this; })();
+var thisArg = {};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(3);
+
+ var results1 = [];
+
+ sample.filter(function() {
+ results1.push(this);
+ });
+
+ assert.sameValue(results1.length, 3, "results1");
+ assert.sameValue(results1[0], expected, "without thisArg - [0]");
+ assert.sameValue(results1[1], expected, "without thisArg - [1]");
+ assert.sameValue(results1[2], expected, "without thisArg - [2]");
+
+ var results2 = [];
+
+ sample.filter(function() {
+ results2.push(this);
+ }, thisArg);
+
+ assert.sameValue(results2.length, 3, "results2");
+ assert.sameValue(results2[0], thisArg, "using thisArg - [0]");
+ assert.sameValue(results2[1], thisArg, "using thisArg - [1]");
+ assert.sameValue(results2[2], thisArg, "using thisArg - [2]");
+});
diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/filter/BigInt/detached-buffer.js
new file mode 100644
index 000000000..19539b599
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/filter/BigInt/detached-buffer.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.filter
+description: Throws a TypeError if this has a detached buffer
+info: |
+ 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ ...
+ 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+var callbackfn = function() {
+ throw new Test262Error();
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+ $DETACHBUFFER(sample.buffer);
+ assert.throws(TypeError, function() {
+ sample.filter(callbackfn);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/filter/BigInt/invoked-as-func.js
new file mode 100644
index 000000000..92e9758b5
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/filter/BigInt/invoked-as-func.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.filter
+description: Throws a TypeError exception when invoked as a function
+info: |
+ 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )
+
+ 1. Let O be the this value.
+ 2. Let valid be ValidateTypedArray(O).
+ 3. ReturnIfAbrupt(valid).
+ ...
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var filter = TypedArray.prototype.filter;
+
+assert.sameValue(typeof filter, 'function');
+
+assert.throws(TypeError, function() {
+ filter();
+});
diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/filter/BigInt/invoked-as-method.js
new file mode 100644
index 000000000..18c818b65
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/filter/BigInt/invoked-as-method.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.filter
+description: Requires a [[TypedArrayName]] internal slot.
+info: |
+ 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )
+
+ 1. Let O be the this value.
+ 2. Let valid be ValidateTypedArray(O).
+ 3. ReturnIfAbrupt(valid).
+ ...
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+assert.sameValue(typeof TypedArrayPrototype.filter, 'function');
+
+assert.throws(TypeError, function() {
+ TypedArrayPrototype.filter();
+});
diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/length.js b/test/built-ins/TypedArray/prototype/filter/BigInt/length.js
new file mode 100644
index 000000000..3c0af26ac
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/filter/BigInt/length.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.filter
+description: >
+ %TypedArray%.prototype.filter.length is 1.
+info: |
+ %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, has a length
+ property whose value is an integer. Unless otherwise specified, this
+ value is equal to the largest number of named arguments shown in the
+ subclause headings for the function description, including optional
+ parameters. However, rest parameters shown using the form “...name”
+ are not included in the default argument count.
+
+ Unless otherwise specified, the length property of a built-in Function
+ object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.filter.length, 1);
+
+verifyNotEnumerable(TypedArray.prototype.filter, "length");
+verifyNotWritable(TypedArray.prototype.filter, "length");
+verifyConfigurable(TypedArray.prototype.filter, "length");
diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/name.js b/test/built-ins/TypedArray/prototype/filter/BigInt/name.js
new file mode 100644
index 000000000..4eb3d76b2
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/filter/BigInt/name.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.filter
+description: >
+ %TypedArray%.prototype.filter.name is "filter".
+info: |
+ %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, that is not
+ identified as an anonymous function has a name property whose value
+ is a String.
+
+ Unless otherwise specified, the name property of a built-in Function
+ object, if it exists, has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.filter.name, "filter");
+
+verifyNotEnumerable(TypedArray.prototype.filter, "name");
+verifyNotWritable(TypedArray.prototype.filter, "name");
+verifyConfigurable(TypedArray.prototype.filter, "name");
diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/filter/BigInt/prop-desc.js
new file mode 100644
index 000000000..37c277bcf
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/filter/BigInt/prop-desc.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.filter
+description: >
+ "filter" property of TypedArrayPrototype
+info: |
+ ES6 section 17: Every other data property described in clauses 18 through 26
+ and in Annex B.2 has the attributes { [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+verifyNotEnumerable(TypedArrayPrototype, 'filter');
+verifyWritable(TypedArrayPrototype, 'filter');
+verifyConfigurable(TypedArrayPrototype, 'filter');
diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/result-does-not-share-buffer.js b/test/built-ins/TypedArray/prototype/filter/BigInt/result-does-not-share-buffer.js
new file mode 100644
index 000000000..70c11fca3
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/filter/BigInt/result-does-not-share-buffer.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.filter
+description: >
+ Return does not share buffer
+info: |
+ 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )
+
+ ...
+ 10. Let A be ? TypedArraySpeciesCreate(O, « captured »).
+ ...
+ 13. Return A.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([40n, 41n, 42n]);
+ var result;
+
+ result = sample.filter(function() { return true; });
+ assert.notSameValue(result.buffer, sample.buffer);
+
+ result = sample.filter(function() { return false; });
+ assert.notSameValue(result.buffer, sample.buffer);
+});
diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/result-empty-callbackfn-returns-false.js b/test/built-ins/TypedArray/prototype/filter/BigInt/result-empty-callbackfn-returns-false.js
new file mode 100644
index 000000000..34058a260
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/filter/BigInt/result-empty-callbackfn-returns-false.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.filter
+description: >
+ Returns empty if every callbackfn returns boolean false
+info: |
+ 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )
+
+ ...
+ 12. For each element e of kept
+ a. Perform ! Set(A, ! ToString(n), e, true).
+ b. Increment n by 1.
+ 13. Return A.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(3);
+
+ [
+ false,
+ "",
+ 0,
+ -0,
+ NaN,
+ undefined,
+ null
+ ].forEach(function(val) {
+ var result = sample.filter(function() {
+ return val;
+ });
+ assert.sameValue(result.length, 0, val);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/result-full-callbackfn-returns-true.js b/test/built-ins/TypedArray/prototype/filter/BigInt/result-full-callbackfn-returns-true.js
new file mode 100644
index 000000000..b539ca2ec
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/filter/BigInt/result-full-callbackfn-returns-true.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.filter
+description: >
+ Returns full length result if every callbackfn returns boolean false
+info: |
+ 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )
+
+ ...
+ 12. For each element e of kept
+ a. Perform ! Set(A, ! ToString(n), e, true).
+ b. Increment n by 1.
+ 13. Return A.
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([40n, 41n, 42n]);
+
+ [
+ true,
+ 1,
+ "test262",
+ Symbol("1"),
+ {},
+ [],
+ -1,
+ Infinity,
+ -Infinity,
+ 0.1,
+ -0.1
+ ].forEach(function(val) {
+ var result = sample.filter(function() { return val; });
+ assert(compareArray(result, sample), val);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor-abrupt.js b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor-abrupt.js
new file mode 100644
index 000000000..ea71fee89
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor-abrupt.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.filter
+description: Return abrupt from SpeciesConstructor's get Constructor
+info: |
+ 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )
+
+ ...
+ 10. Let A be ? TypedArraySpeciesCreate(O, « captured »).
+ ...
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor).
+ ...
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+
+ 1. Assert: Type(O) is Object.
+ 2. Let C be ? Get(O, "constructor").
+ 3. If C is undefined, return defaultConstructor.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([40n, 41n, 42n, 43n]);
+
+ Object.defineProperty(sample, "constructor", {
+ get: function() {
+ throw new Test262Error();
+ }
+ });
+
+ assert.throws(Test262Error, function() {
+ sample.filter(function() {
+ return true;
+ });
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor-inherited.js b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor-inherited.js
new file mode 100644
index 000000000..7de9e3d69
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor-inherited.js
@@ -0,0 +1,64 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.filter
+description: get inherited constructor on SpeciesConstructor
+info: |
+ 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )
+
+ ...
+ 10. Let A be ? TypedArraySpeciesCreate(O, « captured »).
+ ...
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor).
+ ...
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+
+ 1. Assert: Type(O) is Object.
+ 2. Let C be ? Get(O, "constructor").
+ 3. If C is undefined, return defaultConstructor.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([40n, 41n, 42n, 43n]);
+ var calls = 0;
+ var result;
+
+ Object.defineProperty(TA.prototype, "constructor", {
+ get: function() {
+ calls++;
+ }
+ });
+
+ result = sample.filter(function() {
+ return true;
+ });
+
+ assert.sameValue(calls, 1, "called custom ctor get accessor once");
+
+ assert.sameValue(
+ Object.getPrototypeOf(result),
+ Object.getPrototypeOf(sample),
+ "use defaultCtor on an undefined return - getPrototypeOf check"
+ );
+ assert.sameValue(
+ result.constructor,
+ undefined,
+ "used defaultCtor but still checks the inherited .constructor"
+ );
+
+ calls = 6;
+ result.constructor;
+ assert.sameValue(
+ calls,
+ 7,
+ "result.constructor triggers the inherited accessor property"
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor-returns-throws.js b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor-returns-throws.js
new file mode 100644
index 000000000..52fb99998
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor-returns-throws.js
@@ -0,0 +1,65 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.filter
+description: >
+ Throws if O.constructor returns a non-Object and non-undefined value
+info: |
+ 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )
+
+ ...
+ 10. Let A be ? TypedArraySpeciesCreate(O, « captured »).
+ ...
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor).
+ ...
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+
+ 1. Assert: Type(O) is Object.
+ 2. Let C be ? Get(O, "constructor").
+ 3. If C is undefined, return defaultConstructor.
+ 4. If Type(C) is not Object, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var callbackfn = function() { return true; };
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([40n, 41n, 42n, 43n]);
+
+ sample.constructor = 42;
+ assert.throws(TypeError, function() {
+ sample.filter(callbackfn);
+ }, "42");
+
+ sample.constructor = "1";
+ assert.throws(TypeError, function() {
+ sample.filter(callbackfn);
+ }, "string");
+
+ sample.constructor = null;
+ assert.throws(TypeError, function() {
+ sample.filter(callbackfn);
+ }, "null");
+
+ sample.constructor = NaN;
+ assert.throws(TypeError, function() {
+ sample.filter(callbackfn);
+ }, "NaN");
+
+ sample.constructor = false;
+ assert.throws(TypeError, function() {
+ sample.filter(callbackfn);
+ }, "false");
+
+ sample.constructor = Symbol("1");
+ assert.throws(TypeError, function() {
+ sample.filter(callbackfn);
+ }, "symbol");
+});
diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor.js b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor.js
new file mode 100644
index 000000000..2fa985b26
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor.js
@@ -0,0 +1,54 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.filter
+description: get constructor on SpeciesConstructor
+info: |
+ 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )
+
+ ...
+ 10. Let A be ? TypedArraySpeciesCreate(O, « captured »).
+ ...
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor).
+ ...
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+
+ 1. Assert: Type(O) is Object.
+ 2. Let C be ? Get(O, "constructor").
+ 3. If C is undefined, return defaultConstructor.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([40n, 41n, 42n, 43n]);
+ var calls = 0;
+ var result;
+
+ Object.defineProperty(sample, "constructor", {
+ get: function() {
+ calls++;
+ }
+ });
+
+ result = sample.filter(function() { return true; });
+
+ assert.sameValue(calls, 1, "called custom ctor get accessor once");
+
+ assert.sameValue(
+ Object.getPrototypeOf(result),
+ Object.getPrototypeOf(sample),
+ "use defaultCtor on an undefined return - getPrototypeOf check"
+ );
+ assert.sameValue(
+ result.constructor,
+ TA,
+ "use defaultCtor on an undefined return - .constructor check"
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-abrupt.js b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-abrupt.js
new file mode 100644
index 000000000..eb585beb7
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-abrupt.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.filter
+description: >
+ Returns abrupt from get @@species on found constructor
+info: |
+ 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )
+
+ ...
+ 10. Let A be ? TypedArraySpeciesCreate(O, « captured »).
+ ...
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor).
+ ...
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+
+ 1. Assert: Type(O) is Object.
+ 2. Let C be ? Get(O, "constructor").
+ ...
+ 5. Let S be ? Get(C, @@species).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol.species, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(2);
+
+ sample.constructor = {};
+
+ Object.defineProperty(sample.constructor, Symbol.species, {
+ get: function() {
+ throw new Test262Error();
+ }
+ });
+
+ assert.throws(Test262Error, function() {
+ sample.filter(function() { return true; });
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-invocation.js b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-invocation.js
new file mode 100644
index 000000000..5b3f2af2b
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-invocation.js
@@ -0,0 +1,59 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.filter
+description: >
+ Verify arguments on custom @@species construct call
+info: |
+ 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )
+
+ ...
+ 10. Let A be ? TypedArraySpeciesCreate(O, « captured »).
+ ...
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor).
+ 4. Return ? TypedArrayCreate(constructor, argumentList).
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+
+ ...
+ 5. Let S be ? Get(C, @@species).
+ ...
+ 7. If IsConstructor(S) is true, return S.
+ ...
+
+ 22.2.4.6 TypedArrayCreate ( constructor, argumentList )
+
+ 1. Let newTypedArray be ? Construct(constructor, argumentList).
+ 2. Perform ? ValidateTypedArray(newTypedArray).
+ 3. If argumentList is a List of a single Number, then
+ ...
+ 4. Return newTypedArray.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol.species, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([40n, 42n, 42n]);
+ var result, ctorThis;
+
+ sample.constructor = {};
+ sample.constructor[Symbol.species] = function(count) {
+ result = arguments;
+ ctorThis = this;
+ return new TA(count);
+ };
+
+ sample.filter(function(v) { return v === 42n; });
+
+ assert.sameValue(result.length, 1, "called with 1 argument");
+ assert.sameValue(result[0], 2, "[0] is the new captured length");
+
+ assert(
+ ctorThis instanceof sample.constructor[Symbol.species],
+ "`this` value in the @@species fn is an instance of the function itself"
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-length-throws.js b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-length-throws.js
new file mode 100644
index 000000000..80b0ea9f9
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-length-throws.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.filter
+description: >
+ Throws a TypeError if new typedArray's length < captured
+info: |
+ 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )
+
+ ...
+ 10. Let A be ? TypedArraySpeciesCreate(O, « captured »).
+ ...
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 4. Return ? TypedArrayCreate(constructor, argumentList).
+
+ 22.2.4.6 TypedArrayCreate ( constructor, argumentList )
+
+ ...
+ 3. If argumentList is a List of a single Number, then
+ a. If the value of newTypedArray's [[ArrayLength]] internal slot <
+ argumentList[0], throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol.species, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(2);
+
+ sample.constructor = {};
+ sample.constructor[Symbol.species] = function() {
+ return new TA();
+ };
+
+ assert.throws(TypeError, function() {
+ sample.filter(function() { return true; });
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-length.js b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-length.js
new file mode 100644
index 000000000..38af74b53
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-length.js
@@ -0,0 +1,46 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.filter
+description: >
+ Does not throw a TypeError if new typedArray's length >= captured
+info: |
+ 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )
+
+ ...
+ 10. Let A be ? TypedArraySpeciesCreate(O, « captured »).
+ ...
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 4. Return ? TypedArrayCreate(constructor, argumentList).
+
+ 22.2.4.6 TypedArrayCreate ( constructor, argumentList )
+
+ ...
+ 3. If argumentList is a List of a single Number, then
+ a. If the value of newTypedArray's [[ArrayLength]] internal slot <
+ argumentList[0], throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol.species, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(2);
+ var customCount, result;
+
+ sample.constructor = {};
+ sample.constructor[Symbol.species] = function() {
+ return new TA(customCount);
+ };
+
+ customCount = 2;
+ result = sample.filter(function() { return true; });
+ assert.sameValue(result.length, customCount, "length == count");
+
+ customCount = 5;
+ result = sample.filter(function() { return true; });
+ assert.sameValue(result.length, customCount, "length > count");
+});
diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js
new file mode 100644
index 000000000..8ad970667
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js
@@ -0,0 +1,54 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.filter
+description: >
+ Custom @@species constructor may return a different TypedArray
+info: |
+ 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )
+
+ ...
+ 10. Let A be ? TypedArraySpeciesCreate(O, « captured »).
+ ...
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor).
+ 4. Return ? TypedArrayCreate(constructor, argumentList).
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+
+ ...
+ 5. Let S be ? Get(C, @@species).
+ ...
+ 7. If IsConstructor(S) is true, return S.
+ ...
+
+ 22.2.4.6 TypedArrayCreate ( constructor, argumentList )
+
+ 1. Let newTypedArray be ? Construct(constructor, argumentList).
+ 2. Perform ? ValidateTypedArray(newTypedArray).
+ 3. If argumentList is a List of a single Number, then
+ ...
+ 4. Return newTypedArray.
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, Symbol.species, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([40n]);
+ var otherTA = TA === Int8Array ? Int16Array : Int8Array;
+ var other = new otherTA([1, 0, 1]);
+ var result;
+
+ sample.constructor = {};
+ sample.constructor[Symbol.species] = function() {
+ return other;
+ };
+
+ result = sample.filter(function() {});
+
+ assert.sameValue(result, other, "returned another typedarray");
+ assert(compareArray(result, [1, 0, 1]), "the returned object is preserved");
+});
diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-throws.js b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-throws.js
new file mode 100644
index 000000000..ae5d33183
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-throws.js
@@ -0,0 +1,46 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.filter
+description: >
+ Custom @@species constructor throws if it does not return a compatible object
+info: |
+ 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )
+
+ ...
+ 10. Let A be ? TypedArraySpeciesCreate(O, « captured »).
+ ...
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor).
+ 4. Return ? TypedArrayCreate(constructor, argumentList).
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+
+ ...
+ 5. Let S be ? Get(C, @@species).
+ ...
+ 7. If IsConstructor(S) is true, return S.
+ ...
+
+ 22.2.4.6 TypedArrayCreate ( constructor, argumentList )
+
+ 1. Let newTypedArray be ? Construct(constructor, argumentList).
+ 2. Perform ? ValidateTypedArray(newTypedArray).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol.species, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(2);
+
+ sample.constructor = {};
+ sample.constructor[Symbol.species] = Array;
+
+ assert.throws(TypeError, function() {
+ sample.filter(function() {});
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor.js b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor.js
new file mode 100644
index 000000000..4e4da9bee
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor.js
@@ -0,0 +1,56 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.filter
+description: >
+ Use custom @@species constructor if available
+info: |
+ 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )
+
+ ...
+ 10. Let A be ? TypedArraySpeciesCreate(O, « captured »).
+ ...
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor).
+ 4. Return ? TypedArrayCreate(constructor, argumentList).
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+
+ ...
+ 5. Let S be ? Get(C, @@species).
+ ...
+ 7. If IsConstructor(S) is true, return S.
+ ...
+
+ 22.2.4.6 TypedArrayCreate ( constructor, argumentList )
+
+ 1. Let newTypedArray be ? Construct(constructor, argumentList).
+ 2. Perform ? ValidateTypedArray(newTypedArray).
+ 3. If argumentList is a List of a single Number, then
+ ...
+ 4. Return newTypedArray.
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, Symbol.species, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([40n, 41n, 42n]);
+ var calls = 0;
+ var other, result;
+
+ sample.constructor = {};
+ sample.constructor[Symbol.species] = function(captured) {
+ calls++;
+ other = new TA(captured);
+ return other;
+ };
+
+ result = sample.filter(function() { return true; });
+
+ assert.sameValue(calls, 1, "ctor called once");
+ assert.sameValue(result, other, "return is instance of custom constructor");
+ assert(compareArray(result, [40n, 41n, 42n]), "values are set on the new obj");
+});
diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-returns-throws.js b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-returns-throws.js
new file mode 100644
index 000000000..12a76cdda
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-returns-throws.js
@@ -0,0 +1,66 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.filter
+description: >
+ Throws if returned @@species is not a constructor, null or undefined.
+info: |
+ 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )
+
+ ...
+ 10. Let A be ? TypedArraySpeciesCreate(O, « captured »).
+ ...
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor).
+ ...
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+
+ ...
+ 5. Let S be ? Get(C, @@species).
+ 6. If S is either undefined or null, return defaultConstructor.
+ 7. If IsConstructor(S) is true, return S.
+ 8. Throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol.species, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(2);
+
+ sample.constructor = {};
+
+ sample.constructor[Symbol.species] = 0;
+ assert.throws(TypeError, function() {
+ sample.filter(function() {});
+ }, "0");
+
+ sample.constructor[Symbol.species] = "string";
+ assert.throws(TypeError, function() {
+ sample.filter(function() {});
+ }, "string");
+
+ sample.constructor[Symbol.species] = {};
+ assert.throws(TypeError, function() {
+ sample.filter(function() {});
+ }, "{}");
+
+ sample.constructor[Symbol.species] = NaN;
+ assert.throws(TypeError, function() {
+ sample.filter(function() {});
+ }, "NaN");
+
+ sample.constructor[Symbol.species] = false;
+ assert.throws(TypeError, function() {
+ sample.filter(function() {});
+ }, "false");
+
+ sample.constructor[Symbol.species] = true;
+ assert.throws(TypeError, function() {
+ sample.filter(function() {});
+ }, "true");
+});
diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-use-default-ctor.js b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-use-default-ctor.js
new file mode 100644
index 000000000..9ecb72b05
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-use-default-ctor.js
@@ -0,0 +1,54 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.filter
+description: >
+ Use defaultConstructor if @@species is either undefined or null
+info: |
+ 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )
+
+ ...
+ 10. Let A be ? TypedArraySpeciesCreate(O, « captured »).
+ ...
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor).
+ ...
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+
+ ...
+ 5. Let S be ? Get(C, @@species).
+ 6. If S is either undefined or null, return defaultConstructor.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol.species, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(2);
+ var result;
+
+ sample.constructor = {};
+
+ result = sample.filter(function() {});
+
+ assert.sameValue(
+ Object.getPrototypeOf(result),
+ Object.getPrototypeOf(sample),
+ "undefined @@species - prototype check "
+ );
+ assert.sameValue(result.constructor, TA, "undefined @@species - ctor check");
+
+ sample.constructor[Symbol.species] = null;
+ result = sample.filter(function() {});
+
+ assert.sameValue(
+ Object.getPrototypeOf(result),
+ Object.getPrototypeOf(sample),
+ "null @@species - prototype check "
+ );
+ assert.sameValue(result.constructor, TA, "null @@species - ctor check");
+});
diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species.js b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species.js
new file mode 100644
index 000000000..04e413a38
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species.js
@@ -0,0 +1,46 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.filter
+description: >
+ get @@species from found constructor
+info: |
+ 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )
+
+ ...
+ 10. Let A be ? TypedArraySpeciesCreate(O, « captured »).
+ ...
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor).
+ ...
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+
+ 1. Assert: Type(O) is Object.
+ 2. Let C be ? Get(O, "constructor").
+ ...
+ 5. Let S be ? Get(C, @@species).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol.species, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(2);
+ var calls = 0;
+
+ sample.constructor = {};
+
+ Object.defineProperty(sample.constructor, Symbol.species, {
+ get: function() {
+ calls++;
+ }
+ });
+
+ sample.filter(function() {});
+
+ assert.sameValue(calls, 1);
+});
diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/filter/BigInt/this-is-not-object.js
new file mode 100644
index 000000000..0a8a31a27
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/filter/BigInt/this-is-not-object.js
@@ -0,0 +1,53 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.filter
+description: Throws a TypeError exception when `this` is not Object
+info: |
+ 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )
+
+ The following steps are taken:
+
+ 1. Let O be the this value.
+ 2. Perform ? ValidateTypedArray(O).
+ ...
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var filter = TypedArray.prototype.filter;
+var callbackfn = function() {};
+
+assert.throws(TypeError, function() {
+ filter.call(undefined, callbackfn);
+}, "this is undefined");
+
+assert.throws(TypeError, function() {
+ filter.call(null, callbackfn);
+}, "this is null");
+
+assert.throws(TypeError, function() {
+ filter.call(42, callbackfn);
+}, "this is 42");
+
+assert.throws(TypeError, function() {
+ filter.call("1", callbackfn);
+}, "this is a string");
+
+assert.throws(TypeError, function() {
+ filter.call(true, callbackfn);
+}, "this is true");
+
+assert.throws(TypeError, function() {
+ filter.call(false, callbackfn);
+}, "this is false");
+
+var s = Symbol("s");
+assert.throws(TypeError, function() {
+ filter.call(s, callbackfn);
+}, "this is a Symbol");
diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/filter/BigInt/this-is-not-typedarray-instance.js
new file mode 100644
index 000000000..4bb60e605
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/filter/BigInt/this-is-not-typedarray-instance.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.filter
+description: >
+ Throws a TypeError exception when `this` is not a TypedArray instance
+info: |
+ 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )
+
+ The following steps are taken:
+
+ 1. Let O be the this value.
+ 2. Perform ? ValidateTypedArray(O).
+ ...
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var filter = TypedArray.prototype.filter;
+var callbackfn = function() {};
+
+assert.throws(TypeError, function() {
+ filter.call({}, callbackfn);
+}, "this is an Object");
+
+assert.throws(TypeError, function() {
+ filter.call([], callbackfn);
+}, "this is an Array");
+
+var ab = new ArrayBuffer(8);
+assert.throws(TypeError, function() {
+ filter.call(ab, callbackfn);
+}, "this is an ArrayBuffer instance");
+
+var dv = new DataView(new ArrayBuffer(8), 0, 1);
+assert.throws(TypeError, function() {
+ filter.call(dv, callbackfn);
+}, "this is a DataView instance");
diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/values-are-not-cached.js b/test/built-ins/TypedArray/prototype/filter/BigInt/values-are-not-cached.js
new file mode 100644
index 000000000..d2a982a31
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/filter/BigInt/values-are-not-cached.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.filter
+description: >
+ Integer indexed values are not cached before interaction
+info: |
+ 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )
+
+ ...
+ 9. Repeat, while k < len
+ ...
+ c. Let selected be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n, 44n]);
+
+ sample.filter(function(v, i) {
+ if (i < sample.length - 1) {
+ sample[i+1] = 42n;
+ }
+
+ assert.sameValue(
+ v, 42n, "method does not cache values before callbackfn calls"
+ );
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/values-are-set.js b/test/built-ins/TypedArray/prototype/filter/BigInt/values-are-set.js
new file mode 100644
index 000000000..49c65cacf
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/filter/BigInt/values-are-set.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.filter
+description: >
+ Returned instance with filtered values set on it
+info: |
+ 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )
+
+ ...
+ 12. For each element e of kept
+ a. Perform ! Set(A, ! ToString(n), e, true).
+ b. Increment n by 1.
+ 13. Return A.
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([41n, 1n, 42n, 7n]);
+ var result;
+
+ result = sample.filter(function() { return true; });
+ assert(compareArray(result, [41n, 1n, 42n, 7n]), "values are set #1");
+
+ result = sample.filter(function(v) {
+ return v > 40n;
+ });
+ assert(compareArray(result, [41n, 42n]), "values are set #2");
+});
diff --git a/test/built-ins/TypedArray/prototype/filter/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/filter/callbackfn-detachbuffer.js
index ad57fcc22..1e2251472 100644
--- a/test/built-ins/TypedArray/prototype/filter/callbackfn-detachbuffer.js
+++ b/test/built-ins/TypedArray/prototype/filter/callbackfn-detachbuffer.js
@@ -14,6 +14,7 @@ info: |
c. Let selected be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)).
...
includes: [detachArrayBuffer.js, testTypedArray.js]
+features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
diff --git a/test/built-ins/TypedArray/prototype/filter/invoked-as-func.js b/test/built-ins/TypedArray/prototype/filter/invoked-as-func.js
index 0328929f7..fe9a12384 100644
--- a/test/built-ins/TypedArray/prototype/filter/invoked-as-func.js
+++ b/test/built-ins/TypedArray/prototype/filter/invoked-as-func.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.9
+esid: sec-%typedarray%.prototype.filter
description: Throws a TypeError exception when invoked as a function
info: |
22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )
diff --git a/test/built-ins/TypedArray/prototype/filter/invoked-as-method.js b/test/built-ins/TypedArray/prototype/filter/invoked-as-method.js
index 74c7f5c0e..9509bf1ea 100644
--- a/test/built-ins/TypedArray/prototype/filter/invoked-as-method.js
+++ b/test/built-ins/TypedArray/prototype/filter/invoked-as-method.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.9
+esid: sec-%typedarray%.prototype.filter
description: Requires a [[TypedArrayName]] internal slot.
info: |
22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )
diff --git a/test/built-ins/TypedArray/prototype/filter/length.js b/test/built-ins/TypedArray/prototype/filter/length.js
index 8734db0ff..62a72cfa9 100644
--- a/test/built-ins/TypedArray/prototype/filter/length.js
+++ b/test/built-ins/TypedArray/prototype/filter/length.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.9
+esid: sec-%typedarray%.prototype.filter
description: >
%TypedArray%.prototype.filter.length is 1.
info: |
@@ -20,6 +20,7 @@ info: |
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
[[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.filter.length, 1);
diff --git a/test/built-ins/TypedArray/prototype/filter/name.js b/test/built-ins/TypedArray/prototype/filter/name.js
index d9b31ac0f..069c0adc6 100644
--- a/test/built-ins/TypedArray/prototype/filter/name.js
+++ b/test/built-ins/TypedArray/prototype/filter/name.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.9
+esid: sec-%typedarray%.prototype.filter
description: >
%TypedArray%.prototype.filter.name is "filter".
info: |
@@ -17,6 +17,7 @@ info: |
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.filter.name, "filter");
diff --git a/test/built-ins/TypedArray/prototype/filter/prop-desc.js b/test/built-ins/TypedArray/prototype/filter/prop-desc.js
index 4d0715e68..b9dc5886d 100644
--- a/test/built-ins/TypedArray/prototype/filter/prop-desc.js
+++ b/test/built-ins/TypedArray/prototype/filter/prop-desc.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.9
+esid: sec-%typedarray%.prototype.filter
description: >
"filter" property of TypedArrayPrototype
info: |
@@ -9,6 +9,7 @@ info: |
and in Annex B.2 has the attributes { [[Writable]]: true,
[[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
var TypedArrayPrototype = TypedArray.prototype;
diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/find/BigInt/detached-buffer.js
new file mode 100644
index 000000000..f3cfaeb3e
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/find/BigInt/detached-buffer.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.find
+description: Throws a TypeError if this has a detached buffer
+info: |
+ 22.2.3.10 %TypedArray%.prototype.find (predicate [ , thisArg ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ ...
+ 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+var predicate = function() {
+ throw new Test262Error();
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+ $DETACHBUFFER(sample.buffer);
+ assert.throws(TypeError, function() {
+ sample.find(predicate);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/get-length-ignores-length-prop.js b/test/built-ins/TypedArray/prototype/find/BigInt/get-length-ignores-length-prop.js
new file mode 100644
index 000000000..ebdbdf05e
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/find/BigInt/get-length-ignores-length-prop.js
@@ -0,0 +1,54 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.find
+description: >
+ [[Get]] of "length" uses [[ArrayLength]]
+info: |
+ 22.2.3.10 %TypedArray%.prototype.find (predicate [ , thisArg ] )
+
+ %TypedArray%.prototype.find is a distinct function that implements the same
+ algorithm as Array.prototype.find as defined in 22.1.3.8 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length". The implementation of the algorithm may be optimized with
+ the knowledge that the this value is an object that has a fixed length and
+ whose integer indexed properties are not sparse.
+
+ ...
+
+ 22.1.3.8 Array.prototype.find ( predicate[ , thisArg ] )
+
+ ...
+ 2. Let len be ? ToLength(? Get(O, "length")).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+Object.defineProperty(TypedArray.prototype, "length", {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ Object.defineProperty(TA.prototype, "length", {
+ get: function() {
+ throw new Test262Error();
+ }
+ });
+
+ var sample = new TA([42n]);
+
+ Object.defineProperty(sample, "length", {
+ get: function() {
+ throw new Test262Error();
+ },
+ configurable: true
+ });
+
+ assert.sameValue(
+ sample.find(function() { return true; }),
+ 42n
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/find/BigInt/invoked-as-func.js
new file mode 100644
index 000000000..088c3398a
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/find/BigInt/invoked-as-func.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.find
+description: Throws a TypeError exception when invoked as a function
+info: |
+ 22.2.3.10 %TypedArray%.prototype.find (predicate [ , thisArg ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var find = TypedArray.prototype.find;
+
+assert.sameValue(typeof find, 'function');
+
+assert.throws(TypeError, function() {
+ find();
+});
diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/find/BigInt/invoked-as-method.js
new file mode 100644
index 000000000..7bb3bb741
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/find/BigInt/invoked-as-method.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.find
+description: Requires a [[TypedArrayName]] internal slot.
+info: |
+ 22.2.3.10 %TypedArray%.prototype.find (predicate [ , thisArg ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+assert.sameValue(typeof TypedArrayPrototype.find, 'function');
+
+assert.throws(TypeError, function() {
+ TypedArrayPrototype.find();
+});
diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/length.js b/test/built-ins/TypedArray/prototype/find/BigInt/length.js
new file mode 100644
index 000000000..9c8cdcacc
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/find/BigInt/length.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.find
+description: >
+ %TypedArray%.prototype.find.length is 1.
+info: |
+ %TypedArray%.prototype.find (predicate [ , thisArg ] )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, has a length
+ property whose value is an integer. Unless otherwise specified, this
+ value is equal to the largest number of named arguments shown in the
+ subclause headings for the function description, including optional
+ parameters. However, rest parameters shown using the form “...name”
+ are not included in the default argument count.
+
+ Unless otherwise specified, the length property of a built-in Function
+ object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.find.length, 1);
+
+verifyNotEnumerable(TypedArray.prototype.find, "length");
+verifyNotWritable(TypedArray.prototype.find, "length");
+verifyConfigurable(TypedArray.prototype.find, "length");
diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/name.js b/test/built-ins/TypedArray/prototype/find/BigInt/name.js
new file mode 100644
index 000000000..c84053e8e
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/find/BigInt/name.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.find
+description: >
+ %TypedArray%.prototype.find.name is "find".
+info: |
+ %TypedArray%.prototype.find (predicate [ , thisArg ] )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, that is not
+ identified as an anonymous function has a name property whose value
+ is a String.
+
+ Unless otherwise specified, the name property of a built-in Function
+ object, if it exists, has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.find.name, "find");
+
+verifyNotEnumerable(TypedArray.prototype.find, "name");
+verifyNotWritable(TypedArray.prototype.find, "name");
+verifyConfigurable(TypedArray.prototype.find, "name");
diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-changes-value.js b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-changes-value.js
new file mode 100644
index 000000000..86be70f05
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-changes-value.js
@@ -0,0 +1,78 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.find
+description: >
+ Change values during predicate call
+info: |
+ 22.2.3.10 %TypedArray%.prototype.find (predicate [ , thisArg ] )
+
+ %TypedArray%.prototype.find is a distinct function that implements the same
+ algorithm as Array.prototype.find as defined in 22.1.3.8 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length". The implementation of the algorithm may be optimized with
+ the knowledge that the this value is an object that has a fixed length and
+ whose integer indexed properties are not sparse.
+
+ ...
+
+ 22.1.3.8 Array.prototype.find ( predicate[ , thisArg ] )
+
+ ...
+ 4. If thisArg was supplied, let T be thisArg; else let T be undefined.
+ 5. Let k be 0.
+ 6. Repeat, while k < len
+ ...
+ c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
+ ...
+includes: [compareArray.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var arr = [1n, 2n, 3n];
+ var sample;
+ var result;
+
+ sample = new TA(3);
+ sample.find(function(val, i) {
+ sample[i] = arr[i];
+
+ assert.sameValue(val, 0n, "value is not mapped to instance");
+ });
+ assert(compareArray(sample, arr), "values set during each predicate call");
+
+ sample = new TA(arr);
+ result = sample.find(function(val, i) {
+ if ( i === 0 ) {
+ sample[2] = 7n;
+ }
+ return val === 7n;
+ });
+ assert.sameValue(result, 7n, "value found");
+
+ sample = new TA(arr);
+ result = sample.find(function(val, i) {
+ if ( i === 0 ) {
+ sample[2] = 7n;
+ }
+ return val === 3n;
+ });
+ assert.sameValue(result, undefined, "value not found");
+
+ sample = new TA(arr);
+ result = sample.find(function(val, i) {
+ if ( i > 0 ) {
+ sample[0] = 7n;
+ }
+ return val === 7n;
+ });
+ assert.sameValue(result, undefined, "value not found - changed after call");
+
+ sample = new TA(arr);
+ result = sample.find(function() {
+ sample[0] = 7n;
+ return true;
+ });
+ assert.sameValue(result, 1n, "find() returns previous found value");
+});
diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-parameters.js b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-parameters.js
new file mode 100644
index 000000000..8fc8c558b
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-parameters.js
@@ -0,0 +1,62 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.find
+description: >
+ Predicate called as F.call( thisArg, kValue, k, O ) for each array entry.
+info: |
+ 22.2.3.10 %TypedArray%.prototype.find (predicate [ , thisArg ] )
+
+ %TypedArray%.prototype.find is a distinct function that implements the same
+ algorithm as Array.prototype.find as defined in 22.1.3.8 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length". The implementation of the algorithm may be optimized with
+ the knowledge that the this value is an object that has a fixed length and
+ whose integer indexed properties are not sparse.
+
+ ...
+
+ 22.1.3.8 Array.prototype.find ( predicate[ , thisArg ] )
+
+ ...
+ 4. If thisArg was supplied, let T be thisArg; else let T be undefined.
+ 5. Let k be 0.
+ 6. Repeat, while k < len
+ ...
+ c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([39n, 2n, 62n]);
+ var results = [];
+ var result;
+
+ sample.foo = "bar"; // Ignores non integer index properties
+
+ sample.find(function() {
+ results.push(arguments);
+ });
+
+ assert.sameValue(results.length, 3, "predicate is called for each index");
+
+ result = results[0];
+ assert.sameValue(result[0], 39n, "results[0][0] === 39, value");
+ assert.sameValue(result[1], 0, "results[0][1] === 0, index");
+ assert.sameValue(result[2], sample, "results[0][2] === sample, instance");
+ assert.sameValue(result.length, 3, "results[0].length === 3 arguments");
+
+ result = results[1];
+ assert.sameValue(result[0], 2n, "results[1][0] === 2, value");
+ assert.sameValue(result[1], 1, "results[1][1] === 1, index");
+ assert.sameValue(result[2], sample, "results[1][2] === sample, instance");
+ assert.sameValue(result.length, 3, "results[1].length === 3 arguments");
+
+ result = results[2];
+ assert.sameValue(result[0], 62n, "results[2][0] === 62, value");
+ assert.sameValue(result[1], 2, "results[2][1] === 2, index");
+ assert.sameValue(result[2], sample, "results[2][2] === sample, instance");
+ assert.sameValue(result.length, 3, "results[2].length === 3 arguments");
+});
diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-this-non-strict.js b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-this-non-strict.js
new file mode 100644
index 000000000..882bd21af
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-this-non-strict.js
@@ -0,0 +1,59 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.find
+description: >
+ Verify predicate this on non-strict mode
+info: |
+ 22.2.3.10 %TypedArray%.prototype.find (predicate [ , thisArg ] )
+
+ %TypedArray%.prototype.find is a distinct function that implements the same
+ algorithm as Array.prototype.find as defined in 22.1.3.8 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length". The implementation of the algorithm may be optimized with
+ the knowledge that the this value is an object that has a fixed length and
+ whose integer indexed properties are not sparse.
+
+ ...
+
+ 22.1.3.8 Array.prototype.find ( predicate[ , thisArg ] )
+
+ ...
+ 4. If thisArg was supplied, let T be thisArg; else let T be undefined.
+ ...
+ 6. Repeat, while k < len
+ ...
+ c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
+ ...
+flags: [noStrict]
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var T = this;
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+ var result;
+
+ sample.find(function() {
+ result = this;
+ });
+
+ assert.sameValue(result, T, "without thisArg, predicate this is the global");
+
+ result = null;
+ sample.find(function() {
+ result = this;
+ }, undefined);
+
+ assert.sameValue(result, T, "predicate this is the global when thisArg is undefined");
+
+ var o = {};
+ result = null;
+ sample.find(function() {
+ result = this;
+ }, o);
+
+ assert.sameValue(result, o, "thisArg becomes the predicate this");
+});
diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-this-strict.js b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-this-strict.js
new file mode 100644
index 000000000..b7ce4535d
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-this-strict.js
@@ -0,0 +1,53 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.find
+description: >
+ Verify predicate this on strict mode
+info: |
+ 22.2.3.10 %TypedArray%.prototype.find (predicate [ , thisArg ] )
+
+ %TypedArray%.prototype.find is a distinct function that implements the same
+ algorithm as Array.prototype.find as defined in 22.1.3.8 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length". The implementation of the algorithm may be optimized with
+ the knowledge that the this value is an object that has a fixed length and
+ whose integer indexed properties are not sparse.
+
+ ...
+
+ 22.1.3.8 Array.prototype.find ( predicate[ , thisArg ] )
+
+ ...
+ 4. If thisArg was supplied, let T be thisArg; else let T be undefined.
+ ...
+ 6. Repeat, while k < len
+ ...
+ c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
+ ...
+flags: [onlyStrict]
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+ var result;
+
+ sample.find(function() {
+ result = this;
+ });
+
+ assert.sameValue(
+ result,
+ undefined,
+ "without thisArg, predicate this is undefined"
+ );
+
+ var o = {};
+ sample.find(function() {
+ result = this;
+ }, o);
+
+ assert.sameValue(result, o, "thisArg becomes the predicate this");
+});
diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/predicate-is-not-callable-throws.js b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-is-not-callable-throws.js
new file mode 100644
index 000000000..b579dfa11
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-is-not-callable-throws.js
@@ -0,0 +1,66 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.find
+description: >
+ Throws a TypeError exception if predicate is not callable.
+info: |
+ 22.2.3.10 %TypedArray%.prototype.find (predicate [ , thisArg ] )
+
+ %TypedArray%.prototype.find is a distinct function that implements the same
+ algorithm as Array.prototype.find as defined in 22.1.3.8 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length". The implementation of the algorithm may be optimized with
+ the knowledge that the this value is an object that has a fixed length and
+ whose integer indexed properties are not sparse.
+
+ ...
+
+ 22.1.3.8 Array.prototype.find ( predicate[ , thisArg ] )
+
+ ...
+ 3. If IsCallable(predicate) is false, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA();
+
+ assert.throws(TypeError, function() {
+ sample.find({});
+ }, "object");
+
+ assert.throws(TypeError, function() {
+ sample.find(null);
+ }, "null");
+
+ assert.throws(TypeError, function() {
+ sample.find(undefined);
+ }, "undefined");
+
+ assert.throws(TypeError, function() {
+ sample.find(false);
+ }, "false");
+
+ assert.throws(TypeError, function() {
+ sample.find(true);
+ }, "true");
+
+ assert.throws(TypeError, function() {
+ sample.find(1);
+ }, "number");
+
+ assert.throws(TypeError, function() {
+ sample.find("");
+ }, "string");
+
+ assert.throws(TypeError, function() {
+ sample.find([]);
+ }, "array");
+
+ assert.throws(TypeError, function() {
+ sample.find(/./);
+ }, "regexp");
+});
diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/predicate-may-detach-buffer.js b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-may-detach-buffer.js
new file mode 100644
index 000000000..49e58ac61
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-may-detach-buffer.js
@@ -0,0 +1,58 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.find
+description: >
+ Predicate may detach the buffer
+info: |
+ 22.2.3.10 %TypedArray%.prototype.find (predicate [ , thisArg ] )
+
+ %TypedArray%.prototype.find is a distinct function that implements the same
+ algorithm as Array.prototype.find as defined in 22.1.3.8
+
+ ...
+
+ However, such optimization must not introduce any observable changes in the
+ specified behaviour of the algorithm and must take into account the
+ possibility that calls to predicate may cause the this value to become
+ detached.
+
+ ...
+
+ 22.1.3.8 Array.prototype.find ( predicate[ , thisArg ] )
+
+ ...
+ 4. If thisArg was supplied, let T be thisArg; else let T be undefined.
+ 5. Let k be 0.
+ 6. Repeat, while k < len
+ ...
+ b. Let kValue be ? Get(O, Pk).
+ c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
+ ...
+
+ 9.4.5.8 IntegerIndexedElementGet ( O, index )
+
+ ...
+ 3. Let buffer be the value of O's [[ViewedArrayBuffer]] internal slot.
+ 4. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(2);
+ var loops = 0;
+ var completion = false;
+
+ assert.throws(TypeError, function() {
+ sample.find(function() {
+ loops++;
+ $DETACHBUFFER(sample.buffer);
+ completion = true;
+ });
+ }, "throws a TypeError getting a value from the detached buffer");
+
+ assert.sameValue(loops, 1, "predicate is called once");
+ assert(completion, "abrupt completion does not come from DETACHBUFFER");
+});
diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/predicate-not-called-on-empty-array.js b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-not-called-on-empty-array.js
new file mode 100644
index 000000000..230aff544
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-not-called-on-empty-array.js
@@ -0,0 +1,49 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.find
+description: >
+ Predicate is not called on empty instances
+info: |
+ 22.2.3.10 %TypedArray%.prototype.find (predicate [ , thisArg ] )
+
+ %TypedArray%.prototype.find is a distinct function that implements the same
+ algorithm as Array.prototype.find as defined in 22.1.3.8 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length". The implementation of the algorithm may be optimized with
+ the knowledge that the this value is an object that has a fixed length and
+ whose integer indexed properties are not sparse.
+
+ ...
+
+ 22.1.3.8 Array.prototype.find ( predicate[ , thisArg ] )
+
+ ...
+ 6. Repeat, while k < len
+ ...
+ c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA();
+ var called = false;
+
+ var result = sample.find(function() {
+ called = true;
+ return true;
+ });
+
+ assert.sameValue(
+ called,
+ false,
+ "empty instance does not call predicate"
+ );
+ assert.sameValue(
+ result,
+ undefined,
+ "find returns undefined when predicate is not called"
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/find/BigInt/prop-desc.js
new file mode 100644
index 000000000..e2c5e7e9d
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/find/BigInt/prop-desc.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.find
+description: >
+ "find" property of TypedArrayPrototype
+info: |
+ ES6 section 17: Every other data property described in clauses 18 through 26
+ and in Annex B.2 has the attributes { [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+verifyNotEnumerable(TypedArrayPrototype, 'find');
+verifyWritable(TypedArrayPrototype, 'find');
+verifyConfigurable(TypedArrayPrototype, 'find');
diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/return-abrupt-from-predicate-call.js b/test/built-ins/TypedArray/prototype/find/BigInt/return-abrupt-from-predicate-call.js
new file mode 100644
index 000000000..0f693f4a2
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/find/BigInt/return-abrupt-from-predicate-call.js
@@ -0,0 +1,40 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.find
+description: >
+ Return abrupt from predicate call.
+info: |
+ 22.2.3.10 %TypedArray%.prototype.find (predicate [ , thisArg ] )
+
+ %TypedArray%.prototype.find is a distinct function that implements the same
+ algorithm as Array.prototype.find as defined in 22.1.3.8 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length". The implementation of the algorithm may be optimized with
+ the knowledge that the this value is an object that has a fixed length and
+ whose integer indexed properties are not sparse.
+
+ ...
+
+ 22.1.3.8 Array.prototype.find ( predicate[ , thisArg ] )
+
+ ...
+ 6. Repeat, while k < len
+ ...
+ c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+
+ var predicate = function() {
+ throw new Test262Error();
+ };
+
+ assert.throws(Test262Error, function() {
+ sample.find(predicate);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/return-found-value-predicate-result-is-true.js b/test/built-ins/TypedArray/prototype/find/BigInt/return-found-value-predicate-result-is-true.js
new file mode 100644
index 000000000..32ea9abd1
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/find/BigInt/return-found-value-predicate-result-is-true.js
@@ -0,0 +1,65 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.find
+description: >
+ Return found value if predicate return a boolean true value.
+info: |
+ 22.2.3.10 %TypedArray%.prototype.find (predicate [ , thisArg ] )
+
+ %TypedArray%.prototype.find is a distinct function that implements the same
+ algorithm as Array.prototype.find as defined in 22.1.3.8 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length". The implementation of the algorithm may be optimized with
+ the knowledge that the this value is an object that has a fixed length and
+ whose integer indexed properties are not sparse.
+
+ ...
+
+ 22.1.3.8 Array.prototype.find ( predicate[ , thisArg ] )
+
+ ...
+ 6. Repeat, while k < len
+ ...
+ c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
+ d. If testResult is true, return kValue.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([39n, 2n, 62n]);
+ var called, result;
+
+ called = 0;
+ result = sample.find(function() {
+ called++;
+ return true;
+ });
+ assert.sameValue(result, 39n, "returned true on sample[0]");
+ assert.sameValue(called, 1, "predicate was called once");
+
+ called = 0;
+ result = sample.find(function(val) {
+ called++;
+ return val === 62n;
+ });
+ assert.sameValue(called, 3, "predicate was called three times");
+ assert.sameValue(result, 62n, "returned true on sample[3]");
+
+ result = sample.find(function() { return "string"; });
+ assert.sameValue(result, 39n, "ToBoolean(string)");
+
+ result = sample.find(function() { return {}; });
+ assert.sameValue(result, 39n, "ToBoolean(object)");
+
+ result = sample.find(function() { return Symbol(""); });
+ assert.sameValue(result, 39n, "ToBoolean(symbol)");
+
+ result = sample.find(function() { return 1; });
+ assert.sameValue(result, 39n, "ToBoolean(number)");
+
+ result = sample.find(function() { return -1; });
+ assert.sameValue(result, 39n, "ToBoolean(negative number)");
+});
diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/return-undefined-if-predicate-returns-false-value.js b/test/built-ins/TypedArray/prototype/find/BigInt/return-undefined-if-predicate-returns-false-value.js
new file mode 100644
index 000000000..2c8e2d1c3
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/find/BigInt/return-undefined-if-predicate-returns-false-value.js
@@ -0,0 +1,60 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.find
+description: >
+ Return undefined if predicate always returns a boolean false value.
+info: |
+ 22.2.3.10 %TypedArray%.prototype.find (predicate [ , thisArg ] )
+
+ %TypedArray%.prototype.find is a distinct function that implements the same
+ algorithm as Array.prototype.find as defined in 22.1.3.8 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length". The implementation of the algorithm may be optimized with
+ the knowledge that the this value is an object that has a fixed length and
+ whose integer indexed properties are not sparse.
+
+ ...
+
+ 22.1.3.8 Array.prototype.find ( predicate[ , thisArg ] )
+
+ ...
+ 6. Repeat, while k < len
+ ...
+ c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
+ ...
+ 7. Return undefined.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(3);
+ var called = 0;
+
+ var result = sample.find(function() {
+ called++;
+ return false;
+ });
+
+ assert.sameValue(called, 3, "predicate was called three times");
+ assert.sameValue(result, undefined);
+
+ result = sample.find(function() { return ""; });
+ assert.sameValue(result, undefined, "ToBoolean(empty string)");
+
+ result = sample.find(function() { return undefined; });
+ assert.sameValue(result, undefined, "ToBoolean(undefined)");
+
+ result = sample.find(function() { return null; });
+ assert.sameValue(result, undefined, "ToBoolean(null)");
+
+ result = sample.find(function() { return 0; });
+ assert.sameValue(result, undefined, "ToBoolean(0)");
+
+ result = sample.find(function() { return -0; });
+ assert.sameValue(result, undefined, "ToBoolean(-0)");
+
+ result = sample.find(function() { return NaN; });
+ assert.sameValue(result, undefined, "ToBoolean(NaN)");
+});
diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/find/BigInt/this-is-not-object.js
new file mode 100644
index 000000000..149306352
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/find/BigInt/this-is-not-object.js
@@ -0,0 +1,51 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.find
+description: Throws a TypeError exception when `this` is not Object
+info: |
+ 22.2.3.10 %TypedArray%.prototype.find (predicate [ , thisArg ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var find = TypedArray.prototype.find;
+var predicate = function() {};
+
+assert.throws(TypeError, function() {
+ find.call(undefined, predicate);
+}, "this is undefined");
+
+assert.throws(TypeError, function() {
+ find.call(null, predicate);
+}, "this is null");
+
+assert.throws(TypeError, function() {
+ find.call(42, predicate);
+}, "this is 42");
+
+assert.throws(TypeError, function() {
+ find.call("1", predicate);
+}, "this is a string");
+
+assert.throws(TypeError, function() {
+ find.call(true, predicate);
+}, "this is true");
+
+assert.throws(TypeError, function() {
+ find.call(false, predicate);
+}, "this is false");
+
+var s = Symbol("s");
+assert.throws(TypeError, function() {
+ find.call(s, predicate);
+}, "this is a Symbol");
diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/find/BigInt/this-is-not-typedarray-instance.js
new file mode 100644
index 000000000..957be1152
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/find/BigInt/this-is-not-typedarray-instance.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.find
+description: >
+ Throws a TypeError exception when `this` is not a TypedArray instance
+info: |
+ 22.2.3.10 %TypedArray%.prototype.find (predicate [ , thisArg ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var find = TypedArray.prototype.find;
+var predicate = function() {};
+
+assert.throws(TypeError, function() {
+ find.call({}, predicate);
+}, "this is an Object");
+
+assert.throws(TypeError, function() {
+ find.call([], predicate);
+}, "this is an Array");
+
+var ab = new ArrayBuffer(8);
+assert.throws(TypeError, function() {
+ find.call(ab, predicate);
+}, "this is an ArrayBuffer instance");
+
+var dv = new DataView(new ArrayBuffer(8), 0, 1);
+assert.throws(TypeError, function() {
+ find.call(dv, predicate);
+}, "this is a DataView instance");
diff --git a/test/built-ins/TypedArray/prototype/find/get-length-ignores-length-prop.js b/test/built-ins/TypedArray/prototype/find/get-length-ignores-length-prop.js
index b62f9170f..4c5905ee1 100644
--- a/test/built-ins/TypedArray/prototype/find/get-length-ignores-length-prop.js
+++ b/test/built-ins/TypedArray/prototype/find/get-length-ignores-length-prop.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.find
-es6id: 22.2.3.10
description: >
[[Get]] of "length" uses [[ArrayLength]]
info: |
diff --git a/test/built-ins/TypedArray/prototype/find/invoked-as-func.js b/test/built-ins/TypedArray/prototype/find/invoked-as-func.js
index 07152e439..540aa34d7 100644
--- a/test/built-ins/TypedArray/prototype/find/invoked-as-func.js
+++ b/test/built-ins/TypedArray/prototype/find/invoked-as-func.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.10
+esid: sec-%typedarray%.prototype.find
description: Throws a TypeError exception when invoked as a function
info: |
22.2.3.10 %TypedArray%.prototype.find (predicate [ , thisArg ] )
diff --git a/test/built-ins/TypedArray/prototype/find/invoked-as-method.js b/test/built-ins/TypedArray/prototype/find/invoked-as-method.js
index 5661c00fb..98e6faa33 100644
--- a/test/built-ins/TypedArray/prototype/find/invoked-as-method.js
+++ b/test/built-ins/TypedArray/prototype/find/invoked-as-method.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.10
+esid: sec-%typedarray%.prototype.find
description: Requires a [[TypedArrayName]] internal slot.
info: |
22.2.3.10 %TypedArray%.prototype.find (predicate [ , thisArg ] )
diff --git a/test/built-ins/TypedArray/prototype/find/length.js b/test/built-ins/TypedArray/prototype/find/length.js
index 6bc32f8f0..15607315f 100644
--- a/test/built-ins/TypedArray/prototype/find/length.js
+++ b/test/built-ins/TypedArray/prototype/find/length.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.10
+esid: sec-%typedarray%.prototype.find
description: >
%TypedArray%.prototype.find.length is 1.
info: |
@@ -20,6 +20,7 @@ info: |
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
[[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.find.length, 1);
diff --git a/test/built-ins/TypedArray/prototype/find/name.js b/test/built-ins/TypedArray/prototype/find/name.js
index f8f7c11ff..c1636fc13 100644
--- a/test/built-ins/TypedArray/prototype/find/name.js
+++ b/test/built-ins/TypedArray/prototype/find/name.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.10
+esid: sec-%typedarray%.prototype.find
description: >
%TypedArray%.prototype.find.name is "find".
info: |
@@ -17,6 +17,7 @@ info: |
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.find.name, "find");
diff --git a/test/built-ins/TypedArray/prototype/find/predicate-call-changes-value.js b/test/built-ins/TypedArray/prototype/find/predicate-call-changes-value.js
index 556fb9851..0b8baa4ba 100644
--- a/test/built-ins/TypedArray/prototype/find/predicate-call-changes-value.js
+++ b/test/built-ins/TypedArray/prototype/find/predicate-call-changes-value.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.find
-es6id: 22.2.3.10
description: >
Change values during predicate call
info: |
@@ -27,6 +26,7 @@ info: |
c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
...
includes: [compareArray.js, testTypedArray.js]
+features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
diff --git a/test/built-ins/TypedArray/prototype/find/predicate-call-parameters.js b/test/built-ins/TypedArray/prototype/find/predicate-call-parameters.js
index 02c20a2c9..7d364c091 100644
--- a/test/built-ins/TypedArray/prototype/find/predicate-call-parameters.js
+++ b/test/built-ins/TypedArray/prototype/find/predicate-call-parameters.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.find
-es6id: 22.2.3.10
description: >
Predicate called as F.call( thisArg, kValue, k, O ) for each array entry.
info: |
diff --git a/test/built-ins/TypedArray/prototype/find/predicate-call-this-non-strict.js b/test/built-ins/TypedArray/prototype/find/predicate-call-this-non-strict.js
index d4a1ee560..3246908b6 100644
--- a/test/built-ins/TypedArray/prototype/find/predicate-call-this-non-strict.js
+++ b/test/built-ins/TypedArray/prototype/find/predicate-call-this-non-strict.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.find
-es6id: 22.2.3.10
description: >
Verify predicate this on non-strict mode
info: |
diff --git a/test/built-ins/TypedArray/prototype/find/predicate-call-this-strict.js b/test/built-ins/TypedArray/prototype/find/predicate-call-this-strict.js
index f62576392..22ed01f77 100644
--- a/test/built-ins/TypedArray/prototype/find/predicate-call-this-strict.js
+++ b/test/built-ins/TypedArray/prototype/find/predicate-call-this-strict.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.find
-es6id: 22.2.3.10
description: >
Verify predicate this on strict mode
info: |
diff --git a/test/built-ins/TypedArray/prototype/find/predicate-is-not-callable-throws.js b/test/built-ins/TypedArray/prototype/find/predicate-is-not-callable-throws.js
index a8adc918e..f470ad927 100644
--- a/test/built-ins/TypedArray/prototype/find/predicate-is-not-callable-throws.js
+++ b/test/built-ins/TypedArray/prototype/find/predicate-is-not-callable-throws.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.find
-es6id: 22.2.3.10
description: >
Throws a TypeError exception if predicate is not callable.
info: |
diff --git a/test/built-ins/TypedArray/prototype/find/predicate-may-detach-buffer.js b/test/built-ins/TypedArray/prototype/find/predicate-may-detach-buffer.js
index 5dea87238..fbac50d14 100644
--- a/test/built-ins/TypedArray/prototype/find/predicate-may-detach-buffer.js
+++ b/test/built-ins/TypedArray/prototype/find/predicate-may-detach-buffer.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.find
-es6id: 22.2.3.10
description: >
Predicate may detach the buffer
info: |
diff --git a/test/built-ins/TypedArray/prototype/find/predicate-not-called-on-empty-array.js b/test/built-ins/TypedArray/prototype/find/predicate-not-called-on-empty-array.js
index cda391591..304c5da96 100644
--- a/test/built-ins/TypedArray/prototype/find/predicate-not-called-on-empty-array.js
+++ b/test/built-ins/TypedArray/prototype/find/predicate-not-called-on-empty-array.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.find
-es6id: 22.2.3.10
description: >
Predicate is not called on empty instances
info: |
diff --git a/test/built-ins/TypedArray/prototype/find/prop-desc.js b/test/built-ins/TypedArray/prototype/find/prop-desc.js
index 0a2411280..f4d44f373 100644
--- a/test/built-ins/TypedArray/prototype/find/prop-desc.js
+++ b/test/built-ins/TypedArray/prototype/find/prop-desc.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.10
+esid: sec-%typedarray%.prototype.find
description: >
"find" property of TypedArrayPrototype
info: |
@@ -9,6 +9,7 @@ info: |
and in Annex B.2 has the attributes { [[Writable]]: true,
[[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
var TypedArrayPrototype = TypedArray.prototype;
diff --git a/test/built-ins/TypedArray/prototype/find/return-abrupt-from-predicate-call.js b/test/built-ins/TypedArray/prototype/find/return-abrupt-from-predicate-call.js
index ceb765ef1..1c99c9ef7 100644
--- a/test/built-ins/TypedArray/prototype/find/return-abrupt-from-predicate-call.js
+++ b/test/built-ins/TypedArray/prototype/find/return-abrupt-from-predicate-call.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.find
-es6id: 22.2.3.10
description: >
Return abrupt from predicate call.
info: |
diff --git a/test/built-ins/TypedArray/prototype/find/return-found-value-predicate-result-is-true.js b/test/built-ins/TypedArray/prototype/find/return-found-value-predicate-result-is-true.js
index a2d0302c6..304b48355 100644
--- a/test/built-ins/TypedArray/prototype/find/return-found-value-predicate-result-is-true.js
+++ b/test/built-ins/TypedArray/prototype/find/return-found-value-predicate-result-is-true.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.find
-es6id: 22.2.3.10
description: >
Return found value if predicate return a boolean true value.
info: |
diff --git a/test/built-ins/TypedArray/prototype/find/return-undefined-if-predicate-returns-false-value.js b/test/built-ins/TypedArray/prototype/find/return-undefined-if-predicate-returns-false-value.js
index 0133a6948..2a59dc0a4 100644
--- a/test/built-ins/TypedArray/prototype/find/return-undefined-if-predicate-returns-false-value.js
+++ b/test/built-ins/TypedArray/prototype/find/return-undefined-if-predicate-returns-false-value.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.find
-es6id: 22.2.3.10
description: >
Return undefined if predicate always returns a boolean false value.
info: |
diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/detached-buffer.js
new file mode 100644
index 000000000..f8e8ed449
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/detached-buffer.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.findindex
+description: Throws a TypeError if this has a detached buffer
+info: |
+ 22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ ...
+ 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+var predicate = function() {
+ throw new Test262Error();
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+ $DETACHBUFFER(sample.buffer);
+ assert.throws(TypeError, function() {
+ sample.findIndex(predicate);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/get-length-ignores-length-prop.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/get-length-ignores-length-prop.js
new file mode 100644
index 000000000..d4287dfbd
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/get-length-ignores-length-prop.js
@@ -0,0 +1,52 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.findindex
+description: >
+ [[Get]] of "length" uses [[ArrayLength]]
+info: |
+ 22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] )
+
+ %TypedArray%.prototype.findIndex is a distinct function that implements the
+ same algorithm as Array.prototype.findIndex as defined in 22.1.3.9 except that
+ the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ ...
+
+ 22.1.3.9 Array.prototype.findIndex ( predicate[ , thisArg ] )
+
+ ...
+ 2. Let len be ? ToLength(? Get(O, "length")).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+Object.defineProperty(TypedArray.prototype, "length", {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ Object.defineProperty(TA.prototype, "length", {
+ get: function() {
+ throw new Test262Error();
+ }
+ });
+
+ var sample = new TA([42n]);
+
+ Object.defineProperty(sample, "length", {
+ get: function() {
+ throw new Test262Error();
+ },
+ configurable: true
+ });
+
+ assert.sameValue(
+ sample.findIndex(function() { return true; }),
+ 0
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/invoked-as-func.js
new file mode 100644
index 000000000..f305556a1
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/invoked-as-func.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.findindex
+description: Throws a TypeError exception when invoked as a function
+info: |
+ 22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var findIndex = TypedArray.prototype.findIndex;
+
+assert.sameValue(typeof findIndex, 'function');
+
+assert.throws(TypeError, function() {
+ findIndex();
+});
diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/invoked-as-method.js
new file mode 100644
index 000000000..1871afdab
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/invoked-as-method.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.findindex
+description: Requires a [[TypedArrayName]] internal slot.
+info: |
+ 22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+assert.sameValue(typeof TypedArrayPrototype.findIndex, 'function');
+
+assert.throws(TypeError, function() {
+ TypedArrayPrototype.findIndex();
+});
diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/length.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/length.js
new file mode 100644
index 000000000..64d37958e
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/length.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.findindex
+description: >
+ %TypedArray%.prototype.findIndex.length is 1.
+info: |
+ %TypedArray%.prototype.findIndex (predicate [ , thisArg ] )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, has a length
+ property whose value is an integer. Unless otherwise specified, this
+ value is equal to the largest number of named arguments shown in the
+ subclause headings for the function description, including optional
+ parameters. However, rest parameters shown using the form “...name”
+ are not included in the default argument count.
+
+ Unless otherwise specified, the length property of a built-in Function
+ object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.findIndex.length, 1);
+
+verifyNotEnumerable(TypedArray.prototype.findIndex, "length");
+verifyNotWritable(TypedArray.prototype.findIndex, "length");
+verifyConfigurable(TypedArray.prototype.findIndex, "length");
diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/name.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/name.js
new file mode 100644
index 000000000..84a9724a2
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/name.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.findindex
+description: >
+ %TypedArray%.prototype.findIndex.name is "findIndex".
+info: |
+ %TypedArray%.prototype.findIndex (predicate [ , thisArg ] )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, that is not
+ identified as an anonymous function has a name property whose value
+ is a String.
+
+ Unless otherwise specified, the name property of a built-in Function
+ object, if it exists, has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.findIndex.name, "findIndex");
+
+verifyNotEnumerable(TypedArray.prototype.findIndex, "name");
+verifyNotWritable(TypedArray.prototype.findIndex, "name");
+verifyConfigurable(TypedArray.prototype.findIndex, "name");
diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-changes-value.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-changes-value.js
new file mode 100644
index 000000000..2fa760323
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-changes-value.js
@@ -0,0 +1,67 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.findindex
+description: >
+ Change values during predicate call
+info: |
+ 22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] )
+
+ %TypedArray%.prototype.findIndex is a distinct function that implements the
+ same algorithm as Array.prototype.findIndex as defined in 22.1.3.9 except that
+ the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ ...
+
+ 22.1.3.9 Array.prototype.findIndex ( predicate[ , thisArg ] )
+
+ ...
+ 6. Repeat, while k < len
+ ...
+ c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
+ ...
+includes: [compareArray.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var arr = [10n, 20n, 30n];
+ var sample;
+ var result;
+
+ sample = new TA(3);
+ sample.findIndex(function(val, i) {
+ sample[i] = arr[i];
+
+ assert.sameValue(val, 0n, "value is not mapped to instance");
+ });
+ assert(compareArray(sample, arr), "values set during each predicate call");
+
+ sample = new TA(arr);
+ result = sample.findIndex(function(val, i) {
+ if ( i === 0 ) {
+ sample[2] = 7n;
+ }
+ return val === 7n;
+ });
+ assert.sameValue(result, 2, "value found");
+
+ sample = new TA(arr);
+ result = sample.findIndex(function(val, i) {
+ if ( i === 0 ) {
+ sample[2] = 7n;
+ }
+ return val === 30n;
+ });
+ assert.sameValue(result, -1, "value not found");
+
+ sample = new TA(arr);
+ result = sample.findIndex(function(val, i) {
+ if ( i > 0 ) {
+ sample[0] = 7n;
+ }
+ return val === 7n;
+ });
+ assert.sameValue(result, -1, "value not found - changed after call");
+});
diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-parameters.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-parameters.js
new file mode 100644
index 000000000..1025bbb24
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-parameters.js
@@ -0,0 +1,60 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.findindex
+description: >
+ Predicate called as F.call( thisArg, kValue, k, O ) for each array entry.
+info: |
+ 22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] )
+
+ %TypedArray%.prototype.findIndex is a distinct function that implements the
+ same algorithm as Array.prototype.findIndex as defined in 22.1.3.9 except that
+ the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ ...
+
+ 22.1.3.9 Array.prototype.findIndex ( predicate[ , thisArg ] )
+
+ ...
+ 4. If thisArg was supplied, let T be thisArg; else let T be undefined.
+ 5. Let k be 0.
+ 6. Repeat, while k < len
+ ...
+ c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([39n, 2n, 62n]);
+ var results = [];
+ var result;
+
+ sample.foo = "bar"; // Ignores non integer index properties
+
+ sample.findIndex(function() {
+ results.push(arguments);
+ });
+
+ assert.sameValue(results.length, 3, "predicate is called for each index");
+
+ result = results[0];
+ assert.sameValue(result[0], 39n, "results[0][0] === 39, value");
+ assert.sameValue(result[1], 0, "results[0][1] === 0, index");
+ assert.sameValue(result[2], sample, "results[0][2] === sample, instance");
+ assert.sameValue(result.length, 3, "results[0].length === 3, arguments");
+
+ result = results[1];
+ assert.sameValue(result[0], 2n, "results[1][0] === 2, value");
+ assert.sameValue(result[1], 1, "results[1][1] === 1, index");
+ assert.sameValue(result[2], sample, "results[1][2] === sample, instance");
+ assert.sameValue(result.length, 3, "results[1].length === 3, arguments");
+
+ result = results[2];
+ assert.sameValue(result[0], 62n, "results[2][0] === 62, value");
+ assert.sameValue(result[1], 2, "results[2][1] === 2, index");
+ assert.sameValue(result[2], sample, "results[2][2] === sample, instance");
+ assert.sameValue(result.length, 3, "results[2].length === 3, arguments");
+});
diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-this-non-strict.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-this-non-strict.js
new file mode 100644
index 000000000..3c1d4b9f2
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-this-non-strict.js
@@ -0,0 +1,57 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.findindex
+description: >
+ Verify predicate this on non-strict mode
+info: |
+ 22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] )
+
+ %TypedArray%.prototype.findIndex is a distinct function that implements the
+ same algorithm as Array.prototype.findIndex as defined in 22.1.3.9 except that
+ the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ ...
+
+ 22.1.3.9 Array.prototype.findIndex ( predicate[ , thisArg ] )
+
+ ...
+ 4. If thisArg was supplied, let T be thisArg; else let T be undefined.
+ 5. Let k be 0.
+ 6. Repeat, while k < len
+ ...
+ c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
+ ...
+flags: [noStrict]
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var T = this;
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+ var result;
+
+ sample.findIndex(function() {
+ result = this;
+ });
+
+ assert.sameValue(result, T, "without thisArg, predicate this is the global");
+
+ result = null;
+ sample.findIndex(function() {
+ result = this;
+ }, undefined);
+
+ assert.sameValue(result, T, "predicate this is the global when thisArg is undefined");
+
+ var o = {};
+ result = null;
+ sample.findIndex(function() {
+ result = this;
+ }, o);
+
+ assert.sameValue(result, o, "thisArg becomes the predicate this");
+});
diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-this-strict.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-this-strict.js
new file mode 100644
index 000000000..af6ce6a73
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-this-strict.js
@@ -0,0 +1,51 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.findindex
+description: >
+ Predicate thisArg as F.call( thisArg, kValue, k, O ) for each array entry.
+info: |
+ 22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] )
+
+ %TypedArray%.prototype.findIndex is a distinct function that implements the
+ same algorithm as Array.prototype.findIndex as defined in 22.1.3.9 except that
+ the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ ...
+
+ 22.1.3.9 Array.prototype.findIndex ( predicate[ , thisArg ] )
+
+ ...
+ 4. If thisArg was supplied, let T be thisArg; else let T be undefined.
+ 5. Let k be 0.
+ 6. Repeat, while k < len
+ ...
+ c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
+ ...
+flags: [onlyStrict]
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+ var result;
+
+ sample.findIndex(function() {
+ result = this;
+ });
+
+ assert.sameValue(
+ result,
+ undefined,
+ "without thisArg, predicate this is undefined"
+ );
+
+ var o = {};
+ sample.findIndex(function() {
+ result = this;
+ }, o);
+
+ assert.sameValue(result, o, "thisArg becomes the predicate this");
+});
diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-is-not-callable-throws.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-is-not-callable-throws.js
new file mode 100644
index 000000000..c8a101d05
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-is-not-callable-throws.js
@@ -0,0 +1,64 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.findindex
+description: >
+ Throws a TypeError exception if predicate is not callable.
+info: |
+ 22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] )
+
+ %TypedArray%.prototype.findIndex is a distinct function that implements the
+ same algorithm as Array.prototype.findIndex as defined in 22.1.3.9 except that
+ the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ ...
+
+ 22.1.3.9 Array.prototype.findIndex ( predicate[ , thisArg ] )
+
+ ...
+ 3. If IsCallable(predicate) is false, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA();
+ assert.throws(TypeError, function() {
+ sample.findIndex({});
+ }, "{}");
+
+ assert.throws(TypeError, function() {
+ sample.findIndex(null);
+ }, "null");
+
+ assert.throws(TypeError, function() {
+ sample.findIndex(undefined);
+ }, "undefined");
+
+ assert.throws(TypeError, function() {
+ sample.findIndex(false);
+ }, "false");
+
+ assert.throws(TypeError, function() {
+ sample.findIndex(true);
+ }, "true");
+
+ assert.throws(TypeError, function() {
+ sample.findIndex(1);
+ }, "1");
+
+ assert.throws(TypeError, function() {
+ sample.findIndex("");
+ }, "string");
+
+ assert.throws(TypeError, function() {
+ sample.findIndex([]);
+ }, "[]");
+
+ assert.throws(TypeError, function() {
+ sample.findIndex(/./);
+ }, "/./");
+});
+
diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-may-detach-buffer.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-may-detach-buffer.js
new file mode 100644
index 000000000..80078b3fe
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-may-detach-buffer.js
@@ -0,0 +1,51 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.findindex
+description: >
+ Predicate may detach the buffer
+info: |
+ 22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] )
+
+ %TypedArray%.prototype.findIndex is a distinct function that implements the
+ same algorithm as Array.prototype.findIndex as defined in 22.1.3.9 except that
+ the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ ...
+
+ 22.1.3.9 Array.prototype.findIndex ( predicate[ , thisArg ] )
+
+ ...
+ 6. Repeat, while k < len
+ ...
+ b. Let kValue be ? Get(O, Pk).
+ c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
+ ...
+
+ 9.4.5.8 IntegerIndexedElementGet ( O, index )
+
+ ...
+ 3. Let buffer be the value of O's [[ViewedArrayBuffer]] internal slot.
+ 4. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(2);
+ var loops = 0;
+ var completion = false;
+
+ assert.throws(TypeError, function() {
+ sample.findIndex(function() {
+ loops++;
+ $DETACHBUFFER(sample.buffer);
+ completion = true;
+ });
+ }, "throws a TypeError getting a value from the detached buffer");
+
+ assert.sameValue(loops, 1, "predicated is called once");
+ assert(completion, "abrupt completion does not come from DETACHBUFFER");
+});
diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-not-called-on-empty-array.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-not-called-on-empty-array.js
new file mode 100644
index 000000000..a08e80ef5
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-not-called-on-empty-array.js
@@ -0,0 +1,48 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.findindex
+description: >
+ Predicate is not called on an empty instance
+info: |
+ 22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] )
+
+ %TypedArray%.prototype.findIndex is a distinct function that implements the
+ same algorithm as Array.prototype.findIndex as defined in 22.1.3.9 except that
+ the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ ...
+
+ 22.1.3.9 Array.prototype.findIndex ( predicate[ , thisArg ] )
+
+ ...
+ 6. Repeat, while k < len
+ ...
+ c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
+ ...
+ 7. Return -1.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA();
+ var called = false;
+
+ var predicate = function() {
+ called = true;
+ return true;
+ };
+
+ var result = sample.findIndex(predicate);
+
+ assert.sameValue(
+ called, false,
+ "does not call predicate"
+ );
+ assert.sameValue(
+ result, -1,
+ "returns -1 on an empty instance"
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/prop-desc.js
new file mode 100644
index 000000000..9913a867e
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/prop-desc.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.findindex
+description: >
+ "findIndex" property of TypedArrayPrototype
+info: |
+ ES6 section 17: Every other data property described in clauses 18 through 26
+ and in Annex B.2 has the attributes { [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+verifyNotEnumerable(TypedArrayPrototype, 'findIndex');
+verifyWritable(TypedArrayPrototype, 'findIndex');
+verifyConfigurable(TypedArrayPrototype, 'findIndex');
diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-abrupt-from-predicate-call.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-abrupt-from-predicate-call.js
new file mode 100644
index 000000000..49405f3c5
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-abrupt-from-predicate-call.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.findindex
+description: >
+ Return abrupt from predicate call.
+info: |
+ 22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] )
+
+ %TypedArray%.prototype.findIndex is a distinct function that implements the
+ same algorithm as Array.prototype.findIndex as defined in 22.1.3.9 except that
+ the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ ...
+
+ 22.1.3.9 Array.prototype.findIndex ( predicate[ , thisArg ] )
+
+ ...
+ 5. Let k be 0.
+ 6. Repeat, while k < len
+ ...
+ c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var predicate = function() {
+ throw new Test262Error();
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+ assert.throws(Test262Error, function() {
+ sample.findIndex(predicate);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-index-predicate-result-is-true.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-index-predicate-result-is-true.js
new file mode 100644
index 000000000..25e26d808
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-index-predicate-result-is-true.js
@@ -0,0 +1,65 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.findindex
+description: >
+ Return index if predicate return a boolean true value.
+info: |
+ 22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] )
+
+ %TypedArray%.prototype.findIndex is a distinct function that implements the
+ same algorithm as Array.prototype.findIndex as defined in 22.1.3.9 except that
+ the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ ...
+
+ 22.1.3.9 Array.prototype.findIndex ( predicate[ , thisArg ] )
+
+ ...
+ 5. Let k be 0.
+ 6. Repeat, while k < len
+ ...
+ c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
+ d. If testResult is true, return k.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([39n, 3n, 9n]);
+ var called = 0;
+
+ var result = sample.findIndex(function() {
+ called++;
+ return true;
+ });
+
+ assert.sameValue(result, 0, "returned true on sample[0]");
+ assert.sameValue(called, 1, "predicate was called once");
+
+ called = 0;
+ result = sample.findIndex(function(val) {
+ called++;
+ return val === 9n;
+ });
+
+ assert.sameValue(called, 3, "predicate was called three times");
+ assert.sameValue(result, 2, "returned true on sample[3]");
+
+ result = sample.findIndex(function() { return "string"; });
+ assert.sameValue(result, 0, "ToBoolean(string)");
+
+ result = sample.findIndex(function() { return {}; });
+ assert.sameValue(result, 0, "ToBoolean(object)");
+
+ result = sample.findIndex(function() { return Symbol(""); });
+ assert.sameValue(result, 0, "ToBoolean(symbol)");
+
+ result = sample.findIndex(function() { return 1; });
+ assert.sameValue(result, 0, "ToBoolean(number)");
+
+ result = sample.findIndex(function() { return -1; });
+ assert.sameValue(result, 0, "ToBoolean(negative number)");
+});
diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-negative-one-if-predicate-returns-false-value.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-negative-one-if-predicate-returns-false-value.js
new file mode 100644
index 000000000..fcf5d800c
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-negative-one-if-predicate-returns-false-value.js
@@ -0,0 +1,58 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.findindex
+description: >
+ Return -1 if predicate always returns a boolean false value.
+info: |
+ 22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] )
+
+ %TypedArray%.prototype.findIndex is a distinct function that implements the
+ same algorithm as Array.prototype.findIndex as defined in 22.1.3.9 except that
+ the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ ...
+
+ 22.1.3.9 Array.prototype.findIndex ( predicate[ , thisArg ] )
+
+ ...
+ 6. Repeat, while k < len
+ ...
+ c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
+ ...
+ 7. Return -1.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([1n, 2n, 3n]);
+ var called = 0;
+
+ var result = sample.findIndex(function() {
+ called++;
+ return false;
+ });
+
+ assert.sameValue(called, 3, "predicate was called three times");
+ assert.sameValue(result, -1, "result is -1 when predicate returns are false");
+
+ result = sample.findIndex(function() { return ""; });
+ assert.sameValue(result, -1, "ToBoolean(string)");
+
+ result = sample.findIndex(function() { return undefined; });
+ assert.sameValue(result, -1, "ToBoolean(undefined)");
+
+ result = sample.findIndex(function() { return null; });
+ assert.sameValue(result, -1, "ToBoolean(null)");
+
+ result = sample.findIndex(function() { return 0; });
+ assert.sameValue(result, -1, "ToBoolean(0)");
+
+ result = sample.findIndex(function() { return -0; });
+ assert.sameValue(result, -1, "ToBoolean(-0)");
+
+ result = sample.findIndex(function() { return NaN; });
+ assert.sameValue(result, -1, "ToBoolean(NaN)");
+});
diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/this-is-not-object.js
new file mode 100644
index 000000000..fedede8b0
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/this-is-not-object.js
@@ -0,0 +1,51 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.findindex
+description: Throws a TypeError exception when `this` is not Object
+info: |
+ 22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var findIndex = TypedArray.prototype.findIndex;
+var predicate = function() {};
+
+assert.throws(TypeError, function() {
+ findIndex.call(undefined, predicate);
+}, "this is undefined");
+
+assert.throws(TypeError, function() {
+ findIndex.call(null, predicate);
+}, "this is null");
+
+assert.throws(TypeError, function() {
+ findIndex.call(42, predicate);
+}, "this is 42");
+
+assert.throws(TypeError, function() {
+ findIndex.call("1", predicate);
+}, "this is a string");
+
+assert.throws(TypeError, function() {
+ findIndex.call(true, predicate);
+}, "this is true");
+
+assert.throws(TypeError, function() {
+ findIndex.call(false, predicate);
+}, "this is false");
+
+var s = Symbol("s");
+assert.throws(TypeError, function() {
+ findIndex.call(s, predicate);
+}, "this is a Symbol");
diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/this-is-not-typedarray-instance.js
new file mode 100644
index 000000000..0c1bbab00
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/this-is-not-typedarray-instance.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.findindex
+description: >
+ Throws a TypeError exception when `this` is not a TypedArray instance
+info: |
+ 22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var findIndex = TypedArray.prototype.findIndex;
+var predicate = function() {};
+
+assert.throws(TypeError, function() {
+ findIndex.call({}, predicate);
+}, "this is an Object");
+
+assert.throws(TypeError, function() {
+ findIndex.call([], predicate);
+}, "this is an Array");
+
+var ab = new ArrayBuffer(8);
+assert.throws(TypeError, function() {
+ findIndex.call(ab, predicate);
+}, "this is an ArrayBuffer instance");
+
+var dv = new DataView(new ArrayBuffer(8), 0, 1);
+assert.throws(TypeError, function() {
+ findIndex.call(dv, predicate);
+}, "this is a DataView instance");
diff --git a/test/built-ins/TypedArray/prototype/findIndex/get-length-ignores-length-prop.js b/test/built-ins/TypedArray/prototype/findIndex/get-length-ignores-length-prop.js
index 99566c3d5..89b8815c5 100644
--- a/test/built-ins/TypedArray/prototype/findIndex/get-length-ignores-length-prop.js
+++ b/test/built-ins/TypedArray/prototype/findIndex/get-length-ignores-length-prop.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.findindex
-es6id: 22.2.3.11
description: >
[[Get]] of "length" uses [[ArrayLength]]
info: |
diff --git a/test/built-ins/TypedArray/prototype/findIndex/invoked-as-func.js b/test/built-ins/TypedArray/prototype/findIndex/invoked-as-func.js
index 16a85a91d..54ca2a83c 100644
--- a/test/built-ins/TypedArray/prototype/findIndex/invoked-as-func.js
+++ b/test/built-ins/TypedArray/prototype/findIndex/invoked-as-func.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.11
+esid: sec-%typedarray%.prototype.findindex
description: Throws a TypeError exception when invoked as a function
info: |
22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] )
diff --git a/test/built-ins/TypedArray/prototype/findIndex/invoked-as-method.js b/test/built-ins/TypedArray/prototype/findIndex/invoked-as-method.js
index dfd2e8f25..d5ec6304f 100644
--- a/test/built-ins/TypedArray/prototype/findIndex/invoked-as-method.js
+++ b/test/built-ins/TypedArray/prototype/findIndex/invoked-as-method.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.11
+esid: sec-%typedarray%.prototype.findindex
description: Requires a [[TypedArrayName]] internal slot.
info: |
22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] )
diff --git a/test/built-ins/TypedArray/prototype/findIndex/length.js b/test/built-ins/TypedArray/prototype/findIndex/length.js
index f2d44b12b..0ec6d4a5f 100644
--- a/test/built-ins/TypedArray/prototype/findIndex/length.js
+++ b/test/built-ins/TypedArray/prototype/findIndex/length.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.11
+esid: sec-%typedarray%.prototype.findindex
description: >
%TypedArray%.prototype.findIndex.length is 1.
info: |
@@ -20,6 +20,7 @@ info: |
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
[[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.findIndex.length, 1);
diff --git a/test/built-ins/TypedArray/prototype/findIndex/name.js b/test/built-ins/TypedArray/prototype/findIndex/name.js
index c2113b623..deb8c73a9 100644
--- a/test/built-ins/TypedArray/prototype/findIndex/name.js
+++ b/test/built-ins/TypedArray/prototype/findIndex/name.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.11
+esid: sec-%typedarray%.prototype.findindex
description: >
%TypedArray%.prototype.findIndex.name is "findIndex".
info: |
@@ -17,6 +17,7 @@ info: |
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.findIndex.name, "findIndex");
diff --git a/test/built-ins/TypedArray/prototype/findIndex/predicate-call-changes-value.js b/test/built-ins/TypedArray/prototype/findIndex/predicate-call-changes-value.js
index 84efabc26..2843859a0 100644
--- a/test/built-ins/TypedArray/prototype/findIndex/predicate-call-changes-value.js
+++ b/test/built-ins/TypedArray/prototype/findIndex/predicate-call-changes-value.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.findindex
-es6id: 22.2.3.11
description: >
Change values during predicate call
info: |
@@ -23,6 +22,7 @@ info: |
c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
...
includes: [compareArray.js, testTypedArray.js]
+features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
@@ -64,4 +64,4 @@ testWithTypedArrayConstructors(function(TA) {
return val === 7;
});
assert.sameValue(result, -1, "value not found - changed after call");
-}); \ No newline at end of file
+});
diff --git a/test/built-ins/TypedArray/prototype/findIndex/predicate-call-parameters.js b/test/built-ins/TypedArray/prototype/findIndex/predicate-call-parameters.js
index a4102dcb3..5483cc49a 100644
--- a/test/built-ins/TypedArray/prototype/findIndex/predicate-call-parameters.js
+++ b/test/built-ins/TypedArray/prototype/findIndex/predicate-call-parameters.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.findindex
-es6id: 22.2.3.11
description: >
Predicate called as F.call( thisArg, kValue, k, O ) for each array entry.
info: |
diff --git a/test/built-ins/TypedArray/prototype/findIndex/predicate-call-this-non-strict.js b/test/built-ins/TypedArray/prototype/findIndex/predicate-call-this-non-strict.js
index 68175c781..5f6086b8f 100644
--- a/test/built-ins/TypedArray/prototype/findIndex/predicate-call-this-non-strict.js
+++ b/test/built-ins/TypedArray/prototype/findIndex/predicate-call-this-non-strict.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.findindex
-es6id: 22.2.3.11
description: >
Verify predicate this on non-strict mode
info: |
diff --git a/test/built-ins/TypedArray/prototype/findIndex/predicate-call-this-strict.js b/test/built-ins/TypedArray/prototype/findIndex/predicate-call-this-strict.js
index a4dd13ac2..96ef46098 100644
--- a/test/built-ins/TypedArray/prototype/findIndex/predicate-call-this-strict.js
+++ b/test/built-ins/TypedArray/prototype/findIndex/predicate-call-this-strict.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.findindex
-es6id: 22.2.3.11
description: >
Predicate thisArg as F.call( thisArg, kValue, k, O ) for each array entry.
info: |
diff --git a/test/built-ins/TypedArray/prototype/findIndex/predicate-is-not-callable-throws.js b/test/built-ins/TypedArray/prototype/findIndex/predicate-is-not-callable-throws.js
index 5b97bf74a..872c4ffe8 100644
--- a/test/built-ins/TypedArray/prototype/findIndex/predicate-is-not-callable-throws.js
+++ b/test/built-ins/TypedArray/prototype/findIndex/predicate-is-not-callable-throws.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.findindex
-es6id: 22.2.3.11
description: >
Throws a TypeError exception if predicate is not callable.
info: |
diff --git a/test/built-ins/TypedArray/prototype/findIndex/predicate-may-detach-buffer.js b/test/built-ins/TypedArray/prototype/findIndex/predicate-may-detach-buffer.js
index 831d296ce..6124bc3fb 100644
--- a/test/built-ins/TypedArray/prototype/findIndex/predicate-may-detach-buffer.js
+++ b/test/built-ins/TypedArray/prototype/findIndex/predicate-may-detach-buffer.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.findindex
-es6id: 22.2.3.11
description: >
Predicate may detach the buffer
info: |
diff --git a/test/built-ins/TypedArray/prototype/findIndex/predicate-not-called-on-empty-array.js b/test/built-ins/TypedArray/prototype/findIndex/predicate-not-called-on-empty-array.js
index e4fa770da..e6a4abb4a 100644
--- a/test/built-ins/TypedArray/prototype/findIndex/predicate-not-called-on-empty-array.js
+++ b/test/built-ins/TypedArray/prototype/findIndex/predicate-not-called-on-empty-array.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.findindex
-es6id: 22.2.3.11
description: >
Predicate is not called on an empty instance
info: |
diff --git a/test/built-ins/TypedArray/prototype/findIndex/prop-desc.js b/test/built-ins/TypedArray/prototype/findIndex/prop-desc.js
index 014d8284a..74abd2659 100644
--- a/test/built-ins/TypedArray/prototype/findIndex/prop-desc.js
+++ b/test/built-ins/TypedArray/prototype/findIndex/prop-desc.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.11
+esid: sec-%typedarray%.prototype.findindex
description: >
"findIndex" property of TypedArrayPrototype
info: |
@@ -9,6 +9,7 @@ info: |
and in Annex B.2 has the attributes { [[Writable]]: true,
[[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
var TypedArrayPrototype = TypedArray.prototype;
diff --git a/test/built-ins/TypedArray/prototype/findIndex/return-abrupt-from-predicate-call.js b/test/built-ins/TypedArray/prototype/findIndex/return-abrupt-from-predicate-call.js
index df09745c1..1b01c8221 100644
--- a/test/built-ins/TypedArray/prototype/findIndex/return-abrupt-from-predicate-call.js
+++ b/test/built-ins/TypedArray/prototype/findIndex/return-abrupt-from-predicate-call.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.findindex
-es6id: 22.2.3.11
description: >
Return abrupt from predicate call.
info: |
diff --git a/test/built-ins/TypedArray/prototype/findIndex/return-index-predicate-result-is-true.js b/test/built-ins/TypedArray/prototype/findIndex/return-index-predicate-result-is-true.js
index 9e4880f22..498e9ac3e 100644
--- a/test/built-ins/TypedArray/prototype/findIndex/return-index-predicate-result-is-true.js
+++ b/test/built-ins/TypedArray/prototype/findIndex/return-index-predicate-result-is-true.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.findindex
-es6id: 22.2.3.11
description: >
Return index if predicate return a boolean true value.
info: |
diff --git a/test/built-ins/TypedArray/prototype/findIndex/return-negative-one-if-predicate-returns-false-value.js b/test/built-ins/TypedArray/prototype/findIndex/return-negative-one-if-predicate-returns-false-value.js
index f3367fbfa..76bda3ca0 100644
--- a/test/built-ins/TypedArray/prototype/findIndex/return-negative-one-if-predicate-returns-false-value.js
+++ b/test/built-ins/TypedArray/prototype/findIndex/return-negative-one-if-predicate-returns-false-value.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.findindex
-es6id: 22.2.3.11
description: >
Return -1 if predicate always returns a boolean false value.
info: |
diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/arraylength-internal.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/arraylength-internal.js
new file mode 100644
index 000000000..c5d14f29e
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/arraylength-internal.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.foreach
+description: >
+ [[ArrayLength]] is accessed in place of performing a [[Get]] of "length"
+info: |
+ 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ %TypedArray%.prototype.forEach is a distinct function that implements the same
+ algorithm as Array.prototype.forEach as defined in 22.1.3.10 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length"
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample1 = new TA(42);
+ var loop = 0;
+
+ Object.defineProperty(sample1, "length", {value: 1});
+
+ sample1.forEach(function() {
+ loop++;
+ });
+
+ assert.sameValue(loop, 42, "data descriptor");
+
+ var sample2 = new TA(7);
+ loop = 0;
+
+ Object.defineProperty(sample2, "length", {
+ get: function() {
+ throw new Test262Error(
+ "Does not return abrupt getting length property"
+ );
+ }
+ });
+
+ sample2.forEach(function() {
+ loop++;
+ });
+
+ assert.sameValue(loop, 7, "accessor descriptor");
+});
+
diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-arguments-with-thisarg.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-arguments-with-thisarg.js
new file mode 100644
index 000000000..07478cadf
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-arguments-with-thisarg.js
@@ -0,0 +1,55 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.foreach
+description: >
+ thisArg does not affect callbackfn arguments
+info: |
+ 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ %TypedArray%.prototype.forEach is a distinct function that implements the same
+ algorithm as Array.prototype.forEach as defined in 22.1.3.10 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length"
+
+ 22.1.3.10 Array.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ ...
+ 6. Repeat, while k < len
+ ...
+ c. If kPresent is true, then
+ i. Let kValue be ? Get(O, Pk).
+ ii. Perform ? Call(callbackfn, T, « kValue, k, O »).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n, 44n]);
+
+ var results = [];
+ var thisArg = ["test262", 0, "ecma262", 0];
+
+ sample.forEach(function() {
+ results.push(arguments);
+ }, thisArg);
+
+ assert.sameValue(results.length, 3, "results.length");
+ assert.sameValue(thisArg.length, 4, "thisArg.length");
+
+ assert.sameValue(results[0].length, 3, "results[0].length");
+ assert.sameValue(results[0][0], 42n, "results[0][0] - kValue");
+ assert.sameValue(results[0][1], 0, "results[0][1] - k");
+ assert.sameValue(results[0][2], sample, "results[0][2] - this");
+
+ assert.sameValue(results[1].length, 3, "results[1].length");
+ assert.sameValue(results[1][0], 43n, "results[1][0] - kValue");
+ assert.sameValue(results[1][1], 1, "results[1][1] - k");
+ assert.sameValue(results[1][2], sample, "results[1][2] - this");
+
+ assert.sameValue(results[2].length, 3, "results[2].length");
+ assert.sameValue(results[2][0], 44n, "results[2][0] - kValue");
+ assert.sameValue(results[2][1], 2, "results[2][1] - k");
+ assert.sameValue(results[2][2], sample, "results[2][2] - this");
+});
diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-arguments-without-thisarg.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-arguments-without-thisarg.js
new file mode 100644
index 000000000..6b6bdec5c
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-arguments-without-thisarg.js
@@ -0,0 +1,53 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.foreach
+description: >
+ callbackfn arguments
+info: |
+ 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ %TypedArray%.prototype.forEach is a distinct function that implements the same
+ algorithm as Array.prototype.forEach as defined in 22.1.3.10 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length"
+
+ 22.1.3.10 Array.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ ...
+ 6. Repeat, while k < len
+ ...
+ c. If kPresent is true, then
+ i. Let kValue be ? Get(O, Pk).
+ ii. Perform ? Call(callbackfn, T, « kValue, k, O »).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n, 44n]);
+
+ var results = [];
+
+ sample.forEach(function() {
+ results.push(arguments);
+ });
+
+ assert.sameValue(results.length, 3, "results.length");
+
+ assert.sameValue(results[0].length, 3, "results[0].length");
+ assert.sameValue(results[0][0], 42n, "results[0][0] - kValue");
+ assert.sameValue(results[0][1], 0, "results[0][1] - k");
+ assert.sameValue(results[0][2], sample, "results[0][2] - this");
+
+ assert.sameValue(results[1].length, 3, "results[1].length");
+ assert.sameValue(results[1][0], 43n, "results[1][0] - kValue");
+ assert.sameValue(results[1][1], 1, "results[1][1] - k");
+ assert.sameValue(results[1][2], sample, "results[1][2] - this");
+
+ assert.sameValue(results[2].length, 3, "results[2].length");
+ assert.sameValue(results[2][0], 44n, "results[2][0] - kValue");
+ assert.sameValue(results[2][1], 2, "results[2][1] - k");
+ assert.sameValue(results[2][2], sample, "results[2][2] - this");
+});
diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-detachbuffer.js
new file mode 100644
index 000000000..bf04fe979
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-detachbuffer.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.foreach
+description: >
+ Instance buffer can be detached during loop
+info: |
+ 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ %TypedArray%.prototype.forEach is a distinct function that implements the same
+ algorithm as Array.prototype.forEach as defined in 22.1.3.10 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length"
+
+ 22.1.3.10 Array.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ ...
+ 6. Repeat, while k < len
+ ...
+ c. If kPresent is true, then
+ ...
+ ii. Perform ? Call(callbackfn, T, « kValue, k, O »).
+ ...
+includes: [detachArrayBuffer.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var loops = 0;
+ var sample = new TA(2);
+
+ assert.throws(TypeError, function() {
+ sample.forEach(function() {
+ if (loops === 1) {
+ throw new Test262Error("callbackfn called twice");
+ }
+ $DETACHBUFFER(sample.buffer);
+ loops++;
+ });
+ });
+
+ assert.sameValue(loops, 1);
+});
diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-is-not-callable.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-is-not-callable.js
new file mode 100644
index 000000000..219872510
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-is-not-callable.js
@@ -0,0 +1,54 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.foreach
+description: >
+ callbackfn is not callable
+info: |
+ 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ %TypedArray%.prototype.forEach is a distinct function that implements the same
+ algorithm as Array.prototype.forEach as defined in 22.1.3.10 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length"
+
+ 22.1.3.10 Array.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ ...
+ 3. If IsCallable(callbackfn) is false, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(3);
+
+ assert.throws(TypeError, function() {
+ sample.forEach();
+ });
+
+ assert.throws(TypeError, function() {
+ sample.forEach(undefined);
+ });
+
+ assert.throws(TypeError, function() {
+ sample.forEach(null);
+ });
+
+ assert.throws(TypeError, function() {
+ sample.forEach({});
+ });
+
+ assert.throws(TypeError, function() {
+ sample.forEach(1);
+ });
+
+ assert.throws(TypeError, function() {
+ sample.forEach("");
+ });
+
+ assert.throws(TypeError, function() {
+ sample.forEach(false);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-no-interaction-over-non-integer.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-no-interaction-over-non-integer.js
new file mode 100644
index 000000000..9edd63e09
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-no-interaction-over-non-integer.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.foreach
+description: >
+ Does not interact over non-integer properties
+info: |
+ 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ ...
+ 6. Repeat, while k < len
+ ...
+ c. If kPresent is true, then
+ ...
+ ii. Perform ? Call(callbackfn, T, « kValue, k, O »).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([7n, 8n]);
+
+ var results = [];
+
+ sample.foo = 42;
+ sample[Symbol("1")] = 43;
+
+ sample.forEach(function() {
+ results.push(arguments);
+ });
+
+ assert.sameValue(results.length, 2, "results.length");
+
+ assert.sameValue(results[0][1], 0, "results[0][1] - k");
+ assert.sameValue(results[1][1], 1, "results[1][1] - k");
+
+ assert.sameValue(results[0][0], 7n, "results[0][0] - kValue");
+ assert.sameValue(results[1][0], 8n, "results[1][0] - kValue");
+});
diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-not-called-on-empty.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-not-called-on-empty.js
new file mode 100644
index 000000000..f81f5ac40
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-not-called-on-empty.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.foreach
+description: >
+ callbackfn is not called on empty instances
+info: |
+ 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ %TypedArray%.prototype.forEach is a distinct function that implements the same
+ algorithm as Array.prototype.forEach as defined in 22.1.3.10 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length"
+
+ 22.1.3.10 Array.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ ...
+ 6. Repeat, while k < len
+ ...
+ c. If kPresent is true, then
+ ...
+ ii. Perform ? Call(callbackfn, T, « kValue, k, O »).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var called = 0;
+
+ new TA().forEach(function() {
+ called++;
+ });
+
+ assert.sameValue(called, 0);
+});
diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-return-does-not-change-instance.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-return-does-not-change-instance.js
new file mode 100644
index 000000000..341a7decd
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-return-does-not-change-instance.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.foreach
+description: >
+ The callbackfn return does not change the instance
+info: |
+ 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ %TypedArray%.prototype.forEach is a distinct function that implements the same
+ algorithm as Array.prototype.forEach as defined in 22.1.3.10 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length"
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample1 = new TA(3);
+
+ sample1[1] = 1n;
+
+ sample1.forEach(function() {
+ return 42;
+ });
+
+ assert.sameValue(sample1[0], 0n, "[0] == 0");
+ assert.sameValue(sample1[1], 1n, "[1] == 1");
+ assert.sameValue(sample1[2], 0n, "[2] == 0");
+});
diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-returns-abrupt.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-returns-abrupt.js
new file mode 100644
index 000000000..fb9c58a20
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-returns-abrupt.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.foreach
+description: >
+ Returns abrupt from callbackfn
+info: |
+ 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ %TypedArray%.prototype.forEach is a distinct function that implements the same
+ algorithm as Array.prototype.forEach as defined in 22.1.3.10 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length"
+
+ 22.1.3.10 Array.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ ...
+ 6. Repeat, while k < len
+ ...
+ c. If kPresent is true, then
+ ...
+ ii. Perform ? Call(callbackfn, T, « kValue, k, O »).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(3);
+
+ assert.throws(Test262Error, function() {
+ sample.forEach(function() {
+ throw new Test262Error();
+ });
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-set-value-during-interaction.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-set-value-during-interaction.js
new file mode 100644
index 000000000..13bd7fb01
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-set-value-during-interaction.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.foreach
+description: >
+ Integer indexed values changed during iteration
+info: |
+ 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ %TypedArray%.prototype.forEach is a distinct function that implements the same
+ algorithm as Array.prototype.forEach as defined in 22.1.3.10 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length"
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Reflect.set, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n, 44n]);
+ var newVal = 0n;
+
+ sample.forEach(function(val, i) {
+ if (i > 0) {
+ assert.sameValue(
+ sample[i - 1], newVal - 1n,
+ "get the changed value during the loop"
+ );
+ assert.sameValue(
+ Reflect.set(sample, 0, 7n),
+ true,
+ "re-set a value for sample[0]"
+ );
+ }
+ assert.sameValue(
+ Reflect.set(sample, i, newVal),
+ true,
+ "set value during iteration"
+ );
+
+ newVal++;
+ });
+
+ assert.sameValue(sample[0], 7n, "changed values after iteration [0] == 7");
+ assert.sameValue(sample[1], 1n, "changed values after iteration [1] == 1");
+ assert.sameValue(sample[2], 2n, "changed values after iteration [2] == 2");
+});
diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-this.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-this.js
new file mode 100644
index 000000000..df900d125
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-this.js
@@ -0,0 +1,57 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.foreach
+description: >
+ callbackfn `this` value
+info: |
+ 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ %TypedArray%.prototype.forEach is a distinct function that implements the same
+ algorithm as Array.prototype.forEach as defined in 22.1.3.10 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length"
+
+ 22.1.3.10 Array.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ ...
+ 4. If thisArg was supplied, let T be thisArg; else let T be undefined.
+ ...
+ 6. Repeat, while k < len
+ ...
+ c. If kPresent is true, then
+ ...
+ ii. Perform ? Call(callbackfn, T, « kValue, k, O »).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var expected = (function() { return this; })();
+var thisArg = {};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(3);
+
+ var results1 = [];
+
+ sample.forEach(function() {
+ results1.push(this);
+ });
+
+ assert.sameValue(results1.length, 3, "results1");
+ assert.sameValue(results1[0], expected, "without thisArg - [0]");
+ assert.sameValue(results1[1], expected, "without thisArg - [1]");
+ assert.sameValue(results1[2], expected, "without thisArg - [2]");
+
+ var results2 = [];
+
+ sample.forEach(function() {
+ results2.push(this);
+ }, thisArg);
+
+ assert.sameValue(results2.length, 3, "results2");
+ assert.sameValue(results2[0], thisArg, "using thisArg - [0]");
+ assert.sameValue(results2[1], thisArg, "using thisArg - [1]");
+ assert.sameValue(results2[2], thisArg, "using thisArg - [2]");
+});
diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/detached-buffer.js
new file mode 100644
index 000000000..fe196e0cb
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/detached-buffer.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.foreach
+description: Throws a TypeError if this has a detached buffer
+info: |
+ 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ ...
+ 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+var callbackfn = function() {
+ throw new Test262Error();
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+ $DETACHBUFFER(sample.buffer);
+ assert.throws(TypeError, function() {
+ sample.forEach(callbackfn);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/invoked-as-func.js
new file mode 100644
index 000000000..d4eb50b88
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/invoked-as-func.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.foreach
+description: Throws a TypeError exception when invoked as a function
+info: |
+ 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var forEach = TypedArray.prototype.forEach;
+
+assert.sameValue(typeof forEach, 'function');
+
+assert.throws(TypeError, function() {
+ forEach();
+});
diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/invoked-as-method.js
new file mode 100644
index 000000000..f45505275
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/invoked-as-method.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.foreach
+description: Requires a [[TypedArrayName]] internal slot.
+info: |
+ 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+assert.sameValue(typeof TypedArrayPrototype.forEach, 'function');
+
+assert.throws(TypeError, function() {
+ TypedArrayPrototype.forEach();
+});
diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/length.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/length.js
new file mode 100644
index 000000000..f8f9624a9
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/length.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.foreach
+description: >
+ %TypedArray%.prototype.forEach.length is 1.
+info: |
+ %TypedArray%.prototype.forEach (callbackfn [ , thisArg ] )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, has a length
+ property whose value is an integer. Unless otherwise specified, this
+ value is equal to the largest number of named arguments shown in the
+ subclause headings for the function description, including optional
+ parameters. However, rest parameters shown using the form “...name”
+ are not included in the default argument count.
+
+ Unless otherwise specified, the length property of a built-in Function
+ object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.forEach.length, 1);
+
+verifyNotEnumerable(TypedArray.prototype.forEach, "length");
+verifyNotWritable(TypedArray.prototype.forEach, "length");
+verifyConfigurable(TypedArray.prototype.forEach, "length");
diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/name.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/name.js
new file mode 100644
index 000000000..36c9ffde4
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/name.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.foreach
+description: >
+ %TypedArray%.prototype.forEach.name is "forEach".
+info: |
+ %TypedArray%.prototype.forEach (callbackfn [ , thisArg ] )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, that is not
+ identified as an anonymous function has a name property whose value
+ is a String.
+
+ Unless otherwise specified, the name property of a built-in Function
+ object, if it exists, has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.forEach.name, "forEach");
+
+verifyNotEnumerable(TypedArray.prototype.forEach, "name");
+verifyNotWritable(TypedArray.prototype.forEach, "name");
+verifyConfigurable(TypedArray.prototype.forEach, "name");
diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/prop-desc.js
new file mode 100644
index 000000000..b095a89f2
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/prop-desc.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.foreach
+description: >
+ "forEach" property of TypedArrayPrototype
+info: |
+ ES6 section 17: Every other data property described in clauses 18 through 26
+ and in Annex B.2 has the attributes { [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+verifyNotEnumerable(TypedArrayPrototype, 'forEach');
+verifyWritable(TypedArrayPrototype, 'forEach');
+verifyConfigurable(TypedArrayPrototype, 'forEach');
diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/returns-undefined.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/returns-undefined.js
new file mode 100644
index 000000000..467825d27
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/returns-undefined.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.foreach
+description: >
+ Returns undefined
+info: |
+ 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ %TypedArray%.prototype.forEach is a distinct function that implements the same
+ algorithm as Array.prototype.forEach as defined in 22.1.3.10 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length"
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample1 = new TA(42);
+
+ var result1 = sample1.forEach(function() {
+ return 42;
+ });
+
+ assert.sameValue(result1, undefined, "result1");
+
+ var sample2 = new TA(1);
+ var result2 = sample2.forEach(function() {
+ return null;
+ });
+
+ assert.sameValue(result2, undefined, "result2");
+});
diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/this-is-not-object.js
new file mode 100644
index 000000000..6317c05d5
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/this-is-not-object.js
@@ -0,0 +1,51 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.foreach
+description: Throws a TypeError exception when `this` is not Object
+info: |
+ 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var forEach = TypedArray.prototype.forEach;
+var callbackfn = function() {};
+
+assert.throws(TypeError, function() {
+ forEach.call(undefined, callbackfn);
+}, "this is undefined");
+
+assert.throws(TypeError, function() {
+ forEach.call(null, callbackfn);
+}, "this is null");
+
+assert.throws(TypeError, function() {
+ forEach.call(42, callbackfn);
+}, "this is 42");
+
+assert.throws(TypeError, function() {
+ forEach.call("1", callbackfn);
+}, "this is a string");
+
+assert.throws(TypeError, function() {
+ forEach.call(true, callbackfn);
+}, "this is true");
+
+assert.throws(TypeError, function() {
+ forEach.call(false, callbackfn);
+}, "this is false");
+
+var s = Symbol("s");
+assert.throws(TypeError, function() {
+ forEach.call(s, callbackfn);
+}, "this is a Symbol");
diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/this-is-not-typedarray-instance.js
new file mode 100644
index 000000000..33db208c9
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/this-is-not-typedarray-instance.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.foreach
+description: >
+ Throws a TypeError exception when `this` is not a TypedArray instance
+info: |
+ 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var forEach = TypedArray.prototype.forEach;
+var callbackfn = function() {};
+
+assert.throws(TypeError, function() {
+ forEach.call({}, callbackfn);
+}, "this is an Object");
+
+assert.throws(TypeError, function() {
+ forEach.call([], callbackfn);
+}, "this is an Array");
+
+var ab = new ArrayBuffer(8);
+assert.throws(TypeError, function() {
+ forEach.call(ab, callbackfn);
+}, "this is an ArrayBuffer instance");
+
+var dv = new DataView(new ArrayBuffer(8), 0, 1);
+assert.throws(TypeError, function() {
+ forEach.call(dv, callbackfn);
+}, "this is a DataView instance");
diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/values-are-not-cached.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/values-are-not-cached.js
new file mode 100644
index 000000000..1fcc724f8
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/values-are-not-cached.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.foreach
+description: >
+ Integer indexed values are not cached before iteration
+info: |
+ 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] )
+
+ %TypedArray%.prototype.forEach is a distinct function that implements the same
+ algorithm as Array.prototype.forEach as defined in 22.1.3.10 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length"
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n, 44n]);
+
+ sample.forEach(function(v, i) {
+ if (i < sample.length - 1) {
+ sample[i+1] = 42n;
+ }
+
+ assert.sameValue(
+ v, 42n, "method does not cache values before callbackfn calls"
+ );
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/forEach/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/forEach/callbackfn-detachbuffer.js
index 44971dbae..6540255f7 100644
--- a/test/built-ins/TypedArray/prototype/forEach/callbackfn-detachbuffer.js
+++ b/test/built-ins/TypedArray/prototype/forEach/callbackfn-detachbuffer.js
@@ -22,6 +22,7 @@ info: |
ii. Perform ? Call(callbackfn, T, « kValue, k, O »).
...
includes: [detachArrayBuffer.js, testTypedArray.js]
+features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
diff --git a/test/built-ins/TypedArray/prototype/forEach/invoked-as-func.js b/test/built-ins/TypedArray/prototype/forEach/invoked-as-func.js
index 5312bbde0..a99a5bef7 100644
--- a/test/built-ins/TypedArray/prototype/forEach/invoked-as-func.js
+++ b/test/built-ins/TypedArray/prototype/forEach/invoked-as-func.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.12
+esid: sec-%typedarray%.prototype.foreach
description: Throws a TypeError exception when invoked as a function
info: |
22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] )
diff --git a/test/built-ins/TypedArray/prototype/forEach/invoked-as-method.js b/test/built-ins/TypedArray/prototype/forEach/invoked-as-method.js
index 630c7b8a5..a4a25e298 100644
--- a/test/built-ins/TypedArray/prototype/forEach/invoked-as-method.js
+++ b/test/built-ins/TypedArray/prototype/forEach/invoked-as-method.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.12
+esid: sec-%typedarray%.prototype.foreach
description: Requires a [[TypedArrayName]] internal slot.
info: |
22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] )
diff --git a/test/built-ins/TypedArray/prototype/forEach/length.js b/test/built-ins/TypedArray/prototype/forEach/length.js
index bc00a6ccf..48bdb6a25 100644
--- a/test/built-ins/TypedArray/prototype/forEach/length.js
+++ b/test/built-ins/TypedArray/prototype/forEach/length.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.12
+esid: sec-%typedarray%.prototype.foreach
description: >
%TypedArray%.prototype.forEach.length is 1.
info: |
@@ -20,6 +20,7 @@ info: |
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
[[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.forEach.length, 1);
diff --git a/test/built-ins/TypedArray/prototype/forEach/name.js b/test/built-ins/TypedArray/prototype/forEach/name.js
index 7a3cf395f..23ae3f631 100644
--- a/test/built-ins/TypedArray/prototype/forEach/name.js
+++ b/test/built-ins/TypedArray/prototype/forEach/name.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.12
+esid: sec-%typedarray%.prototype.foreach
description: >
%TypedArray%.prototype.forEach.name is "forEach".
info: |
@@ -17,6 +17,7 @@ info: |
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.forEach.name, "forEach");
diff --git a/test/built-ins/TypedArray/prototype/forEach/prop-desc.js b/test/built-ins/TypedArray/prototype/forEach/prop-desc.js
index 86fc95ef0..58e7e95b1 100644
--- a/test/built-ins/TypedArray/prototype/forEach/prop-desc.js
+++ b/test/built-ins/TypedArray/prototype/forEach/prop-desc.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.12
+esid: sec-%typedarray%.prototype.foreach
description: >
"forEach" property of TypedArrayPrototype
info: |
@@ -9,6 +9,7 @@ info: |
and in Annex B.2 has the attributes { [[Writable]]: true,
[[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
var TypedArrayPrototype = TypedArray.prototype;
diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/includes/BigInt/detached-buffer.js
new file mode 100644
index 000000000..990e4b01a
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/includes/BigInt/detached-buffer.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.includes
+description: Throws a TypeError if this has a detached buffer
+info: |
+ 22.2.3.14 %TypedArray%.prototype.includes ( searchElement [ , fromIndex ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ ...
+ 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+ $DETACHBUFFER(sample.buffer);
+ assert.throws(TypeError, function() {
+ sample.includes(0);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/fromIndex-equal-or-greater-length-returns-false.js b/test/built-ins/TypedArray/prototype/includes/BigInt/fromIndex-equal-or-greater-length-returns-false.js
new file mode 100644
index 000000000..a59b7084a
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/includes/BigInt/fromIndex-equal-or-greater-length-returns-false.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.includes
+description: Return false if fromIndex >= ArrayLength
+info: |
+ 22.2.3.13 %TypedArray%.prototype.includes ( searchElement [ , fromIndex ] )
+
+ %TypedArray%.prototype.includes is a distinct function that implements the
+ same algorithm as Array.prototype.includes as defined in 22.1.3.11 except that
+ the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ 22.1.3.11 Array.prototype.includes ( searchElement [ , fromIndex ] )
+
+ ...
+ 4. Let n be ? ToInteger(fromIndex). (If fromIndex is undefined, this step
+ produces the value 0.)
+ 5. If n ≥ 0, then
+ a. Let k be n.
+ ...
+ 7. Repeat, while k < len
+ ...
+ 8. Return false.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample;
+
+ sample = new TA(42);
+ assert.sameValue(sample.includes(0, 42), false);
+ assert.sameValue(sample.includes(0, 43), false);
+});
diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/fromIndex-infinity.js b/test/built-ins/TypedArray/prototype/includes/BigInt/fromIndex-infinity.js
new file mode 100644
index 000000000..56dd73515
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/includes/BigInt/fromIndex-infinity.js
@@ -0,0 +1,44 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.includes
+description: handle Infinity values for fromIndex
+info: |
+ 22.2.3.13 %TypedArray%.prototype.includes ( searchElement [ , fromIndex ] )
+
+ %TypedArray%.prototype.includes is a distinct function that implements the
+ same algorithm as Array.prototype.includes as defined in 22.1.3.11 except that
+ the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ 22.1.3.11 Array.prototype.includes ( searchElement [ , fromIndex ] )
+
+ ...
+ 4. Let n be ? ToInteger(fromIndex). (If fromIndex is undefined, this step
+ produces the value 0.)
+ 5. If n ≥ 0, then
+ a. Let k be n.
+ 6. Else n < 0,
+ a. Let k be len + n.
+ b. If k < 0, let k be 0.
+ 7. Repeat, while k < len
+ ...
+ 8. Return false.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n, 43n, 41n]);
+
+ assert.sameValue(
+ sample.includes(43n, Infinity),
+ false,
+ "includes(43, Infinity)"
+ );
+ assert.sameValue(
+ sample.includes(43n, -Infinity),
+ true,
+ "includes(43, -Infinity)");
+});
diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/fromIndex-minus-zero.js b/test/built-ins/TypedArray/prototype/includes/BigInt/fromIndex-minus-zero.js
new file mode 100644
index 000000000..83ee261a7
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/includes/BigInt/fromIndex-minus-zero.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.includes
+description: -0 fromIndex becomes 0
+info: |
+ 22.2.3.13 %TypedArray%.prototype.includes ( searchElement [ , fromIndex ] )
+
+ %TypedArray%.prototype.includes is a distinct function that implements the
+ same algorithm as Array.prototype.includes as defined in 22.1.3.11 except that
+ the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ 22.1.3.11 Array.prototype.includes ( searchElement [ , fromIndex ] )
+
+ ...
+ 5. If n ≥ 0, then
+ a. Let k be n.
+ ...
+ 7. Repeat, while k < len
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample;
+
+ sample = new TA([42n, 43n]);
+ assert.sameValue(sample.includes(42n, -0), true, "-0 [0]");
+ assert.sameValue(sample.includes(43n, -0), true, "-0 [1]");
+ assert.sameValue(sample.includes(44n, -0), false, "-0 [2]");
+});
diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/includes/BigInt/get-length-uses-internal-arraylength.js
new file mode 100644
index 000000000..2117ea212
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/includes/BigInt/get-length-uses-internal-arraylength.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.includes
+description: Get "length" uses internal ArrayLength
+info: |
+ 22.2.3.13 %TypedArray%.prototype.includes ( searchElement [ , fromIndex ] )
+
+ %TypedArray%.prototype.includes is a distinct function that implements the
+ same algorithm as Array.prototype.includes as defined in 22.1.3.11 except that
+ the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ 22.1.3.11 Array.prototype.includes ( searchElement [ , fromIndex ] )
+
+ ...
+ 2. Let len be ? ToLength(? Get(O, "length")).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+Object.defineProperty(TypedArray.prototype, "length", {value: 0});
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([7n]);
+
+ Object.defineProperty(TA.prototype, "length", {value: 0});
+ Object.defineProperty(sample, "length", {value: 0});
+
+ assert.sameValue(sample.includes(7n), true);
+});
diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/includes/BigInt/invoked-as-func.js
new file mode 100644
index 000000000..cb8069bc3
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/includes/BigInt/invoked-as-func.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.includes
+description: Throws a TypeError exception when invoked as a function
+info: |
+ 22.2.3.14 %TypedArray%.prototype.includes ( searchElement [ , fromIndex ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var includes = TypedArray.prototype.includes;
+
+assert.sameValue(typeof includes, "function");
+
+assert.throws(TypeError, function() {
+ includes();
+});
diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/includes/BigInt/invoked-as-method.js
new file mode 100644
index 000000000..78f7428a1
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/includes/BigInt/invoked-as-method.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.includes
+description: Requires a [[TypedArrayName]] internal slot.
+info: |
+ 22.2.3.14 %TypedArray%.prototype.includes ( searchElement [ , fromIndex ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+assert.sameValue(typeof TypedArrayPrototype.includes, "function");
+
+assert.throws(TypeError, function() {
+ TypedArrayPrototype.includes();
+});
diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/length-zero-returns-false.js b/test/built-ins/TypedArray/prototype/includes/BigInt/length-zero-returns-false.js
new file mode 100644
index 000000000..9c06fa6c1
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/includes/BigInt/length-zero-returns-false.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.includes
+description: Returns false if length is 0
+info: |
+ 22.2.3.13 %TypedArray%.prototype.includes ( searchElement [ , fromIndex ] )
+
+ %TypedArray%.prototype.includes is a distinct function that implements the
+ same algorithm as Array.prototype.includes as defined in 22.1.3.11 except that
+ the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ 22.1.3.11 Array.prototype.includes ( searchElement [ , fromIndex ] )
+
+ ...
+ 2. Let len be ? ToLength(? Get(O, "length")).
+ 3. If len is 0, return false.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var fromIndex = {
+ valueOf: function() {
+ throw new Test262Error();
+ }
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA();
+ assert.sameValue(sample.includes(0), false, "returns false");
+ assert.sameValue(sample.includes(), false, "returns false - no arg");
+ assert.sameValue(
+ sample.includes(0, fromIndex), false,
+ "length is checked before ToInteger(fromIndex)"
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/length.js b/test/built-ins/TypedArray/prototype/includes/BigInt/length.js
new file mode 100644
index 000000000..f438ccd6f
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/includes/BigInt/length.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.includes
+description: >
+ %TypedArray%.prototype.includes.length is 1.
+info: |
+ %TypedArray%.prototype.includes ( searchElement [ , fromIndex ] )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, has a length
+ property whose value is an integer. Unless otherwise specified, this
+ value is equal to the largest number of named arguments shown in the
+ subclause headings for the function description, including optional
+ parameters. However, rest parameters shown using the form “...name”
+ are not included in the default argument count.
+
+ Unless otherwise specified, the length property of a built-in Function
+ object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.includes.length, 1);
+
+verifyNotEnumerable(TypedArray.prototype.includes, "length");
+verifyNotWritable(TypedArray.prototype.includes, "length");
+verifyConfigurable(TypedArray.prototype.includes, "length");
diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/name.js b/test/built-ins/TypedArray/prototype/includes/BigInt/name.js
new file mode 100644
index 000000000..4d90c44c8
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/includes/BigInt/name.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.includes
+description: >
+ %TypedArray%.prototype.includes.name is "includes".
+info: |
+ %TypedArray%.prototype.includes (searchElement [ , fromIndex ] )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, that is not
+ identified as an anonymous function has a name property whose value
+ is a String.
+
+ Unless otherwise specified, the name property of a built-in Function
+ object, if it exists, has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.includes.name, "includes");
+
+verifyNotEnumerable(TypedArray.prototype.includes, "name");
+verifyNotWritable(TypedArray.prototype.includes, "name");
+verifyConfigurable(TypedArray.prototype.includes, "name");
diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/includes/BigInt/prop-desc.js
new file mode 100644
index 000000000..fa4630d51
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/includes/BigInt/prop-desc.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.includes
+description: >
+ "includes" property of TypedArrayPrototype
+info: |
+ ES6 section 17: Every other data property described in clauses 18 through 26
+ and in Annex B.2 has the attributes { [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+verifyNotEnumerable(TypedArrayPrototype, "includes");
+verifyWritable(TypedArrayPrototype, "includes");
+verifyConfigurable(TypedArrayPrototype, "includes");
diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/return-abrupt-tointeger-fromindex-symbol.js b/test/built-ins/TypedArray/prototype/includes/BigInt/return-abrupt-tointeger-fromindex-symbol.js
new file mode 100644
index 000000000..0625bfbcf
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/includes/BigInt/return-abrupt-tointeger-fromindex-symbol.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.includes
+description: Return abrupt from ToInteger(fromIndex) - using symbol
+info: |
+ 22.2.3.13 %TypedArray%.prototype.includes ( searchElement [ , fromIndex ] )
+
+ %TypedArray%.prototype.includes is a distinct function that implements the
+ same algorithm as Array.prototype.includes as defined in 22.1.3.11 except that
+ the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ 22.1.3.11 Array.prototype.includes ( searchElement [ , fromIndex ] )
+
+ ...
+ 4. Let n be ? ToInteger(fromIndex). (If fromIndex is undefined, this step
+ produces the value 0.)
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var fromIndex = Symbol("1");
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([7n]);
+
+ assert.throws(TypeError, function() {
+ sample.includes(7n, fromIndex);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/return-abrupt-tointeger-fromindex.js b/test/built-ins/TypedArray/prototype/includes/BigInt/return-abrupt-tointeger-fromindex.js
new file mode 100644
index 000000000..1013df57e
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/includes/BigInt/return-abrupt-tointeger-fromindex.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.includes
+description: Return abrupt from ToInteger(fromIndex)
+info: |
+ 22.2.3.13 %TypedArray%.prototype.includes ( searchElement [ , fromIndex ] )
+
+ %TypedArray%.prototype.includes is a distinct function that implements the
+ same algorithm as Array.prototype.includes as defined in 22.1.3.11 except that
+ the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ 22.1.3.11 Array.prototype.includes ( searchElement [ , fromIndex ] )
+
+ ...
+ 4. Let n be ? ToInteger(fromIndex). (If fromIndex is undefined, this step
+ produces the value 0.)
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var fromIndex = {
+ valueOf: function() {
+ throw new Test262Error();
+ }
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([7n]);
+
+ assert.throws(Test262Error, function() {
+ sample.includes(7n, fromIndex);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/search-found-returns-true.js b/test/built-ins/TypedArray/prototype/includes/BigInt/search-found-returns-true.js
new file mode 100644
index 000000000..3d1140a0a
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/includes/BigInt/search-found-returns-true.js
@@ -0,0 +1,44 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.includes
+description: returns true for found index
+info: |
+ 22.2.3.13 %TypedArray%.prototype.includes ( searchElement [ , fromIndex ] )
+
+ %TypedArray%.prototype.includes is a distinct function that implements the
+ same algorithm as Array.prototype.includes as defined in 22.1.3.11 except that
+ the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ 22.1.3.11 Array.prototype.includes ( searchElement [ , fromIndex ] )
+
+ ...
+ 5. If n ≥ 0, then
+ a. Let k be n.
+ 6. Else n < 0,
+ a. Let k be len + n.
+ b. If k < 0, let k be 0.
+ 7. Repeat, while k < len
+ a. Let elementK be the result of ? Get(O, ! ToString(k)).
+ b. If SameValueZero(searchElement, elementK) is true, return true.
+ c. Increase k by 1.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n, 42n, 41n]);
+ assert.sameValue(sample.includes(42n), true, "includes(42)");
+ assert.sameValue(sample.includes(43n), true, "includes(43)");
+ assert.sameValue(sample.includes(43n, 1), true, "includes(43, 1)");
+ assert.sameValue(sample.includes(42n, 1), true, "includes(42, 1)");
+ assert.sameValue(sample.includes(42n, 2), true, "includes(42, 2)");
+
+ assert.sameValue(sample.includes(42n, -4), true, "includes(42, -4)");
+ assert.sameValue(sample.includes(42n, -3), true, "includes(42, -3)");
+ assert.sameValue(sample.includes(42n, -2), true, "includes(42, -2)");
+ assert.sameValue(sample.includes(42n, -5), true, "includes(42, -5)");
+});
diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/search-not-found-returns-false.js b/test/built-ins/TypedArray/prototype/includes/BigInt/search-not-found-returns-false.js
new file mode 100644
index 000000000..9d4673e8c
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/includes/BigInt/search-not-found-returns-false.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.includes
+description: returns false if the element is not found
+info: |
+ 22.2.3.13 %TypedArray%.prototype.includes ( searchElement [ , fromIndex ] )
+
+ %TypedArray%.prototype.includes is a distinct function that implements the
+ same algorithm as Array.prototype.includes as defined in 22.1.3.11 except that
+ the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ 22.1.3.11 Array.prototype.includes ( searchElement [ , fromIndex ] )
+
+ ...
+ 5. If n ≥ 0, then
+ a. Let k be n.
+ 6. Else n < 0,
+ a. Let k be len + n.
+ b. If k < 0, let k be 0.
+ 7. Repeat, while k < len
+ a. Let elementK be the result of ? Get(O, ! ToString(k)).
+ b. If SameValueZero(searchElement, elementK) is true, return true.
+ c. Increase k by 1.
+ 8. Return false.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample;
+
+ sample = new TA([42n, 43n, 42n, 41n]);
+ assert.sameValue(sample.includes(44n), false, "includes(44)");
+ assert.sameValue(sample.includes(43n, 2), false, "includes(43, 2)");
+ assert.sameValue(sample.includes(42n, 3), false, "includes(42, 3)");
+ assert.sameValue(sample.includes(44n, -4), false, "includes(44, -4)");
+ assert.sameValue(sample.includes(44n, -5), false, "includes(44, -5)");
+ assert.sameValue(sample.includes(42n, -1), false, "includes(42, -1)");
+});
diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/includes/BigInt/this-is-not-object.js
new file mode 100644
index 000000000..88a42bcdf
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/includes/BigInt/this-is-not-object.js
@@ -0,0 +1,50 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.includes
+description: Throws a TypeError exception when `this` is not Object
+info: |
+ 22.2.3.14 %TypedArray%.prototype.includes ( searchElement [ , fromIndex ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var includes = TypedArray.prototype.includes;
+
+assert.throws(TypeError, function() {
+ includes.call(undefined, 42);
+}, "this is undefined");
+
+assert.throws(TypeError, function() {
+ includes.call(null, 42);
+}, "this is null");
+
+assert.throws(TypeError, function() {
+ includes.call(42, 42);
+}, "this is 42");
+
+assert.throws(TypeError, function() {
+ includes.call("1", 42);
+}, "this is a string");
+
+assert.throws(TypeError, function() {
+ includes.call(true, 42);
+}, "this is true");
+
+assert.throws(TypeError, function() {
+ includes.call(false, 42);
+}, "this is false");
+
+var s = Symbol("s");
+assert.throws(TypeError, function() {
+ includes.call(s, 42);
+}, "this is a Symbol");
diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/includes/BigInt/this-is-not-typedarray-instance.js
new file mode 100644
index 000000000..713fe26dd
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/includes/BigInt/this-is-not-typedarray-instance.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.includes
+description: >
+ Throws a TypeError exception when `this` is not a TypedArray instance
+info: |
+ 22.2.3.14 %TypedArray%.prototype.includes ( searchElement [ , fromIndex ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var includes = TypedArray.prototype.includes;
+
+assert.throws(TypeError, function() {
+ includes.call({}, 42);
+}, "this is an Object");
+
+assert.throws(TypeError, function() {
+ includes.call([], 42);
+}, "this is an Array");
+
+var ab = new ArrayBuffer(8);
+assert.throws(TypeError, function() {
+ includes.call(ab, 42);
+}, "this is an ArrayBuffer instance");
+
+var dv = new DataView(new ArrayBuffer(8), 0, 1);
+assert.throws(TypeError, function() {
+ includes.call(dv, 42);
+}, "this is a DataView instance");
diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/tointeger-fromindex.js b/test/built-ins/TypedArray/prototype/includes/BigInt/tointeger-fromindex.js
new file mode 100644
index 000000000..4c5872be6
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/includes/BigInt/tointeger-fromindex.js
@@ -0,0 +1,65 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.includes
+description: get the integer value from fromIndex
+info: |
+ 22.2.3.13 %TypedArray%.prototype.includes ( searchElement [ , fromIndex ] )
+
+ %TypedArray%.prototype.includes is a distinct function that implements the
+ same algorithm as Array.prototype.includes as defined in 22.1.3.11 except that
+ the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ 22.1.3.11 Array.prototype.includes ( searchElement [ , fromIndex ] )
+
+ ...
+ 4. Let n be ? ToInteger(fromIndex). (If fromIndex is undefined, this step
+ produces the value 0.)
+ 5. If n ≥ 0, then
+ a. Let k be n.
+ ...
+ 7. Repeat, while k < len
+ a. Let elementK be the result of ? Get(O, ! ToString(k)).
+ b. If SameValueZero(searchElement, elementK) is true, return true.
+ c. Increase k by 1.
+ 8. Return false.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var obj = {
+ valueOf: function() {
+ return 1;
+ }
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample;
+
+ sample = new TA([42n, 43n]);
+ assert.sameValue(sample.includes(42n, "1"), false, "string [0]");
+ assert.sameValue(sample.includes(43n, "1"), true, "string [1]");
+
+ assert.sameValue(sample.includes(42n, true), false, "true [0]");
+ assert.sameValue(sample.includes(43n, true), true, "true [1]");
+
+ assert.sameValue(sample.includes(42n, false), true, "false [0]");
+ assert.sameValue(sample.includes(43n, false), true, "false [1]");
+
+ assert.sameValue(sample.includes(42n, NaN), true, "NaN [0]");
+ assert.sameValue(sample.includes(43n, NaN), true, "NaN [1]");
+
+ assert.sameValue(sample.includes(42n, null), true, "null [0]");
+ assert.sameValue(sample.includes(43n, null), true, "null [1]");
+
+ assert.sameValue(sample.includes(42n, undefined), true, "undefined [0]");
+ assert.sameValue(sample.includes(43n, undefined), true, "undefined [1]");
+
+ assert.sameValue(sample.includes(42n, null), true, "null [0]");
+ assert.sameValue(sample.includes(43n, null), true, "null [1]");
+
+ assert.sameValue(sample.includes(42n, obj), false, "object [0]");
+ assert.sameValue(sample.includes(43n, obj), true, "object [1]");
+});
diff --git a/test/built-ins/TypedArray/prototype/includes/length.js b/test/built-ins/TypedArray/prototype/includes/length.js
index 95a4c9922..b59e5c995 100644
--- a/test/built-ins/TypedArray/prototype/includes/length.js
+++ b/test/built-ins/TypedArray/prototype/includes/length.js
@@ -20,6 +20,7 @@ info: |
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
[[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.includes.length, 1);
diff --git a/test/built-ins/TypedArray/prototype/includes/name.js b/test/built-ins/TypedArray/prototype/includes/name.js
index 7996b2a3a..7f515b125 100644
--- a/test/built-ins/TypedArray/prototype/includes/name.js
+++ b/test/built-ins/TypedArray/prototype/includes/name.js
@@ -17,6 +17,7 @@ info: |
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.includes.name, "includes");
diff --git a/test/built-ins/TypedArray/prototype/includes/prop-desc.js b/test/built-ins/TypedArray/prototype/includes/prop-desc.js
index 8214efc1e..16cca2097 100644
--- a/test/built-ins/TypedArray/prototype/includes/prop-desc.js
+++ b/test/built-ins/TypedArray/prototype/includes/prop-desc.js
@@ -9,6 +9,7 @@ info: |
and in Annex B.2 has the attributes { [[Writable]]: true,
[[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
var TypedArrayPrototype = TypedArray.prototype;
diff --git a/test/built-ins/TypedArray/prototype/includes/this-is-not-object.js b/test/built-ins/TypedArray/prototype/includes/this-is-not-object.js
index bf43ae7c8..2e7fdcc07 100644
--- a/test/built-ins/TypedArray/prototype/includes/this-is-not-object.js
+++ b/test/built-ins/TypedArray/prototype/includes/this-is-not-object.js
@@ -1,7 +1,6 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.14
esid: sec-%typedarray%.prototype.includes
description: Throws a TypeError exception when `this` is not Object
info: |
diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/detached-buffer.js
new file mode 100644
index 000000000..1d44ab16d
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/detached-buffer.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.indexof
+description: Throws a TypeError if this has a detached buffer
+info: |
+ 22.2.3.13 %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ ...
+ 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+ $DETACHBUFFER(sample.buffer);
+ assert.throws(TypeError, function() {
+ sample.indexOf(0);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/fromIndex-equal-or-greater-length-returns-minus-one.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/fromIndex-equal-or-greater-length-returns-minus-one.js
new file mode 100644
index 000000000..022f4a156
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/fromIndex-equal-or-greater-length-returns-minus-one.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.indexof
+description: Return -1 if fromIndex >= ArrayLength
+info: |
+ 22.2.3.13 %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] )
+
+ %TypedArray%.prototype.indexOf is a distinct function that implements the same
+ algorithm as Array.prototype.indexOf as defined in 22.1.3.12 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length".
+
+ 22.1.3.12 Array.prototype.indexOf ( searchElement [ , fromIndex ] )
+
+ ...
+ 4. Let n be ? ToInteger(fromIndex). (If fromIndex is undefined, this step
+ produces the value 0.)
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample;
+
+ sample = new TA(42);
+ assert.sameValue(sample.indexOf(0, 42), -1);
+ assert.sameValue(sample.indexOf(0, 43), -1);
+});
diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/fromIndex-infinity.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/fromIndex-infinity.js
new file mode 100644
index 000000000..07bcd38a4
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/fromIndex-infinity.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.indexof
+description: handle Infinity values for fromIndex
+info: |
+ 22.2.3.13 %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] )
+
+ %TypedArray%.prototype.indexOf is a distinct function that implements the same
+ algorithm as Array.prototype.indexOf as defined in 22.1.3.12 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length".
+
+ 22.1.3.12 Array.prototype.indexOf ( searchElement [ , fromIndex ] )
+
+ ...
+ 6. If n ≥ 0, then
+ a. If n is -0, let k be +0; else let k be n.
+ 7. Else n < 0,
+ a. Let k be len + n.
+ b. If k < 0, let k be 0.
+ 8. Repeat, while k < len
+ a. Let kPresent be ? HasProperty(O, ! ToString(k)).
+ b. If kPresent is true, then
+ i. Let elementK be ? Get(O, ! ToString(k)).
+ ii. Let same be the result of performing Strict Equality Comparison
+ searchElement === elementK.
+ iii. If same is true, return k.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n, 43n, 41n]);
+
+ assert.sameValue(sample.indexOf(43n, Infinity), -1, "indexOf(43, Infinity)");
+ assert.sameValue(sample.indexOf(43n, -Infinity), 1, "indexOf(43, -Infinity)");
+});
diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/fromIndex-minus-zero.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/fromIndex-minus-zero.js
new file mode 100644
index 000000000..90dc45150
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/fromIndex-minus-zero.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.indexof
+description: -0 fromIndex becomes 0
+info: |
+ 22.2.3.13 %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] )
+
+ %TypedArray%.prototype.indexOf is a distinct function that implements the same
+ algorithm as Array.prototype.indexOf as defined in 22.1.3.12 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length".
+
+ 22.1.3.12 Array.prototype.indexOf ( searchElement [ , fromIndex ] )
+
+ ...
+ 6. If n ≥ 0, then
+ a. If n is -0, let k be +0; else let k be n.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample;
+
+ sample = new TA([42n, 43n]);
+ assert.sameValue(sample.indexOf(42n, -0), 0, "-0 [0]");
+ assert.sameValue(sample.indexOf(43n, -0), 1, "-0 [1]");
+});
diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/get-length-uses-internal-arraylength.js
new file mode 100644
index 000000000..9c386b222
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/get-length-uses-internal-arraylength.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.indexof
+description: Get "length" uses internal ArrayLength
+info: |
+ 22.2.3.13 %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] )
+
+ %TypedArray%.prototype.indexOf is a distinct function that implements the same
+ algorithm as Array.prototype.indexOf as defined in 22.1.3.12 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length".
+
+ 22.1.3.12 Array.prototype.indexOf ( searchElement [ , fromIndex ] )
+
+ ...
+ 2. Let len be ? ToLength(? Get(O, "length")).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+Object.defineProperty(TypedArray.prototype, "length", {value: 0});
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([7n]);
+
+ Object.defineProperty(TA.prototype, "length", {value: 0});
+ Object.defineProperty(sample, "length", {value: 0});
+
+ assert.sameValue(sample.indexOf(7n), 0);
+});
diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/invoked-as-func.js
new file mode 100644
index 000000000..f2d8ff705
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/invoked-as-func.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.indexof
+description: Throws a TypeError exception when invoked as a function
+info: |
+ 22.2.3.13 %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var indexOf = TypedArray.prototype.indexOf;
+
+assert.sameValue(typeof indexOf, 'function');
+
+assert.throws(TypeError, function() {
+ indexOf();
+});
diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/invoked-as-method.js
new file mode 100644
index 000000000..80560a9ad
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/invoked-as-method.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.indexof
+description: Requires a [[TypedArrayName]] internal slot.
+info: |
+ 22.2.3.13 %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+assert.sameValue(typeof TypedArrayPrototype.indexOf, 'function');
+
+assert.throws(TypeError, function() {
+ TypedArrayPrototype.indexOf();
+});
diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/length-zero-returns-minus-one.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/length-zero-returns-minus-one.js
new file mode 100644
index 000000000..510a58f7b
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/length-zero-returns-minus-one.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.indexof
+description: Returns -1 if length is 0
+info: |
+ 22.2.3.13 %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] )
+
+ %TypedArray%.prototype.indexOf is a distinct function that implements the same
+ algorithm as Array.prototype.indexOf as defined in 22.1.3.12 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length".
+
+ 22.1.3.12 Array.prototype.indexOf ( searchElement [ , fromIndex ] )
+
+ ...
+ 2. Let len be ? ToLength(? Get(O, "length")).
+ 3. If len is 0, return -1.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var fromIndex = {
+ valueOf: function() {
+ throw new Test262Error();
+ }
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA();
+ assert.sameValue(sample.indexOf(0), -1, "returns -1");
+ assert.sameValue(
+ sample.indexOf(0, fromIndex), -1,
+ "length is checked before ToInteger(fromIndex)"
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/length.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/length.js
new file mode 100644
index 000000000..d39f7dab9
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/length.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.indexof
+description: >
+ %TypedArray%.prototype.indexOf.length is 1.
+info: |
+ %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, has a length
+ property whose value is an integer. Unless otherwise specified, this
+ value is equal to the largest number of named arguments shown in the
+ subclause headings for the function description, including optional
+ parameters. However, rest parameters shown using the form “...name”
+ are not included in the default argument count.
+
+ Unless otherwise specified, the length property of a built-in Function
+ object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.indexOf.length, 1);
+
+verifyNotEnumerable(TypedArray.prototype.indexOf, "length");
+verifyNotWritable(TypedArray.prototype.indexOf, "length");
+verifyConfigurable(TypedArray.prototype.indexOf, "length");
diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/name.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/name.js
new file mode 100644
index 000000000..93ad66115
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/name.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.indexof
+description: >
+ %TypedArray%.prototype.indexOf.name is "indexOf".
+info: |
+ %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, that is not
+ identified as an anonymous function has a name property whose value
+ is a String.
+
+ Unless otherwise specified, the name property of a built-in Function
+ object, if it exists, has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.indexOf.name, "indexOf");
+
+verifyNotEnumerable(TypedArray.prototype.indexOf, "name");
+verifyNotWritable(TypedArray.prototype.indexOf, "name");
+verifyConfigurable(TypedArray.prototype.indexOf, "name");
diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/prop-desc.js
new file mode 100644
index 000000000..aab149737
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/prop-desc.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.indexof
+description: >
+ "indexOf" property of TypedArrayPrototype
+info: |
+ ES6 section 17: Every other data property described in clauses 18 through 26
+ and in Annex B.2 has the attributes { [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+verifyNotEnumerable(TypedArrayPrototype, 'indexOf');
+verifyWritable(TypedArrayPrototype, 'indexOf');
+verifyConfigurable(TypedArrayPrototype, 'indexOf');
diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/return-abrupt-tointeger-fromindex-symbol.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/return-abrupt-tointeger-fromindex-symbol.js
new file mode 100644
index 000000000..843a22a29
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/return-abrupt-tointeger-fromindex-symbol.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.indexof
+description: Return abrupt from ToInteger(fromIndex) - using symbol
+info: |
+ 22.2.3.13 %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] )
+
+ %TypedArray%.prototype.indexOf is a distinct function that implements the same
+ algorithm as Array.prototype.indexOf as defined in 22.1.3.12 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length".
+
+ 22.1.3.12 Array.prototype.indexOf ( searchElement [ , fromIndex ] )
+
+ ...
+ 4. Let n be ? ToInteger(fromIndex). (If fromIndex is undefined, this step
+ produces the value 0.)
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var fromIndex = Symbol("1");
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+
+ assert.throws(TypeError, function() {
+ sample.indexOf(7, fromIndex);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/return-abrupt-tointeger-fromindex.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/return-abrupt-tointeger-fromindex.js
new file mode 100644
index 000000000..751b482b9
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/return-abrupt-tointeger-fromindex.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.indexof
+description: Return abrupt from ToInteger(fromIndex)
+info: |
+ 22.2.3.13 %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] )
+
+ %TypedArray%.prototype.indexOf is a distinct function that implements the same
+ algorithm as Array.prototype.indexOf as defined in 22.1.3.12 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length".
+
+ 22.1.3.12 Array.prototype.indexOf ( searchElement [ , fromIndex ] )
+
+ ...
+ 4. Let n be ? ToInteger(fromIndex). (If fromIndex is undefined, this step
+ produces the value 0.)
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var fromIndex = {
+ valueOf: function() {
+ throw new Test262Error();
+ }
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+
+ assert.throws(Test262Error, function() {
+ sample.indexOf(7, fromIndex);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/search-found-returns-index.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/search-found-returns-index.js
new file mode 100644
index 000000000..484e16f5c
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/search-found-returns-index.js
@@ -0,0 +1,46 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.indexof
+description: returns index for the first found element
+info: |
+ 22.2.3.13 %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] )
+
+ %TypedArray%.prototype.indexOf is a distinct function that implements the same
+ algorithm as Array.prototype.indexOf as defined in 22.1.3.12 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length".
+
+ 22.1.3.12 Array.prototype.indexOf ( searchElement [ , fromIndex ] )
+
+ ...
+ 6. If n ≥ 0, then
+ a. If n is -0, let k be +0; else let k be n.
+ 7. Else n < 0,
+ a. Let k be len + n.
+ b. If k < 0, let k be 0.
+ 8. Repeat, while k < len
+ a. Let kPresent be ? HasProperty(O, ! ToString(k)).
+ b. If kPresent is true, then
+ i. Let elementK be ? Get(O, ! ToString(k)).
+ ii. Let same be the result of performing Strict Equality Comparison
+ searchElement === elementK.
+ iii. If same is true, return k.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n, 42n, 41n]);
+ assert.sameValue(sample.indexOf(42n), 0, "indexOf(42)");
+ assert.sameValue(sample.indexOf(43n), 1, "indexOf(43)");
+ assert.sameValue(sample.indexOf(43n, 1), 1, "indexOf(43, 1)");
+ assert.sameValue(sample.indexOf(42n, 1), 2, "indexOf(42, 1)");
+ assert.sameValue(sample.indexOf(42n, 2), 2, "indexOf(42, 2)");
+
+ assert.sameValue(sample.indexOf(42n, -4), 0, "indexOf(42, -4)");
+ assert.sameValue(sample.indexOf(42n, -3), 2, "indexOf(42, -3)");
+ assert.sameValue(sample.indexOf(42n, -2), 2, "indexOf(42, -2)");
+ assert.sameValue(sample.indexOf(42n, -5), 0, "indexOf(42, -5)");
+});
diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/search-not-found-returns-minus-one.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/search-not-found-returns-minus-one.js
new file mode 100644
index 000000000..2ef363213
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/search-not-found-returns-minus-one.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.indexof
+description: returns -1 if the element if not found
+info: |
+ 22.2.3.13 %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] )
+
+ %TypedArray%.prototype.indexOf is a distinct function that implements the same
+ algorithm as Array.prototype.indexOf as defined in 22.1.3.12 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length".
+
+ 22.1.3.12 Array.prototype.indexOf ( searchElement [ , fromIndex ] )
+
+ ...
+ 6. If n ≥ 0, then
+ a. If n is -0, let k be +0; else let k be n.
+ 7. Else n < 0,
+ a. Let k be len + n.
+ b. If k < 0, let k be 0.
+ ...
+ 9. Return -1.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample;
+
+ sample = new TA([42n, 43n, 42n, 41n]);
+ assert.sameValue(sample.indexOf(44n), -1, "indexOf(44)");
+ assert.sameValue(sample.indexOf(43n, 2), -1, "indexOf(43, 2)");
+ assert.sameValue(sample.indexOf(42n, 3), -1, "indexOf(42, 3)");
+ assert.sameValue(sample.indexOf(44n, -4), -1, "indexOf(44, -4)");
+ assert.sameValue(sample.indexOf(44n, -5), -1, "indexOf(44, -5)");
+ assert.sameValue(sample.indexOf(42n, -1), -1, "indexOf(42, -1)");
+});
diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/this-is-not-object.js
new file mode 100644
index 000000000..c572d7dd3
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/this-is-not-object.js
@@ -0,0 +1,50 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.indexof
+description: Throws a TypeError exception when `this` is not Object
+info: |
+ 22.2.3.13 %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var indexOf = TypedArray.prototype.indexOf;
+
+assert.throws(TypeError, function() {
+ indexOf.call(undefined, 42);
+}, "this is undefined");
+
+assert.throws(TypeError, function() {
+ indexOf.call(null, 42);
+}, "this is null");
+
+assert.throws(TypeError, function() {
+ indexOf.call(42, 42);
+}, "this is 42");
+
+assert.throws(TypeError, function() {
+ indexOf.call("1", 42);
+}, "this is a string");
+
+assert.throws(TypeError, function() {
+ indexOf.call(true, 42);
+}, "this is true");
+
+assert.throws(TypeError, function() {
+ indexOf.call(false, 42);
+}, "this is false");
+
+var s = Symbol("s");
+assert.throws(TypeError, function() {
+ indexOf.call(s, 42);
+}, "this is a Symbol");
diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/this-is-not-typedarray-instance.js
new file mode 100644
index 000000000..753fc3f79
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/this-is-not-typedarray-instance.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.indexof
+description: >
+ Throws a TypeError exception when `this` is not a TypedArray instance
+info: |
+ 22.2.3.13 %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var indexOf = TypedArray.prototype.indexOf;
+
+assert.throws(TypeError, function() {
+ indexOf.call({}, 42);
+}, "this is an Object");
+
+assert.throws(TypeError, function() {
+ indexOf.call([], 42);
+}, "this is an Array");
+
+var ab = new ArrayBuffer(8);
+assert.throws(TypeError, function() {
+ indexOf.call(ab, 42);
+}, "this is an ArrayBuffer instance");
+
+var dv = new DataView(new ArrayBuffer(8), 0, 1);
+assert.throws(TypeError, function() {
+ indexOf.call(dv, 42);
+}, "this is a DataView instance");
diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/tointeger-fromindex.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/tointeger-fromindex.js
new file mode 100644
index 000000000..dd62589c5
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/tointeger-fromindex.js
@@ -0,0 +1,57 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.indexof
+description: Return -1 if fromIndex >= ArrayLength - converted values
+info: |
+ 22.2.3.13 %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] )
+
+ %TypedArray%.prototype.indexOf is a distinct function that implements the same
+ algorithm as Array.prototype.indexOf as defined in 22.1.3.12 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length".
+
+ 22.1.3.12 Array.prototype.indexOf ( searchElement [ , fromIndex ] )
+
+ ...
+ 4. Let n be ? ToInteger(fromIndex). (If fromIndex is undefined, this step
+ produces the value 0.)
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var obj = {
+ valueOf: function() {
+ return 1;
+ }
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample;
+
+ sample = new TA([42n, 43n]);
+ assert.sameValue(sample.indexOf(42n, "1"), -1, "string [0]");
+ assert.sameValue(sample.indexOf(43n, "1"), 1, "string [1]");
+
+ assert.sameValue(sample.indexOf(42n, true), -1, "true [0]");
+ assert.sameValue(sample.indexOf(43n, true), 1, "true [1]");
+
+ assert.sameValue(sample.indexOf(42n, false), 0, "false [0]");
+ assert.sameValue(sample.indexOf(43n, false), 1, "false [1]");
+
+ assert.sameValue(sample.indexOf(42n, NaN), 0, "NaN [0]");
+ assert.sameValue(sample.indexOf(43n, NaN), 1, "NaN [1]");
+
+ assert.sameValue(sample.indexOf(42n, null), 0, "null [0]");
+ assert.sameValue(sample.indexOf(43n, null), 1, "null [1]");
+
+ assert.sameValue(sample.indexOf(42n, undefined), 0, "undefined [0]");
+ assert.sameValue(sample.indexOf(43n, undefined), 1, "undefined [1]");
+
+ assert.sameValue(sample.indexOf(42n, null), 0, "null [0]");
+ assert.sameValue(sample.indexOf(43n, null), 1, "null [1]");
+
+ assert.sameValue(sample.indexOf(42n, obj), -1, "object [0]");
+ assert.sameValue(sample.indexOf(43n, obj), 1, "object [1]");
+});
diff --git a/test/built-ins/TypedArray/prototype/indexOf/invoked-as-func.js b/test/built-ins/TypedArray/prototype/indexOf/invoked-as-func.js
index d304d4426..99207d03d 100644
--- a/test/built-ins/TypedArray/prototype/indexOf/invoked-as-func.js
+++ b/test/built-ins/TypedArray/prototype/indexOf/invoked-as-func.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.13
+esid: sec-%typedarray%.prototype.indexof
description: Throws a TypeError exception when invoked as a function
info: |
22.2.3.13 %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] )
diff --git a/test/built-ins/TypedArray/prototype/indexOf/invoked-as-method.js b/test/built-ins/TypedArray/prototype/indexOf/invoked-as-method.js
index ef348b237..75f1957a7 100644
--- a/test/built-ins/TypedArray/prototype/indexOf/invoked-as-method.js
+++ b/test/built-ins/TypedArray/prototype/indexOf/invoked-as-method.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.13
+esid: sec-%typedarray%.prototype.indexof
description: Requires a [[TypedArrayName]] internal slot.
info: |
22.2.3.13 %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] )
diff --git a/test/built-ins/TypedArray/prototype/indexOf/length.js b/test/built-ins/TypedArray/prototype/indexOf/length.js
index 09f1a36fa..5729797c6 100644
--- a/test/built-ins/TypedArray/prototype/indexOf/length.js
+++ b/test/built-ins/TypedArray/prototype/indexOf/length.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.13
+esid: sec-%typedarray%.prototype.indexof
description: >
%TypedArray%.prototype.indexOf.length is 1.
info: |
@@ -20,6 +20,7 @@ info: |
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
[[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.indexOf.length, 1);
diff --git a/test/built-ins/TypedArray/prototype/indexOf/name.js b/test/built-ins/TypedArray/prototype/indexOf/name.js
index 1f1ba6bfc..ee50628ff 100644
--- a/test/built-ins/TypedArray/prototype/indexOf/name.js
+++ b/test/built-ins/TypedArray/prototype/indexOf/name.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.13
+esid: sec-%typedarray%.prototype.indexof
description: >
%TypedArray%.prototype.indexOf.name is "indexOf".
info: |
@@ -17,6 +17,7 @@ info: |
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.indexOf.name, "indexOf");
diff --git a/test/built-ins/TypedArray/prototype/indexOf/prop-desc.js b/test/built-ins/TypedArray/prototype/indexOf/prop-desc.js
index 6e58a0755..e950a34a7 100644
--- a/test/built-ins/TypedArray/prototype/indexOf/prop-desc.js
+++ b/test/built-ins/TypedArray/prototype/indexOf/prop-desc.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.13
+esid: sec-%typedarray%.prototype.indexof
description: >
"indexOf" property of TypedArrayPrototype
info: |
@@ -9,6 +9,7 @@ info: |
and in Annex B.2 has the attributes { [[Writable]]: true,
[[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
var TypedArrayPrototype = TypedArray.prototype;
diff --git a/test/built-ins/TypedArray/prototype/join/BigInt/custom-separator-result-from-tostring-on-each-simple-value.js b/test/built-ins/TypedArray/prototype/join/BigInt/custom-separator-result-from-tostring-on-each-simple-value.js
new file mode 100644
index 000000000..df053b194
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/join/BigInt/custom-separator-result-from-tostring-on-each-simple-value.js
@@ -0,0 +1,78 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.join
+description: >
+ Concatenates the result of toString for each value with custom separator
+info: |
+ 22.2.3.15 %TypedArray%.prototype.join ( separator )
+
+ %TypedArray%.prototype.join is a distinct function that implements the same
+ algorithm as Array.prototype.join as defined in 22.1.3.13 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length".
+
+ 22.1.3.13 Array.prototype.join (separator)
+
+ ...
+ 7. If element0 is undefined or null, let R be the empty String; otherwise, let
+ R be ? ToString(element0).
+ 8. Let k be 1.
+ 9. Repeat, while k < len
+ a. Let S be the String value produced by concatenating R and sep.
+ b. Let element be ? Get(O, ! ToString(k)).
+ c. If element is undefined or null, let next be the empty String; otherwise,
+ let next be ? ToString(element).
+ d. Let R be a String value produced by concatenating S and next.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([1n, 0n, 2n, 3n, 42n, 127n]);
+
+ var result;
+
+ result = sample.join(",");
+ assert.sameValue(result, "1,0,2,3,42,127");
+
+ result = sample.join(undefined);
+ assert.sameValue(result, "1,0,2,3,42,127");
+
+ result = sample.join(null);
+ assert.sameValue(result, "1null0null2null3null42null127");
+
+ result = sample.join(",,");
+ assert.sameValue(result, "1,,0,,2,,3,,42,,127");
+
+ result = sample.join(0);
+ assert.sameValue(result, "10002030420127");
+
+ result = sample.join("");
+ assert.sameValue(result, "102342127");
+
+ result = sample.join(" a b c ");
+ assert.sameValue(result, "1 a b c 0 a b c 2 a b c 3 a b c 42 a b c 127");
+
+ result = sample.join({});
+ assert.sameValue(result, "1[object Object]0[object Object]2[object Object]3[object Object]42[object Object]127");
+
+ result = sample.join(true);
+ assert.sameValue(result, "1true0true2true3true42true127");
+
+ result = sample.join({ toString: function() { return "foo"; }});
+ assert.sameValue(result, "1foo0foo2foo3foo42foo127");
+
+ result = sample.join({ toString: undefined, valueOf: function() { return "bar"; }});
+ assert.sameValue(result, "1bar0bar2bar3bar42bar127");
+
+ result = sample.join(false);
+ assert.sameValue(result, "1false0false2false3false42false127");
+
+ result = sample.join(-1);
+ assert.sameValue(result, "1-10-12-13-142-1127");
+
+ result = sample.join(-0);
+ assert.sameValue(result, "10002030420127");
+});
diff --git a/test/built-ins/TypedArray/prototype/join/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/join/BigInt/detached-buffer.js
new file mode 100644
index 000000000..1af7ae94c
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/join/BigInt/detached-buffer.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.join
+description: Throws a TypeError if this has a detached buffer
+info: |
+ 22.2.3.15 %TypedArray%.prototype.join ( separator )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ ...
+ 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+var obj = {
+ toString: function() {
+ throw new Test262Error();
+ }
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+ $DETACHBUFFER(sample.buffer);
+ assert.throws(TypeError, function() {
+ sample.join(obj);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/join/BigInt/empty-instance-empty-string.js b/test/built-ins/TypedArray/prototype/join/BigInt/empty-instance-empty-string.js
new file mode 100644
index 000000000..a7103a83e
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/join/BigInt/empty-instance-empty-string.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.join
+description: Return the empty String if length is 0
+info: |
+ 22.2.3.15 %TypedArray%.prototype.join ( separator )
+
+ %TypedArray%.prototype.join is a distinct function that implements the same
+ algorithm as Array.prototype.join as defined in 22.1.3.13 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length".
+
+ 22.1.3.13 Array.prototype.join (separator)
+
+ ...
+ 4. Let sep be ? ToString(separator).
+ 5. If len is zero, return the empty String.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA();
+
+ assert.sameValue(sample.join(), "");
+ assert.sameValue(sample.join("test262"), "");
+});
diff --git a/test/built-ins/TypedArray/prototype/join/BigInt/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/join/BigInt/get-length-uses-internal-arraylength.js
new file mode 100644
index 000000000..87e785727
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/join/BigInt/get-length-uses-internal-arraylength.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.join
+description: Get "length" uses internal ArrayLength
+info: |
+ 22.2.3.15 %TypedArray%.prototype.join ( separator )
+
+ %TypedArray%.prototype.join is a distinct function that implements the same
+ algorithm as Array.prototype.join as defined in 22.1.3.13 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length".
+
+ 22.1.3.13 Array.prototype.join (separator)
+
+ 1. Let O be ? ToObject(this value).
+ 2. Let len be ? ToLength(? Get(O, "length")).
+ ...
+ 5. If len is zero, return the empty String.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var getCalls = 0;
+var desc = {
+ get: function getLen() {
+ getCalls++;
+ return 0;
+ }
+};
+
+Object.defineProperty(TypedArray.prototype, "length", desc);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n]);
+
+ Object.defineProperty(TA.prototype, "length", desc);
+ Object.defineProperty(sample, "length", desc);
+
+ var result = sample.join();
+
+ assert.sameValue(getCalls, 0, "ignores length properties");
+ assert.notSameValue(result, "", "result is not affected but custom length 0");
+});
diff --git a/test/built-ins/TypedArray/prototype/join/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/join/BigInt/invoked-as-func.js
new file mode 100644
index 000000000..1340f3931
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/join/BigInt/invoked-as-func.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.join
+description: Throws a TypeError exception when invoked as a function
+info: |
+ 22.2.3.14 %TypedArray%.prototype.join ( separator )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var join = TypedArray.prototype.join;
+
+assert.sameValue(typeof join, 'function');
+
+assert.throws(TypeError, function() {
+ join();
+});
diff --git a/test/built-ins/TypedArray/prototype/join/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/join/BigInt/invoked-as-method.js
new file mode 100644
index 000000000..1121e42aa
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/join/BigInt/invoked-as-method.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.join
+description: Requires a [[TypedArrayName]] internal slot.
+info: |
+ 22.2.3.14 %TypedArray%.prototype.join ( separator )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+assert.sameValue(typeof TypedArrayPrototype.join, 'function');
+
+assert.throws(TypeError, function() {
+ TypedArrayPrototype.join();
+});
diff --git a/test/built-ins/TypedArray/prototype/join/BigInt/length.js b/test/built-ins/TypedArray/prototype/join/BigInt/length.js
new file mode 100644
index 000000000..6e1332323
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/join/BigInt/length.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.join
+description: >
+ %TypedArray%.prototype.join.length is 1.
+info: |
+ %TypedArray%.prototype.join ( separator )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, has a length
+ property whose value is an integer. Unless otherwise specified, this
+ value is equal to the largest number of named arguments shown in the
+ subclause headings for the function description, including optional
+ parameters. However, rest parameters shown using the form “...name”
+ are not included in the default argument count.
+
+ Unless otherwise specified, the length property of a built-in Function
+ object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.join.length, 1);
+
+verifyNotEnumerable(TypedArray.prototype.join, "length");
+verifyNotWritable(TypedArray.prototype.join, "length");
+verifyConfigurable(TypedArray.prototype.join, "length");
diff --git a/test/built-ins/TypedArray/prototype/join/BigInt/name.js b/test/built-ins/TypedArray/prototype/join/BigInt/name.js
new file mode 100644
index 000000000..c7a1bfdfc
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/join/BigInt/name.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.join
+description: >
+ %TypedArray%.prototype.join.name is "join".
+info: |
+ %TypedArray%.prototype.join ( separator )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, that is not
+ identified as an anonymous function has a name property whose value
+ is a String.
+
+ Unless otherwise specified, the name property of a built-in Function
+ object, if it exists, has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.join.name, "join");
+
+verifyNotEnumerable(TypedArray.prototype.join, "name");
+verifyNotWritable(TypedArray.prototype.join, "name");
+verifyConfigurable(TypedArray.prototype.join, "name");
diff --git a/test/built-ins/TypedArray/prototype/join/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/join/BigInt/prop-desc.js
new file mode 100644
index 000000000..f1ab91a06
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/join/BigInt/prop-desc.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.join
+description: >
+ "join" property of TypedArrayPrototype
+info: |
+ ES6 section 17: Every other data property described in clauses 18 through 26
+ and in Annex B.2 has the attributes { [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+verifyNotEnumerable(TypedArrayPrototype, 'join');
+verifyWritable(TypedArrayPrototype, 'join');
+verifyConfigurable(TypedArrayPrototype, 'join');
diff --git a/test/built-ins/TypedArray/prototype/join/BigInt/result-from-tostring-on-each-simple-value.js b/test/built-ins/TypedArray/prototype/join/BigInt/result-from-tostring-on-each-simple-value.js
new file mode 100644
index 000000000..ca80064ec
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/join/BigInt/result-from-tostring-on-each-simple-value.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.join
+description: Concatenates the result of toString for each simple value
+info: |
+ 22.2.3.15 %TypedArray%.prototype.join ( separator )
+
+ %TypedArray%.prototype.join is a distinct function that implements the same
+ algorithm as Array.prototype.join as defined in 22.1.3.13 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length".
+
+ 22.1.3.13 Array.prototype.join (separator)
+
+ ...
+ 7. If element0 is undefined or null, let R be the empty String; otherwise, let
+ R be ? ToString(element0).
+ 8. Let k be 1.
+ 9. Repeat, while k < len
+ a. Let S be the String value produced by concatenating R and sep.
+ b. Let element be ? Get(O, ! ToString(k)).
+ c. If element is undefined or null, let next be the empty String; otherwise,
+ let next be ? ToString(element).
+ d. Let R be a String value produced by concatenating S and next.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([1n, 0n, 2n, 3n, 42n, 127n]);
+
+ var result = sample.join();
+
+ assert.sameValue(result, "1,0,2,3,42,127");
+});
diff --git a/test/built-ins/TypedArray/prototype/join/BigInt/return-abrupt-from-separator-symbol.js b/test/built-ins/TypedArray/prototype/join/BigInt/return-abrupt-from-separator-symbol.js
new file mode 100644
index 000000000..fe27585b2
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/join/BigInt/return-abrupt-from-separator-symbol.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.join
+description: Return abrupt from ToString(Symbol separator)
+info: |
+ 22.2.3.15 %TypedArray%.prototype.join ( separator )
+
+ %TypedArray%.prototype.join is a distinct function that implements the same
+ algorithm as Array.prototype.join as defined in 22.1.3.13 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length".
+
+ 22.1.3.13 Array.prototype.join (separator)
+
+ ...
+ 4. Let sep be ? ToString(separator).
+ 5. If len is zero, return the empty String.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var s = Symbol("");
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA();
+
+ assert.throws(TypeError, function() {
+ sample.join(s);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/join/BigInt/return-abrupt-from-separator.js b/test/built-ins/TypedArray/prototype/join/BigInt/return-abrupt-from-separator.js
new file mode 100644
index 000000000..beb8d16b0
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/join/BigInt/return-abrupt-from-separator.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.join
+description: Return abrupt from ToString(separator)
+info: |
+ 22.2.3.15 %TypedArray%.prototype.join ( separator )
+
+ %TypedArray%.prototype.join is a distinct function that implements the same
+ algorithm as Array.prototype.join as defined in 22.1.3.13 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length".
+
+ 22.1.3.13 Array.prototype.join (separator)
+
+ ...
+ 4. Let sep be ? ToString(separator).
+ 5. If len is zero, return the empty String.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var obj = {
+ toString: function() {
+ throw new Test262Error();
+ }
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA();
+
+ assert.throws(Test262Error, function() {
+ sample.join(obj);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/join/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/join/BigInt/this-is-not-object.js
new file mode 100644
index 000000000..6f04ef810
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/join/BigInt/this-is-not-object.js
@@ -0,0 +1,50 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.join
+description: Throws a TypeError exception when `this` is not Object
+info: |
+ 22.2.3.15 %TypedArray%.prototype.join ( separator )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var join = TypedArray.prototype.join;
+
+assert.throws(TypeError, function() {
+ join.call(undefined, "");
+}, "this is undefined");
+
+assert.throws(TypeError, function() {
+ join.call(null, "");
+}, "this is null");
+
+assert.throws(TypeError, function() {
+ join.call(42, "");
+}, "this is 42");
+
+assert.throws(TypeError, function() {
+ join.call("1", "");
+}, "this is a string");
+
+assert.throws(TypeError, function() {
+ join.call(true, "");
+}, "this is true");
+
+assert.throws(TypeError, function() {
+ join.call(false, "");
+}, "this is false");
+
+var s = Symbol("s");
+assert.throws(TypeError, function() {
+ join.call(s, "");
+}, "this is a Symbol");
diff --git a/test/built-ins/TypedArray/prototype/join/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/join/BigInt/this-is-not-typedarray-instance.js
new file mode 100644
index 000000000..582c99f3d
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/join/BigInt/this-is-not-typedarray-instance.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.join
+description: >
+ Throws a TypeError exception when `this` is not a TypedArray instance
+info: |
+ 22.2.3.15 %TypedArray%.prototype.join ( separator )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var join = TypedArray.prototype.join;
+
+assert.throws(TypeError, function() {
+ join.call({}, "");
+}, "this is an Object");
+
+assert.throws(TypeError, function() {
+ join.call([], "");
+}, "this is an Array");
+
+var ab = new ArrayBuffer(8);
+assert.throws(TypeError, function() {
+ join.call(ab, "");
+}, "this is an ArrayBuffer instance");
+
+var dv = new DataView(new ArrayBuffer(8), 0, 1);
+assert.throws(TypeError, function() {
+ join.call(dv, "");
+}, "this is a DataView instance");
diff --git a/test/built-ins/TypedArray/prototype/join/invoked-as-func.js b/test/built-ins/TypedArray/prototype/join/invoked-as-func.js
index 0c85a33c5..a2c1cb169 100644
--- a/test/built-ins/TypedArray/prototype/join/invoked-as-func.js
+++ b/test/built-ins/TypedArray/prototype/join/invoked-as-func.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.14
+esid: sec-%typedarray%.prototype.join
description: Throws a TypeError exception when invoked as a function
info: |
22.2.3.14 %TypedArray%.prototype.join ( separator )
diff --git a/test/built-ins/TypedArray/prototype/join/invoked-as-method.js b/test/built-ins/TypedArray/prototype/join/invoked-as-method.js
index 910a03ff1..6f83240f5 100644
--- a/test/built-ins/TypedArray/prototype/join/invoked-as-method.js
+++ b/test/built-ins/TypedArray/prototype/join/invoked-as-method.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.14
+esid: sec-%typedarray%.prototype.join
description: Requires a [[TypedArrayName]] internal slot.
info: |
22.2.3.14 %TypedArray%.prototype.join ( separator )
diff --git a/test/built-ins/TypedArray/prototype/join/length.js b/test/built-ins/TypedArray/prototype/join/length.js
index 4223addcb..1353a225a 100644
--- a/test/built-ins/TypedArray/prototype/join/length.js
+++ b/test/built-ins/TypedArray/prototype/join/length.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.14
+esid: sec-%typedarray%.prototype.join
description: >
%TypedArray%.prototype.join.length is 1.
info: |
@@ -20,6 +20,7 @@ info: |
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
[[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.join.length, 1);
diff --git a/test/built-ins/TypedArray/prototype/join/name.js b/test/built-ins/TypedArray/prototype/join/name.js
index 6e99daf0a..e859b75c5 100644
--- a/test/built-ins/TypedArray/prototype/join/name.js
+++ b/test/built-ins/TypedArray/prototype/join/name.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.14
+esid: sec-%typedarray%.prototype.join
description: >
%TypedArray%.prototype.join.name is "join".
info: |
@@ -17,6 +17,7 @@ info: |
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.join.name, "join");
diff --git a/test/built-ins/TypedArray/prototype/join/prop-desc.js b/test/built-ins/TypedArray/prototype/join/prop-desc.js
index fca83e7e1..bc12cb00c 100644
--- a/test/built-ins/TypedArray/prototype/join/prop-desc.js
+++ b/test/built-ins/TypedArray/prototype/join/prop-desc.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.14
+esid: sec-%typedarray%.prototype.join
description: >
"join" property of TypedArrayPrototype
info: |
@@ -9,6 +9,7 @@ info: |
and in Annex B.2 has the attributes { [[Writable]]: true,
[[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
var TypedArrayPrototype = TypedArray.prototype;
diff --git a/test/built-ins/TypedArray/prototype/keys/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/keys/BigInt/detached-buffer.js
new file mode 100644
index 000000000..90189e441
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/keys/BigInt/detached-buffer.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.keys
+description: Throws a TypeError if this has a detached buffer
+info: |
+ 22.2.3.16 %TypedArray%.prototype.keys ( )
+
+ 1. Let O be the this value.
+ 2. Perform ? ValidateTypedArray(O).
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ ...
+ 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+ $DETACHBUFFER(sample.buffer);
+ assert.throws(TypeError, function() {
+ sample.keys();
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/keys/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/keys/BigInt/invoked-as-func.js
new file mode 100644
index 000000000..2b04ed7f2
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/keys/BigInt/invoked-as-func.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.keys
+description: Throws a TypeError exception when invoked as a function
+info: |
+ 22.2.3.15 %TypedArray%.prototype.keys ( )
+
+ 1. Let O be the this value.
+ 2. Let valid be ValidateTypedArray(O).
+ 3. ReturnIfAbrupt(valid).
+ ...
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var keys = TypedArray.prototype.keys;
+
+assert.sameValue(typeof keys, 'function');
+
+assert.throws(TypeError, function() {
+ keys();
+});
diff --git a/test/built-ins/TypedArray/prototype/keys/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/keys/BigInt/invoked-as-method.js
new file mode 100644
index 000000000..9e67e8b90
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/keys/BigInt/invoked-as-method.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.keys
+description: Requires a [[TypedArrayName]] internal slot.
+info: |
+ 22.2.3.15 %TypedArray%.prototype.keys ( )
+
+ 1. Let O be the this value.
+ 2. Let valid be ValidateTypedArray(O).
+ 3. ReturnIfAbrupt(valid).
+ ...
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+assert.sameValue(typeof TypedArrayPrototype.keys, 'function');
+
+assert.throws(TypeError, function() {
+ TypedArrayPrototype.keys();
+});
diff --git a/test/built-ins/TypedArray/prototype/keys/BigInt/iter-prototype.js b/test/built-ins/TypedArray/prototype/keys/BigInt/iter-prototype.js
new file mode 100644
index 000000000..c8e5f11d8
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/keys/BigInt/iter-prototype.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 22.2.3.16
+esid: sec-%typedarray%.prototype.keys
+description: >
+ The prototype of the returned iterator is ArrayIteratorPrototype
+info: |
+ 22.2.3.16 %TypedArray%.prototype.keys ( )
+
+ ...
+ 3. Return CreateArrayIterator(O, "key").
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol.iterator, TypedArray]
+---*/
+
+var ArrayIteratorProto = Object.getPrototypeOf([][Symbol.iterator]());
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([0n, 42n, 64n]);
+ var iter = sample.keys();
+
+ assert.sameValue(Object.getPrototypeOf(iter), ArrayIteratorProto);
+});
diff --git a/test/built-ins/TypedArray/prototype/keys/BigInt/length.js b/test/built-ins/TypedArray/prototype/keys/BigInt/length.js
new file mode 100644
index 000000000..0f4b206a5
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/keys/BigInt/length.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.keys
+description: >
+ %TypedArray%.prototype.keys.length is 0.
+info: |
+ %TypedArray%.prototype.keys ( )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, has a length
+ property whose value is an integer. Unless otherwise specified, this
+ value is equal to the largest number of named arguments shown in the
+ subclause headings for the function description, including optional
+ parameters. However, rest parameters shown using the form “...name”
+ are not included in the default argument count.
+
+ Unless otherwise specified, the length property of a built-in Function
+ object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.keys.length, 0);
+
+verifyNotEnumerable(TypedArray.prototype.keys, "length");
+verifyNotWritable(TypedArray.prototype.keys, "length");
+verifyConfigurable(TypedArray.prototype.keys, "length");
diff --git a/test/built-ins/TypedArray/prototype/keys/BigInt/name.js b/test/built-ins/TypedArray/prototype/keys/BigInt/name.js
new file mode 100644
index 000000000..da53744ca
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/keys/BigInt/name.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.keys
+description: >
+ %TypedArray%.prototype.keys.name is "keys".
+info: |
+ %TypedArray%.prototype.keys ( )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, that is not
+ identified as an anonymous function has a name property whose value
+ is a String.
+
+ Unless otherwise specified, the name property of a built-in Function
+ object, if it exists, has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.keys.name, "keys");
+
+verifyNotEnumerable(TypedArray.prototype.keys, "name");
+verifyNotWritable(TypedArray.prototype.keys, "name");
+verifyConfigurable(TypedArray.prototype.keys, "name");
diff --git a/test/built-ins/TypedArray/prototype/keys/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/keys/BigInt/prop-desc.js
new file mode 100644
index 000000000..74b5908dc
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/keys/BigInt/prop-desc.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.keys
+description: >
+ "keys" property of TypedArrayPrototype
+info: |
+ ES6 section 17: Every other data property described in clauses 18 through 26
+ and in Annex B.2 has the attributes { [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+verifyNotEnumerable(TypedArrayPrototype, 'keys');
+verifyWritable(TypedArrayPrototype, 'keys');
+verifyConfigurable(TypedArrayPrototype, 'keys');
diff --git a/test/built-ins/TypedArray/prototype/keys/BigInt/return-itor.js b/test/built-ins/TypedArray/prototype/keys/BigInt/return-itor.js
new file mode 100644
index 000000000..6bccf1c2d
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/keys/BigInt/return-itor.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 22.2.3.16
+esid: sec-%typedarray%.prototype.keys
+description: Return an iterator for the keys.
+info: |
+ 22.2.3.16 %TypedArray%.prototype.keys ( )
+
+ ...
+ 3. Return CreateArrayIterator(O, "key").
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var sample = [0n, 42n, 64n];
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var typedArray = new TA(sample);
+ var itor = typedArray.keys();
+
+ var next = itor.next();
+ assert.sameValue(next.value, 0);
+ assert.sameValue(next.done, false);
+
+ next = itor.next();
+ assert.sameValue(next.value, 1);
+ assert.sameValue(next.done, false);
+
+ next = itor.next();
+ assert.sameValue(next.value, 2);
+ assert.sameValue(next.done, false);
+
+ next = itor.next();
+ assert.sameValue(next.value, undefined);
+ assert.sameValue(next.done, true);
+});
diff --git a/test/built-ins/TypedArray/prototype/keys/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/keys/BigInt/this-is-not-object.js
new file mode 100644
index 000000000..7fd0c8f05
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/keys/BigInt/this-is-not-object.js
@@ -0,0 +1,52 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.keys
+description: Throws a TypeError exception when `this` is not Object
+info: |
+ 22.2.3.16 %TypedArray%.prototype.keys ( )
+
+ The following steps are taken:
+
+ 1. Let O be the this value.
+ 2. Perform ? ValidateTypedArray(O).
+ ...
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var keys = TypedArray.prototype.keys;
+
+assert.throws(TypeError, function() {
+ keys.call(undefined);
+}, "this is undefined");
+
+assert.throws(TypeError, function() {
+ keys.call(null);
+}, "this is null");
+
+assert.throws(TypeError, function() {
+ keys.call(42);
+}, "this is 42");
+
+assert.throws(TypeError, function() {
+ keys.call("1");
+}, "this is a string");
+
+assert.throws(TypeError, function() {
+ keys.call(true);
+}, "this is true");
+
+assert.throws(TypeError, function() {
+ keys.call(false);
+}, "this is false");
+
+var s = Symbol("s");
+assert.throws(TypeError, function() {
+ keys.call(s);
+}, "this is a Symbol");
diff --git a/test/built-ins/TypedArray/prototype/keys/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/keys/BigInt/this-is-not-typedarray-instance.js
new file mode 100644
index 000000000..6978bfb3d
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/keys/BigInt/this-is-not-typedarray-instance.js
@@ -0,0 +1,44 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.keys
+description: >
+ Throws a TypeError exception when `this` is not a TypedArray instance
+info: |
+ 22.2.3.16 %TypedArray%.prototype.keys ( )
+
+ The following steps are taken:
+
+ 1. Let O be the this value.
+ 2. Perform ? ValidateTypedArray(O).
+ ...
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var keys = TypedArray.prototype.keys;
+
+assert.throws(TypeError, function() {
+ keys.call({});
+}, "this is an Object");
+
+assert.throws(TypeError, function() {
+ keys.call([]);
+}, "this is an Array");
+
+var ab = new ArrayBuffer(8);
+assert.throws(TypeError, function() {
+ keys.call(ab);
+}, "this is an ArrayBuffer instance");
+
+var dv = new DataView(new ArrayBuffer(8), 0, 1);
+assert.throws(TypeError, function() {
+ keys.call(dv);
+}, "this is a DataView instance");
diff --git a/test/built-ins/TypedArray/prototype/keys/invoked-as-func.js b/test/built-ins/TypedArray/prototype/keys/invoked-as-func.js
index 2788b24d6..6c65712c4 100644
--- a/test/built-ins/TypedArray/prototype/keys/invoked-as-func.js
+++ b/test/built-ins/TypedArray/prototype/keys/invoked-as-func.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.15
+esid: sec-%typedarray%.prototype.keys
description: Throws a TypeError exception when invoked as a function
info: |
22.2.3.15 %TypedArray%.prototype.keys ( )
diff --git a/test/built-ins/TypedArray/prototype/keys/invoked-as-method.js b/test/built-ins/TypedArray/prototype/keys/invoked-as-method.js
index e98b6081c..8b3cc12f1 100644
--- a/test/built-ins/TypedArray/prototype/keys/invoked-as-method.js
+++ b/test/built-ins/TypedArray/prototype/keys/invoked-as-method.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.15
+esid: sec-%typedarray%.prototype.keys
description: Requires a [[TypedArrayName]] internal slot.
info: |
22.2.3.15 %TypedArray%.prototype.keys ( )
diff --git a/test/built-ins/TypedArray/prototype/keys/length.js b/test/built-ins/TypedArray/prototype/keys/length.js
index 1f5be5e1c..8ca31ed83 100644
--- a/test/built-ins/TypedArray/prototype/keys/length.js
+++ b/test/built-ins/TypedArray/prototype/keys/length.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.15
+esid: sec-%typedarray%.prototype.keys
description: >
%TypedArray%.prototype.keys.length is 0.
info: |
@@ -20,6 +20,7 @@ info: |
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
[[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.keys.length, 0);
diff --git a/test/built-ins/TypedArray/prototype/keys/name.js b/test/built-ins/TypedArray/prototype/keys/name.js
index ed2c2d9e8..787e112f9 100644
--- a/test/built-ins/TypedArray/prototype/keys/name.js
+++ b/test/built-ins/TypedArray/prototype/keys/name.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.15
+esid: sec-%typedarray%.prototype.keys
description: >
%TypedArray%.prototype.keys.name is "keys".
info: |
@@ -17,6 +17,7 @@ info: |
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.keys.name, "keys");
diff --git a/test/built-ins/TypedArray/prototype/keys/prop-desc.js b/test/built-ins/TypedArray/prototype/keys/prop-desc.js
index 71e4a2c4b..eb9eb8114 100644
--- a/test/built-ins/TypedArray/prototype/keys/prop-desc.js
+++ b/test/built-ins/TypedArray/prototype/keys/prop-desc.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.15
+esid: sec-%typedarray%.prototype.keys
description: >
"keys" property of TypedArrayPrototype
info: |
@@ -9,6 +9,7 @@ info: |
and in Annex B.2 has the attributes { [[Writable]]: true,
[[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
var TypedArrayPrototype = TypedArray.prototype;
diff --git a/test/built-ins/TypedArray/prototype/keys/return-itor.js b/test/built-ins/TypedArray/prototype/keys/return-itor.js
index 877f06965..f496130b6 100644
--- a/test/built-ins/TypedArray/prototype/keys/return-itor.js
+++ b/test/built-ins/TypedArray/prototype/keys/return-itor.js
@@ -13,7 +13,7 @@ includes: [testTypedArray.js]
features: [TypedArray]
---*/
-var sample = new Int8Array([0, 42, 64]);
+var sample = [0, 42, 64];
testWithTypedArrayConstructors(function(TA) {
var typedArray = new TA(sample);
diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/detached-buffer.js
new file mode 100644
index 000000000..616f96ce5
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/detached-buffer.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.lastindexof
+description: Throws a TypeError if this has a detached buffer
+info: |
+ 22.2.3.17 %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ ...
+ 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+ $DETACHBUFFER(sample.buffer);
+ assert.throws(TypeError, function() {
+ sample.lastIndexOf(0);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/fromIndex-infinity.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/fromIndex-infinity.js
new file mode 100644
index 000000000..1c0488a76
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/fromIndex-infinity.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.lastindexof
+description: handle Infinity values for fromIndex
+info: |
+ 22.2.3.17 %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ] )
+
+ %TypedArray%.prototype.lastIndexOf is a distinct function that implements the
+ same algorithm as Array.prototype.lastIndexOf as defined in 22.1.3.15 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ 22.1.3.15 Array.prototype.lastIndexOf ( searchElement [ , fromIndex ] )
+
+ ...
+ 5. If n ≥ 0, then
+ a. If n is -0, let k be +0; else let k be min(n, len - 1).
+ 6. Else n < 0,
+ a. Let k be len + n.
+ 7. Repeat, while k ≥ 0
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n, 43n, 41n]);
+
+ assert.sameValue(sample.lastIndexOf(43n, Infinity), 2, "lastIndexOf(43, Infinity)");
+ assert.sameValue(sample.lastIndexOf(43n, -Infinity), -1, "lastIndexOf(43, -Infinity)");
+});
diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/fromIndex-minus-zero.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/fromIndex-minus-zero.js
new file mode 100644
index 000000000..bd42c0272
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/fromIndex-minus-zero.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.lastindexof
+description: -0 fromIndex becomes 0
+info: |
+ 22.2.3.17 %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ] )
+
+ %TypedArray%.prototype.lastIndexOf is a distinct function that implements the
+ same algorithm as Array.prototype.lastIndexOf as defined in 22.1.3.15 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ 22.1.3.15 Array.prototype.lastIndexOf ( searchElement [ , fromIndex ] )
+
+ ...
+ 5. If n ≥ 0, then
+ a. If n is -0, let k be +0; else let k be min(n, len - 1).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample;
+
+ sample = new TA([42n, 43n]);
+ assert.sameValue(sample.lastIndexOf(42n, -0), 0, "-0 [0]");
+ assert.sameValue(sample.lastIndexOf(43n, -0), -1, "-0 [1]");
+});
diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/get-length-uses-internal-arraylength.js
new file mode 100644
index 000000000..ee9f23ff0
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/get-length-uses-internal-arraylength.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.lastindexof
+description: Get "length" uses internal ArrayLength
+info: |
+ 22.2.3.17 %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ] )
+
+ %TypedArray%.prototype.lastIndexOf is a distinct function that implements the
+ same algorithm as Array.prototype.lastIndexOf as defined in 22.1.3.15 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ 22.1.3.15 Array.prototype.lastIndexOf ( searchElement [ , fromIndex ] )
+
+ ...
+ 2. Let len be ? ToLength(? Get(O, "length")).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+Object.defineProperty(TypedArray.prototype, "length", {value: 0});
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([7n]);
+
+ Object.defineProperty(TA.prototype, "length", {value: 0});
+ Object.defineProperty(sample, "length", {value: 0});
+
+ assert.sameValue(sample.lastIndexOf(7n), 0);
+});
diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/invoked-as-func.js
new file mode 100644
index 000000000..3f9822050
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/invoked-as-func.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.lastindexof
+description: Throws a TypeError exception when invoked as a function
+info: |
+ 22.2.3.16 %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var lastIndexOf = TypedArray.prototype.lastIndexOf;
+
+assert.sameValue(typeof lastIndexOf, 'function');
+
+assert.throws(TypeError, function() {
+ lastIndexOf();
+});
diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/invoked-as-method.js
new file mode 100644
index 000000000..3f034e421
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/invoked-as-method.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.lastindexof
+description: Requires a [[TypedArrayName]] internal slot.
+info: |
+ 22.2.3.16 %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+assert.sameValue(typeof TypedArrayPrototype.lastIndexOf, 'function');
+
+assert.throws(TypeError, function() {
+ TypedArrayPrototype.lastIndexOf();
+});
diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/length-zero-returns-minus-one.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/length-zero-returns-minus-one.js
new file mode 100644
index 000000000..07fc5da72
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/length-zero-returns-minus-one.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.lastindexof
+description: Returns -1 if length is 0
+info: |
+ 22.2.3.17 %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ] )
+
+ %TypedArray%.prototype.lastIndexOf is a distinct function that implements the
+ same algorithm as Array.prototype.lastIndexOf as defined in 22.1.3.15 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ 22.1.3.15 Array.prototype.lastIndexOf ( searchElement [ , fromIndex ] )
+
+ ...
+ 2. Let len be ? ToLength(? Get(O, "length")).
+ 3. If len is 0, return -1.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var fromIndex = {
+ valueOf: function() {
+ throw new Test262Error();
+ }
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA();
+ assert.sameValue(sample.lastIndexOf(0), -1, "returns -1");
+ assert.sameValue(
+ sample.lastIndexOf(0, fromIndex), -1,
+ "length is checked before ToInteger(fromIndex)"
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/length.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/length.js
new file mode 100644
index 000000000..dbc89d473
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/length.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.lastindexof
+description: >
+ %TypedArray%.prototype.lastIndexOf.length is 1.
+info: |
+ %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ] )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, has a length
+ property whose value is an integer. Unless otherwise specified, this
+ value is equal to the largest number of named arguments shown in the
+ subclause headings for the function description, including optional
+ parameters. However, rest parameters shown using the form “...name”
+ are not included in the default argument count.
+
+ Unless otherwise specified, the length property of a built-in Function
+ object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.lastIndexOf.length, 1);
+
+verifyNotEnumerable(TypedArray.prototype.lastIndexOf, "length");
+verifyNotWritable(TypedArray.prototype.lastIndexOf, "length");
+verifyConfigurable(TypedArray.prototype.lastIndexOf, "length");
diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/name.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/name.js
new file mode 100644
index 000000000..b4216d190
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/name.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.lastindexof
+description: >
+ %TypedArray%.prototype.lastIndexOf.name is "lastIndexOf".
+info: |
+ %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ] )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, that is not
+ identified as an anonymous function has a name property whose value
+ is a String.
+
+ Unless otherwise specified, the name property of a built-in Function
+ object, if it exists, has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.lastIndexOf.name, "lastIndexOf");
+
+verifyNotEnumerable(TypedArray.prototype.lastIndexOf, "name");
+verifyNotWritable(TypedArray.prototype.lastIndexOf, "name");
+verifyConfigurable(TypedArray.prototype.lastIndexOf, "name");
diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/prop-desc.js
new file mode 100644
index 000000000..52a04ab83
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/prop-desc.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.lastindexof
+description: >
+ "lastIndexOf" property of TypedArrayPrototype
+info: |
+ ES6 section 17: Every other data property described in clauses 18 through 26
+ and in Annex B.2 has the attributes { [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+verifyNotEnumerable(TypedArrayPrototype, 'lastIndexOf');
+verifyWritable(TypedArrayPrototype, 'lastIndexOf');
+verifyConfigurable(TypedArrayPrototype, 'lastIndexOf');
diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/return-abrupt-tointeger-fromindex-symbol.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/return-abrupt-tointeger-fromindex-symbol.js
new file mode 100644
index 000000000..67c1ea4c6
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/return-abrupt-tointeger-fromindex-symbol.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.lastindexof
+description: Return abrupt from ToInteger(fromIndex) - using symbol
+info: |
+ 22.2.3.17 %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ] )
+
+ %TypedArray%.prototype.lastIndexOf is a distinct function that implements the
+ same algorithm as Array.prototype.lastIndexOf as defined in 22.1.3.15 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ 22.1.3.15 Array.prototype.lastIndexOf ( searchElement [ , fromIndex ] )
+
+ ...
+ 4. If argument fromIndex was passed, let n be ? ToInteger(fromIndex); else let
+ n be len-1.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var fromIndex = Symbol("1");
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+
+ assert.throws(TypeError, function() {
+ sample.lastIndexOf(7, fromIndex);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/return-abrupt-tointeger-fromindex.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/return-abrupt-tointeger-fromindex.js
new file mode 100644
index 000000000..2f3465b34
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/return-abrupt-tointeger-fromindex.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.lastindexof
+description: Return abrupt from ToInteger(fromIndex)
+info: |
+ 22.2.3.17 %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ] )
+
+ %TypedArray%.prototype.lastIndexOf is a distinct function that implements the
+ same algorithm as Array.prototype.lastIndexOf as defined in 22.1.3.15 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ 22.1.3.15 Array.prototype.lastIndexOf ( searchElement [ , fromIndex ] )
+
+ ...
+ 4. If argument fromIndex was passed, let n be ? ToInteger(fromIndex); else let
+ n be len-1.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var fromIndex = {
+ valueOf: function() {
+ throw new Test262Error();
+ }
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+
+ assert.throws(Test262Error, function() {
+ sample.lastIndexOf(7, fromIndex);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/search-found-returns-index.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/search-found-returns-index.js
new file mode 100644
index 000000000..91ce88731
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/search-found-returns-index.js
@@ -0,0 +1,57 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.lastindexof
+description: returns index for the first found element
+info: |
+ 22.2.3.17 %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ] )
+
+ %TypedArray%.prototype.lastIndexOf is a distinct function that implements the
+ same algorithm as Array.prototype.lastIndexOf as defined in 22.1.3.15 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ 22.1.3.15 Array.prototype.lastIndexOf ( searchElement [ , fromIndex ] )
+
+ ...
+ 5. If n ≥ 0, then
+ a. If n is -0, let k be +0; else let k be min(n, len - 1).
+ 6. Else n < 0,
+ a. Let k be len + n.
+ 7. Repeat, while k ≥ 0
+ a. Let kPresent be ? HasProperty(O, ! ToString(k)).
+ b. If kPresent is true, then
+ i. Let elementK be ? Get(O, ! ToString(k)).
+ ii. Let same be the result of performing Strict Equality Comparison
+ searchElement === elementK.
+ iii. If same is true, return k.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n, 42n, 41n]);
+ assert.sameValue(sample.lastIndexOf(42n), 2, "lastIndexOf(42)");
+ assert.sameValue(sample.lastIndexOf(43n), 1, "lastIndexOf(43)");
+ assert.sameValue(sample.lastIndexOf(41n), 3, "lastIndexOf(41)");
+ assert.sameValue(sample.lastIndexOf(41n, 3), 3, "lastIndexOf(41, 3)");
+ assert.sameValue(sample.lastIndexOf(41n, 4), 3, "lastIndexOf(41, 4)");
+ assert.sameValue(sample.lastIndexOf(43n, 1), 1, "lastIndexOf(43, 1)");
+ assert.sameValue(sample.lastIndexOf(43n, 2), 1, "lastIndexOf(43, 2)");
+ assert.sameValue(sample.lastIndexOf(43n, 3), 1, "lastIndexOf(43, 3)");
+ assert.sameValue(sample.lastIndexOf(43n, 4), 1, "lastIndexOf(43, 4)");
+ assert.sameValue(sample.lastIndexOf(42n, 0), 0, "lastIndexOf(42, 0)");
+ assert.sameValue(sample.lastIndexOf(42n, 1), 0, "lastIndexOf(42, 1)");
+ assert.sameValue(sample.lastIndexOf(42n, 2), 2, "lastIndexOf(42, 2)");
+ assert.sameValue(sample.lastIndexOf(42n, 3), 2, "lastIndexOf(42, 3)");
+ assert.sameValue(sample.lastIndexOf(42n, 4), 2, "lastIndexOf(42, 4)");
+ assert.sameValue(sample.lastIndexOf(42n, -4), 0, "lastIndexOf(42, -4)");
+ assert.sameValue(sample.lastIndexOf(42n, -3), 0, "lastIndexOf(42, -3)");
+ assert.sameValue(sample.lastIndexOf(42n, -2), 2, "lastIndexOf(42, -2)");
+ assert.sameValue(sample.lastIndexOf(42n, -1), 2, "lastIndexOf(42, -1)");
+ assert.sameValue(sample.lastIndexOf(43n, -3), 1, "lastIndexOf(43, -3)");
+ assert.sameValue(sample.lastIndexOf(43n, -2), 1, "lastIndexOf(43, -2)");
+ assert.sameValue(sample.lastIndexOf(43n, -1), 1, "lastIndexOf(43, -1)");
+ assert.sameValue(sample.lastIndexOf(41n, -1), 3, "lastIndexOf(41, -1)");
+});
diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/search-not-found-returns-minus-one.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/search-not-found-returns-minus-one.js
new file mode 100644
index 000000000..823e43174
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/search-not-found-returns-minus-one.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.lastindexof
+description: returns -1 if the element if not found
+info: |
+ 22.2.3.17 %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ] )
+
+ %TypedArray%.prototype.lastIndexOf is a distinct function that implements the
+ same algorithm as Array.prototype.lastIndexOf as defined in 22.1.3.15 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ 22.1.3.15 Array.prototype.lastIndexOf ( searchElement [ , fromIndex ] )
+
+ ...
+ 5. If n ≥ 0, then
+ a. If n is -0, let k be +0; else let k be min(n, len - 1).
+ 6. Else n < 0,
+ a. Let k be len + n.
+ 7. Repeat, while k ≥ 0
+ ...
+ 8. Return -1.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample;
+
+ sample = new TA([42n, 43n, 42n, 41n]);
+ assert.sameValue(sample.lastIndexOf(44n), -1, "lastIndexOf(44)");
+ assert.sameValue(sample.lastIndexOf(44n, -4), -1, "lastIndexOf(44, -4)");
+ assert.sameValue(sample.lastIndexOf(44n, -5), -1, "lastIndexOf(44, -5)");
+ assert.sameValue(sample.lastIndexOf(42n, -5), -1, "lastIndexOf(42, -5)");
+ assert.sameValue(sample.lastIndexOf(43n, -4), -1, "lastIndexOf(43, -4)");
+ assert.sameValue(sample.lastIndexOf(43n, -5), -1, "lastIndexOf(43, -5)");
+ assert.sameValue(sample.lastIndexOf(41n, 0), -1, "lastIndexOf(41, 0)");
+ assert.sameValue(sample.lastIndexOf(41n, 1), -1, "lastIndexOf(41, 1)");
+ assert.sameValue(sample.lastIndexOf(41n, 2), -1, "lastIndexOf(41, 2)");
+ assert.sameValue(sample.lastIndexOf(43n, 0), -1, "lastIndexOf(43, 0)");
+});
diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/this-is-not-object.js
new file mode 100644
index 000000000..02a4312c0
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/this-is-not-object.js
@@ -0,0 +1,50 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.lastindexof
+description: Throws a TypeError exception when `this` is not Object
+info: |
+ 22.2.3.17 %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var lastIndexOf = TypedArray.prototype.lastIndexOf;
+
+assert.throws(TypeError, function() {
+ lastIndexOf.call(undefined, 42);
+}, "this is undefined");
+
+assert.throws(TypeError, function() {
+ lastIndexOf.call(null, 42);
+}, "this is null");
+
+assert.throws(TypeError, function() {
+ lastIndexOf.call(42, 42);
+}, "this is 42");
+
+assert.throws(TypeError, function() {
+ lastIndexOf.call("1", 42);
+}, "this is a string");
+
+assert.throws(TypeError, function() {
+ lastIndexOf.call(true, 42);
+}, "this is true");
+
+assert.throws(TypeError, function() {
+ lastIndexOf.call(false, 42);
+}, "this is false");
+
+var s = Symbol("s");
+assert.throws(TypeError, function() {
+ lastIndexOf.call(s, 42);
+}, "this is a Symbol");
diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/this-is-not-typedarray-instance.js
new file mode 100644
index 000000000..e59dc5c53
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/this-is-not-typedarray-instance.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.lastindexof
+description: >
+ Throws a TypeError exception when `this` is not a TypedArray instance
+info: |
+ 22.2.3.17 %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var lastIndexOf = TypedArray.prototype.lastIndexOf;
+
+assert.throws(TypeError, function() {
+ lastIndexOf.call({}, 42);
+}, "this is an Object");
+
+assert.throws(TypeError, function() {
+ lastIndexOf.call([], 42);
+}, "this is an Array");
+
+var ab = new ArrayBuffer(8);
+assert.throws(TypeError, function() {
+ lastIndexOf.call(ab, 42);
+}, "this is an ArrayBuffer instance");
+
+var dv = new DataView(new ArrayBuffer(8), 0, 1);
+assert.throws(TypeError, function() {
+ lastIndexOf.call(dv, 42);
+}, "this is a DataView instance");
diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/tointeger-fromindex.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/tointeger-fromindex.js
new file mode 100644
index 000000000..a51656722
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/tointeger-fromindex.js
@@ -0,0 +1,57 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.lastindexof
+description: Return -1 if fromIndex >= ArrayLength - converted values
+info: |
+ 22.2.3.17 %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ] )
+
+ %TypedArray%.prototype.lastIndexOf is a distinct function that implements the
+ same algorithm as Array.prototype.lastIndexOf as defined in 22.1.3.15 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ 22.1.3.15 Array.prototype.lastIndexOf ( searchElement [ , fromIndex ] )
+
+ ...
+ 4. If argument fromIndex was passed, let n be ? ToInteger(fromIndex); else let
+ n be len-1.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var obj = {
+ valueOf: function() {
+ return 1;
+ }
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample;
+
+ sample = new TA([42n, 43n]);
+ assert.sameValue(sample.lastIndexOf(42n, "1"), 0, "string [0]");
+ assert.sameValue(sample.lastIndexOf(43n, "1"), 1, "string [1]");
+
+ assert.sameValue(sample.lastIndexOf(42n, true), 0, "true [0]");
+ assert.sameValue(sample.lastIndexOf(43n, true), 1, "true [1]");
+
+ assert.sameValue(sample.lastIndexOf(42n, false), 0, "false [0]");
+ assert.sameValue(sample.lastIndexOf(43n, false), -1, "false [1]");
+
+ assert.sameValue(sample.lastIndexOf(42n, NaN), 0, "NaN [0]");
+ assert.sameValue(sample.lastIndexOf(43n, NaN), -1, "NaN [1]");
+
+ assert.sameValue(sample.lastIndexOf(42n, null), 0, "null [0]");
+ assert.sameValue(sample.lastIndexOf(43n, null), -1, "null [1]");
+
+ assert.sameValue(sample.lastIndexOf(42n, undefined), 0, "undefined [0]");
+ assert.sameValue(sample.lastIndexOf(43n, undefined), -1, "undefined [1]");
+
+ assert.sameValue(sample.lastIndexOf(42n, null), 0, "null [0]");
+ assert.sameValue(sample.lastIndexOf(43n, null), -1, "null [1]");
+
+ assert.sameValue(sample.lastIndexOf(42n, obj), 0, "object [0]");
+ assert.sameValue(sample.lastIndexOf(43n, obj), 1, "object [1]");
+});
diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/invoked-as-func.js b/test/built-ins/TypedArray/prototype/lastIndexOf/invoked-as-func.js
index 2462fec66..0448d059c 100644
--- a/test/built-ins/TypedArray/prototype/lastIndexOf/invoked-as-func.js
+++ b/test/built-ins/TypedArray/prototype/lastIndexOf/invoked-as-func.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.16
+esid: sec-%typedarray%.prototype.lastindexof
description: Throws a TypeError exception when invoked as a function
info: |
22.2.3.16 %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ] )
diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/invoked-as-method.js b/test/built-ins/TypedArray/prototype/lastIndexOf/invoked-as-method.js
index ecf6183d4..347d0c7c1 100644
--- a/test/built-ins/TypedArray/prototype/lastIndexOf/invoked-as-method.js
+++ b/test/built-ins/TypedArray/prototype/lastIndexOf/invoked-as-method.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.16
+esid: sec-%typedarray%.prototype.lastindexof
description: Requires a [[TypedArrayName]] internal slot.
info: |
22.2.3.16 %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ] )
diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/length.js b/test/built-ins/TypedArray/prototype/lastIndexOf/length.js
index 6e0a829bc..ffac1f404 100644
--- a/test/built-ins/TypedArray/prototype/lastIndexOf/length.js
+++ b/test/built-ins/TypedArray/prototype/lastIndexOf/length.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.16
+esid: sec-%typedarray%.prototype.lastindexof
description: >
%TypedArray%.prototype.lastIndexOf.length is 1.
info: |
@@ -20,6 +20,7 @@ info: |
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
[[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.lastIndexOf.length, 1);
diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/name.js b/test/built-ins/TypedArray/prototype/lastIndexOf/name.js
index 859ad4cde..7af241b5a 100644
--- a/test/built-ins/TypedArray/prototype/lastIndexOf/name.js
+++ b/test/built-ins/TypedArray/prototype/lastIndexOf/name.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.16
+esid: sec-%typedarray%.prototype.lastindexof
description: >
%TypedArray%.prototype.lastIndexOf.name is "lastIndexOf".
info: |
@@ -17,6 +17,7 @@ info: |
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.lastIndexOf.name, "lastIndexOf");
diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/prop-desc.js b/test/built-ins/TypedArray/prototype/lastIndexOf/prop-desc.js
index c1b1a3c61..31fa33034 100644
--- a/test/built-ins/TypedArray/prototype/lastIndexOf/prop-desc.js
+++ b/test/built-ins/TypedArray/prototype/lastIndexOf/prop-desc.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.16
+esid: sec-%typedarray%.prototype.lastindexof
description: >
"lastIndexOf" property of TypedArrayPrototype
info: |
@@ -9,6 +9,7 @@ info: |
and in Annex B.2 has the attributes { [[Writable]]: true,
[[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
var TypedArrayPrototype = TypedArray.prototype;
diff --git a/test/built-ins/TypedArray/prototype/length/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/length/BigInt/detached-buffer.js
new file mode 100644
index 000000000..31ee55484
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/length/BigInt/detached-buffer.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-%typedarray%.prototype.length
+description: Returns 0 if the instance has a detached buffer
+info: |
+ 22.2.3.18 get %TypedArray%.prototype.length
+
+ ...
+ 5. Let buffer be the value of O's [[ViewedArrayBuffer]] internal slot.
+ 6. If IsDetachedBuffer(buffer) is true, return 0.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(42);
+ $DETACHBUFFER(sample.buffer);
+ assert.sameValue(sample.length, 0);
+});
diff --git a/test/built-ins/TypedArray/prototype/length/BigInt/invoked-as-accessor.js b/test/built-ins/TypedArray/prototype/length/BigInt/invoked-as-accessor.js
new file mode 100644
index 000000000..d67d24370
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/length/BigInt/invoked-as-accessor.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-%typedarray%.prototype.length
+description: >
+ Requires this value to have a [[ViewedArrayBuffer]] internal slot
+info: |
+ 22.2.3.17 get %TypedArray%.prototype.length
+
+ 1. Let O be the this value.
+ ...
+ 3. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+assert.throws(TypeError, function() {
+ TypedArrayPrototype.length;
+});
diff --git a/test/built-ins/TypedArray/prototype/length/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/length/BigInt/invoked-as-func.js
new file mode 100644
index 000000000..100bf4c55
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/length/BigInt/invoked-as-func.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-%typedarray%.prototype.length
+description: Throws a TypeError exception when invoked as a function
+info: |
+ 22.2.3.17 get %TypedArray%.prototype.length
+
+ 1. Let O be the this value.
+ 2. If Type(O) is not Object, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+var getter = Object.getOwnPropertyDescriptor(
+ TypedArrayPrototype, 'length'
+).get;
+
+assert.throws(TypeError, function() {
+ getter();
+});
diff --git a/test/built-ins/TypedArray/prototype/length/BigInt/length.js b/test/built-ins/TypedArray/prototype/length/BigInt/length.js
new file mode 100644
index 000000000..832fba4a9
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/length/BigInt/length.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-get-%typedarray%.prototype.length
+description: >
+ get %TypedArray%.prototype.length.length is 0.
+info: |
+ get %TypedArray%.prototype.length
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, has a length
+ property whose value is an integer. Unless otherwise specified, this
+ value is equal to the largest number of named arguments shown in the
+ subclause headings for the function description, including optional
+ parameters. However, rest parameters shown using the form “...name”
+ are not included in the default argument count.
+
+ Unless otherwise specified, the length property of a built-in Function
+ object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, "length");
+
+assert.sameValue(desc.get.length, 0);
+
+verifyNotEnumerable(desc.get, "length");
+verifyNotWritable(desc.get, "length");
+verifyConfigurable(desc.get, "length");
diff --git a/test/built-ins/TypedArray/prototype/length/BigInt/name.js b/test/built-ins/TypedArray/prototype/length/BigInt/name.js
new file mode 100644
index 000000000..f7f29be88
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/length/BigInt/name.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-get-%typedarray%.prototype.length
+description: >
+ get %TypedArray%.prototype.length.name is "get length".
+info: |
+ get %TypedArray%.prototype.length
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, that is not
+ identified as an anonymous function has a name property whose value
+ is a String.
+
+ Unless otherwise specified, the name property of a built-in Function
+ object, if it exists, has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, "length");
+
+assert.sameValue(desc.get.name, "get length");
+
+verifyNotEnumerable(desc.get, "name");
+verifyNotWritable(desc.get, "name");
+verifyConfigurable(desc.get, "name");
diff --git a/test/built-ins/TypedArray/prototype/length/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/length/BigInt/prop-desc.js
new file mode 100644
index 000000000..2afd62048
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/length/BigInt/prop-desc.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-%typedarray%.prototype.length
+description: >
+ "length" property of TypedArrayPrototype
+info: |
+ %TypedArray%.prototype.length is an accessor property whose set accessor
+ function is undefined.
+
+ Section 17: Every accessor property described in clauses 18 through 26 and in
+ Annex B.2 has the attributes {[[Enumerable]]: false, [[Configurable]]: true }
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+var desc = Object.getOwnPropertyDescriptor(TypedArrayPrototype, "length");
+
+assert.sameValue(desc.set, undefined);
+assert.sameValue(typeof desc.get, "function");
+
+verifyNotEnumerable(TypedArrayPrototype, "length");
+verifyConfigurable(TypedArrayPrototype, "length");
diff --git a/test/built-ins/TypedArray/prototype/length/BigInt/return-length.js b/test/built-ins/TypedArray/prototype/length/BigInt/return-length.js
new file mode 100644
index 000000000..419acd0f6
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/length/BigInt/return-length.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-%typedarray%.prototype.length
+description: >
+ Return value from the [[ArrayLength]] internal slot
+info: |
+ 22.2.3.18 get %TypedArray%.prototype.length
+
+ ...
+ 6. Let length be the value of O's [[ArrayLength]] internal slot.
+ 7. Return length.
+
+ ---
+
+ The current tests on `prop-desc.js` and `length.js` already assert `length` is
+ not a dynamic property as in regular arrays.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var ta1 = new TA();
+ assert.sameValue(ta1.length, 0);
+
+ var ta2 = new TA(42);
+ assert.sameValue(ta2.length, 42);
+});
diff --git a/test/built-ins/TypedArray/prototype/length/BigInt/this-has-no-typedarrayname-internal.js b/test/built-ins/TypedArray/prototype/length/BigInt/this-has-no-typedarrayname-internal.js
new file mode 100644
index 000000000..1dd1d7696
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/length/BigInt/this-has-no-typedarrayname-internal.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-%typedarray%.prototype.length
+description: >
+ Throws a TypeError exception when `this` does not have a [[TypedArrayName]]
+ internal slot
+info: |
+ 22.2.3.18 get %TypedArray%.prototype.length
+
+ 1. Let O be the this value.
+ 2. If Type(O) is not Object, throw a TypeError exception.
+ 3. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, DataView, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+var getter = Object.getOwnPropertyDescriptor(
+ TypedArrayPrototype, "length"
+).get;
+
+assert.throws(TypeError, function() {
+ getter.call({});
+});
+
+assert.throws(TypeError, function() {
+ getter.call([]);
+});
+
+var ab = new ArrayBuffer(8);
+assert.throws(TypeError, function() {
+ getter.call(ab);
+});
+
+var dv = new DataView(new ArrayBuffer(8), 0);
+assert.throws(TypeError, function() {
+ getter.call(dv);
+});
diff --git a/test/built-ins/TypedArray/prototype/length/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/length/BigInt/this-is-not-object.js
new file mode 100644
index 000000000..663a6402b
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/length/BigInt/this-is-not-object.js
@@ -0,0 +1,49 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-%typedarray%.prototype.length
+description: Throws a TypeError exception when `this` is not Object
+info: |
+ 22.2.3.18 get %TypedArray%.prototype.length
+
+ 1. Let O be the this value.
+ 2. If Type(O) is not Object, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+var getter = Object.getOwnPropertyDescriptor(
+ TypedArrayPrototype, "length"
+).get;
+
+
+assert.throws(TypeError, function() {
+ getter.call(undefined);
+}, "undefined");
+
+assert.throws(TypeError, function() {
+ getter.call(null);
+}, "null");
+
+assert.throws(TypeError, function() {
+ getter.call(42);
+}, "number");
+
+assert.throws(TypeError, function() {
+ getter.call("1");
+}, "string");
+
+assert.throws(TypeError, function() {
+ getter.call(true);
+}, "true");
+
+assert.throws(TypeError, function() {
+ getter.call(false);
+}, "false");
+
+var s = Symbol("s");
+assert.throws(TypeError, function() {
+ getter.call(s);
+}, "symbol");
diff --git a/test/built-ins/TypedArray/prototype/length/invoked-as-accessor.js b/test/built-ins/TypedArray/prototype/length/invoked-as-accessor.js
index 731737656..cc13ea81c 100644
--- a/test/built-ins/TypedArray/prototype/length/invoked-as-accessor.js
+++ b/test/built-ins/TypedArray/prototype/length/invoked-as-accessor.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.17
+esid: sec-get-%typedarray%.prototype.length
description: >
Requires this value to have a [[ViewedArrayBuffer]] internal slot
info: |
diff --git a/test/built-ins/TypedArray/prototype/length/invoked-as-func.js b/test/built-ins/TypedArray/prototype/length/invoked-as-func.js
index 7f94fd1bb..4606e730e 100644
--- a/test/built-ins/TypedArray/prototype/length/invoked-as-func.js
+++ b/test/built-ins/TypedArray/prototype/length/invoked-as-func.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.17
+esid: sec-get-%typedarray%.prototype.length
description: Throws a TypeError exception when invoked as a function
info: |
22.2.3.17 get %TypedArray%.prototype.length
diff --git a/test/built-ins/TypedArray/prototype/length/length.js b/test/built-ins/TypedArray/prototype/length/length.js
index 43ac09dc6..83477ed19 100644
--- a/test/built-ins/TypedArray/prototype/length/length.js
+++ b/test/built-ins/TypedArray/prototype/length/length.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.17
+esid: sec-get-%typedarray%.prototype.length
description: >
get %TypedArray%.prototype.length.length is 0.
info: |
@@ -20,6 +20,7 @@ info: |
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
[[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, "length");
diff --git a/test/built-ins/TypedArray/prototype/length/name.js b/test/built-ins/TypedArray/prototype/length/name.js
index d9d6605da..733f7c4ea 100644
--- a/test/built-ins/TypedArray/prototype/length/name.js
+++ b/test/built-ins/TypedArray/prototype/length/name.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.17
+esid: sec-get-%typedarray%.prototype.length
description: >
get %TypedArray%.prototype.length.name is "get length".
info: |
@@ -17,6 +17,7 @@ info: |
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, "length");
diff --git a/test/built-ins/TypedArray/prototype/length/prop-desc.js b/test/built-ins/TypedArray/prototype/length/prop-desc.js
index 290311346..eb3284e68 100644
--- a/test/built-ins/TypedArray/prototype/length/prop-desc.js
+++ b/test/built-ins/TypedArray/prototype/length/prop-desc.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.17
+esid: sec-get-%typedarray%.prototype.length
description: >
"length" property of TypedArrayPrototype
info: |
@@ -11,6 +11,7 @@ info: |
Section 17: Every accessor property described in clauses 18 through 26 and in
Annex B.2 has the attributes {[[Enumerable]]: false, [[Configurable]]: true }
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
var TypedArrayPrototype = TypedArray.prototype;
diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/arraylength-internal.js b/test/built-ins/TypedArray/prototype/map/BigInt/arraylength-internal.js
new file mode 100644
index 000000000..a23cca257
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/map/BigInt/arraylength-internal.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.map
+description: >
+ [[ArrayLength]] is accessed in place of performing a [[Get]] of "length"
+info: |
+ 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] )
+
+ ...
+ 3. Let len be the value of O's [[ArrayLength]] internal slot.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample1 = new TA(42);
+ var loop = 0;
+
+ Object.defineProperty(sample1, "length", {value: 1});
+
+ sample1.map(function() {
+ loop++;
+ return 0n;
+ });
+ assert.sameValue(loop, 42, "data descriptor");
+
+ loop = 0;
+ var sample2 = new TA(4);
+ Object.defineProperty(sample2, "length", {
+ get: function() {
+ throw new Test262Error(
+ "Does not return abrupt getting length property"
+ );
+ }
+ });
+
+ sample2.map(function() {
+ loop++;
+ return 0n;
+ });
+ assert.sameValue(loop, 4, "accessor descriptor");
+});
+
diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-arguments-with-thisarg.js b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-arguments-with-thisarg.js
new file mode 100644
index 000000000..169a83dee
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-arguments-with-thisarg.js
@@ -0,0 +1,48 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.map
+description: >
+ thisArg does not affect callbackfn arguments
+info: |
+ 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] )
+
+ ...
+ 8. Repeat, while k < len
+ a. Let Pk be ! ToString(k).
+ b. Let kValue be ? Get(O, Pk).
+ c. Let mappedValue be ? Call(callbackfn, T, « kValue, k, O »).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n, 44n]);
+
+ var results = [];
+ var thisArg = ["test262", 0, "ecma262", 0];
+
+ sample.map(function() {
+ results.push(arguments);
+ return 0n;
+ }, thisArg);
+
+ assert.sameValue(results.length, 3, "results.length");
+ assert.sameValue(thisArg.length, 4, "thisArg.length");
+
+ assert.sameValue(results[0].length, 3, "results[0].length");
+ assert.sameValue(results[0][0], 42n, "results[0][0] - kValue");
+ assert.sameValue(results[0][1], 0, "results[0][1] - k");
+ assert.sameValue(results[0][2], sample, "results[0][2] - this");
+
+ assert.sameValue(results[1].length, 3, "results[1].length");
+ assert.sameValue(results[1][0], 43n, "results[1][0] - kValue");
+ assert.sameValue(results[1][1], 1, "results[1][1] - k");
+ assert.sameValue(results[1][2], sample, "results[1][2] - this");
+
+ assert.sameValue(results[2].length, 3, "results[2].length");
+ assert.sameValue(results[2][0], 44n, "results[2][0] - kValue");
+ assert.sameValue(results[2][1], 2, "results[2][1] - k");
+ assert.sameValue(results[2][2], sample, "results[2][2] - this");
+});
diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-arguments-without-thisarg.js b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-arguments-without-thisarg.js
new file mode 100644
index 000000000..13e7c1500
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-arguments-without-thisarg.js
@@ -0,0 +1,46 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.map
+description: >
+ callbackfn arguments
+info: |
+ 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] )
+
+ ...
+ 8. Repeat, while k < len
+ a. Let Pk be ! ToString(k).
+ b. Let kValue be ? Get(O, Pk).
+ c. Let mappedValue be ? Call(callbackfn, T, « kValue, k, O »).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n, 44n]);
+
+ var results = [];
+
+ sample.map(function() {
+ results.push(arguments);
+ return 0n;
+ });
+
+ assert.sameValue(results.length, 3, "results.length");
+
+ assert.sameValue(results[0].length, 3, "results[0].length");
+ assert.sameValue(results[0][0], 42n, "results[0][0] - kValue");
+ assert.sameValue(results[0][1], 0, "results[0][1] - k");
+ assert.sameValue(results[0][2], sample, "results[0][2] - this");
+
+ assert.sameValue(results[1].length, 3, "results[1].length");
+ assert.sameValue(results[1][0], 43n, "results[1][0] - kValue");
+ assert.sameValue(results[1][1], 1, "results[1][1] - k");
+ assert.sameValue(results[1][2], sample, "results[1][2] - this");
+
+ assert.sameValue(results[2].length, 3, "results[2].length");
+ assert.sameValue(results[2][0], 44n, "results[2][0] - kValue");
+ assert.sameValue(results[2][1], 2, "results[2][1] - k");
+ assert.sameValue(results[2][2], sample, "results[2][2] - this");
+});
diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-detachbuffer.js
new file mode 100644
index 000000000..d8abe4bd4
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-detachbuffer.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.map
+description: >
+ Instance buffer can be detached during loop
+info: |
+ 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] )
+
+ ...
+ 8. Repeat, while k < len
+ ...
+ b. Let kValue be ? Get(O, Pk).
+ c. Let mappedValue be ? Call(callbackfn, T, « kValue, k, O »).
+ ...
+includes: [detachArrayBuffer.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var loops = 0;
+ var sample = new TA(2);
+
+ assert.throws(TypeError, function() {
+ sample.map(function() {
+ if (loops === 1) {
+ throw new Test262Error("callbackfn called twice");
+ }
+ $DETACHBUFFER(sample.buffer);
+ loops++;
+ return 0n;
+ });
+ });
+
+ assert.sameValue(loops, 1, "callbackfn called only once");
+});
diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-is-not-callable.js b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-is-not-callable.js
new file mode 100644
index 000000000..4f30cdf50
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-is-not-callable.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.map
+description: >
+ callbackfn is not callable
+info: |
+ 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] )
+
+ ...
+ 4. If IsCallable(callbackfn) is false, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(3);
+
+ assert.throws(TypeError, function() {
+ sample.map();
+ });
+
+ assert.throws(TypeError, function() {
+ sample.map(undefined);
+ });
+
+ assert.throws(TypeError, function() {
+ sample.map(null);
+ });
+
+ assert.throws(TypeError, function() {
+ sample.map({});
+ });
+
+ assert.throws(TypeError, function() {
+ sample.map(1);
+ });
+
+ assert.throws(TypeError, function() {
+ sample.map("");
+ });
+
+ assert.throws(TypeError, function() {
+ sample.map(false);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-no-interaction-over-non-integer-properties.js b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-no-interaction-over-non-integer-properties.js
new file mode 100644
index 000000000..e8bf86d04
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-no-interaction-over-non-integer-properties.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.map
+description: >
+ Does not interact over non-integer properties
+info: |
+ 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] )
+
+ ...
+ 8. Repeat, while k < len
+ a. Let Pk be ! ToString(k).
+ b. Let kValue be ? Get(O, Pk).
+ c. Let mappedValue be ? Call(callbackfn, T, « kValue, k, O »).
+ ...
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([7n, 8n]);
+
+ var results = [];
+
+ sample.foo = 42;
+ sample[Symbol("1")] = 43;
+
+ sample.map(function() {
+ results.push(arguments);
+ return 0n;
+ });
+
+ assert.sameValue(results.length, 2, "results.length");
+
+ assert.sameValue(results[0][1], 0, "results[0][1] - k");
+ assert.sameValue(results[1][1], 1, "results[1][1] - k");
+
+ assert.sameValue(results[0][0], 7n, "results[0][0] - kValue");
+ assert.sameValue(results[1][0], 8n, "results[1][0] - kValue");
+});
diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-not-called-on-empty.js b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-not-called-on-empty.js
new file mode 100644
index 000000000..3e7a82aeb
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-not-called-on-empty.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.map
+description: >
+ callbackfn is not called on empty instances
+info: |
+ 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] )
+
+ ...
+ 7. Let k be 0.
+ 8. Repeat, while k < len
+ ...
+ c. Let mappedValue be ? Call(callbackfn, T, « kValue, k, O »).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var called = 0;
+
+ new TA().map(function() {
+ called++;
+ });
+
+ assert.sameValue(called, 0);
+});
diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-return-affects-returned-object.js b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-return-affects-returned-object.js
new file mode 100644
index 000000000..f2f679a6d
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-return-affects-returned-object.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.map
+description: >
+ The callbackfn returned values are applied to the new instance
+info: |
+ 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] )
+
+ 6. Let A be ? TypedArraySpeciesCreate(O, « len »).
+ 7. Let k be 0.
+ 8. Repeat, while k < len
+ ...
+ c. Let mappedValue be ? Call(callbackfn, T, « kValue, k, O »).
+ d. Perform ? Set(A, Pk, mappedValue, true).
+ ...
+ 9. Return A.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([1n, 2n, 4n]);
+ var result = sample.map(function(v) {
+ return v * 3n;
+ });
+
+ assert.sameValue(result[0], 3n, "result[0] == 3");
+ assert.sameValue(result[1], 6n, "result[1] == 6");
+ assert.sameValue(result[2], 12n, "result[2] == 12");
+});
diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-return-does-not-change-instance.js b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-return-does-not-change-instance.js
new file mode 100644
index 000000000..dfd441f3c
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-return-does-not-change-instance.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.map
+description: >
+ The callbackfn return does not change the `this` instance
+info: |
+ 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] )
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample1 = new TA(3);
+
+ sample1[1] = 1n;
+
+ sample1.map(function() {
+ return 42n;
+ });
+
+ assert.sameValue(sample1[0], 0n, "[0] == 0");
+ assert.sameValue(sample1[1], 1n, "[1] == 1");
+ assert.sameValue(sample1[2], 0n, "[2] == 0");
+});
diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-return-does-not-copy-non-integer-properties.js b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-return-does-not-copy-non-integer-properties.js
new file mode 100644
index 000000000..4783a2a1e
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-return-does-not-copy-non-integer-properties.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.map
+description: >
+ Does not copy non-integer properties to returned value
+info: |
+ 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] )
+
+ ...
+ 8. Repeat, while k < len
+ a. Let Pk be ! ToString(k).
+ b. Let kValue be ? Get(O, Pk).
+ c. Let mappedValue be ? Call(callbackfn, T, « kValue, k, O »).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([7n, 8n]);
+ var bar = Symbol("1");
+
+ sample.foo = 42;
+ sample[bar] = 1;
+
+ var result = sample.map(function() {
+ return 0n;
+ });
+
+ assert.sameValue(result.length, 2, "result.length");
+ assert.sameValue(
+ Object.getOwnPropertyDescriptor(result, "foo"),
+ undefined,
+ "foo"
+ );
+ assert.sameValue(
+ Object.getOwnPropertyDescriptor(result, bar),
+ undefined,
+ "bar"
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-returns-abrupt.js b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-returns-abrupt.js
new file mode 100644
index 000000000..c8080729d
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-returns-abrupt.js
@@ -0,0 +1,22 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.map
+description: >
+ Returns abrupt from callbackfn
+info: |
+ 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] )
+
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(3);
+
+ assert.throws(Test262Error, function() {
+ sample.map(function() {
+ throw new Test262Error();
+ });
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-set-value-during-interaction.js b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-set-value-during-interaction.js
new file mode 100644
index 000000000..df41cb459
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-set-value-during-interaction.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.map
+description: >
+ Integer indexed values changed during iteration
+info: |
+ 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] )
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Reflect.set, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n, 44n]);
+ var newVal = 0n;
+
+ sample.map(function(val, i) {
+ if (i > 0) {
+ assert.sameValue(
+ sample[i - 1], newVal - 1n,
+ "get the changed value during the loop"
+ );
+ assert.sameValue(
+ Reflect.set(sample, 0, 7n),
+ true,
+ "re-set a value for sample[0]"
+ );
+ }
+ assert.sameValue(
+ Reflect.set(sample, i, newVal),
+ true,
+ "set value during iteration"
+ );
+
+ newVal++;
+ return 0n;
+ });
+
+ assert.sameValue(sample[0], 7n, "changed values after iteration [0] == 7");
+ assert.sameValue(sample[1], 1n, "changed values after iteration [1] == 1");
+ assert.sameValue(sample[2], 2n, "changed values after iteration [2] == 2");
+});
diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-this.js b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-this.js
new file mode 100644
index 000000000..820dfb198
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-this.js
@@ -0,0 +1,50 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.map
+description: >
+ callbackfn `this` value
+info: |
+ 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] )
+
+ ...
+ 5. If thisArg was supplied, let T be thisArg; else let T be undefined.
+ ...
+ 8. Repeat, while k < len
+ ...
+ c. Let mappedValue be ? Call(callbackfn, T, « kValue, k, O »).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var expected = (function() { return this; })();
+var thisArg = {};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(3);
+
+ var results1 = [];
+
+ sample.map(function() {
+ results1.push(this);
+ return 0n;
+ });
+
+ assert.sameValue(results1.length, 3, "results1");
+ assert.sameValue(results1[0], expected, "without thisArg - [0]");
+ assert.sameValue(results1[1], expected, "without thisArg - [1]");
+ assert.sameValue(results1[2], expected, "without thisArg - [2]");
+
+ var results2 = [];
+
+ sample.map(function() {
+ results2.push(this);
+ return 0n;
+ }, thisArg);
+
+ assert.sameValue(results2.length, 3, "results2");
+ assert.sameValue(results2[0], thisArg, "using thisArg - [0]");
+ assert.sameValue(results2[1], thisArg, "using thisArg - [1]");
+ assert.sameValue(results2[2], thisArg, "using thisArg - [2]");
+});
diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/map/BigInt/detached-buffer.js
new file mode 100644
index 000000000..c7039bd1d
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/map/BigInt/detached-buffer.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.map
+description: Throws a TypeError if this has a detached buffer
+info: |
+ 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] )
+
+ 1. Let O be the this value.
+ 2. Perform ? ValidateTypedArray(O).
+ ...
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ ...
+ 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+var callbackfn = function() {
+ throw new Test262Error();
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+ $DETACHBUFFER(sample.buffer);
+ assert.throws(TypeError, function() {
+ sample.map(callbackfn);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/map/BigInt/invoked-as-func.js
new file mode 100644
index 000000000..20e5bb534
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/map/BigInt/invoked-as-func.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.map
+description: Throws a TypeError exception when invoked as a function
+info: |
+ 22.2.3.18 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] )
+
+ 1. Let O be the this value.
+ 2. Let valid be ValidateTypedArray(O).
+ 3. ReturnIfAbrupt(valid).
+ ...
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var map = TypedArray.prototype.map;
+
+assert.sameValue(typeof map, 'function');
+
+assert.throws(TypeError, function() {
+ map();
+});
diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/map/BigInt/invoked-as-method.js
new file mode 100644
index 000000000..7f03579fd
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/map/BigInt/invoked-as-method.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.map
+description: Requires a [[TypedArrayName]] internal slot.
+info: |
+ 22.2.3.18 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] )
+
+ 1. Let O be the this value.
+ 2. Let valid be ValidateTypedArray(O).
+ 3. ReturnIfAbrupt(valid).
+ ...
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+assert.sameValue(typeof TypedArrayPrototype.map, 'function');
+
+assert.throws(TypeError, function() {
+ TypedArrayPrototype.map();
+});
diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/length.js b/test/built-ins/TypedArray/prototype/map/BigInt/length.js
new file mode 100644
index 000000000..95a983b03
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/map/BigInt/length.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.map
+description: >
+ %TypedArray%.prototype.map.length is 1.
+info: |
+ %TypedArray%.prototype.map ( callbackfn [ , thisArg ] )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, has a length
+ property whose value is an integer. Unless otherwise specified, this
+ value is equal to the largest number of named arguments shown in the
+ subclause headings for the function description, including optional
+ parameters. However, rest parameters shown using the form “...name”
+ are not included in the default argument count.
+
+ Unless otherwise specified, the length property of a built-in Function
+ object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.map.length, 1);
+
+verifyNotEnumerable(TypedArray.prototype.map, "length");
+verifyNotWritable(TypedArray.prototype.map, "length");
+verifyConfigurable(TypedArray.prototype.map, "length");
diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/name.js b/test/built-ins/TypedArray/prototype/map/BigInt/name.js
new file mode 100644
index 000000000..0f54d40cb
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/map/BigInt/name.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.map
+description: >
+ %TypedArray%.prototype.map.name is "map".
+info: |
+ %TypedArray%.prototype.map ( callbackfn [ , thisArg ] )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, that is not
+ identified as an anonymous function has a name property whose value
+ is a String.
+
+ Unless otherwise specified, the name property of a built-in Function
+ object, if it exists, has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.map.name, "map");
+
+verifyNotEnumerable(TypedArray.prototype.map, "name");
+verifyNotWritable(TypedArray.prototype.map, "name");
+verifyConfigurable(TypedArray.prototype.map, "name");
diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/map/BigInt/prop-desc.js
new file mode 100644
index 000000000..ea1d8805f
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/map/BigInt/prop-desc.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.map
+description: >
+ "map" property of TypedArrayPrototype
+info: |
+ ES6 section 17: Every other data property described in clauses 18 through 26
+ and in Annex B.2 has the attributes { [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+verifyNotEnumerable(TypedArrayPrototype, 'map');
+verifyWritable(TypedArrayPrototype, 'map');
+verifyConfigurable(TypedArrayPrototype, 'map');
diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-conversion-operation-consistent-nan.js b/test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-conversion-operation-consistent-nan.js
new file mode 100644
index 000000000..1b9534f1a
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-conversion-operation-consistent-nan.js
@@ -0,0 +1,62 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.map
+description: Consistent canonicalization of NaN values
+info: |
+ 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] )
+
+ ...
+ 8. Repeat, while k < len
+ ...
+ d. Perform ? Set(A, Pk, mappedValue, true).
+ ...
+
+ 9.4.5.9 IntegerIndexedElementSet ( O, index, value )
+
+ ...
+ 15. Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue).
+ ...
+
+ 24.1.1.6 SetValueInBuffer ( arrayBuffer, byteIndex, type, value [ ,
+ isLittleEndian ] )
+
+ ...
+ 8. If type is "Float32", then
+ a. Set rawBytes to a List containing the 4 bytes that are the result
+ of converting value to IEEE 754-2008 binary32 format using “Round to
+ nearest, ties to even” rounding mode. If isLittleEndian is false, the
+ bytes are arranged in big endian order. Otherwise, the bytes are
+ arranged in little endian order. If value is NaN, rawValue may be set
+ to any implementation chosen IEEE 754-2008 binary64 format Not-a-Number
+ encoding. An implementation must always choose the same encoding for
+ each implementation distinguishable NaN value.
+ 9. Else, if type is "Float64", then
+ a. Set rawBytes to a List containing the 8 bytes that are the IEEE
+ 754-2008 binary64 format encoding of value. If isLittleEndian is false,
+ the bytes are arranged in big endian order. Otherwise, the bytes are
+ arranged in little endian order. If value is NaN, rawValue may be set
+ to any implementation chosen IEEE 754-2008 binary32 format Not-a-Number
+ encoding. An implementation must always choose the same encoding for
+ each implementation distinguishable NaN value.
+ ...
+includes: [nans.js, testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+function body(FloatArray) {
+ var sample = new FloatArray(distinctNaNs);
+ var sampleBytes, resultBytes;
+ var i = 0;
+
+ var result = sample.map(function() {
+ return distinctNaNs[i++];
+ });
+
+ sampleBytes = new Uint8Array(sample.buffer);
+ resultBytes = new Uint8Array(result.buffer);
+
+ assert(compareArray(sampleBytes, resultBytes));
+}
+
+testWithBigIntTypedArrayConstructors(body, [Float32Array, Float64Array]);
diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-conversion-operation.js b/test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-conversion-operation.js
new file mode 100644
index 000000000..6f2b83a63
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-conversion-operation.js
@@ -0,0 +1,52 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.map
+description: >
+ Verify conversion values on returned instance
+info: |
+ 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] )
+
+ ...
+ 8. Repeat, while k < len
+ ...
+ d. Perform ? Set(A, Pk, mappedValue, true).
+ ...
+
+ 9.4.5.9 IntegerIndexedElementSet ( O, index, value )
+
+ ...
+ 15. Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue).
+ ...
+
+ 24.1.1.6 SetValueInBuffer ( arrayBuffer, byteIndex, type, value [ ,
+ isLittleEndian ] )
+
+ ...
+ 8. If type is "Float32", then
+ ...
+ 9. Else, if type is "Float64", then
+ ...
+ 10. Else,
+ ...
+ b. Let convOp be the abstract operation named in the Conversion Operation
+ column in Table 50 for Element Type type.
+ c. Let intValue be convOp(value).
+ d. If intValue ≥ 0, then
+ ...
+ e. Else,
+ ...
+includes: [byteConversionValues.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testTypedArrayConversions(byteConversionValues, function(TA, value, expected, initial) {
+ var sample = new TA([initial]);
+
+ var result = sample.map(function() {
+ return value;
+ });
+
+ assert.sameValue(result[0], expected, value + " converts to " + expected);
+});
diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-from-empty-length.js b/test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-from-empty-length.js
new file mode 100644
index 000000000..957bb7cdd
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-from-empty-length.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.map
+description: >
+ Returns a new typedArray instance from the same constructor with the same
+ length and a new buffer object - testing on an instance with length == 0
+info: |
+ 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] )
+
+ ...
+ 6. Let A be ? TypedArraySpeciesCreate(O, « len »).
+ 7. Let k be 0.
+ 8. Repeat, while k < len
+ ...
+ c. Let mappedValue be ? Call(callbackfn, T, « kValue, k, O »).
+ ...
+ 9. Return A.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(0);
+
+ var result = sample.map(function() {});
+
+ assert.notSameValue(result, sample, "new typedArray object");
+ assert.sameValue(result.constructor, TA, "same constructor");
+ assert(result instanceof TA, "result is an instance of " + TA.name);
+ assert.sameValue(
+ Object.getPrototypeOf(result),
+ Object.getPrototypeOf(sample),
+ "result has the same prototype of sample"
+ );
+ assert.sameValue(result.length, 0, "same length");
+ assert.notSameValue(result.buffer, sample.buffer, "new buffer");
+});
diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-from-positive-length.js b/test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-from-positive-length.js
new file mode 100644
index 000000000..e7ba97709
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-from-positive-length.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.map
+description: >
+ Returns a new typedArray instance from the same constructor with the same
+ length and a new buffer object - testing on an instance with length > 0
+info: |
+ 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] )
+
+ ...
+ 6. Let A be ? TypedArraySpeciesCreate(O, « len »).
+ 7. Let k be 0.
+ 8. Repeat, while k < len
+ ...
+ c. Let mappedValue be ? Call(callbackfn, T, « kValue, k, O »).
+ ...
+ 9. Return A.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(3);
+
+ var result = sample.map(function(v) {
+ return v;
+ });
+
+ assert.notSameValue(result, sample, "new typedArray object");
+ assert.sameValue(result.constructor, sample.constructor, "same constructor");
+ assert.sameValue(result.length, 3, "same length");
+ assert.notSameValue(result.buffer, sample.buffer, "new buffer");
+});
diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/map/BigInt/this-is-not-object.js
new file mode 100644
index 000000000..50fa543a6
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/map/BigInt/this-is-not-object.js
@@ -0,0 +1,51 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.map
+description: Throws a TypeError exception when `this` is not Object
+info: |
+ 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] )
+
+ 1. Let O be the this value.
+ 2. Perform ? ValidateTypedArray(O).
+ ...
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var map = TypedArray.prototype.map;
+var callbackfn = function() {};
+
+assert.throws(TypeError, function() {
+ map.call(undefined, callbackfn);
+}, "this is undefined");
+
+assert.throws(TypeError, function() {
+ map.call(null, callbackfn);
+}, "this is null");
+
+assert.throws(TypeError, function() {
+ map.call(42, callbackfn);
+}, "this is 42");
+
+assert.throws(TypeError, function() {
+ map.call("1", callbackfn);
+}, "this is a string");
+
+assert.throws(TypeError, function() {
+ map.call(true, callbackfn);
+}, "this is true");
+
+assert.throws(TypeError, function() {
+ map.call(false, callbackfn);
+}, "this is false");
+
+var s = Symbol("s");
+assert.throws(TypeError, function() {
+ map.call(s, callbackfn);
+}, "this is a Symbol");
diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/map/BigInt/this-is-not-typedarray-instance.js
new file mode 100644
index 000000000..97266d749
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/map/BigInt/this-is-not-typedarray-instance.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.map
+description: >
+ Throws a TypeError exception when `this` is not a TypedArray instance
+info: |
+ 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] )
+
+ 1. Let O be the this value.
+ 2. Perform ? ValidateTypedArray(O).
+ ...
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var map = TypedArray.prototype.map;
+var callbackfn = function() {};
+
+assert.throws(TypeError, function() {
+ map.call({}, callbackfn);
+}, "this is an Object");
+
+assert.throws(TypeError, function() {
+ map.call([], callbackfn);
+}, "this is an Array");
+
+var ab = new ArrayBuffer(8);
+assert.throws(TypeError, function() {
+ map.call(ab, callbackfn);
+}, "this is an ArrayBuffer instance");
+
+var dv = new DataView(new ArrayBuffer(8), 0, 1);
+assert.throws(TypeError, function() {
+ map.call(dv, callbackfn);
+}, "this is a DataView instance");
diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/values-are-not-cached.js b/test/built-ins/TypedArray/prototype/map/BigInt/values-are-not-cached.js
new file mode 100644
index 000000000..6b6728228
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/map/BigInt/values-are-not-cached.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.map
+description: >
+ Integer indexed values changed during iteration
+info: |
+ 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] )
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n, 44n]);
+
+ sample.map(function(v, i) {
+ if (i < sample.length - 1) {
+ sample[i+1] = 42n;
+ }
+
+ assert.sameValue(
+ v, 42n, "method does not cache values before callbackfn calls"
+ );
+
+ return 0n;
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/map/arraylength-internal.js b/test/built-ins/TypedArray/prototype/map/arraylength-internal.js
index 0f9ec0807..bb7186fc8 100644
--- a/test/built-ins/TypedArray/prototype/map/arraylength-internal.js
+++ b/test/built-ins/TypedArray/prototype/map/arraylength-internal.js
@@ -22,6 +22,7 @@ testWithTypedArrayConstructors(function(TA) {
sample1.map(function() {
loop++;
+ return 0;
});
assert.sameValue(loop, 42, "data descriptor");
@@ -37,6 +38,7 @@ testWithTypedArrayConstructors(function(TA) {
sample2.map(function() {
loop++;
+ return 0;
});
assert.sameValue(loop, 4, "accessor descriptor");
});
diff --git a/test/built-ins/TypedArray/prototype/map/callbackfn-arguments-with-thisarg.js b/test/built-ins/TypedArray/prototype/map/callbackfn-arguments-with-thisarg.js
index 5ffb6ce94..7b0fcfcf2 100644
--- a/test/built-ins/TypedArray/prototype/map/callbackfn-arguments-with-thisarg.js
+++ b/test/built-ins/TypedArray/prototype/map/callbackfn-arguments-with-thisarg.js
@@ -25,6 +25,7 @@ testWithTypedArrayConstructors(function(TA) {
sample.map(function() {
results.push(arguments);
+ return 0;
}, thisArg);
assert.sameValue(results.length, 3, "results.length");
diff --git a/test/built-ins/TypedArray/prototype/map/callbackfn-arguments-without-thisarg.js b/test/built-ins/TypedArray/prototype/map/callbackfn-arguments-without-thisarg.js
index 97386a564..12ce6c784 100644
--- a/test/built-ins/TypedArray/prototype/map/callbackfn-arguments-without-thisarg.js
+++ b/test/built-ins/TypedArray/prototype/map/callbackfn-arguments-without-thisarg.js
@@ -24,6 +24,7 @@ testWithTypedArrayConstructors(function(TA) {
sample.map(function() {
results.push(arguments);
+ return 0;
});
assert.sameValue(results.length, 3, "results.length");
diff --git a/test/built-ins/TypedArray/prototype/map/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/map/callbackfn-detachbuffer.js
index 1a7e78fae..a183289a0 100644
--- a/test/built-ins/TypedArray/prototype/map/callbackfn-detachbuffer.js
+++ b/test/built-ins/TypedArray/prototype/map/callbackfn-detachbuffer.js
@@ -14,6 +14,7 @@ info: |
c. Let mappedValue be ? Call(callbackfn, T, « kValue, k, O »).
...
includes: [detachArrayBuffer.js, testTypedArray.js]
+features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
@@ -27,6 +28,7 @@ testWithTypedArrayConstructors(function(TA) {
}
$DETACHBUFFER(sample.buffer);
loops++;
+ return 0;
});
});
diff --git a/test/built-ins/TypedArray/prototype/map/callbackfn-no-interaction-over-non-integer-properties.js b/test/built-ins/TypedArray/prototype/map/callbackfn-no-interaction-over-non-integer-properties.js
index 0ce305a7e..e097d50ce 100644
--- a/test/built-ins/TypedArray/prototype/map/callbackfn-no-interaction-over-non-integer-properties.js
+++ b/test/built-ins/TypedArray/prototype/map/callbackfn-no-interaction-over-non-integer-properties.js
@@ -28,6 +28,7 @@ testWithTypedArrayConstructors(function(TA) {
sample.map(function() {
results.push(arguments);
+ return 0;
});
assert.sameValue(results.length, 2, "results.length");
diff --git a/test/built-ins/TypedArray/prototype/map/callbackfn-set-value-during-interaction.js b/test/built-ins/TypedArray/prototype/map/callbackfn-set-value-during-interaction.js
index 0d520cd45..ddc93200a 100644
--- a/test/built-ins/TypedArray/prototype/map/callbackfn-set-value-during-interaction.js
+++ b/test/built-ins/TypedArray/prototype/map/callbackfn-set-value-during-interaction.js
@@ -34,6 +34,7 @@ testWithTypedArrayConstructors(function(TA) {
);
newVal++;
+ return 0;
});
assert.sameValue(sample[0], 7, "changed values after iteration [0] == 7");
diff --git a/test/built-ins/TypedArray/prototype/map/invoked-as-func.js b/test/built-ins/TypedArray/prototype/map/invoked-as-func.js
index 8431e13ca..d330f2889 100644
--- a/test/built-ins/TypedArray/prototype/map/invoked-as-func.js
+++ b/test/built-ins/TypedArray/prototype/map/invoked-as-func.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.18
+esid: sec-%typedarray%.prototype.map
description: Throws a TypeError exception when invoked as a function
info: |
22.2.3.18 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] )
diff --git a/test/built-ins/TypedArray/prototype/map/invoked-as-method.js b/test/built-ins/TypedArray/prototype/map/invoked-as-method.js
index b1a722c48..ebccfdff9 100644
--- a/test/built-ins/TypedArray/prototype/map/invoked-as-method.js
+++ b/test/built-ins/TypedArray/prototype/map/invoked-as-method.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.18
+esid: sec-%typedarray%.prototype.map
description: Requires a [[TypedArrayName]] internal slot.
info: |
22.2.3.18 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] )
diff --git a/test/built-ins/TypedArray/prototype/map/length.js b/test/built-ins/TypedArray/prototype/map/length.js
index 1a88244a0..b6b51f554 100644
--- a/test/built-ins/TypedArray/prototype/map/length.js
+++ b/test/built-ins/TypedArray/prototype/map/length.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.18
+esid: sec-%typedarray%.prototype.map
description: >
%TypedArray%.prototype.map.length is 1.
info: |
@@ -20,6 +20,7 @@ info: |
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
[[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.map.length, 1);
diff --git a/test/built-ins/TypedArray/prototype/map/name.js b/test/built-ins/TypedArray/prototype/map/name.js
index 0158e044f..92aad9621 100644
--- a/test/built-ins/TypedArray/prototype/map/name.js
+++ b/test/built-ins/TypedArray/prototype/map/name.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.18
+esid: sec-%typedarray%.prototype.map
description: >
%TypedArray%.prototype.map.name is "map".
info: |
@@ -17,6 +17,7 @@ info: |
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.map.name, "map");
diff --git a/test/built-ins/TypedArray/prototype/map/prop-desc.js b/test/built-ins/TypedArray/prototype/map/prop-desc.js
index b00e16469..473ecddaa 100644
--- a/test/built-ins/TypedArray/prototype/map/prop-desc.js
+++ b/test/built-ins/TypedArray/prototype/map/prop-desc.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.18
+esid: sec-%typedarray%.prototype.map
description: >
"map" property of TypedArrayPrototype
info: |
@@ -9,6 +9,7 @@ info: |
and in Annex B.2 has the attributes { [[Writable]]: true,
[[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
var TypedArrayPrototype = TypedArray.prototype;
diff --git a/test/built-ins/TypedArray/prototype/map/return-new-typedarray-conversion-operation-consistent-nan.js b/test/built-ins/TypedArray/prototype/map/return-new-typedarray-conversion-operation-consistent-nan.js
index 836a51239..15b63f791 100644
--- a/test/built-ins/TypedArray/prototype/map/return-new-typedarray-conversion-operation-consistent-nan.js
+++ b/test/built-ins/TypedArray/prototype/map/return-new-typedarray-conversion-operation-consistent-nan.js
@@ -41,6 +41,7 @@ info: |
each implementation distinguishable NaN value.
...
includes: [nans.js, testTypedArray.js, compareArray.js]
+features: [TypedArray]
---*/
function body(FloatArray) {
diff --git a/test/built-ins/TypedArray/prototype/map/return-new-typedarray-conversion-operation.js b/test/built-ins/TypedArray/prototype/map/return-new-typedarray-conversion-operation.js
index 13f1de02c..29ee3f8ab 100644
--- a/test/built-ins/TypedArray/prototype/map/return-new-typedarray-conversion-operation.js
+++ b/test/built-ins/TypedArray/prototype/map/return-new-typedarray-conversion-operation.js
@@ -38,6 +38,7 @@ info: |
e. Else,
...
includes: [byteConversionValues.js, testTypedArray.js]
+features: [TypedArray]
---*/
testTypedArrayConversions(byteConversionValues, function(TA, value, expected, initial) {
diff --git a/test/built-ins/TypedArray/prototype/map/values-are-not-cached.js b/test/built-ins/TypedArray/prototype/map/values-are-not-cached.js
index d2345b13c..8900d596a 100644
--- a/test/built-ins/TypedArray/prototype/map/values-are-not-cached.js
+++ b/test/built-ins/TypedArray/prototype/map/values-are-not-cached.js
@@ -22,5 +22,7 @@ testWithTypedArrayConstructors(function(TA) {
assert.sameValue(
v, 42, "method does not cache values before callbackfn calls"
);
+
+ return 0;
});
});
diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-arguments-custom-accumulator.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-arguments-custom-accumulator.js
new file mode 100644
index 000000000..6b54c191c
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-arguments-custom-accumulator.js
@@ -0,0 +1,58 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduce
+description: >
+ callbackfn arguments using custom accumulator
+info: |
+ 22.2.3.20 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] )
+
+ %TypedArray%.prototype.reduce is a distinct function that implements the same
+ algorithm as Array.prototype.reduce as defined in 22.1.3.19 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length".
+
+ 22.1.3.19 Array.prototype.reduce ( callbackfn [ , initialValue ] )
+
+ ...
+ 8. Repeat, while k < len
+ ...
+ c. If kPresent is true, then
+ ...
+ i. Let accumulator be ? Call(callbackfn, undefined, « accumulator, kValue,
+ k, O »).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n, 44n]);
+
+ var results = [];
+
+ sample.reduce(function(accumulator) {
+ results.push(arguments);
+ return accumulator + 1;
+ }, 7);
+
+ assert.sameValue(results.length, 3, "results.length");
+
+ assert.sameValue(results[0].length, 4, "results[0].length");
+ assert.sameValue(results[0][0], 7, "results[0][0] - accumulator");
+ assert.sameValue(results[0][1], 42n, "results[0][1] - kValue");
+ assert.sameValue(results[0][2], 0, "results[0][2] - k");
+ assert.sameValue(results[0][3], sample, "results[0][3] - this");
+
+ assert.sameValue(results[1].length, 4, "results[1].length");
+ assert.sameValue(results[1][0], 8, "results[1][0] - accumulator");
+ assert.sameValue(results[1][1], 43n, "results[1][1] - kValue");
+ assert.sameValue(results[1][2], 1, "results[1][2] - k");
+ assert.sameValue(results[1][3], sample, "results[1][3] - this");
+
+ assert.sameValue(results[2].length, 4, "results[2].length");
+ assert.sameValue(results[2][0], 9, "results[2][0] - accumulator");
+ assert.sameValue(results[2][1], 44n, "results[2][1] - kValue");
+ assert.sameValue(results[2][2], 2, "results[2][2] - k");
+ assert.sameValue(results[2][3], sample, "results[2][3] - this");
+});
diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-arguments-default-accumulator.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-arguments-default-accumulator.js
new file mode 100644
index 000000000..ab9e5a286
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-arguments-default-accumulator.js
@@ -0,0 +1,59 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduce
+description: >
+ callbackfn arguments using default accumulator (value at index 0)
+info: |
+ 22.2.3.20 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] )
+
+ %TypedArray%.prototype.reduce is a distinct function that implements the same
+ algorithm as Array.prototype.reduce as defined in 22.1.3.19 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length".
+
+ 22.1.3.19 Array.prototype.reduce ( callbackfn [ , initialValue ] )
+
+ ...
+ 7. Else initialValue is not present,
+ a. Let kPresent be false.
+ b. Repeat, while kPresent is false and k < len
+ ...
+ iii. If kPresent is true, then
+ 1. Let accumulator be ? Get(O, Pk).
+ ...
+ 8. Repeat, while k < len
+ ...
+ c. If kPresent is true, then
+ ...
+ i. Let accumulator be ? Call(callbackfn, undefined, « accumulator, kValue,
+ k, O »).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n, 44n]);
+
+ var results = [];
+
+ sample.reduce(function(accumulator) {
+ results.push(arguments);
+ return accumulator - 1n;
+ });
+
+ assert.sameValue(results.length, 2, "results.length");
+
+ assert.sameValue(results[0].length, 4, "results[1].length");
+ assert.sameValue(results[0][0], 42n, "results[1][0] - accumulator");
+ assert.sameValue(results[0][1], 43n, "results[1][1] - kValue");
+ assert.sameValue(results[0][2], 1, "results[1][2] - k");
+ assert.sameValue(results[0][3], sample, "results[1][3] - this");
+
+ assert.sameValue(results[1].length, 4, "results[2].length");
+ assert.sameValue(results[1][0], 41n, "results[2][0] - accumulator");
+ assert.sameValue(results[1][1], 44n, "results[2][1] - kValue");
+ assert.sameValue(results[1][2], 2, "results[2][2] - k");
+ assert.sameValue(results[1][3], sample, "results[2][3] - this");
+});
diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-detachbuffer.js
new file mode 100644
index 000000000..f904d53a1
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-detachbuffer.js
@@ -0,0 +1,44 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduce
+description: >
+ Instance buffer can be detached during loop
+info: |
+ 22.2.3.20 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] )
+
+ %TypedArray%.prototype.reduce is a distinct function that implements the same
+ algorithm as Array.prototype.reduce as defined in 22.1.3.19 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length".
+
+ 22.1.3.19 Array.prototype.reduce ( callbackfn [ , initialValue ] )
+
+ ...
+ 8. Repeat, while k < len
+ ...
+ c. If kPresent is true, then
+ ...
+ i. Let accumulator be ? Call(callbackfn, undefined, « accumulator, kValue,
+ k, O »).
+ ...
+includes: [detachArrayBuffer.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var loops = 0;
+ var sample = new TA(2);
+
+ assert.throws(TypeError, function() {
+ sample.reduce(function() {
+ if (loops === 1) {
+ throw new Test262Error("callbackfn called twice");
+ }
+ $DETACHBUFFER(sample.buffer);
+ loops++;
+ }, 0);
+ });
+
+ assert.sameValue(loops, 1, "callbackfn called only once");
+});
diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-is-not-callable-throws.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-is-not-callable-throws.js
new file mode 100644
index 000000000..36b147501
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-is-not-callable-throws.js
@@ -0,0 +1,67 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduce
+description: >
+ Throws TypeError if callbackfn is not callable
+info: |
+ 22.2.3.20 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] )
+
+ %TypedArray%.prototype.reduce is a distinct function that implements the same
+ algorithm as Array.prototype.reduce as defined in 22.1.3.19 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length".
+
+ 22.1.3.19 Array.prototype.reduce ( callbackfn [ , initialValue ] )
+
+ ...
+ 3. If IsCallable(callbackfn) is false, throw a TypeError exception.
+ 4. If len is 0 and initialValue is not present, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+
+ assert.throws(TypeError, function() {
+ sample.reduce();
+ }, "no arg");
+
+ assert.throws(TypeError, function() {
+ sample.reduce(undefined);
+ }, "undefined");
+
+ assert.throws(TypeError, function() {
+ sample.reduce(null);
+ }, "null");
+
+ assert.throws(TypeError, function() {
+ sample.reduce({});
+ }, "{}");
+
+ assert.throws(TypeError, function() {
+ sample.reduce(1);
+ }, "1");
+
+ assert.throws(TypeError, function() {
+ sample.reduce(NaN);
+ }, "NaN");
+
+ assert.throws(TypeError, function() {
+ sample.reduce("");
+ }, "string");
+
+ assert.throws(TypeError, function() {
+ sample.reduce(false);
+ }, "false");
+
+ assert.throws(TypeError, function() {
+ sample.reduce(true);
+ }, "true");
+
+ assert.throws(TypeError, function() {
+ sample.reduce(Symbol(""));
+ }, "symbol");
+});
diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-no-iteration-over-non-integer-properties.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-no-iteration-over-non-integer-properties.js
new file mode 100644
index 000000000..f8282a42e
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-no-iteration-over-non-integer-properties.js
@@ -0,0 +1,48 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduce
+description: >
+ Does not iterate over non-integer properties
+info: |
+ 22.2.3.20 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] )
+
+ %TypedArray%.prototype.reduce is a distinct function that implements the same
+ algorithm as Array.prototype.reduce as defined in 22.1.3.19 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length".
+
+ 22.1.3.19 Array.prototype.reduce ( callbackfn [ , initialValue ] )
+
+ ...
+ 8. Repeat, while k < len
+ ...
+ c. If kPresent is true, then
+ ...
+ i. Let accumulator be ? Call(callbackfn, undefined, « accumulator, kValue,
+ k, O »).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([7n, 8n]);
+
+ var results = [];
+
+ sample.foo = 42;
+ sample[Symbol("1")] = 43;
+
+ sample.reduce(function() {
+ results.push(arguments);
+ }, 0);
+
+ assert.sameValue(results.length, 2, "results.length");
+
+ assert.sameValue(results[0][2], 0, "results[0][2] - k");
+ assert.sameValue(results[1][2], 1, "results[1][2] - k");
+
+ assert.sameValue(results[0][1], 7n, "results[0][1] - kValue");
+ assert.sameValue(results[1][1], 8n, "results[1][1] - kValue");
+});
diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-not-called-on-empty.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-not-called-on-empty.js
new file mode 100644
index 000000000..8bcbcfd43
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-not-called-on-empty.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduce
+description: >
+ callbackfn is not called on empty instances
+info: |
+ 22.2.3.20 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] )
+
+ %TypedArray%.prototype.reduce is a distinct function that implements the same
+ algorithm as Array.prototype.reduce as defined in 22.1.3.19 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length".
+
+ 22.1.3.19 Array.prototype.reduce ( callbackfn [ , initialValue ] )
+
+ ...
+ 4. If len is 0 and initialValue is not present, throw a TypeError exception.
+ ...
+ 8. Repeat, while k < len
+ ...
+ c. If kPresent is true, then
+ ...
+ i. Let accumulator be ? Call(callbackfn, undefined, « accumulator, kValue,
+ k, O »).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var called = 0;
+
+ new TA().reduce(function() {
+ called++;
+ }, undefined);
+
+ assert.sameValue(called, 0);
+});
diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-return-does-not-change-instance.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-return-does-not-change-instance.js
new file mode 100644
index 000000000..31785cec9
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-return-does-not-change-instance.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduce
+description: >
+ The callbackfn return does not change the `this` instance
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([0n, 1n, 0n]);
+
+ sample.reduce(function() {
+ return 42;
+ }, 7);
+
+ assert.sameValue(sample[0], 0n, "[0] == 0");
+ assert.sameValue(sample[1], 1n, "[1] == 1");
+ assert.sameValue(sample[2], 0n, "[2] == 0");
+});
diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-returns-abrupt.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-returns-abrupt.js
new file mode 100644
index 000000000..25470aff7
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-returns-abrupt.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduce
+description: >
+ Returns abrupt from callbackfn
+info: |
+ 22.2.3.20 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] )
+
+ %TypedArray%.prototype.reduce is a distinct function that implements the same
+ algorithm as Array.prototype.reduce as defined in 22.1.3.19 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length".
+
+ 22.1.3.19 Array.prototype.reduce ( callbackfn [ , initialValue ] )
+
+ ...
+ 8. Repeat, while k < len
+ ...
+ c. If kPresent is true, then
+ ...
+ i. Let accumulator be ? Call(callbackfn, undefined, « accumulator, kValue,
+ k, O »).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(2);
+
+ assert.throws(Test262Error, function() {
+ sample.reduce(function() {
+ throw new Test262Error();
+ });
+ });
+
+ assert.throws(Test262Error, function() {
+ sample.reduce(function() {
+ throw new Test262Error();
+ }, 0);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-set-value-during-iteration.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-set-value-during-iteration.js
new file mode 100644
index 000000000..d77a8ebda
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-set-value-during-iteration.js
@@ -0,0 +1,49 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.reduce
+description: >
+ Integer indexed values changed during iteration
+info: |
+ 22.2.3.20 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] )
+
+ %TypedArray%.prototype.reduce is a distinct function that implements the same
+ algorithm as Array.prototype.reduce as defined in 22.1.3.19 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length".
+
+ 22.1.3.19 Array.prototype.reduce ( callbackfn [ , initialValue ] )
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Reflect.set, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n, 44n]);
+ var newVal = 0n;
+
+ sample.reduce(function(acc, val, i) {
+ if (i > 0) {
+ assert.sameValue(
+ sample[i - 1], newVal - 1n,
+ "get the changed value during the loop"
+ );
+ assert.sameValue(
+ Reflect.set(sample, 0, 7n),
+ true,
+ "re-set a value for sample[0]"
+ );
+ }
+ assert.sameValue(
+ Reflect.set(sample, i, newVal),
+ true,
+ "set value during iteration"
+ );
+
+ newVal++;
+ }, 0);
+
+ assert.sameValue(sample[0], 7n, "changed values after iteration [0] == 7");
+ assert.sameValue(sample[1], 1n, "changed values after iteration [1] == 1");
+ assert.sameValue(sample[2], 2n, "changed values after iteration [2] == 2");
+});
diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-this.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-this.js
new file mode 100644
index 000000000..fe364eeac
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-this.js
@@ -0,0 +1,44 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduce
+description: >
+ callbackfn `this` value
+info: |
+ 22.2.3.20 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] )
+
+ %TypedArray%.prototype.reduce is a distinct function that implements the same
+ algorithm as Array.prototype.reduce as defined in 22.1.3.19 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length".
+
+ 22.1.3.19 Array.prototype.reduce ( callbackfn [ , initialValue ] )
+
+ ...
+ 8. Repeat, while k < len
+ ...
+ c. If kPresent is true, then
+ ...
+ i. Let accumulator be ? Call(callbackfn, undefined, « accumulator, kValue,
+ k, O »).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var expected = (function() { return this; })();
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(3);
+
+ var results = [];
+
+ sample.reduce(function() {
+ results.push(this);
+ }, 0);
+
+ assert.sameValue(results.length, 3, "results.length");
+ assert.sameValue(results[0], expected, "[0]");
+ assert.sameValue(results[1], expected, "[1]");
+ assert.sameValue(results[2], expected, "[2]");
+});
diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/detached-buffer.js
new file mode 100644
index 000000000..91763bcfb
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/detached-buffer.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduce
+description: Throws a TypeError if this has a detached buffer
+info: |
+ 22.2.3.20 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ ...
+ 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+var callbackfn = function() {
+ throw new Test262Error();
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+ $DETACHBUFFER(sample.buffer);
+ assert.throws(TypeError, function() {
+ sample.reduce(callbackfn);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/empty-instance-return-initialvalue.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/empty-instance-return-initialvalue.js
new file mode 100644
index 000000000..34ed97d79
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/empty-instance-return-initialvalue.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduce
+description: >
+ Returns given initialValue on empty instances without calling callbackfn
+info: |
+ 22.2.3.20 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] )
+
+ %TypedArray%.prototype.reduce is a distinct function that implements the same
+ algorithm as Array.prototype.reduce as defined in 22.1.3.19 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length".
+
+ 22.1.3.19 Array.prototype.reduce ( callbackfn [ , initialValue ] )
+
+ ...
+ 7. Else initialValue is not present,
+ ...
+ b. Repeat, while kPresent is false and k < len
+ ...
+ iii. If kPresent is true, then
+ 1. Let accumulator be ? Get(O, Pk).
+ iv. Increase k by 1.
+ ...
+ 8. Repeat, while k < len
+ ...
+ 9. Return accumulator.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var called = false;
+ var result = new TA().reduce(function() {
+ called = true;
+ }, 42);
+
+ assert.sameValue(result, 42);
+ assert.sameValue(called, false);
+});
diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/empty-instance-with-no-initialvalue-throws.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/empty-instance-with-no-initialvalue-throws.js
new file mode 100644
index 000000000..f903b32a0
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/empty-instance-with-no-initialvalue-throws.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduce
+description: >
+ If len is 0 and initialValue is not present, throw a TypeError exception.
+info: |
+ 22.2.3.20 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] )
+
+ %TypedArray%.prototype.reduce is a distinct function that implements the same
+ algorithm as Array.prototype.reduce as defined in 22.1.3.19 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length".
+
+ 22.1.3.19 Array.prototype.reduce ( callbackfn [ , initialValue ] )
+
+ ...
+ 4. If len is 0 and initialValue is not present, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var called = 0;
+
+ assert.throws(TypeError, function() {
+ new TA().reduce(function() {
+ called++;
+ });
+ });
+
+ assert.sameValue(called, 0);
+});
diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/get-length-uses-internal-arraylength.js
new file mode 100644
index 000000000..98ff2510d
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/get-length-uses-internal-arraylength.js
@@ -0,0 +1,46 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduce
+description: Get "length" uses internal ArrayLength
+info: |
+ 22.2.3.20 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] )
+
+ %TypedArray%.prototype.reduce is a distinct function that implements the same
+ algorithm as Array.prototype.reduce as defined in 22.1.3.19 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length".
+
+ 22.1.3.19 Array.prototype.reduce ( callbackfn [ , initialValue ] )
+
+ 1. Let O be ? ToObject(this value).
+ 2. Let len be ? ToLength(? Get(O, "length")).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var getCalls = 0;
+var desc = {
+ get: function getLen() {
+ getCalls++;
+ return 0;
+ }
+};
+
+Object.defineProperty(TypedArray.prototype, "length", desc);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n]);
+ var calls = 0;
+
+ Object.defineProperty(TA.prototype, "length", desc);
+ Object.defineProperty(sample, "length", desc);
+
+ sample.reduce(function() {
+ calls++;
+ }, 0);
+
+ assert.sameValue(getCalls, 0, "ignores length properties");
+ assert.sameValue(calls, 2, "iterations are not affected by custom length");
+});
diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/invoked-as-func.js
new file mode 100644
index 000000000..6b0406b58
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/invoked-as-func.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduce
+description: Throws a TypeError exception when invoked as a function
+info: |
+ 22.2.3.19 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] )
+
+ ...
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var reduce = TypedArray.prototype.reduce;
+
+assert.sameValue(typeof reduce, 'function');
+
+assert.throws(TypeError, function() {
+ reduce();
+});
diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/invoked-as-method.js
new file mode 100644
index 000000000..609adb498
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/invoked-as-method.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduce
+description: Requires a [[TypedArrayName]] internal slot.
+info: |
+ 22.2.3.19 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] )
+
+ ...
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+assert.sameValue(typeof TypedArrayPrototype.reduce, 'function');
+
+assert.throws(TypeError, function() {
+ TypedArrayPrototype.reduce();
+});
diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/length.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/length.js
new file mode 100644
index 000000000..bb04ee94f
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/length.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.reduce
+description: >
+ %TypedArray%.prototype.reduce.length is 1.
+info: |
+ %TypedArray%.prototype.reduce ( callbackfn [ , thisArg ] )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, has a length
+ property whose value is an integer. Unless otherwise specified, this
+ value is equal to the largest number of named arguments shown in the
+ subclause headings for the function description, including optional
+ parameters. However, rest parameters shown using the form “...name”
+ are not included in the default argument count.
+
+ Unless otherwise specified, the length property of a built-in Function
+ object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.reduce.length, 1);
+
+verifyNotEnumerable(TypedArray.prototype.reduce, "length");
+verifyNotWritable(TypedArray.prototype.reduce, "length");
+verifyConfigurable(TypedArray.prototype.reduce, "length");
diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/name.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/name.js
new file mode 100644
index 000000000..e07d1dfa5
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/name.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.reduce
+description: >
+ %TypedArray%.prototype.reduce.name is "reduce".
+info: |
+ %TypedArray%.prototype.reduce ( callbackfn [ , thisArg ] )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, that is not
+ identified as an anonymous function has a name property whose value
+ is a String.
+
+ Unless otherwise specified, the name property of a built-in Function
+ object, if it exists, has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.reduce.name, "reduce");
+
+verifyNotEnumerable(TypedArray.prototype.reduce, "name");
+verifyNotWritable(TypedArray.prototype.reduce, "name");
+verifyConfigurable(TypedArray.prototype.reduce, "name");
diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/prop-desc.js
new file mode 100644
index 000000000..ed8d8a42c
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/prop-desc.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduce
+description: >
+ "reduce" property of TypedArrayPrototype
+info: |
+ ES6 section 17: Every other data property described in clauses 18 through 26
+ and in Annex B.2 has the attributes { [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+verifyNotEnumerable(TypedArrayPrototype, 'reduce');
+verifyWritable(TypedArrayPrototype, 'reduce');
+verifyConfigurable(TypedArrayPrototype, 'reduce');
diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/result-is-last-callbackfn-return.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/result-is-last-callbackfn-return.js
new file mode 100644
index 000000000..2c424d4c8
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/result-is-last-callbackfn-return.js
@@ -0,0 +1,59 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduce
+description: >
+ Returns last accumulator value
+info: |
+ 22.2.3.20 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] )
+
+ %TypedArray%.prototype.reduce is a distinct function that implements the same
+ algorithm as Array.prototype.reduce as defined in 22.1.3.19 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length".
+
+ 22.1.3.19 Array.prototype.reduce ( callbackfn [ , initialValue ] )
+
+ ...
+ 7. Else initialValue is not present,
+ ...
+ b. Repeat, while kPresent is false and k < len
+ ...
+ iii. If kPresent is true, then
+ 1. Let accumulator be ? Get(O, Pk).
+ iv. Increase k by 1.
+ ...
+ 8. Repeat, while k < len
+ ...
+ c. If kPresent is true, then
+ i. Let kValue be ? Get(O, Pk).
+ ii. Let accumulator be ? Call(callbackfn, undefined, « accumulator,
+ kValue, k, O »).
+ 9. Return accumulator.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var calls, result;
+
+ calls = 0;
+ result = new TA([1n, 2n, 3n]).reduce(function() {
+ calls++;
+
+ if (calls == 2) {
+ return 42;
+ }
+ });
+ assert.sameValue(result, 42, "using default accumulator");
+
+ calls = 0;
+ result = new TA([1n, 2n, 3n]).reduce(function() {
+ calls++;
+
+ if (calls == 3) {
+ return 7;
+ }
+ }, 0);
+ assert.sameValue(result, 7, "using custom accumulator");
+});
diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/result-of-any-type.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/result-of-any-type.js
new file mode 100644
index 000000000..e67a68dc3
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/result-of-any-type.js
@@ -0,0 +1,67 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduce
+description: >
+ Result can be of any type without any number conversions
+info: |
+ 22.2.3.20 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] )
+
+ %TypedArray%.prototype.reduce is a distinct function that implements the same
+ algorithm as Array.prototype.reduce as defined in 22.1.3.19 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length".
+
+ 22.1.3.19 Array.prototype.reduce ( callbackfn [ , initialValue ] )
+
+ ...
+ 7. Else initialValue is not present,
+ ...
+ b. Repeat, while kPresent is false and k < len
+ ...
+ iii. If kPresent is true, then
+ 1. Let accumulator be ? Get(O, Pk).
+ iv. Increase k by 1.
+ ...
+ 8. Repeat, while k < len
+ ...
+ c. If kPresent is true, then
+ i. Let kValue be ? Get(O, Pk).
+ ii. Let accumulator be ? Call(callbackfn, undefined, « accumulator,
+ kValue, k, O »).
+ 9. Return accumulator.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n, 44n]);
+ [
+ ["test262", "string"],
+ ["", "empty string"],
+ [undefined, "undefined"],
+ [null, "null"],
+ [-0, "-0"],
+ [42, "integer"],
+ [NaN, "NaN"],
+ [Infinity, "Infinity"],
+ [0.6, "float number"],
+ [true, "true"],
+ [false, "false"],
+ [Symbol(""), "symbol"],
+ [{}, "object"]
+ ].forEach(function(item) {
+ var result;
+
+ result = sample.reduce(function() {
+ return item[0];
+ });
+ assert.sameValue(result, item[0], item[1] + " - using default accumulator");
+
+ result = sample.reduce(function() {
+ return item[0];
+ }, 0);
+
+ assert.sameValue(result, item[0], item[1] + " - using custom accumulator");
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/return-first-value-without-callbackfn.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/return-first-value-without-callbackfn.js
new file mode 100644
index 000000000..766bcdb62
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/return-first-value-without-callbackfn.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduce
+description: >
+ Returns [0] without calling callbackfn if length is 1 and initialValue is not
+ present.
+info: |
+ 22.2.3.20 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] )
+
+ %TypedArray%.prototype.reduce is a distinct function that implements the same
+ algorithm as Array.prototype.reduce as defined in 22.1.3.19 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length".
+
+ 22.1.3.19 Array.prototype.reduce ( callbackfn [ , initialValue ] )
+
+ ...
+ 7. Else initialValue is not present,
+ ...
+ b. Repeat, while kPresent is false and k < len
+ ...
+ iii. If kPresent is true, then
+ 1. Let accumulator be ? Get(O, Pk).
+ iv. Increase k by 1.
+ ...
+ 8. Repeat, while k < len
+ ...
+ 9. Return accumulator.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var called = false;
+ var result = new TA([42n]).reduce(function() {
+ called = true;
+ });
+
+ assert.sameValue(result, 42n);
+ assert.sameValue(called, false);
+});
diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/this-is-not-object.js
new file mode 100644
index 000000000..14680f3d4
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/this-is-not-object.js
@@ -0,0 +1,51 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduce
+description: Throws a TypeError exception when `this` is not Object
+info: |
+ 22.2.3.20 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var reduce = TypedArray.prototype.reduce;
+var callbackfn = function() {};
+
+assert.throws(TypeError, function() {
+ reduce.call(undefined, callbackfn);
+}, "this is undefined");
+
+assert.throws(TypeError, function() {
+ reduce.call(null, callbackfn);
+}, "this is null");
+
+assert.throws(TypeError, function() {
+ reduce.call(42, callbackfn);
+}, "this is 42");
+
+assert.throws(TypeError, function() {
+ reduce.call("1", callbackfn);
+}, "this is a string");
+
+assert.throws(TypeError, function() {
+ reduce.call(true, callbackfn);
+}, "this is true");
+
+assert.throws(TypeError, function() {
+ reduce.call(false, callbackfn);
+}, "this is false");
+
+var s = Symbol("s");
+assert.throws(TypeError, function() {
+ reduce.call(s, callbackfn);
+}, "this is a Symbol");
diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/this-is-not-typedarray-instance.js
new file mode 100644
index 000000000..6dedc8cd2
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/this-is-not-typedarray-instance.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduce
+description: >
+ Throws a TypeError exception when `this` is not a TypedArray instance
+info: |
+ 22.2.3.20 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var reduce = TypedArray.prototype.reduce;
+var callbackfn = function() {};
+
+assert.throws(TypeError, function() {
+ reduce.call({}, callbackfn);
+}, "this is an Object");
+
+assert.throws(TypeError, function() {
+ reduce.call([], callbackfn);
+}, "this is an Array");
+
+var ab = new ArrayBuffer(8);
+assert.throws(TypeError, function() {
+ reduce.call(ab, callbackfn);
+}, "this is an ArrayBuffer instance");
+
+var dv = new DataView(new ArrayBuffer(8), 0, 1);
+assert.throws(TypeError, function() {
+ reduce.call(dv, callbackfn);
+}, "this is a DataView instance");
diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/values-are-not-cached.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/values-are-not-cached.js
new file mode 100644
index 000000000..5362bf1dd
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/values-are-not-cached.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduce
+description: >
+ Integer indexed values are not cached before iteration
+info: |
+ 22.2.3.20 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] )
+
+ %TypedArray%.prototype.reduce is a distinct function that implements the same
+ algorithm as Array.prototype.reduce as defined in 22.1.3.19 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length".
+
+ 22.1.3.19 Array.prototype.reduce ( callbackfn [ , initialValue ] )
+
+ ...
+ 8. Repeat, while k < len
+ ...
+ c. If kPresent is true, then
+ i. Let kValue be ? Get(O, Pk).
+ ii. Let accumulator be ? Call(callbackfn, undefined, « accumulator, kValue,
+ k, O »).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n, 44n]);
+
+ sample.reduce(function(a, v, i) {
+ if (i < sample.length - 1) {
+ sample[i+1] = 42n;
+ }
+
+ assert.sameValue(
+ v, 42n, "method does not cache values before callbackfn calls"
+ );
+ }, 0);
+});
diff --git a/test/built-ins/TypedArray/prototype/reduce/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/reduce/callbackfn-detachbuffer.js
index ac8ddff2e..773b4b4c2 100644
--- a/test/built-ins/TypedArray/prototype/reduce/callbackfn-detachbuffer.js
+++ b/test/built-ins/TypedArray/prototype/reduce/callbackfn-detachbuffer.js
@@ -23,6 +23,7 @@ info: |
k, O »).
...
includes: [detachArrayBuffer.js, testTypedArray.js]
+features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
diff --git a/test/built-ins/TypedArray/prototype/reduce/invoked-as-func.js b/test/built-ins/TypedArray/prototype/reduce/invoked-as-func.js
index ab7b67039..bf5bf5e10 100644
--- a/test/built-ins/TypedArray/prototype/reduce/invoked-as-func.js
+++ b/test/built-ins/TypedArray/prototype/reduce/invoked-as-func.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.19
+esid: sec-%typedarray%.prototype.reduce
description: Throws a TypeError exception when invoked as a function
info: |
22.2.3.19 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] )
diff --git a/test/built-ins/TypedArray/prototype/reduce/invoked-as-method.js b/test/built-ins/TypedArray/prototype/reduce/invoked-as-method.js
index e50473401..b35bef486 100644
--- a/test/built-ins/TypedArray/prototype/reduce/invoked-as-method.js
+++ b/test/built-ins/TypedArray/prototype/reduce/invoked-as-method.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.19
+esid: sec-%typedarray%.prototype.reduce
description: Requires a [[TypedArrayName]] internal slot.
info: |
22.2.3.19 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] )
diff --git a/test/built-ins/TypedArray/prototype/reduce/length.js b/test/built-ins/TypedArray/prototype/reduce/length.js
index 7bf2e6f01..9d4afc624 100644
--- a/test/built-ins/TypedArray/prototype/reduce/length.js
+++ b/test/built-ins/TypedArray/prototype/reduce/length.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.19
+esid: sec-%typedarray%.prototype.reduce
description: >
%TypedArray%.prototype.reduce.length is 1.
info: |
@@ -20,6 +20,7 @@ info: |
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
[[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.reduce.length, 1);
diff --git a/test/built-ins/TypedArray/prototype/reduce/name.js b/test/built-ins/TypedArray/prototype/reduce/name.js
index 33cf84edb..9074a96d4 100644
--- a/test/built-ins/TypedArray/prototype/reduce/name.js
+++ b/test/built-ins/TypedArray/prototype/reduce/name.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.19
+esid: sec-%typedarray%.prototype.reduce
description: >
%TypedArray%.prototype.reduce.name is "reduce".
info: |
@@ -17,6 +17,7 @@ info: |
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.reduce.name, "reduce");
diff --git a/test/built-ins/TypedArray/prototype/reduce/prop-desc.js b/test/built-ins/TypedArray/prototype/reduce/prop-desc.js
index d291e79bc..338776d73 100644
--- a/test/built-ins/TypedArray/prototype/reduce/prop-desc.js
+++ b/test/built-ins/TypedArray/prototype/reduce/prop-desc.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.19
+esid: sec-%typedarray%.prototype.reduce
description: >
"reduce" property of TypedArrayPrototype
info: |
@@ -9,6 +9,7 @@ info: |
and in Annex B.2 has the attributes { [[Writable]]: true,
[[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
var TypedArrayPrototype = TypedArray.prototype;
diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-arguments-custom-accumulator.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-arguments-custom-accumulator.js
new file mode 100644
index 000000000..1d5d7dfbf
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-arguments-custom-accumulator.js
@@ -0,0 +1,59 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduceright
+description: >
+ callbackfn arguments using custom accumulator
+info: |
+ 22.2.3.21 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] )
+
+ %TypedArray%.prototype.reduceRight is a distinct function that implements the
+ same algorithm as Array.prototype.reduceRight as defined in 22.1.3.20 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ 22.1.3.20 Array.prototype.reduceRight ( callbackfn [ , initialValue ] )
+
+ ...
+ 8. Repeat, while k ≥ 0
+ ...
+ c. If kPresent is true, then
+ i. Let kValue be ? Get(O, Pk).
+ ii. Let accumulator be ? Call(callbackfn, undefined, « accumulator,
+ kValue, k, O »).
+ d. Decrease k by 1.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n, 44n]);
+
+ var results = [];
+
+ sample.reduceRight(function(accumulator) {
+ results.push(arguments);
+ return accumulator + 1;
+ }, 7);
+
+ assert.sameValue(results.length, 3, "results.length");
+
+ assert.sameValue(results[0].length, 4, "results[0].length");
+ assert.sameValue(results[0][0], 7, "results[0][0] - accumulator");
+ assert.sameValue(results[0][1], 44n, "results[0][1] - kValue");
+ assert.sameValue(results[0][2], 2, "results[0][2] - k");
+ assert.sameValue(results[0][3], sample, "results[0][3] - this");
+
+ assert.sameValue(results[1].length, 4, "results[1].length");
+ assert.sameValue(results[1][0], 8, "results[1][0] - accumulator");
+ assert.sameValue(results[1][1], 43n, "results[1][1] - kValue");
+ assert.sameValue(results[1][2], 1, "results[1][2] - k");
+ assert.sameValue(results[1][3], sample, "results[1][3] - this");
+
+ assert.sameValue(results[2].length, 4, "results[2].length");
+ assert.sameValue(results[2][0], 9, "results[2][0] - accumulator");
+ assert.sameValue(results[2][1], 42n, "results[2][1] - kValue");
+ assert.sameValue(results[2][2], 0, "results[2][2] - k");
+ assert.sameValue(results[2][3], sample, "results[2][3] - this");
+});
diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-arguments-default-accumulator.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-arguments-default-accumulator.js
new file mode 100644
index 000000000..ec251e709
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-arguments-default-accumulator.js
@@ -0,0 +1,62 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduceright
+description: >
+ callbackfn arguments using default accumulator (value at last index)
+info: |
+ 22.2.3.21 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] )
+
+ %TypedArray%.prototype.reduceRight is a distinct function that implements the
+ same algorithm as Array.prototype.reduceRight as defined in 22.1.3.20 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ 22.1.3.20 Array.prototype.reduceRight ( callbackfn [ , initialValue ] )
+
+ ...
+ 7. Else initialValue is not present,
+ ...
+ b. Repeat, while kPresent is false and k ≥ 0
+ ...
+ ii. Let kPresent be ? HasProperty(O, Pk).
+ iii. If kPresent is true, then
+ 1. Let accumulator be ? Get(O, Pk).
+ iv. Decrease k by 1.
+ ...
+ 8. Repeat, while k ≥ 0
+ ...
+ c. If kPresent is true, then
+ i. Let kValue be ? Get(O, Pk).
+ ii. Let accumulator be ? Call(callbackfn, undefined, « accumulator,
+ kValue, k, O »).
+ d. Decrease k by 1.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n, 44n]);
+
+ var results = [];
+
+ sample.reduceRight(function(accumulator) {
+ results.push(arguments);
+ return accumulator + 1n;
+ });
+
+ assert.sameValue(results.length, 2, "results.length");
+
+ assert.sameValue(results[0].length, 4, "results[1].length");
+ assert.sameValue(results[0][0], 44n, "results[1][0] - accumulator");
+ assert.sameValue(results[0][1], 43n, "results[1][1] - kValue");
+ assert.sameValue(results[0][2], 1, "results[1][2] - k");
+ assert.sameValue(results[0][3], sample, "results[1][3] - this");
+
+ assert.sameValue(results[1].length, 4, "results[2].length");
+ assert.sameValue(results[1][0], 45n, "results[2][0] - accumulator");
+ assert.sameValue(results[1][1], 42n, "results[2][1] - kValue");
+ assert.sameValue(results[1][2], 0, "results[2][2] - k");
+ assert.sameValue(results[1][3], sample, "results[2][3] - this");
+});
diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-detachbuffer.js
new file mode 100644
index 000000000..fe816660c
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-detachbuffer.js
@@ -0,0 +1,44 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduceright
+description: >
+ Instance buffer can be detached during loop
+info: |
+ 22.2.3.21 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] )
+
+ %TypedArray%.prototype.reduceRight is a distinct function that implements the
+ same algorithm as Array.prototype.reduceRight as defined in 22.1.3.20 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ 22.1.3.20 Array.prototype.reduceRight ( callbackfn [ , initialValue ] )
+
+ ...
+ 8. Repeat, while k < len
+ ...
+ c. If kPresent is true, then
+ ...
+ i. Let accumulator be ? Call(callbackfn, undefined, « accumulator, kValue,
+ k, O »).
+ ...
+includes: [detachArrayBuffer.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var loops = 0;
+ var sample = new TA(2);
+
+ assert.throws(TypeError, function() {
+ sample.reduceRight(function() {
+ if (loops === 1) {
+ throw new Test262Error("callbackfn called twice");
+ }
+ $DETACHBUFFER(sample.buffer);
+ loops++;
+ }, 0);
+ });
+
+ assert.sameValue(loops, 1, "callbackfn called only once");
+});
diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-is-not-callable-throws.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-is-not-callable-throws.js
new file mode 100644
index 000000000..880e1a1a9
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-is-not-callable-throws.js
@@ -0,0 +1,67 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduceright
+description: >
+ Throws TypeError if callbackfn is not callable
+info: |
+ 22.2.3.21 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] )
+
+ %TypedArray%.prototype.reduceRight is a distinct function that implements the
+ same algorithm as Array.prototype.reduceRight as defined in 22.1.3.20 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ 22.1.3.20 Array.prototype.reduceRight ( callbackfn [ , initialValue ] )
+
+ ...
+ 3. If IsCallable(callbackfn) is false, throw a TypeError exception.
+ 4. If len is 0 and initialValue is not present, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+
+ assert.throws(TypeError, function() {
+ sample.reduceRight();
+ }, "no arg");
+
+ assert.throws(TypeError, function() {
+ sample.reduceRight(undefined);
+ }, "undefined");
+
+ assert.throws(TypeError, function() {
+ sample.reduceRight(null);
+ }, "null");
+
+ assert.throws(TypeError, function() {
+ sample.reduceRight({});
+ }, "{}");
+
+ assert.throws(TypeError, function() {
+ sample.reduceRight(1);
+ }, "1");
+
+ assert.throws(TypeError, function() {
+ sample.reduceRight(NaN);
+ }, "NaN");
+
+ assert.throws(TypeError, function() {
+ sample.reduceRight("");
+ }, "string");
+
+ assert.throws(TypeError, function() {
+ sample.reduceRight(false);
+ }, "false");
+
+ assert.throws(TypeError, function() {
+ sample.reduceRight(true);
+ }, "true");
+
+ assert.throws(TypeError, function() {
+ sample.reduceRight(Symbol(""));
+ }, "symbol");
+});
diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-no-iteration-over-non-integer-properties.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-no-iteration-over-non-integer-properties.js
new file mode 100644
index 000000000..9dc6d1771
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-no-iteration-over-non-integer-properties.js
@@ -0,0 +1,49 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduceright
+description: >
+ Does not iterate over non-integer properties
+info: |
+ 22.2.3.21 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] )
+
+ %TypedArray%.prototype.reduceRight is a distinct function that implements the
+ same algorithm as Array.prototype.reduceRight as defined in 22.1.3.20 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ 22.1.3.20 Array.prototype.reduceRight ( callbackfn [ , initialValue ] )
+
+ ...
+ 8. Repeat, while k ≥ 0
+ ...
+ c. If kPresent is true, then
+ i. Let kValue be ? Get(O, Pk).
+ ii. Let accumulator be ? Call(callbackfn, undefined, « accumulator,
+ kValue, k, O »).
+ d. Decrease k by 1.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([7n, 8n]);
+
+ var results = [];
+
+ sample.foo = 42;
+ sample[Symbol("1")] = 43;
+
+ sample.reduceRight(function() {
+ results.push(arguments);
+ }, 0);
+
+ assert.sameValue(results.length, 2, "results.length");
+
+ assert.sameValue(results[0][2], 1, "results[0][2] - k");
+ assert.sameValue(results[1][2], 0, "results[1][2] - k");
+
+ assert.sameValue(results[0][1], 8n, "results[0][1] - kValue");
+ assert.sameValue(results[1][1], 7n, "results[1][1] - kValue");
+});
diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-not-called-on-empty.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-not-called-on-empty.js
new file mode 100644
index 000000000..ce9dc4b05
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-not-called-on-empty.js
@@ -0,0 +1,40 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduceright
+description: >
+ callbackfn is not called on empty instances
+info: |
+ 22.2.3.21 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] )
+
+ %TypedArray%.prototype.reduceRight is a distinct function that implements the
+ same algorithm as Array.prototype.reduceRight as defined in 22.1.3.20 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ 22.1.3.20 Array.prototype.reduceRight ( callbackfn [ , initialValue ] )
+
+ ...
+ 4. If len is 0 and initialValue is not present, throw a TypeError exception.
+ ...
+ 8. Repeat, while k ≥ 0
+ ...
+ c. If kPresent is true, then
+ i. Let kValue be ? Get(O, Pk).
+ ii. Let accumulator be ? Call(callbackfn, undefined, « accumulator,
+ kValue, k, O »).
+ d. Decrease k by 1.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var called = 0;
+
+ new TA().reduceRight(function() {
+ called++;
+ }, undefined);
+
+ assert.sameValue(called, 0);
+});
diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-return-does-not-change-instance.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-return-does-not-change-instance.js
new file mode 100644
index 000000000..2dccce9e3
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-return-does-not-change-instance.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduceright
+description: >
+ The callbackfn return does not change the `this` instance
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([0n, 1n, 0n]);
+
+ sample.reduceRight(function() {
+ return 42;
+ }, 7);
+
+ assert.sameValue(sample[0], 0n, "[0] == 0");
+ assert.sameValue(sample[1], 1n, "[1] == 1");
+ assert.sameValue(sample[2], 0n, "[2] == 0");
+});
diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-returns-abrupt.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-returns-abrupt.js
new file mode 100644
index 000000000..ce1cc6d0e
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-returns-abrupt.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduceright
+description: >
+ Returns abrupt from callbackfn
+info: |
+ 22.2.3.21 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] )
+
+ %TypedArray%.prototype.reduceRight is a distinct function that implements the
+ same algorithm as Array.prototype.reduceRight as defined in 22.1.3.20 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ 22.1.3.20 Array.prototype.reduceRight ( callbackfn [ , initialValue ] )
+
+ ...
+ 8. Repeat, while k < len
+ ...
+ c. If kPresent is true, then
+ ...
+ i. Let accumulator be ? Call(callbackfn, undefined, « accumulator, kValue,
+ k, O »).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(2);
+
+ assert.throws(Test262Error, function() {
+ sample.reduceRight(function() {
+ throw new Test262Error();
+ });
+ });
+
+ assert.throws(Test262Error, function() {
+ sample.reduceRight(function() {
+ throw new Test262Error();
+ }, 0);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-set-value-during-iteration.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-set-value-during-iteration.js
new file mode 100644
index 000000000..3442517c0
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-set-value-during-iteration.js
@@ -0,0 +1,49 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.reduceright
+description: >
+ Integer indexed values changed during iteration
+info: |
+ 22.2.3.21 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] )
+
+ %TypedArray%.prototype.reduceRight is a distinct function that implements the
+ same algorithm as Array.prototype.reduceRight as defined in 22.1.3.20 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ 22.1.3.20 Array.prototype.reduceRight ( callbackfn [ , initialValue ] )
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Reflect.set, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n, 44n]);
+ var newVal = 0n;
+
+ sample.reduceRight(function(acc, val, i) {
+ if (i < sample.length - 1) {
+ assert.sameValue(
+ sample[i + 1], newVal - 1n,
+ "get the changed value during the loop"
+ );
+ assert.sameValue(
+ Reflect.set(sample, 2, 7n),
+ true,
+ "re-set a value for sample[2]"
+ );
+ }
+ assert.sameValue(
+ Reflect.set(sample, i, newVal),
+ true,
+ "set value during iteration"
+ );
+
+ newVal++;
+ }, 0);
+
+ assert.sameValue(sample[0], 2n, "changed values after iteration [0] == 2");
+ assert.sameValue(sample[1], 1n, "changed values after iteration [1] == 1");
+ assert.sameValue(sample[2], 7n, "changed values after iteration [2] == 7");
+});
diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-this.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-this.js
new file mode 100644
index 000000000..6210eea50
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-this.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduceright
+description: >
+ callbackfn `this` value
+info: |
+ 22.2.3.21 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] )
+
+ %TypedArray%.prototype.reduceRight is a distinct function that implements the
+ same algorithm as Array.prototype.reduceRight as defined in 22.1.3.20 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ 22.1.3.20 Array.prototype.reduceRight ( callbackfn [ , initialValue ] )
+
+ ...
+ 8. Repeat, while k ≥ 0
+ ...
+ c. If kPresent is true, then
+ i. Let kValue be ? Get(O, Pk).
+ ii. Let accumulator be ? Call(callbackfn, undefined, « accumulator,
+ kValue, k, O »).
+ d. Decrease k by 1.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var expected = (function() { return this; })();
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(3);
+
+ var results = [];
+
+ sample.reduceRight(function() {
+ results.push(this);
+ }, 0);
+
+ assert.sameValue(results.length, 3, "results.length");
+ assert.sameValue(results[0], expected, "[0]");
+ assert.sameValue(results[1], expected, "[1]");
+ assert.sameValue(results[2], expected, "[2]");
+});
diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/detached-buffer.js
new file mode 100644
index 000000000..08e635433
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/detached-buffer.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduceright
+description: Throws a TypeError if this has a detached buffer
+info: |
+ 22.2.3.21 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ ...
+ 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+var callbackfn = function() {
+ throw new Test262Error();
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+ $DETACHBUFFER(sample.buffer);
+ assert.throws(TypeError, function() {
+ sample.reduceRight(callbackfn);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/empty-instance-return-initialvalue.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/empty-instance-return-initialvalue.js
new file mode 100644
index 000000000..2818b78b1
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/empty-instance-return-initialvalue.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduceright
+description: >
+ Returns given initialValue on empty instances without calling callbackfn
+info: |
+ 22.2.3.21 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] )
+
+ %TypedArray%.prototype.reduceRight is a distinct function that implements the
+ same algorithm as Array.prototype.reduceRight as defined in 22.1.3.20 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ 22.1.3.20 Array.prototype.reduceRight ( callbackfn [ , initialValue ] )
+
+ ...
+ 7. Else initialValue is not present,
+ ...
+ b. Repeat, while kPresent is false and k ≥ 0
+ ...
+ ii. Let kPresent be ? HasProperty(O, Pk).
+ iii. If kPresent is true, then
+ 1. Let accumulator be ? Get(O, Pk).
+ iv. Decrease k by 1.
+ ...
+ 8. Repeat, while k ≥ 0
+ ...
+ 9. Return accumulator.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var called = false;
+ var result = new TA().reduceRight(function() {
+ called = true;
+ }, 42);
+
+ assert.sameValue(result, 42);
+ assert.sameValue(called, false);
+});
diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/empty-instance-with-no-initialvalue-throws.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/empty-instance-with-no-initialvalue-throws.js
new file mode 100644
index 000000000..65b07a1ce
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/empty-instance-with-no-initialvalue-throws.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduceright
+description: >
+ If len is 0 and initialValue is not present, throw a TypeError exception.
+info: |
+ 22.2.3.21 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] )
+
+ %TypedArray%.prototype.reduceRight is a distinct function that implements the
+ same algorithm as Array.prototype.reduceRight as defined in 22.1.3.20 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ 22.1.3.20 Array.prototype.reduceRight ( callbackfn [ , initialValue ] )
+
+ ...
+ 4. If len is 0 and initialValue is not present, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var called = 0;
+
+ assert.throws(TypeError, function() {
+ new TA().reduceRight(function() {
+ called++;
+ });
+ });
+
+ assert.sameValue(called, 0);
+});
diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/get-length-uses-internal-arraylength.js
new file mode 100644
index 000000000..2aae5480c
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/get-length-uses-internal-arraylength.js
@@ -0,0 +1,46 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduceright
+description: Get "length" uses internal ArrayLength
+info: |
+ 22.2.3.21 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] )
+
+ %TypedArray%.prototype.reduceRight is a distinct function that implements the
+ same algorithm as Array.prototype.reduceRight as defined in 22.1.3.20 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ 22.1.3.20 Array.prototype.reduceRight ( callbackfn [ , initialValue ] )
+
+ 1. Let O be ? ToObject(this value).
+ 2. Let len be ? ToLength(? Get(O, "length")).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var getCalls = 0;
+var desc = {
+ get: function getLen() {
+ getCalls++;
+ return 0;
+ }
+};
+
+Object.defineProperty(TypedArray.prototype, "length", desc);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n]);
+ var calls = 0;
+
+ Object.defineProperty(TA.prototype, "length", desc);
+ Object.defineProperty(sample, "length", desc);
+
+ sample.reduceRight(function() {
+ calls++;
+ }, 0);
+
+ assert.sameValue(getCalls, 0, "ignores length properties");
+ assert.sameValue(calls, 2, "iterations are not affected by custom length");
+});
diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/invoked-as-func.js
new file mode 100644
index 000000000..9a0fec093
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/invoked-as-func.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduceright
+description: Throws a TypeError exception when invoked as a function
+info: |
+ 22.2.3.20 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] )
+
+ ...
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var reduceRight = TypedArray.prototype.reduceRight;
+
+assert.sameValue(typeof reduceRight, 'function');
+
+assert.throws(TypeError, function() {
+ reduceRight();
+});
diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/invoked-as-method.js
new file mode 100644
index 000000000..d36832aa2
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/invoked-as-method.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduceright
+description: Requires a [[TypedArrayName]] internal slot.
+info: |
+ 22.2.3.20 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] )
+
+ ...
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+assert.sameValue(typeof TypedArrayPrototype.reduceRight, 'function');
+
+assert.throws(TypeError, function() {
+ TypedArrayPrototype.reduceRight();
+});
diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/length.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/length.js
new file mode 100644
index 000000000..8cf3d8d6a
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/length.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.reduceright
+description: >
+ %TypedArray%.prototype.reduceRight.length is 1.
+info: |
+ %TypedArray%.prototype.reduceRight ( callbackfn [ , thisArg ] )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, has a length
+ property whose value is an integer. Unless otherwise specified, this
+ value is equal to the largest number of named arguments shown in the
+ subclause headings for the function description, including optional
+ parameters. However, rest parameters shown using the form “...name”
+ are not included in the default argument count.
+
+ Unless otherwise specified, the length property of a built-in Function
+ object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.reduceRight.length, 1);
+
+verifyNotEnumerable(TypedArray.prototype.reduceRight, "length");
+verifyNotWritable(TypedArray.prototype.reduceRight, "length");
+verifyConfigurable(TypedArray.prototype.reduceRight, "length");
diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/name.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/name.js
new file mode 100644
index 000000000..fb63b3a35
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/name.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.reduceright
+description: >
+ %TypedArray%.prototype.reduceRight.name is "reduceRight".
+info: |
+ %TypedArray%.prototype.reduceRight ( callbackfn [ , thisArg ] )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, that is not
+ identified as an anonymous function has a name property whose value
+ is a String.
+
+ Unless otherwise specified, the name property of a built-in Function
+ object, if it exists, has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.reduceRight.name, "reduceRight");
+
+verifyNotEnumerable(TypedArray.prototype.reduceRight, "name");
+verifyNotWritable(TypedArray.prototype.reduceRight, "name");
+verifyConfigurable(TypedArray.prototype.reduceRight, "name");
diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/prop-desc.js
new file mode 100644
index 000000000..0d6f4d2fd
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/prop-desc.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduceright
+description: >
+ "reduceRight" property of TypedArrayPrototype
+info: |
+ ES6 section 17: Every other data property described in clauses 18 through 26
+ and in Annex B.2 has the attributes { [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+verifyNotEnumerable(TypedArrayPrototype, 'reduceRight');
+verifyWritable(TypedArrayPrototype, 'reduceRight');
+verifyConfigurable(TypedArrayPrototype, 'reduceRight');
diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/result-is-last-callbackfn-return.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/result-is-last-callbackfn-return.js
new file mode 100644
index 000000000..140b095cb
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/result-is-last-callbackfn-return.js
@@ -0,0 +1,61 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduceright
+description: >
+ Returns last accumulator value
+info: |
+ 22.2.3.21 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] )
+
+ %TypedArray%.prototype.reduceRight is a distinct function that implements the
+ same algorithm as Array.prototype.reduceRight as defined in 22.1.3.20 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ 22.1.3.20 Array.prototype.reduceRight ( callbackfn [ , initialValue ] )
+
+ ...
+ 7. Else initialValue is not present,
+ ...
+ b. Repeat, while kPresent is false and k ≥ 0
+ ...
+ ii. Let kPresent be ? HasProperty(O, Pk).
+ iii. If kPresent is true, then
+ 1. Let accumulator be ? Get(O, Pk).
+ iv. Decrease k by 1.
+ ...
+ 8. Repeat, while k ≥ 0
+ ...
+ c. If kPresent is true, then
+ i. Let kValue be ? Get(O, Pk).
+ ii. Let accumulator be ? Call(callbackfn, undefined, « accumulator,
+ kValue, k, O »).
+ d. Decrease k by 1.
+ 9. Return accumulator.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var calls, result;
+
+ calls = 0;
+ result = new TA([1n, 2n, 3n]).reduceRight(function() {
+ calls++;
+
+ if (calls == 2) {
+ return 42;
+ }
+ });
+ assert.sameValue(result, 42, "using default accumulator");
+
+ calls = 0;
+ result = new TA([1n, 2n, 3n]).reduceRight(function() {
+ calls++;
+
+ if (calls == 3) {
+ return 7;
+ }
+ }, 0);
+ assert.sameValue(result, 7, "using custom accumulator");
+});
diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/result-of-any-type.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/result-of-any-type.js
new file mode 100644
index 000000000..a70a4135d
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/result-of-any-type.js
@@ -0,0 +1,69 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduceright
+description: >
+ Result can be of any type without any number conversions
+info: |
+ 22.2.3.21 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] )
+
+ %TypedArray%.prototype.reduceRight is a distinct function that implements the
+ same algorithm as Array.prototype.reduceRight as defined in 22.1.3.20 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ 22.1.3.20 Array.prototype.reduceRight ( callbackfn [ , initialValue ] )
+
+ ...
+ 7. Else initialValue is not present,
+ ...
+ b. Repeat, while kPresent is false and k ≥ 0
+ ...
+ ii. Let kPresent be ? HasProperty(O, Pk).
+ iii. If kPresent is true, then
+ 1. Let accumulator be ? Get(O, Pk).
+ iv. Decrease k by 1.
+ ...
+ 8. Repeat, while k ≥ 0
+ ...
+ c. If kPresent is true, then
+ i. Let kValue be ? Get(O, Pk).
+ ii. Let accumulator be ? Call(callbackfn, undefined, « accumulator,
+ kValue, k, O »).
+ d. Decrease k by 1.
+ 9. Return accumulator.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n, 44n]);
+ [
+ ["test262", "string"],
+ ["", "empty string"],
+ [undefined, "undefined"],
+ [null, "null"],
+ [-0, "-0"],
+ [42, "integer"],
+ [NaN, "NaN"],
+ [Infinity, "Infinity"],
+ [0.6, "float number"],
+ [true, "true"],
+ [false, "false"],
+ [Symbol(""), "symbol"],
+ [{}, "object"]
+ ].forEach(function(item) {
+ var result;
+
+ result = sample.reduceRight(function() {
+ return item[0];
+ });
+ assert.sameValue(result, item[0], item[1] + " - using default accumulator");
+
+ result = sample.reduceRight(function() {
+ return item[0];
+ }, 0);
+
+ assert.sameValue(result, item[0], item[1] + " - using custom accumulator");
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/return-first-value-without-callbackfn.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/return-first-value-without-callbackfn.js
new file mode 100644
index 000000000..71ada5949
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/return-first-value-without-callbackfn.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduceright
+description: >
+ Returns [0] without calling callbackfn if length is 1 and initialValue is not
+ present.
+info: |
+ 22.2.3.21 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] )
+
+ %TypedArray%.prototype.reduceRight is a distinct function that implements the
+ same algorithm as Array.prototype.reduceRight as defined in 22.1.3.20 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ 22.1.3.20 Array.prototype.reduceRight ( callbackfn [ , initialValue ] )
+
+ ...
+ 7. Else initialValue is not present,
+ ...
+ b. Repeat, while kPresent is false and k ≥ 0
+ ...
+ ii. Let kPresent be ? HasProperty(O, Pk).
+ iii. If kPresent is true, then
+ 1. Let accumulator be ? Get(O, Pk).
+ iv. Decrease k by 1.
+ ...
+ 8. Repeat, while k ≥ 0
+ ...
+ 9. Return accumulator.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var called = false;
+ var result = new TA([42n]).reduceRight(function() {
+ called = true;
+ });
+
+ assert.sameValue(result, 42n);
+ assert.sameValue(called, false);
+});
diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/this-is-not-object.js
new file mode 100644
index 000000000..fccf9de2b
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/this-is-not-object.js
@@ -0,0 +1,51 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduceright
+description: Throws a TypeError exception when `this` is not Object
+info: |
+ 22.2.3.21 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var reduceRight = TypedArray.prototype.reduceRight;
+var callbackfn = function() {};
+
+assert.throws(TypeError, function() {
+ reduceRight.call(undefined, callbackfn);
+}, "this is undefined");
+
+assert.throws(TypeError, function() {
+ reduceRight.call(null, callbackfn);
+}, "this is null");
+
+assert.throws(TypeError, function() {
+ reduceRight.call(42, callbackfn);
+}, "this is 42");
+
+assert.throws(TypeError, function() {
+ reduceRight.call("1", callbackfn);
+}, "this is a string");
+
+assert.throws(TypeError, function() {
+ reduceRight.call(true, callbackfn);
+}, "this is true");
+
+assert.throws(TypeError, function() {
+ reduceRight.call(false, callbackfn);
+}, "this is false");
+
+var s = Symbol("s");
+assert.throws(TypeError, function() {
+ reduceRight.call(s, callbackfn);
+}, "this is a Symbol");
diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/this-is-not-typedarray-instance.js
new file mode 100644
index 000000000..8092e93e9
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/this-is-not-typedarray-instance.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduceright
+description: >
+ Throws a TypeError exception when `this` is not a TypedArray instance
+info: |
+ 22.2.3.21 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var reduceRight = TypedArray.prototype.reduceRight;
+var callbackfn = function() {};
+
+assert.throws(TypeError, function() {
+ reduceRight.call({}, callbackfn);
+}, "this is an Object");
+
+assert.throws(TypeError, function() {
+ reduceRight.call([], callbackfn);
+}, "this is an Array");
+
+var ab = new ArrayBuffer(8);
+assert.throws(TypeError, function() {
+ reduceRight.call(ab, callbackfn);
+}, "this is an ArrayBuffer instance");
+
+var dv = new DataView(new ArrayBuffer(8), 0, 1);
+assert.throws(TypeError, function() {
+ reduceRight.call(dv, callbackfn);
+}, "this is a DataView instance");
diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/values-are-not-cached.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/values-are-not-cached.js
new file mode 100644
index 000000000..c0ae38dd7
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/values-are-not-cached.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reduceright
+description: >
+ Integer indexed values are not cached before iteration
+info: |
+ 22.2.3.21 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] )
+
+ %TypedArray%.prototype.reduceRight is a distinct function that implements the
+ same algorithm as Array.prototype.reduceRight as defined in 22.1.3.20 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length".
+
+ 22.1.3.20 Array.prototype.reduceRight ( callbackfn [ , initialValue ] )
+
+ ...
+ 8. Repeat, while k ≥ 0
+ ...
+ c. If kPresent is true, then
+ i. Let kValue be ? Get(O, Pk).
+ ii. Let accumulator be ? Call(callbackfn, undefined, « accumulator,
+ kValue, k, O »).
+ d. Decrease k by 1.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([44n, 43n, 42n]);
+
+ sample.reduceRight(function(a, v, i) {
+ if (i > 0) {
+ sample[i-1] = 42n;
+ }
+
+ assert.sameValue(
+ v, 42n, "method does not cache values before callbackfn calls"
+ );
+ }, 0);
+});
diff --git a/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-detachbuffer.js
index cd5ab46f6..7731c1e96 100644
--- a/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-detachbuffer.js
+++ b/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-detachbuffer.js
@@ -23,6 +23,7 @@ info: |
k, O »).
...
includes: [detachArrayBuffer.js, testTypedArray.js]
+features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
diff --git a/test/built-ins/TypedArray/prototype/reduceRight/invoked-as-func.js b/test/built-ins/TypedArray/prototype/reduceRight/invoked-as-func.js
index e7f3104ad..49937beb2 100644
--- a/test/built-ins/TypedArray/prototype/reduceRight/invoked-as-func.js
+++ b/test/built-ins/TypedArray/prototype/reduceRight/invoked-as-func.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.20
+esid: sec-%typedarray%.prototype.reduceright
description: Throws a TypeError exception when invoked as a function
info: |
22.2.3.20 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] )
diff --git a/test/built-ins/TypedArray/prototype/reduceRight/invoked-as-method.js b/test/built-ins/TypedArray/prototype/reduceRight/invoked-as-method.js
index 397eb2b1d..f3cd49e0b 100644
--- a/test/built-ins/TypedArray/prototype/reduceRight/invoked-as-method.js
+++ b/test/built-ins/TypedArray/prototype/reduceRight/invoked-as-method.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.20
+esid: sec-%typedarray%.prototype.reduceright
description: Requires a [[TypedArrayName]] internal slot.
info: |
22.2.3.20 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] )
diff --git a/test/built-ins/TypedArray/prototype/reduceRight/length.js b/test/built-ins/TypedArray/prototype/reduceRight/length.js
index 4bb6265de..7d0227b6b 100644
--- a/test/built-ins/TypedArray/prototype/reduceRight/length.js
+++ b/test/built-ins/TypedArray/prototype/reduceRight/length.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.20
+esid: sec-%typedarray%.prototype.reduceright
description: >
%TypedArray%.prototype.reduceRight.length is 1.
info: |
@@ -20,6 +20,7 @@ info: |
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
[[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.reduceRight.length, 1);
diff --git a/test/built-ins/TypedArray/prototype/reduceRight/name.js b/test/built-ins/TypedArray/prototype/reduceRight/name.js
index e9cec95aa..e483a273b 100644
--- a/test/built-ins/TypedArray/prototype/reduceRight/name.js
+++ b/test/built-ins/TypedArray/prototype/reduceRight/name.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.20
+esid: sec-%typedarray%.prototype.reduceright
description: >
%TypedArray%.prototype.reduceRight.name is "reduceRight".
info: |
@@ -17,6 +17,7 @@ info: |
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.reduceRight.name, "reduceRight");
diff --git a/test/built-ins/TypedArray/prototype/reduceRight/prop-desc.js b/test/built-ins/TypedArray/prototype/reduceRight/prop-desc.js
index 5b22846e0..0dd9b7acd 100644
--- a/test/built-ins/TypedArray/prototype/reduceRight/prop-desc.js
+++ b/test/built-ins/TypedArray/prototype/reduceRight/prop-desc.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.20
+esid: sec-%typedarray%.prototype.reduceright
description: >
"reduceRight" property of TypedArrayPrototype
info: |
@@ -9,6 +9,7 @@ info: |
and in Annex B.2 has the attributes { [[Writable]]: true,
[[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
var TypedArrayPrototype = TypedArray.prototype;
diff --git a/test/built-ins/TypedArray/prototype/reverse/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/reverse/BigInt/detached-buffer.js
new file mode 100644
index 000000000..5067380d5
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reverse/BigInt/detached-buffer.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reverse
+description: Throws a TypeError if this has a detached buffer
+info: |
+ 22.2.3.22 %TypedArray%.prototype.reverse ( )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ ...
+ 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+ $DETACHBUFFER(sample.buffer);
+ assert.throws(TypeError, function() {
+ sample.reverse();
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/reverse/BigInt/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/reverse/BigInt/get-length-uses-internal-arraylength.js
new file mode 100644
index 000000000..0a08956c7
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reverse/BigInt/get-length-uses-internal-arraylength.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reverse
+description: Get "length" uses internal ArrayLength
+info: |
+ 22.2.3.22 %TypedArray%.prototype.reverse ( )
+
+ %TypedArray%.prototype.reverse is a distinct function that implements the same
+ algorithm as Array.prototype.reverse as defined in 22.1.3.21 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length".
+
+ 22.1.3.21 Array.prototype.reverse ( )
+
+ 1. Let O be ? ToObject(this value).
+ 2. Let len be ? ToLength(? Get(O, "length")).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var getCalls = 0;
+var desc = {
+ get: function getLen() {
+ getCalls++;
+ return 0;
+ }
+};
+
+Object.defineProperty(TypedArray.prototype, "length", desc);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n]);
+
+ Object.defineProperty(TA.prototype, "length", desc);
+ Object.defineProperty(sample, "length", desc);
+
+ sample.reverse();
+
+ assert.sameValue(getCalls, 0, "ignores length properties");
+});
diff --git a/test/built-ins/TypedArray/prototype/reverse/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/reverse/BigInt/invoked-as-func.js
new file mode 100644
index 000000000..48e16d6be
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reverse/BigInt/invoked-as-func.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reverse
+description: Throws a TypeError exception when invoked as a function
+info: |
+ 22.2.3.21 %TypedArray%.prototype.reverse ( )
+
+ ...
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var reverse = TypedArray.prototype.reverse;
+
+assert.sameValue(typeof reverse, 'function');
+
+assert.throws(TypeError, function() {
+ reverse();
+});
diff --git a/test/built-ins/TypedArray/prototype/reverse/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/reverse/BigInt/invoked-as-method.js
new file mode 100644
index 000000000..601ce65ff
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reverse/BigInt/invoked-as-method.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reverse
+description: Requires a [[TypedArrayName]] internal slot.
+info: |
+ 22.2.3.21 %TypedArray%.prototype.reverse ( )
+
+ ...
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+assert.sameValue(typeof TypedArrayPrototype.reverse, 'function');
+
+assert.throws(TypeError, function() {
+ TypedArrayPrototype.reverse();
+});
diff --git a/test/built-ins/TypedArray/prototype/reverse/BigInt/length.js b/test/built-ins/TypedArray/prototype/reverse/BigInt/length.js
new file mode 100644
index 000000000..22545aeb0
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reverse/BigInt/length.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.reverse
+description: >
+ %TypedArray%.prototype.reverse.length is 0.
+info: |
+ %TypedArray%.prototype.reverse ( )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, has a length
+ property whose value is an integer. Unless otherwise specified, this
+ value is equal to the largest number of named arguments shown in the
+ subclause headings for the function description, including optional
+ parameters. However, rest parameters shown using the form “...name”
+ are not included in the default argument count.
+
+ Unless otherwise specified, the length property of a built-in Function
+ object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.reverse.length, 0);
+
+verifyNotEnumerable(TypedArray.prototype.reverse, "length");
+verifyNotWritable(TypedArray.prototype.reverse, "length");
+verifyConfigurable(TypedArray.prototype.reverse, "length");
diff --git a/test/built-ins/TypedArray/prototype/reverse/BigInt/name.js b/test/built-ins/TypedArray/prototype/reverse/BigInt/name.js
new file mode 100644
index 000000000..2fda014b2
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reverse/BigInt/name.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.reverse
+description: >
+ %TypedArray%.prototype.reverse.name is "reverse".
+info: |
+ %TypedArray%.prototype.reverse ( )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, that is not
+ identified as an anonymous function has a name property whose value
+ is a String.
+
+ Unless otherwise specified, the name property of a built-in Function
+ object, if it exists, has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.reverse.name, "reverse");
+
+verifyNotEnumerable(TypedArray.prototype.reverse, "name");
+verifyNotWritable(TypedArray.prototype.reverse, "name");
+verifyConfigurable(TypedArray.prototype.reverse, "name");
diff --git a/test/built-ins/TypedArray/prototype/reverse/BigInt/preserves-non-numeric-properties.js b/test/built-ins/TypedArray/prototype/reverse/BigInt/preserves-non-numeric-properties.js
new file mode 100644
index 000000000..a06d52f98
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reverse/BigInt/preserves-non-numeric-properties.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reverse
+description: Preserves non numeric properties
+info: |
+ 22.2.3.22 %TypedArray%.prototype.reverse ( )
+
+ %TypedArray%.prototype.reverse is a distinct function that implements the same
+ algorithm as Array.prototype.reverse as defined in 22.1.3.21 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length".
+
+ 22.1.3.21 Array.prototype.reverse ( )
+
+ ...
+ 6. Return O.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var s = Symbol("1");
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample, result;
+
+ sample = new TA(2);
+ sample.foo = 42;
+ sample.bar = "bar";
+ sample[s] = 1;
+ result = sample.reverse();
+ assert.sameValue(result.foo, 42, "sample.foo === 42");
+ assert.sameValue(result.bar, "bar", "sample.bar === 'bar'");
+ assert.sameValue(result[s], 1, "sample[s] === 1");
+});
diff --git a/test/built-ins/TypedArray/prototype/reverse/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/reverse/BigInt/prop-desc.js
new file mode 100644
index 000000000..3bd6e881d
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reverse/BigInt/prop-desc.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reverse
+description: >
+ "reverse" property of TypedArrayPrototype
+info: |
+ ES6 section 17: Every other data property described in clauses 18 through 26
+ and in Annex B.2 has the attributes { [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+verifyNotEnumerable(TypedArrayPrototype, 'reverse');
+verifyWritable(TypedArrayPrototype, 'reverse');
+verifyConfigurable(TypedArrayPrototype, 'reverse');
diff --git a/test/built-ins/TypedArray/prototype/reverse/BigInt/returns-original-object.js b/test/built-ins/TypedArray/prototype/reverse/BigInt/returns-original-object.js
new file mode 100644
index 000000000..c9f8fdafd
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reverse/BigInt/returns-original-object.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reverse
+description: Returns the same object
+info: |
+ 22.2.3.22 %TypedArray%.prototype.reverse ( )
+
+ %TypedArray%.prototype.reverse is a distinct function that implements the same
+ algorithm as Array.prototype.reverse as defined in 22.1.3.21 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length".
+
+ 22.1.3.21 Array.prototype.reverse ( )
+
+ ...
+ 6. Return O.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var buffer = new ArrayBuffer(64);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample, result, expectedLength;
+
+ sample = new TA(buffer, 0);
+ expectedLength = sample.length;
+ result = sample.reverse();
+ assert.sameValue(result, sample, "returns the same object");
+ assert.sameValue(sample.buffer, buffer, "keeps the same buffer");
+ assert.sameValue(sample.length, expectedLength, "length is preserved");
+
+ sample = new TA(buffer, 0, 0);
+ result = sample.reverse();
+ assert.sameValue(result, sample, "returns the same object (empty instance)");
+ assert.sameValue(sample.buffer, buffer, "keeps the same buffer (empty instance)");
+ assert.sameValue(sample.length, 0, "length is preserved (empty instance)");
+});
diff --git a/test/built-ins/TypedArray/prototype/reverse/BigInt/reverts.js b/test/built-ins/TypedArray/prototype/reverse/BigInt/reverts.js
new file mode 100644
index 000000000..92aa0eb3e
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reverse/BigInt/reverts.js
@@ -0,0 +1,57 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reverse
+description: Reverts values
+info: |
+ 22.2.3.22 %TypedArray%.prototype.reverse ( )
+
+ %TypedArray%.prototype.reverse is a distinct function that implements the same
+ algorithm as Array.prototype.reverse as defined in 22.1.3.21 except that the
+ this object's [[ArrayLength]] internal slot is accessed in place of performing
+ a [[Get]] of "length".
+
+ 22.1.3.21 Array.prototype.reverse ( )
+
+ ...
+ 6. Return O.
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var buffer = new ArrayBuffer(64);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(buffer, 0, 4);
+ var other = new TA(buffer, 0, 5);
+
+ sample[0] = 42n;
+ sample[1] = 43n;
+ sample[2] = 2n;
+ sample[3] = 1n;
+ other[4] = 7n;
+
+ sample.reverse();
+ assert(
+ compareArray(sample, [1n, 2n, 43n, 42n])
+ );
+
+ assert(
+ compareArray(other, [1n, 2n, 43n, 42n, 7n])
+ );
+
+ sample[0] = 7n;
+ sample[1] = 17n;
+ sample[2] = 1n;
+ sample[3] = 0n;
+ other[4] = 42n;
+
+ other.reverse();
+ assert(
+ compareArray(other, [42n, 0n, 1n, 17n, 7n])
+ );
+
+ assert(
+ compareArray(sample, [42n, 0n, 1n, 17n])
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/reverse/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/reverse/BigInt/this-is-not-object.js
new file mode 100644
index 000000000..82255a345
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reverse/BigInt/this-is-not-object.js
@@ -0,0 +1,50 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reverse
+description: Throws a TypeError exception when `this` is not Object
+info: |
+ 22.2.3.22 %TypedArray%.prototype.reverse ( )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var reverse = TypedArray.prototype.reverse;
+
+assert.throws(TypeError, function() {
+ reverse.call(undefined);
+}, "this is undefined");
+
+assert.throws(TypeError, function() {
+ reverse.call(null);
+}, "this is null");
+
+assert.throws(TypeError, function() {
+ reverse.call(42);
+}, "this is 42");
+
+assert.throws(TypeError, function() {
+ reverse.call("1");
+}, "this is a string");
+
+assert.throws(TypeError, function() {
+ reverse.call(true);
+}, "this is true");
+
+assert.throws(TypeError, function() {
+ reverse.call(false);
+}, "this is false");
+
+var s = Symbol("s");
+assert.throws(TypeError, function() {
+ reverse.call(s);
+}, "this is a Symbol");
diff --git a/test/built-ins/TypedArray/prototype/reverse/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/reverse/BigInt/this-is-not-typedarray-instance.js
new file mode 100644
index 000000000..07b5138d9
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/reverse/BigInt/this-is-not-typedarray-instance.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.reverse
+description: >
+ Throws a TypeError exception when `this` is not a TypedArray instance
+info: |
+ 22.2.3.22 %TypedArray%.prototype.reverse ( )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var reverse = TypedArray.prototype.reverse;
+
+assert.throws(TypeError, function() {
+ reverse.call({});
+}, "this is an Object");
+
+assert.throws(TypeError, function() {
+ reverse.call([]);
+}, "this is an Array");
+
+var ab = new ArrayBuffer(8);
+assert.throws(TypeError, function() {
+ reverse.call(ab);
+}, "this is an ArrayBuffer instance");
+
+var dv = new DataView(new ArrayBuffer(8), 0, 1);
+assert.throws(TypeError, function() {
+ reverse.call(dv);
+}, "this is a DataView instance");
diff --git a/test/built-ins/TypedArray/prototype/reverse/invoked-as-func.js b/test/built-ins/TypedArray/prototype/reverse/invoked-as-func.js
index a35fbf147..3082a2ff7 100644
--- a/test/built-ins/TypedArray/prototype/reverse/invoked-as-func.js
+++ b/test/built-ins/TypedArray/prototype/reverse/invoked-as-func.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.21
+esid: sec-%typedarray%.prototype.reverse
description: Throws a TypeError exception when invoked as a function
info: |
22.2.3.21 %TypedArray%.prototype.reverse ( )
diff --git a/test/built-ins/TypedArray/prototype/reverse/invoked-as-method.js b/test/built-ins/TypedArray/prototype/reverse/invoked-as-method.js
index 510fa2083..991cd44af 100644
--- a/test/built-ins/TypedArray/prototype/reverse/invoked-as-method.js
+++ b/test/built-ins/TypedArray/prototype/reverse/invoked-as-method.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.21
+esid: sec-%typedarray%.prototype.reverse
description: Requires a [[TypedArrayName]] internal slot.
info: |
22.2.3.21 %TypedArray%.prototype.reverse ( )
diff --git a/test/built-ins/TypedArray/prototype/reverse/length.js b/test/built-ins/TypedArray/prototype/reverse/length.js
index 644539de0..4a0364829 100644
--- a/test/built-ins/TypedArray/prototype/reverse/length.js
+++ b/test/built-ins/TypedArray/prototype/reverse/length.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.21
+esid: sec-%typedarray%.prototype.reverse
description: >
%TypedArray%.prototype.reverse.length is 0.
info: |
@@ -20,6 +20,7 @@ info: |
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
[[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.reverse.length, 0);
diff --git a/test/built-ins/TypedArray/prototype/reverse/name.js b/test/built-ins/TypedArray/prototype/reverse/name.js
index 7c52b9b5d..eff372aa3 100644
--- a/test/built-ins/TypedArray/prototype/reverse/name.js
+++ b/test/built-ins/TypedArray/prototype/reverse/name.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.21
+esid: sec-%typedarray%.prototype.reverse
description: >
%TypedArray%.prototype.reverse.name is "reverse".
info: |
@@ -17,6 +17,7 @@ info: |
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.reverse.name, "reverse");
diff --git a/test/built-ins/TypedArray/prototype/reverse/prop-desc.js b/test/built-ins/TypedArray/prototype/reverse/prop-desc.js
index a3bc215b6..dbe292d44 100644
--- a/test/built-ins/TypedArray/prototype/reverse/prop-desc.js
+++ b/test/built-ins/TypedArray/prototype/reverse/prop-desc.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.21
+esid: sec-%typedarray%.prototype.reverse
description: >
"reverse" property of TypedArrayPrototype
info: |
@@ -9,6 +9,7 @@ info: |
and in Annex B.2 has the attributes { [[Writable]]: true,
[[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
var TypedArrayPrototype = TypedArray.prototype;
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-negative-integer-offset-throws.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-negative-integer-offset-throws.js
new file mode 100644
index 000000000..a5896d24b
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-negative-integer-offset-throws.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set-array-offset
+description: >
+ Throw a RangeError exception if targetOffset < 0
+info: |
+ 22.2.3.23.1 %TypedArray%.prototype.set (array [ , offset ] )
+
+ 1. Assert: array is any ECMAScript language value other than an Object with a
+ [[TypedArrayName]] internal slot. If it is such an Object, the definition in
+ 22.2.3.23.2 applies.
+ ...
+ 6. Let targetOffset be ? ToInteger(offset).
+ 7. If targetOffset < 0, throw a RangeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(4);
+
+ assert.throws(RangeError, function() {
+ sample.set([1], -1);
+ }, "-1");
+
+ assert.throws(RangeError, function() {
+ sample.set([1], -1.00001);
+ }, "-1.00001");
+
+ assert.throws(RangeError, function() {
+ sample.set([1], -Infinity);
+ }, "-Infinity");
+});
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-offset-tointeger.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-offset-tointeger.js
new file mode 100644
index 000000000..e5d504634
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-offset-tointeger.js
@@ -0,0 +1,95 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set-array-offset
+description: >
+ ToInteger(offset) operations
+info: |
+ 22.2.3.23.1 %TypedArray%.prototype.set (array [ , offset ] )
+
+ 1. Assert: array is any ECMAScript language value other than an Object with a
+ [[TypedArrayName]] internal slot. If it is such an Object, the definition in
+ 22.2.3.23.2 applies.
+ ...
+ 6. Let targetOffset be ? ToInteger(offset).
+ 7. If targetOffset < 0, throw a RangeError exception.
+ ...
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample;
+
+ sample = new TA([1n, 2n]);
+ sample.set([42n], "");
+ assert(compareArray(sample, [42n, 2n]), "the empty string");
+
+ sample = new TA([1n, 2n]);
+ sample.set([42n], "0");
+ assert(compareArray(sample, [42n, 2n]), "'0'");
+
+ sample = new TA([1n, 2n]);
+ sample.set([42n], false);
+ assert(compareArray(sample, [42n, 2n]), "false");
+
+ sample = new TA([1n, 2n]);
+ sample.set([42n], 0.1);
+ assert(compareArray(sample, [42n, 2n]), "0.1");
+
+ sample = new TA([1n, 2n]);
+ sample.set([42n], 0.9);
+ assert(compareArray(sample, [42n, 2n]), "0.9");
+
+ sample = new TA([1n, 2n]);
+ sample.set([42n], -0.5);
+ assert(compareArray(sample, [42n, 2n]), "-0.5");
+
+ sample = new TA([1n, 2n]);
+ sample.set([42n], 1.1);
+ assert(compareArray(sample, [1n, 42n]), "1.1");
+
+ sample = new TA([1n, 2n]);
+ sample.set([42n], NaN);
+ assert(compareArray(sample, [42n, 2n]), "NaN");
+
+ sample = new TA([1n, 2n]);
+ sample.set([42n], null);
+ assert(compareArray(sample, [42n, 2n]), "null");
+
+ sample = new TA([1n, 2n]);
+ sample.set([42n], undefined);
+ assert(compareArray(sample, [42n, 2n]), "undefined");
+
+ sample = new TA([1n, 2n]);
+ sample.set([42n], {});
+ assert(compareArray(sample, [42n, 2n]), "{}");
+
+ sample = new TA([1n, 2n]);
+ sample.set([42n], []);
+ assert(compareArray(sample, [42n, 2n]), "[]");
+
+ sample = new TA([1n, 2n]);
+ sample.set([42n], [0]);
+ assert(compareArray(sample, [42n, 2n]), "[0]");
+
+ sample = new TA([1n, 2n]);
+ sample.set([42n], true);
+ assert(compareArray(sample, [1n, 42n]), "true");
+
+ sample = new TA([1n, 2n]);
+ sample.set([42n], "1");
+ assert(compareArray(sample, [1n, 42n]), "'1'");
+
+ sample = new TA([1n, 2n]);
+ sample.set([42n], [1]);
+ assert(compareArray(sample, [1n, 42n]), "[1]");
+
+ sample = new TA([1n, 2n]);
+ sample.set([42n], { valueOf: function() {return 1;} });
+ assert(compareArray(sample, [1n, 42n]), "valueOf");
+
+ sample = new TA([1n, 2n]);
+ sample.set([42n], { toString: function() {return 1;} });
+ assert(compareArray(sample, [1n, 42n]), "toString");
+});
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-get-length.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-get-length.js
new file mode 100644
index 000000000..bd6a28723
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-get-length.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set-array-offset
+description: >
+ Return abrupt getting src "length"
+info: |
+ 22.2.3.23.1 %TypedArray%.prototype.set (array [ , offset ] )
+
+ 1. Assert: array is any ECMAScript language value other than an Object with a
+ [[TypedArrayName]] internal slot. If it is such an Object, the definition in
+ 22.2.3.23.2 applies.
+ ...
+ 16. Let srcLength be ? ToLength(? Get(src, "length")).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var obj = {};
+Object.defineProperty(obj, "length", {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([1n, 2n, 3n]);
+
+ assert.throws(Test262Error, function() {
+ sample.set(obj);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-get-value.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-get-value.js
new file mode 100644
index 000000000..237c94645
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-get-value.js
@@ -0,0 +1,48 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set-array-offset
+description: >
+ Return abrupt from getting src property value
+info: |
+ 22.2.3.23.1 %TypedArray%.prototype.set (array [ , offset ] )
+
+ 1. Assert: array is any ECMAScript language value other than an Object with a
+ [[TypedArrayName]] internal slot. If it is such an Object, the definition in
+ 22.2.3.23.2 applies.
+ ...
+ 21. Repeat, while targetByteIndex < limit
+ a. Let Pk be ! ToString(k).
+ b. Let kNumber be ? ToNumber(? Get(src, Pk)).
+ c. If IsDetachedBuffer(targetBuffer) is true, throw a TypeError exception.
+ d. Perform SetValueInBuffer(targetBuffer, targetByteIndex, targetType,
+ kNumber).
+ ...
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var obj = {
+ length: 4,
+ "0": 42n,
+ "1": 43n,
+ "3": 44n
+ };
+ Object.defineProperty(obj, "2", {
+ get: function() {
+ throw new Test262Error();
+ }
+ });
+
+ var sample = new TA([1n, 2n, 3n, 4n]);
+
+ assert.throws(Test262Error, function() {
+ sample.set(obj);
+ });
+
+ assert(
+ compareArray(sample, [42n, 43n, 3n, 4n]),
+ "values are set until exception"
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-length-symbol.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-length-symbol.js
new file mode 100644
index 000000000..e0393870d
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-length-symbol.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set-array-offset
+description: >
+ Return abrupt getting src "length" as symbol
+info: |
+ 22.2.3.23.1 %TypedArray%.prototype.set (array [ , offset ] )
+
+ 1. Assert: array is any ECMAScript language value other than an Object with a
+ [[TypedArrayName]] internal slot. If it is such an Object, the definition in
+ 22.2.3.23.2 applies.
+ ...
+ 16. Let srcLength be ? ToLength(? Get(src, "length")).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var obj = {
+ length: Symbol("1")
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([1n, 2n, 3n]);
+
+ assert.throws(TypeError, function() {
+ sample.set(obj);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-length.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-length.js
new file mode 100644
index 000000000..f2bea7374
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-length.js
@@ -0,0 +1,46 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set-array-offset
+description: >
+ Return abrupt from ToLength(src "length")
+info: |
+ 22.2.3.23.1 %TypedArray%.prototype.set (array [ , offset ] )
+
+ 1. Assert: array is any ECMAScript language value other than an Object with a
+ [[TypedArrayName]] internal slot. If it is such an Object, the definition in
+ 22.2.3.23.2 applies.
+ ...
+ 16. Let srcLength be ? ToLength(? Get(src, "length")).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var obj1 = {
+ length: {
+ valueOf: function() {
+ throw new Test262Error();
+ }
+ }
+};
+
+var obj2 = {
+ length: {
+ toString: function() {
+ throw new Test262Error();
+ }
+ }
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([1n, 2n, 3n]);
+
+ assert.throws(Test262Error, function() {
+ sample.set(obj1);
+ }, "valueOf");
+
+ assert.throws(Test262Error, function() {
+ sample.set(obj2);
+ }, "toString");
+});
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-tonumber-value-symbol.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-tonumber-value-symbol.js
new file mode 100644
index 000000000..683d318f0
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-tonumber-value-symbol.js
@@ -0,0 +1,44 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set-array-offset
+description: >
+ Return abrupt from ToNumber(src property symbol value)
+info: |
+ 22.2.3.23.1 %TypedArray%.prototype.set (array [ , offset ] )
+
+ 1. Assert: array is any ECMAScript language value other than an Object with a
+ [[TypedArrayName]] internal slot. If it is such an Object, the definition in
+ 22.2.3.23.2 applies.
+ ...
+ 21. Repeat, while targetByteIndex < limit
+ a. Let Pk be ! ToString(k).
+ b. Let kNumber be ? ToNumber(? Get(src, Pk)).
+ c. If IsDetachedBuffer(targetBuffer) is true, throw a TypeError exception.
+ d. Perform SetValueInBuffer(targetBuffer, targetByteIndex, targetType,
+ kNumber).
+ ...
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var obj = {
+ length: 4,
+ "0": 42n,
+ "1": 43n,
+ "2": Symbol("1"),
+ "3": 44n
+ };
+
+ var sample = new TA([1n, 2n, 3n, 4n]);
+
+ assert.throws(TypeError, function() {
+ sample.set(obj);
+ });
+
+ assert(
+ compareArray(sample, [42n, 43n, 3n, 4n]),
+ "values are set until exception"
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-tonumber-value.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-tonumber-value.js
new file mode 100644
index 000000000..7195d3f7d
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-tonumber-value.js
@@ -0,0 +1,48 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set-array-offset
+description: >
+ Return abrupt from ToNumber(src property value)
+info: |
+ 22.2.3.23.1 %TypedArray%.prototype.set (array [ , offset ] )
+
+ 1. Assert: array is any ECMAScript language value other than an Object with a
+ [[TypedArrayName]] internal slot. If it is such an Object, the definition in
+ 22.2.3.23.2 applies.
+ ...
+ 21. Repeat, while targetByteIndex < limit
+ a. Let Pk be ! ToString(k).
+ b. Let kNumber be ? ToNumber(? Get(src, Pk)).
+ c. If IsDetachedBuffer(targetBuffer) is true, throw a TypeError exception.
+ d. Perform SetValueInBuffer(targetBuffer, targetByteIndex, targetType,
+ kNumber).
+ ...
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var obj = {
+ length: 4,
+ "0": 42n,
+ "1": 43n,
+ "2": {
+ valueOf: function() {
+ throw new Test262Error();
+ }
+ },
+ "3": 44n
+ };
+
+ var sample = new TA([1n, 2n, 3n, 4n]);
+
+ assert.throws(Test262Error, function() {
+ sample.set(obj);
+ });
+
+ assert(
+ compareArray(sample, [42n, 43n, 3n, 4n]),
+ "values are set until exception"
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-tointeger-offset-symbol.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-tointeger-offset-symbol.js
new file mode 100644
index 000000000..f9d8699ab
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-tointeger-offset-symbol.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set-array-offset
+description: >
+ Return abrupt from ToInteger(Symbol offset)
+info: |
+ 22.2.3.23.1 %TypedArray%.prototype.set (array [ , offset ] )
+
+ 1. Assert: array is any ECMAScript language value other than an Object with a
+ [[TypedArrayName]] internal slot. If it is such an Object, the definition in
+ 22.2.3.23.2 applies.
+ ...
+ 6. Let targetOffset be ? ToInteger(offset).
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var s = Symbol("1");
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(2);
+
+ assert.throws(TypeError, function() {
+ sample.set([1], s);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-tointeger-offset.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-tointeger-offset.js
new file mode 100644
index 000000000..ca31811e5
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-tointeger-offset.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set-array-offset
+description: >
+ Return abrupt from ToInteger(offset)
+info: |
+ 22.2.3.23.1 %TypedArray%.prototype.set (array [ , offset ] )
+
+ 1. Assert: array is any ECMAScript language value other than an Object with a
+ [[TypedArrayName]] internal slot. If it is such an Object, the definition in
+ 22.2.3.23.2 applies.
+ ...
+ 6. Let targetOffset be ? ToInteger(offset).
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var obj1 = {
+ valueOf: function() {
+ throw new Test262Error();
+ }
+};
+
+var obj2 = {
+ toString: function() {
+ throw new Test262Error();
+ }
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA();
+
+ assert.throws(Test262Error, function() {
+ sample.set([], obj1);
+ }, "abrupt from valueOf");
+
+ assert.throws(Test262Error, function() {
+ sample.set([], obj2);
+ }, "abrupt from toString");
+});
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-toobject-offset.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-toobject-offset.js
new file mode 100644
index 000000000..d55c05cd5
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-toobject-offset.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set-array-offset
+description: >
+ Return abrupt from ToObject(array)
+info: |
+ 22.2.3.23.1 %TypedArray%.prototype.set (array [ , offset ] )
+
+ 1. Assert: array is any ECMAScript language value other than an Object with a
+ [[TypedArrayName]] internal slot. If it is such an Object, the definition in
+ 22.2.3.23.2 applies.
+ ...
+ 15. Let src be ? ToObject(array).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([1n, 2n, 3n]);
+
+ assert.throws(TypeError, function() {
+ sample.set(undefined);
+ }, "undefined");
+
+ assert.throws(TypeError, function() {
+ sample.set(null);
+ }, "null");
+});
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-set-values-in-order.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-set-values-in-order.js
new file mode 100644
index 000000000..3eb5722ef
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-set-values-in-order.js
@@ -0,0 +1,72 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set-array-offset
+description: >
+ Get and set each value in order
+info: |
+ 22.2.3.23.1 %TypedArray%.prototype.set (array [ , offset ] )
+
+ 1. Assert: array is any ECMAScript language value other than an Object with a
+ [[TypedArrayName]] internal slot. If it is such an Object, the definition in
+ 22.2.3.23.2 applies.
+ ...
+ 21. Repeat, while targetByteIndex < limit
+ a. Let Pk be ! ToString(k).
+ b. Let kNumber be ? ToNumber(? Get(src, Pk)).
+ c. If IsDetachedBuffer(targetBuffer) is true, throw a TypeError exception.
+ d. Perform SetValueInBuffer(targetBuffer, targetByteIndex, targetType,
+ kNumber).
+ ...
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(5);
+ var calls = [];
+ var obj = {
+ length: 3
+ };
+ Object.defineProperty(obj, 0, {
+ get: function() {
+ calls.push(0);
+ calls.push(sample.join());
+ return 42n;
+ }
+ });
+
+ Object.defineProperty(obj, 1, {
+ get: function() {
+ calls.push(1);
+ calls.push(sample.join());
+ return 43n;
+ }
+ });
+
+ Object.defineProperty(obj, 2, {
+ get: function() {
+ calls.push(2);
+ calls.push(sample.join());
+ return 44n;
+ }
+ });
+
+ Object.defineProperty(obj, 3, {
+ get: function() {
+ throw new Test262Error("Should not call obj[3]");
+ }
+ });
+
+ sample.set(obj, 1);
+
+ assert(
+ compareArray(sample, [0n, 42n, 43n, 44n, 0n]),
+ "values are set for src length"
+ );
+
+ assert(
+ compareArray(calls, [0, "0,0,0,0,0", 1, "0,42,0,0,0", 2, "0,42,43,0,0"]),
+ "values are set in order"
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-set-values.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-set-values.js
new file mode 100644
index 000000000..1e3a226f8
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-set-values.js
@@ -0,0 +1,63 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set-array-offset
+description: >
+ Set values to target and return undefined
+info: |
+ 22.2.3.23.1 %TypedArray%.prototype.set (array [ , offset ] )
+
+ 1. Assert: array is any ECMAScript language value other than an Object with a
+ [[TypedArrayName]] internal slot. If it is such an Object, the definition in
+ 22.2.3.23.2 applies.
+ ...
+ 21. Repeat, while targetByteIndex < limit
+ Let Pk be ! ToString(k).
+ Let kNumber be ? ToNumber(? Get(src, Pk)).
+ If IsDetachedBuffer(targetBuffer) is true, throw a TypeError exception.
+ Perform SetValueInBuffer(targetBuffer, targetByteIndex, targetType, kNumber).
+ ...
+ 22. Return undefined.
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var src = [42n, 43n];
+ var srcObj = {
+ length: 2,
+ '0': 7n,
+ '1': 17n
+ };
+ var sample, result;
+
+ sample = new TA([1n, 2n, 3n, 4n]);
+ result = sample.set(src, 0);
+ assert(compareArray(sample, [42n, 43n, 3n, 4n]), "offset: 0, result: " + sample);
+ assert.sameValue(result, undefined, "returns undefined");
+
+ sample = new TA([1n, 2n, 3n, 4n]);
+ result = sample.set(src, 1);
+ assert(compareArray(sample, [1n, 42n, 43n, 4n]), "offset: 1, result: " + sample);
+ assert.sameValue(result, undefined, "returns undefined");
+
+ sample = new TA([1n, 2n, 3n, 4n]);
+ result = sample.set(src, 2);
+ assert(compareArray(sample, [1n, 2n, 42n, 43n]), "offset: 2, result: " + sample);
+ assert.sameValue(result, undefined, "returns undefined");
+
+ sample = new TA([1n, 2n, 3n, 4n]);
+ result = sample.set(srcObj, 0);
+ assert(compareArray(sample, [7n, 17n, 3n, 4n]), "offset: 0, result: " + sample);
+ assert.sameValue(result, undefined, "returns undefined");
+
+ sample = new TA([1n, 2n, 3n, 4n]);
+ result = sample.set(srcObj, 1);
+ assert(compareArray(sample, [1n, 7n, 17n, 4n]), "offset: 1, result: " + sample);
+ assert.sameValue(result, undefined, "returns undefined");
+
+ sample = new TA([1n, 2n, 3n, 4n]);
+ result = sample.set(srcObj, 2);
+ assert(compareArray(sample, [1n, 2n, 7n, 17n]), "offset: 2, result: " + sample);
+ assert.sameValue(result, undefined, "returns undefined");
+});
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-tonumber-value-conversions.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-tonumber-value-conversions.js
new file mode 100644
index 000000000..78fd9dcbb
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-tonumber-value-conversions.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set-array-offset
+description: >
+ Values conversions on ToNumber(src property value)
+info: |
+ 22.2.3.23.1 %TypedArray%.prototype.set (array [ , offset ] )
+
+ 1. Assert: array is any ECMAScript language value other than an Object with a
+ [[TypedArrayName]] internal slot. If it is such an Object, the definition in
+ 22.2.3.23.2 applies.
+ ...
+ 21. Repeat, while targetByteIndex < limit
+ a. Let Pk be ! ToString(k).
+ b. Let kNumber be ? ToNumber(? Get(src, Pk)).
+ c. If IsDetachedBuffer(targetBuffer) is true, throw a TypeError exception.
+ d. Perform SetValueInBuffer(targetBuffer, targetByteIndex, targetType,
+ kNumber).
+ ...
+includes: [byteConversionValues.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testTypedArrayConversions(byteConversionValues, function(TA, value, expected, initial) {
+ var sample = new TA([initial]);
+
+ sample.set([value]);
+
+ assert.sameValue(sample[0], expected, "["+value+"] => ["+expected +"]");
+});
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-tonumber-value-type-conversions.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-tonumber-value-type-conversions.js
new file mode 100644
index 000000000..d3d5c1aa4
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-tonumber-value-type-conversions.js
@@ -0,0 +1,49 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set-array-offset
+description: >
+ Type conversions on ToNumber(src property value)
+info: |
+ 22.2.3.23.1 %TypedArray%.prototype.set (array [ , offset ] )
+
+ 1. Assert: array is any ECMAScript language value other than an Object with a
+ [[TypedArrayName]] internal slot. If it is such an Object, the definition in
+ 22.2.3.23.2 applies.
+ ...
+ 21. Repeat, while targetByteIndex < limit
+ a. Let Pk be ! ToString(k).
+ b. Let kNumber be ? ToNumber(? Get(src, Pk)).
+ c. If IsDetachedBuffer(targetBuffer) is true, throw a TypeError exception.
+ d. Perform SetValueInBuffer(targetBuffer, targetByteIndex, targetType,
+ kNumber).
+ ...
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var obj1 = {
+ valueOf: function() {
+ return 42n;
+ }
+ };
+
+ var obj2 = {
+ toString: function() {
+ return "42";
+ }
+ };
+
+ var arr = [false, true, obj1, [], [1]];
+
+ var sample = new TA(arr.length);
+ var expected = new TA([0n, 1n, 42n, 0n, 1n]);
+
+ sample.set(arr);
+
+ assert(
+ compareArray(sample, expected),
+ "sample: [" + sample + "], expected: [" + expected + "]"
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-values-are-not-cached.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-values-are-not-cached.js
new file mode 100644
index 000000000..d6156af97
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-values-are-not-cached.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set-array-offset
+description: >
+ Values from src array are not cached
+info: |
+ 22.2.3.23.1 %TypedArray%.prototype.set (array [ , offset ] )
+
+ 1. Assert: array is any ECMAScript language value other than an Object with a
+ [[TypedArrayName]] internal slot. If it is such an Object, the definition in
+ 22.2.3.23.2 applies.
+ ...
+ 21. Repeat, while targetByteIndex < limit
+ a. Let Pk be ! ToString(k).
+ b. Let kNumber be ? ToNumber(? Get(src, Pk)).
+ c. If IsDetachedBuffer(targetBuffer) is true, throw a TypeError exception.
+ d. Perform SetValueInBuffer(targetBuffer, targetByteIndex, targetType,
+ kNumber).
+ ...
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(5);
+ var obj = {
+ length: 5,
+ '1': 7n,
+ '2': 7n,
+ '3': 7n,
+ '4': 7n
+ };
+ Object.defineProperty(obj, 0, {
+ get: function() {
+ obj[1] = 43n;
+ obj[2] = 44n;
+ obj[3] = 45n;
+ obj[4] = 46n;
+ return 42n;
+ }
+ });
+
+ sample.set(obj);
+
+ assert(compareArray(sample, [42n, 43n, 44n, 45n, 46n]));
+});
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-target-arraylength-internal.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-target-arraylength-internal.js
new file mode 100644
index 000000000..a6e6a3d34
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-target-arraylength-internal.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set-array-offset
+description: >
+ Uses target's internal [[ArrayLength]]
+info: |
+ 22.2.3.23.1 %TypedArray%.prototype.set (array [ , offset ] )
+
+ 1. Assert: array is any ECMAScript language value other than an Object with a
+ [[TypedArrayName]] internal slot. If it is such an Object, the definition in
+ 22.2.3.23.2 applies.
+ ...
+ 10. Let targetLength be the value of target's [[ArrayLength]] internal slot.
+ ...
+ 17. If srcLength + targetOffset > targetLength, throw a RangeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var getCalls = 0;
+var desc = {
+ get: function() {
+ getCalls++;
+ return 0;
+ }
+};
+
+Object.defineProperty(TypedArray.prototype, "length", desc);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(2);
+
+ Object.defineProperty(TA.prototype, "length", desc);
+ Object.defineProperty(sample, "length", desc);
+
+ sample.set([42n, 43n]);
+
+ assert.sameValue(getCalls, 0, "ignores length properties");
+});
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-targetbuffer-detached-on-get-src-value-throws.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-targetbuffer-detached-on-get-src-value-throws.js
new file mode 100644
index 000000000..568e8b9b0
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-targetbuffer-detached-on-get-src-value-throws.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set-array-offset
+description: >
+ Throws an error if buffer is detached before setting a value
+info: |
+ 22.2.3.23.1 %TypedArray%.prototype.set (array [ , offset ] )
+
+ 1. Assert: array is any ECMAScript language value other than an Object with a
+ [[TypedArrayName]] internal slot. If it is such an Object, the definition in
+ 22.2.3.23.2 applies.
+ ...
+ 21. Repeat, while targetByteIndex < limit
+ a. Let Pk be ! ToString(k).
+ b. Let kNumber be ? ToNumber(? Get(src, Pk)).
+ c. If IsDetachedBuffer(targetBuffer) is true, throw a TypeError exception.
+ d. Perform SetValueInBuffer(targetBuffer, targetByteIndex, targetType,
+ kNumber).
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([1n, 2n, 3n]);
+ var obj = {
+ length: 3,
+ "0": 42n
+ };
+ Object.defineProperty(obj, 1, {
+ get: function() {
+ $DETACHBUFFER(sample.buffer);
+ }
+ });
+ Object.defineProperty(obj, 2, {
+ get: function() {
+ throw new Test262Error("Should not get other values");
+ }
+ });
+
+ assert.throws(TypeError, function() {
+ sample.set(obj);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-targetbuffer-detached-on-tointeger-offset-throws.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-targetbuffer-detached-on-tointeger-offset-throws.js
new file mode 100644
index 000000000..a25113b5a
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-targetbuffer-detached-on-tointeger-offset-throws.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set-array-offset
+description: >
+ Throws a TypeError if targetBuffer is detached on ToInteger(offset)
+info: |
+ 22.2.3.23.1 %TypedArray%.prototype.set (array [ , offset ] )
+
+ 1. Assert: array is any ECMAScript language value other than an Object with a
+ [[TypedArrayName]] internal slot. If it is such an Object, the definition in
+ 22.2.3.23.2 applies.
+ ...
+ 6. Let targetOffset be ? ToInteger(offset).
+ ...
+ 8. Let targetBuffer be the value of target's [[ViewedArrayBuffer]] internal
+ slot.
+ 9. If IsDetachedBuffer(targetBuffer) is true, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(2);
+ var calledOffset = 0;
+ var obj = {
+ valueOf: function() {
+ $DETACHBUFFER(sample.buffer);
+ calledOffset += 1;
+ }
+ };
+
+ assert.throws(TypeError, function() {
+ sample.set([1], obj);
+ });
+
+ assert.sameValue(calledOffset, 1);
+});
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-targetbuffer-detached-throws.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-targetbuffer-detached-throws.js
new file mode 100644
index 000000000..9a2bd2531
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-targetbuffer-detached-throws.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set-array-offset
+description: >
+ Throws a TypeError if targetBuffer is detached
+info: |
+ 22.2.3.23.1 %TypedArray%.prototype.set (array [ , offset ] )
+
+ 1. Assert: array is any ECMAScript language value other than an Object with a
+ [[TypedArrayName]] internal slot. If it is such an Object, the definition in
+ 22.2.3.23.2 applies.
+ ...
+ 8. Let targetBuffer be the value of target's [[ViewedArrayBuffer]] internal
+ slot.
+ 9. If IsDetachedBuffer(targetBuffer) is true, throw a TypeError exception.
+ ...
+ 15. Let src be ? ToObject(array).
+ 16. Let srcLength be ? ToLength(? Get(src, "length")).
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+var obj = {};
+Object.defineProperty(obj, "length", {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(2);
+ $DETACHBUFFER(sample.buffer);
+
+ assert.throws(TypeError, function() {
+ sample.set([1]);
+ }, "regular check");
+
+ assert.throws(TypeError, function() {
+ sample.set(obj);
+ }, "IsDetachedBuffer happens before Get(src.length)");
+});
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/bit-precision.js b/test/built-ins/TypedArray/prototype/set/BigInt/bit-precision.js
new file mode 100644
index 000000000..979b0b384
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/bit-precision.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set.2
+description: Preservation of bit-level encoding
+info: |
+ [...]
+ 28. Else,
+ a. NOTE: If srcType and targetType are the same, the transfer must be
+ performed in a manner that preserves the bit-level encoding of the
+ source data.
+ b. Repeat, while targetByteIndex < limit
+ i. Let value be GetValueFromBuffer(srcBuffer, srcByteIndex, "Uint8").
+ ii. Perform SetValueInBuffer(targetBuffer, targetByteIndex, "Uint8",
+ value).
+ iii. Set srcByteIndex to srcByteIndex + 1.
+ iv. Set targetByteIndex to targetByteIndex + 1.
+includes: [nans.js, compareArray.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+function body(FloatArray) {
+ var source = new FloatArray(distinctNaNs);
+ var target = new FloatArray(distinctNaNs.length);
+ var sourceBytes, targetBytes;
+
+ target.set(source);
+
+ sourceBytes = new Uint8Array(source.buffer);
+ targetBytes = new Uint8Array(target.buffer);
+
+ assert(compareArray(sourceBytes, targetBytes))
+}
+
+testWithBigIntTypedArrayConstructors(body, [Float32Array, Float64Array]);
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/set/BigInt/invoked-as-func.js
new file mode 100644
index 000000000..ee55b5aa4
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/invoked-as-func.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set
+description: Throws a TypeError exception when invoked as a function
+info: |
+ 22.2.3.22 %TypedArray%.prototype.set ( overloaded [ , offset ])
+
+ This function is not generic. The this value must be an object with a
+ [[TypedArrayName]] internal slot.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var set = TypedArray.prototype.set;
+
+assert.sameValue(typeof set, 'function');
+
+assert.throws(TypeError, function() {
+ set();
+});
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/set/BigInt/invoked-as-method.js
new file mode 100644
index 000000000..1b0a08698
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/invoked-as-method.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set
+description: Requires a [[TypedArrayName]] internal slot.
+info: |
+ 22.2.3.22 %TypedArray%.prototype.set ( overloaded [ , offset ])
+
+ This function is not generic. The this value must be an object with a
+ [[TypedArrayName]] internal slot.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+assert.sameValue(typeof TypedArrayPrototype.set, 'function');
+
+assert.throws(TypeError, function() {
+ TypedArrayPrototype.set();
+});
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/length.js b/test/built-ins/TypedArray/prototype/set/BigInt/length.js
new file mode 100644
index 000000000..2f1001cd0
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/length.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.set
+description: >
+ %TypedArray%.prototype.set.length is 1.
+info: |
+ %TypedArray%.prototype.set ( overloaded [ , offset ])
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, has a length
+ property whose value is an integer. Unless otherwise specified, this
+ value is equal to the largest number of named arguments shown in the
+ subclause headings for the function description, including optional
+ parameters. However, rest parameters shown using the form “...name”
+ are not included in the default argument count.
+
+ Unless otherwise specified, the length property of a built-in Function
+ object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.set.length, 1);
+
+verifyNotEnumerable(TypedArray.prototype.set, "length");
+verifyNotWritable(TypedArray.prototype.set, "length");
+verifyConfigurable(TypedArray.prototype.set, "length");
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/name.js b/test/built-ins/TypedArray/prototype/set/BigInt/name.js
new file mode 100644
index 000000000..85d386c7c
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/name.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.set
+description: >
+ %TypedArray%.prototype.set.name is "set".
+info: |
+ %TypedArray%.prototype.set ( overloaded [ , offset ])
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, that is not
+ identified as an anonymous function has a name property whose value
+ is a String.
+
+ Unless otherwise specified, the name property of a built-in Function
+ object, if it exists, has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.set.name, "set");
+
+verifyNotEnumerable(TypedArray.prototype.set, "name");
+verifyNotWritable(TypedArray.prototype.set, "name");
+verifyConfigurable(TypedArray.prototype.set, "name");
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/set/BigInt/prop-desc.js
new file mode 100644
index 000000000..ca3c8bc15
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/prop-desc.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set
+description: >
+ "set" property of TypedArrayPrototype
+info: |
+ ES6 section 17: Every other data property described in clauses 18 through 26
+ and in Annex B.2 has the attributes { [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+verifyNotEnumerable(TypedArrayPrototype, 'set');
+verifyWritable(TypedArrayPrototype, 'set');
+verifyConfigurable(TypedArrayPrototype, 'set');
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/set/BigInt/this-is-not-object.js
new file mode 100644
index 000000000..d1b6242e9
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/this-is-not-object.js
@@ -0,0 +1,75 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set-overloaded-offset
+description: Throws a TypeError exception when `this` is not Object
+info: |
+ 22.2.3.23 %TypedArray%.prototype.set
+
+ ...
+ 2. Let target be the this value.
+ 3. If Type(target) is not Object, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var set = TypedArray.prototype.set;
+
+assert.throws(TypeError, function() {
+ set.call(undefined, []);
+}, "this is undefined");
+
+assert.throws(TypeError, function() {
+ set.call(null, []);
+}, "this is null");
+
+assert.throws(TypeError, function() {
+ set.call(undefined, new Int8Array());
+}, "this is undefined");
+
+assert.throws(TypeError, function() {
+ set.call(null, new Int8Array());
+}, "this is null");
+
+assert.throws(TypeError, function() {
+ set.call(42, []);
+}, "this is 42");
+
+assert.throws(TypeError, function() {
+ set.call("1", []);
+}, "this is a string");
+
+assert.throws(TypeError, function() {
+ set.call(true, []);
+}, "this is true");
+
+assert.throws(TypeError, function() {
+ set.call(false, []);
+}, "this is false");
+
+var s1 = Symbol("s");
+assert.throws(TypeError, function() {
+ set.call(s1, []);
+}, "this is a Symbol");
+
+assert.throws(TypeError, function() {
+ set.call(42, new Int8Array(1));
+}, "this is 42");
+
+assert.throws(TypeError, function() {
+ set.call("1", new Int8Array(1));
+}, "this is a string");
+
+assert.throws(TypeError, function() {
+ set.call(true, new Int8Array(1));
+}, "this is true");
+
+assert.throws(TypeError, function() {
+ set.call(false, new Int8Array(1));
+}, "this is false");
+
+var s2 = Symbol("s");
+assert.throws(TypeError, function() {
+ set.call(s2, new Int8Array(1));
+}, "this is a Symbol");
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/set/BigInt/this-is-not-typedarray-instance.js
new file mode 100644
index 000000000..77220ea6a
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/this-is-not-typedarray-instance.js
@@ -0,0 +1,56 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set-overloaded-offset
+description: >
+ Throws a TypeError exception when `this` is not a TypedArray instance
+info: |
+ 22.2.3.23 %TypedArray%.prototype.set
+
+ ...
+ 2. Let target be the this value.
+ 3. If Type(target) is not Object, throw a TypeError exception.
+ 4. If target does not have a [[TypedArrayName]] internal slot, throw a
+ TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var set = TypedArray.prototype.set;
+
+assert.throws(TypeError, function() {
+ set.call({}, []);
+}, "this is an Object");
+
+assert.throws(TypeError, function() {
+ set.call([], []);
+}, "this is an Array");
+
+var ab1 = new ArrayBuffer(8);
+assert.throws(TypeError, function() {
+ set.call(ab1, []);
+}, "this is an ArrayBuffer instance");
+
+var dv1 = new DataView(new ArrayBuffer(8), 0, 1);
+assert.throws(TypeError, function() {
+ set.call(dv1, []);
+}, "this is a DataView instance");
+
+assert.throws(TypeError, function() {
+ set.call({}, new Int8Array());
+}, "this is an Object");
+
+assert.throws(TypeError, function() {
+ set.call([], new Int8Array());
+}, "this is an Array");
+
+var ab2 = new ArrayBuffer(8);
+assert.throws(TypeError, function() {
+ set.call(ab2, new Int8Array());
+}, "this is an ArrayBuffer instance");
+
+var dv2 = new DataView(new ArrayBuffer(8), 0, 1);
+assert.throws(TypeError, function() {
+ set.call(dv2, new Int8Array());
+}, "this is a DataView instance");
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-negative-integer-offset-throws.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-negative-integer-offset-throws.js
new file mode 100644
index 000000000..d5848d91a
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-negative-integer-offset-throws.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set-typedarray-offset
+description: >
+ Throw a RangeError exception if targetOffset < 0
+info: |
+ 22.2.3.23.2 %TypedArray%.prototype.set(typedArray [ , offset ] )
+
+ 1. Assert: typedArray has a [[TypedArrayName]] internal slot. If it does not,
+ the definition in 22.2.3.23.1 applies.
+ ...
+ 6. Let targetOffset be ? ToInteger(offset).
+ 7. If targetOffset < 0, throw a RangeError exception.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA();
+
+ assert.throws(RangeError, function() {
+ sample.set(sample, -1);
+ }, "-1");
+
+ assert.throws(RangeError, function() {
+ sample.set(sample, -1.00001);
+ }, "-1.00001");
+
+ assert.throws(RangeError, function() {
+ sample.set(sample, -Infinity);
+ }, "-Infinity");
+});
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-offset-tointeger.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-offset-tointeger.js
new file mode 100644
index 000000000..3b191aa4e
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-offset-tointeger.js
@@ -0,0 +1,93 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set-typedarray-offset
+description: >
+ ToInteger(offset) operations
+info: |
+ 22.2.3.23.2 %TypedArray%.prototype.set(typedArray [ , offset ] )
+
+ 1. Assert: typedArray has a [[TypedArrayName]] internal slot. If it does not,
+ the definition in 22.2.3.23.1 applies.
+ ...
+ 6. Let targetOffset be ? ToInteger(offset).
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample;
+ var src = new TA([42n]);
+
+ sample = new TA([1n, 2n]);
+ sample.set(src, "");
+ assert(compareArray(sample, [42n, 2n]), "the empty string");
+
+ sample = new TA([1n, 2n]);
+ sample.set(src, "0");
+ assert(compareArray(sample, [42n, 2n]), "'0'");
+
+ sample = new TA([1n, 2n]);
+ sample.set(src, false);
+ assert(compareArray(sample, [42n, 2n]), "false");
+
+ sample = new TA([1n, 2n]);
+ sample.set(src, 0.1);
+ assert(compareArray(sample, [42n, 2n]), "0.1");
+
+ sample = new TA([1n, 2n]);
+ sample.set(src, 0.9);
+ assert(compareArray(sample, [42n, 2n]), "0.9");
+
+ sample = new TA([1n, 2n]);
+ sample.set(src, -0.5);
+ assert(compareArray(sample, [42n, 2n]), "-0.5");
+
+ sample = new TA([1n, 2n]);
+ sample.set(src, 1.1);
+ assert(compareArray(sample, [1n, 42n]), "1.1");
+
+ sample = new TA([1n, 2n]);
+ sample.set(src, NaN);
+ assert(compareArray(sample, [42n, 2n]), "NaN");
+
+ sample = new TA([1n, 2n]);
+ sample.set(src, null);
+ assert(compareArray(sample, [42n, 2n]), "null");
+
+ sample = new TA([1n, 2n]);
+ sample.set(src, undefined);
+ assert(compareArray(sample, [42n, 2n]), "undefined");
+
+ sample = new TA([1n, 2n]);
+ sample.set(src, {});
+ assert(compareArray(sample, [42n, 2n]), "{}");
+
+ sample = new TA([1n, 2n]);
+ sample.set(src, []);
+ assert(compareArray(sample, [42n, 2n]), "[]");
+
+ sample = new TA([1n, 2n]);
+ sample.set(src, [0]);
+ assert(compareArray(sample, [42n, 2n]), "[0]");
+
+ sample = new TA([1n, 2n]);
+ sample.set(src, true);
+ assert(compareArray(sample, [1n, 42n]), "true");
+
+ sample = new TA([1n, 2n]);
+ sample.set(src, "1");
+ assert(compareArray(sample, [1n, 42n]), "'1'");
+
+ sample = new TA([1n, 2n]);
+ sample.set(src, [1]);
+ assert(compareArray(sample, [1n, 42n]), "[1]");
+
+ sample = new TA([1n, 2n]);
+ sample.set(src, { valueOf: function() {return 1;} });
+ assert(compareArray(sample, [1n, 42n]), "valueOf");
+
+ sample = new TA([1n, 2n]);
+ sample.set(src, { toString: function() {return 1;} });
+ assert(compareArray(sample, [1n, 42n]), "toString");
+});
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-return-abrupt-from-tointeger-offset-symbol.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-return-abrupt-from-tointeger-offset-symbol.js
new file mode 100644
index 000000000..1dd14da8c
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-return-abrupt-from-tointeger-offset-symbol.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set-typedarray-offset
+description: >
+ Return abrupt from ToInteger(Symbol offset)
+info: |
+ 22.2.3.23.2 %TypedArray%.prototype.set(typedArray [ , offset ] )
+
+ 1. Assert: typedArray has a [[TypedArrayName]] internal slot. If it does not,
+ the definition in 22.2.3.23.1 applies.
+ ...
+ 6. Let targetOffset be ? ToInteger(offset).
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var s = Symbol("1");
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA();
+
+ assert.throws(TypeError, function() {
+ sample.set(sample, s);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-return-abrupt-from-tointeger-offset.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-return-abrupt-from-tointeger-offset.js
new file mode 100644
index 000000000..7f3c93ff3
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-return-abrupt-from-tointeger-offset.js
@@ -0,0 +1,40 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set-typedarray-offset
+description: >
+ Return abrupt from ToInteger(offset)
+info: |
+ 22.2.3.23.2 %TypedArray%.prototype.set(typedArray [ , offset ] )
+
+ 1. Assert: typedArray has a [[TypedArrayName]] internal slot. If it does not,
+ the definition in 22.2.3.23.1 applies.
+ ...
+ 6. Let targetOffset be ? ToInteger(offset).
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var obj1 = {
+ valueOf: function() {
+ throw new Test262Error();
+ }
+};
+
+var obj2 = {
+ toString: function() {
+ throw new Test262Error();
+ }
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA();
+
+ assert.throws(Test262Error, function() {
+ sample.set(sample, obj1);
+ }, "abrupt from valueOf");
+
+ assert.throws(Test262Error, function() {
+ sample.set(sample, obj2);
+ }, "abrupt from toString");
+});
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-conversions-sab.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-conversions-sab.js
new file mode 100644
index 000000000..7cf6f1111
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-conversions-sab.js
@@ -0,0 +1,51 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.set-typedarray-offset
+description: >
+ Set converted values from different buffer of different types and different type instances
+includes: [byteConversionValues.js, testBigIntTypedArray.js]
+features: [BigInt, SharedArrayBuffer]
+---*/
+
+testTypedArrayConversions(byteConversionValues, function(TA, value, expected, initial) {
+ if (TA === Float64Array || TA === Float32Array || TA === Uint8ClampedArray) {
+ return;
+ }
+ if (TA === Int32Array) {
+ return;
+ }
+
+ var sab, src, target;
+
+ sab = new SharedArrayBuffer(4);
+ src = new Int32Array(sab);
+ src[0] = value;
+ target = new TA([initial]);
+
+ target.set(src);
+
+ assert.sameValue(target[0], expected, "src is SAB-backed");
+
+ sab = new SharedArrayBuffer(4);
+ src = new Int32Array([value]);
+ target = new TA(sab);
+ target[0] = initial;
+
+ target.set(src);
+
+ assert.sameValue(target[0], expected, "target is SAB-backed");
+
+ var sab1 = new SharedArrayBuffer(4);
+ var sab2 = new SharedArrayBuffer(4);
+ src = new Int32Array(sab1);
+ src[0] = value;
+ target = new TA(sab2);
+ target[0] = initial;
+
+ target.set(src);
+
+ assert.sameValue(target[0], expected, "src and target are SAB-backed");
+});
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-conversions.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-conversions.js
new file mode 100644
index 000000000..fbb323f97
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-conversions.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set-typedarray-offset
+description: >
+ Set converted values from different buffer and different type instances
+info: |
+ 22.2.3.23.2 %TypedArray%.prototype.set(typedArray [ , offset ] )
+
+ 1. Assert: typedArray has a [[TypedArrayName]] internal slot. If it does not,
+ the definition in 22.2.3.23.1 applies.
+ ...
+ 23. If SameValue(srcBuffer, targetBuffer) is true, then
+ ...
+ 24. Else, let srcByteIndex be srcByteOffset.
+ ...
+ 27. If SameValue(srcType, targetType) is true, then,
+ ...
+ 28. Else,
+ a. Repeat, while targetByteIndex < limit
+ i. Let value be GetValueFromBuffer(srcBuffer, srcByteIndex, srcType).
+ ii. Perform SetValueInBuffer(targetBuffer, targetByteIndex, targetType,
+ value).
+includes: [byteConversionValues.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testTypedArrayConversions(byteConversionValues, function(TA, value, expected, initial) {
+ if (TA === Float64Array) {
+ return;
+ }
+ var src = new Float64Array([value]);
+ var target = new TA([initial]);
+
+ target.set(src);
+
+ assert.sameValue(target[0], expected);
+});
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-sab.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-sab.js
new file mode 100644
index 000000000..408633ced
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-sab.js
@@ -0,0 +1,107 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.set-typedarray-offset
+description: >
+ Set values from different instances using the different buffer and different
+ type.
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, SharedArrayBuffer, TypedArray]
+---*/
+
+var int_views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array];
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var other = Int32Array;
+ var sab = new SharedArrayBuffer(2 * other.BYTES_PER_ELEMENT);
+ var src = new other(sab);
+ src[0] = 42;
+ src[1] = 43;
+ var sample, result;
+
+ sample = new TA([1, 2, 3, 4]);
+ result = sample.set(src, 0);
+ assert(compareArray(sample, [42, 43, 3, 4]), "src is SAB-backed, offset: 0, result: " + sample);
+ assert.sameValue(result, undefined, "returns undefined");
+
+ sample = new TA([1, 2, 3, 4]);
+ result = sample.set(src, 1);
+ assert(compareArray(sample, [1, 42, 43, 4]), "src is SAB-backed, offset: 1, result: " + sample);
+ assert.sameValue(result, undefined, "returns undefined");
+
+ sample = new TA([1, 2, 3, 4]);
+ result = sample.set(src, 2);
+ assert(compareArray(sample, [1, 2, 42, 43]), "src is SAB-backed, offset: 2, result: " + sample);
+ assert.sameValue(result, undefined, "returns undefined");
+
+
+ src = new other([42, 43]);
+
+ sab = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT);
+ sample = new TA(sab);
+ sample[0] = 1;
+ sample[1] = 2;
+ sample[2] = 3;
+ sample[3] = 4;
+ result = sample.set(src, 0);
+ assert(compareArray(sample, [42, 43, 3, 4]), "sample is SAB-backed, offset: 0, result: " + sample);
+ assert.sameValue(result, undefined, "returns undefined");
+
+ sab = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT);
+ sample = new TA(sab);
+ sample[0] = 1;
+ sample[1] = 2;
+ sample[2] = 3;
+ sample[3] = 4;
+ result = sample.set(src, 1);
+ assert(compareArray(sample, [1, 42, 43, 4]), "sample is SAB-backed, offset: 1, result: " + sample);
+ assert.sameValue(result, undefined, "returns undefined");
+
+ sab = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT);
+ sample = new TA(sab);
+ sample[0] = 1;
+ sample[1] = 2;
+ sample[2] = 3;
+ sample[3] = 4;
+ result = sample.set(src, 2);
+ assert(compareArray(sample, [1, 2, 42, 43]), "sample is SAB-backed, offset: 2, result: " + sample);
+ assert.sameValue(result, undefined, "returns undefined");
+
+ var sab1 = new SharedArrayBuffer(2 * other.BYTES_PER_ELEMENT);
+ src = new other(sab1);
+ src[0] = 42;
+ src[1] = 43;
+
+ var sab2;
+ sab2 = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT);
+ sample = new TA(sab2);
+ sample[0] = 1;
+ sample[1] = 2;
+ sample[2] = 3;
+ sample[3] = 4;
+ result = sample.set(src, 0);
+ assert(compareArray(sample, [42, 43, 3, 4]), "src and sample are SAB-backed, offset: 0, result: " + sample);
+ assert.sameValue(result, undefined, "returns undefined");
+
+ sab2 = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT);
+ sample = new TA(sab2);
+ sample[0] = 1;
+ sample[1] = 2;
+ sample[2] = 3;
+ sample[3] = 4;
+ result = sample.set(src, 1);
+ assert(compareArray(sample, [1, 42, 43, 4]), "src and sample are SAB-backed, offset: 1, result: " + sample);
+ assert.sameValue(result, undefined, "returns undefined");
+
+ sab2 = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT);
+ sample = new TA(sab2);
+ sample[0] = 1;
+ sample[1] = 2;
+ sample[2] = 3;
+ sample[3] = 4;
+ result = sample.set(src, 2);
+ assert(compareArray(sample, [1, 2, 42, 43]), "src and sample are SAB-backed, offset: 2, result: " + sample);
+ assert.sameValue(result, undefined, "returns undefined");
+}, int_views);
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type.js
new file mode 100644
index 000000000..4456c5dcc
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type.js
@@ -0,0 +1,48 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set-typedarray-offset
+description: >
+ Set values from different instances using the different buffer and different
+ type.
+info: |
+ 22.2.3.23.2 %TypedArray%.prototype.set(typedArray [ , offset ] )
+
+ 1. Assert: typedArray has a [[TypedArrayName]] internal slot. If it does not,
+ the definition in 22.2.3.23.1 applies.
+ ...
+ 23. If SameValue(srcBuffer, targetBuffer) is true, then
+ ...
+ 24. Else, let srcByteIndex be srcByteOffset.
+ ...
+ 27. If SameValue(srcType, targetType) is true, then,
+ ...
+ 28. Else,
+ a. Repeat, while targetByteIndex < limit
+ i. Let value be GetValueFromBuffer(srcBuffer, srcByteIndex, srcType).
+ ii. Perform SetValueInBuffer(targetBuffer, targetByteIndex, targetType,
+ value).
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var other = TA === BigInt64Array ? BigUint64Array : BigInt64Array;
+ var src = new other([42n, 43n]);
+ var sample, result;
+
+ sample = new TA([1n, 2n, 3n, 4n]);
+ result = sample.set(src, 0);
+ assert(compareArray(sample, [42n, 43n, 3n, 4n]), "offset: 0, result: " + sample);
+ assert.sameValue(result, undefined, "returns undefined");
+
+ sample = new TA([1n, 2n, 3n, 4n]);
+ result = sample.set(src, 1);
+ assert(compareArray(sample, [1n, 42n, 43n, 4n]), "offset: 1, result: " + sample);
+ assert.sameValue(result, undefined, "returns undefined");
+
+ sample = new TA([1n, 2n, 3n, 4n]);
+ result = sample.set(src, 2);
+ assert(compareArray(sample, [1n, 2n, 42n, 43n]), "offset: 2, result: " + sample);
+ assert.sameValue(result, undefined, "returns undefined");
+});
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-same-type-sab.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-same-type-sab.js
new file mode 100644
index 000000000..6e1279ea4
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-same-type-sab.js
@@ -0,0 +1,107 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set-typedarray-offset
+description: >
+ Set values from different instances using the different buffer and same
+ constructor. srcBuffer values are cached.
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, SharedArrayBuffer, TypedArray]
+---*/
+
+var int_views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array];
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample, result;
+
+ var sab = new SharedArrayBuffer(2 * TA.BYTES_PER_ELEMENT);
+ var src = new TA(sab);
+ src[0] = 42;
+ src[1] = 43;
+
+ sample = new TA([1, 2, 3, 4]);
+ result = sample.set(src, 1);
+ assert(compareArray(sample, [1, 42, 43, 4]), "src is SAB-backed, offset: 1, result: " + sample);
+ assert.sameValue(result, undefined, "returns undefined");
+
+ sample = new TA([1, 2, 3, 4]);
+ result = sample.set(src, 0);
+ assert(compareArray(sample, [42, 43, 3, 4]), "src is SAB-backed, offset: 0, result: " + sample);
+ assert.sameValue(result, undefined, "returns undefined");
+
+ sample = new TA([1, 2, 3, 4]);
+ result = sample.set(src, 2);
+ assert(compareArray(sample, [1, 2, 42, 43]), "src is SAB-backed, offset: 2, result: " + sample);
+ assert.sameValue(result, undefined, "returns undefined");
+
+
+ src = new TA([42, 43]);
+
+ sab = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT);
+ sample = new TA(sab);
+ sample[0] = 1;
+ sample[1] = 2;
+ sample[2] = 3;
+ sample[3] = 4;
+ result = sample.set(src, 1);
+ assert(compareArray(sample, [1, 42, 43, 4]), "sample is SAB-backed, offset: 1, result: " + sample);
+ assert.sameValue(result, undefined, "returns undefined");
+
+ sab = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT);
+ sample = new TA(sab);
+ sample[0] = 1;
+ sample[1] = 2;
+ sample[2] = 3;
+ sample[3] = 4;
+ result = sample.set(src, 0);
+ assert(compareArray(sample, [42, 43, 3, 4]), "sample is SAB-backed, offset: 0, result: " + sample);
+ assert.sameValue(result, undefined, "returns undefined");
+
+ sab = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT);
+ sample = new TA(sab);
+ sample[0] = 1;
+ sample[1] = 2;
+ sample[2] = 3;
+ sample[3] = 4;
+ result = sample.set(src, 2);
+ assert(compareArray(sample, [1, 2, 42, 43]), "sample is SAB-backed, offset: 2, result: " + sample);
+ assert.sameValue(result, undefined, "returns undefined");
+
+
+ var sab1 = new SharedArrayBuffer(2 * TA.BYTES_PER_ELEMENT);
+ src = new TA(sab1);
+ src[0] = 42;
+ src[1] = 43;
+
+ var sab2;
+ sab2 = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT);
+ sample = new TA(sab2);
+ sample[0] = 1;
+ sample[1] = 2;
+ sample[2] = 3;
+ sample[3] = 4;
+ result = sample.set(src, 1);
+ assert(compareArray(sample, [1, 42, 43, 4]), "src and sample are SAB-backed, offset: 1, result: " + sample);
+ assert.sameValue(result, undefined, "returns undefined");
+
+ sab2 = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT);
+ sample = new TA(sab2);
+ sample[0] = 1;
+ sample[1] = 2;
+ sample[2] = 3;
+ sample[3] = 4;
+ result = sample.set(src, 0);
+ assert(compareArray(sample, [42, 43, 3, 4]), "src and sample are SAB-backed, offset: 0, result: " + sample);
+ assert.sameValue(result, undefined, "returns undefined");
+
+ sab2 = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT);
+ sample = new TA(sab2);
+ sample[0] = 1;
+ sample[1] = 2;
+ sample[2] = 3;
+ sample[3] = 4;
+ result = sample.set(src, 2);
+ assert(compareArray(sample, [1, 2, 42, 43]), "src and sample are SAB-backed, offset: 2, result: " + sample);
+ assert.sameValue(result, undefined, "returns undefined");
+}, int_views);
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-same-type.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-same-type.js
new file mode 100644
index 000000000..d806b6a6c
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-same-type.js
@@ -0,0 +1,50 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set-typedarray-offset
+description: >
+ Set values from different instances using the different buffer and same
+ constructor. srcBuffer values are cached.
+info: |
+ 22.2.3.23.2 %TypedArray%.prototype.set(typedArray [ , offset ] )
+
+ 1. Assert: typedArray has a [[TypedArrayName]] internal slot. If it does not,
+ the definition in 22.2.3.23.1 applies.
+ ...
+ 23. If SameValue(srcBuffer, targetBuffer) is true, then
+ ...
+ 24. Else, let srcByteIndex be srcByteOffset.
+ ...
+ 27. If SameValue(srcType, targetType) is true, then,
+ a. NOTE: If srcType and targetType are the same, the transfer must be
+ performed in a manner that preserves the bit-level encoding of the source
+ data.
+ b. Repeat, while targetByteIndex < limit
+ i. Let value be GetValueFromBuffer(srcBuffer, srcByteIndex, "Uint8").
+ ii. Perform SetValueInBuffer(targetBuffer, targetByteIndex, "Uint8",
+ value).
+ ...
+ 29. Return undefined.
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample, result;
+ var src = new TA([42n, 43n]);
+
+ sample = new TA([1n, 2n, 3n, 4n]);
+ result = sample.set(src, 1);
+ assert(compareArray(sample, [1n, 42n, 43n, 4n]), "offset: 1, result: " + sample);
+ assert.sameValue(result, undefined, "returns undefined");
+
+ sample = new TA([1n, 2n, 3n, 4n]);
+ result = sample.set(src, 0);
+ assert(compareArray(sample, [42n, 43n, 3n, 4n]), "offset: 0, result: " + sample);
+ assert.sameValue(result, undefined, "returns undefined");
+
+ sample = new TA([1n, 2n, 3n, 4n]);
+ result = sample.set(src, 2);
+ assert(compareArray(sample, [1n, 2n, 42n, 43n]), "offset: 2, result: " + sample);
+ assert.sameValue(result, undefined, "returns undefined");
+});
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-same-buffer-same-type-sab.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-same-buffer-same-type-sab.js
new file mode 100644
index 000000000..86c686e3b
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-same-buffer-same-type-sab.js
@@ -0,0 +1,51 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.set-typedarray-offset
+description: >
+ Set values from different instances using the same buffer and same
+ constructor. srcBuffer values are cached.
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, SharedArrayBuffer, TypedArray]
+---*/
+
+var int_views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array];
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample, src, result, sab;
+
+ sab = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT);
+ sample = new TA(sab);
+ sample[0] = 1;
+ sample[1] = 2;
+ sample[2] = 3;
+ sample[3] = 4;
+ src = new TA(sample.buffer, 0, 2);
+ result = sample.set(src, 0);
+ assert(compareArray(sample, [1, 2, 3, 4]), "offset: 0, result: " + sample);
+ assert.sameValue(result, undefined, "returns undefined");
+
+ sab = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT);
+ sample = new TA(sab);
+ sample[0] = 1;
+ sample[1] = 2;
+ sample[2] = 3;
+ sample[3] = 4;
+ src = new TA(sample.buffer, 0, 2);
+ result = sample.set(src, 1);
+ assert(compareArray(sample, [1, 1, 2, 4]), "offset: 1, result: " + sample);
+ assert.sameValue(result, undefined, "returns undefined");
+
+ sab = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT);
+ sample = new TA(sab);
+ sample[0] = 1;
+ sample[1] = 2;
+ sample[2] = 3;
+ sample[3] = 4;
+ src = new TA(sample.buffer, 0, 2);
+ result = sample.set(src, 2);
+ assert(compareArray(sample, [1, 2, 1, 2]), "offset: 2, result: " + sample);
+ assert.sameValue(result, undefined, "returns undefined");
+}, int_views);
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-same-buffer-same-type.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-same-buffer-same-type.js
new file mode 100644
index 000000000..ab1454760
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-same-buffer-same-type.js
@@ -0,0 +1,53 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set-typedarray-offset
+description: >
+ Set values from different instances using the same buffer and same
+ constructor. srcBuffer values are cached.
+info: |
+ 22.2.3.23.2 %TypedArray%.prototype.set(typedArray [ , offset ] )
+
+ 1. Assert: typedArray has a [[TypedArrayName]] internal slot. If it does not,
+ the definition in 22.2.3.23.1 applies.
+ ...
+ 23. If SameValue(srcBuffer, targetBuffer) is true, then
+ a. Let srcBuffer be ? CloneArrayBuffer(srcBuffer, srcByteOffset, srcLength,
+ %ArrayBuffer%).
+ b. NOTE: %ArrayBuffer% is used to clone srcBuffer because is it known to not
+ have any observable side-effects.
+ ...
+ ...
+ 27. If SameValue(srcType, targetType) is true, then,
+ a. NOTE: If srcType and targetType are the same, the transfer must be
+ performed in a manner that preserves the bit-level encoding of the source
+ data.
+ b. Repeat, while targetByteIndex < limit
+ i. Let value be GetValueFromBuffer(srcBuffer, srcByteIndex, "Uint8").
+ ii. Perform SetValueInBuffer(targetBuffer, targetByteIndex, "Uint8",
+ value).
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample, src, result;
+
+ sample = new TA([1n, 2n, 3n, 4n]);
+ src = new TA(sample.buffer, 0, 2);
+ result = sample.set(src, 0);
+ assert(compareArray(sample, [1n, 2n, 3n, 4n]), "offset: 0, result: " + sample);
+ assert.sameValue(result, undefined, "returns undefined");
+
+ sample = new TA([1n, 2n, 3n, 4n]);
+ src = new TA(sample.buffer, 0, 2);
+ result = sample.set(src, 1);
+ assert(compareArray(sample, [1n, 1n, 2n, 4n]), "offset: 1, result: " + sample);
+ assert.sameValue(result, undefined, "returns undefined");
+
+ sample = new TA([1n, 2n, 3n, 4n]);
+ src = new TA(sample.buffer, 0, 2);
+ result = sample.set(src, 2);
+ assert(compareArray(sample, [1n, 2n, 1n, 2n]), "offset: 2, result: " + sample);
+ assert.sameValue(result, undefined, "returns undefined");
+});
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-src-arraylength-internal.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-src-arraylength-internal.js
new file mode 100644
index 000000000..96ea335ec
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-src-arraylength-internal.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set-typedarray-offset
+description: >
+ Uses typedArray's internal [[ArrayLength]]
+info: |
+ 22.2.3.23.2 %TypedArray%.prototype.set(typedArray [ , offset ] )
+
+ 1. Assert: typedArray has a [[TypedArrayName]] internal slot. If it does not,
+ the definition in 22.2.3.23.1 applies.
+ ...
+ 20. Let srcLength be the value of typedArray's [[ArrayLength]] internal slot.
+ ...
+ 22. If srcLength + targetOffset > targetLength, throw a RangeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var getCalls = 0;
+var desc = {
+ get: function getLen() {
+ getCalls++;
+ return 42;
+ }
+};
+
+Object.defineProperty(TypedArray.prototype, "length", desc);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(2);
+ var src = new TA([42n, 43n]);
+
+ Object.defineProperty(TA.prototype, "length", desc);
+ Object.defineProperty(src, "length", desc);
+
+ sample.set(src);
+
+ assert.sameValue(getCalls, 0, "ignores length properties");
+});
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-src-byteoffset-internal.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-src-byteoffset-internal.js
new file mode 100644
index 000000000..35c3ace2a
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-src-byteoffset-internal.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2017 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set-typedarray-offset
+description: >
+ Uses typedArray's internal [[ByteOffset]]
+info: |
+ 22.2.3.23.2 %TypedArray%.prototype.set(typedArray [ , offset ] )
+ 1. Assert: typedArray has a [[TypedArrayName]] internal slot. If it does not,
+ the definition in 22.2.3.23.1 applies.
+ ...
+ 21. Let srcByteOffset be typedArray.[[ByteOffset]].
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var getCalls = 0;
+var desc = {
+ get: function getLen() {
+ getCalls++;
+ return 0;
+ }
+};
+
+Object.defineProperty(TypedArray.prototype, "byteOffset", desc);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(2);
+ var src = new TA([42n, 43n]);
+ var other = TA === BigInt64Array ? BigUint64Array : BigInt64Array;
+ var src2 = new other([42n, 43n]);
+ var src3 = new other(sample.buffer, 0, 2);
+
+ Object.defineProperty(TA.prototype, "byteOffset", desc);
+ Object.defineProperty(src, "byteOffset", desc);
+ Object.defineProperty(src2, "byteOffset", desc);
+ Object.defineProperty(src3, "byteOffset", desc);
+
+ sample.set(src);
+ sample.set(src2);
+ sample.set(src3);
+
+ assert.sameValue(getCalls, 0, "ignores byteOffset properties");
+});
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-src-range-greather-than-target-throws-rangeerror.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-src-range-greather-than-target-throws-rangeerror.js
new file mode 100644
index 000000000..2a24d0990
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-src-range-greather-than-target-throws-rangeerror.js
@@ -0,0 +1,51 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set-typedarray-offset
+description: >
+ If srcLength + targetOffset > targetLength, throw a RangeError exception.
+info: |
+ 22.2.3.23.2 %TypedArray%.prototype.set(typedArray [ , offset ] )
+
+ 1. Assert: typedArray has a [[TypedArrayName]] internal slot. If it does not,
+ the definition in 22.2.3.23.1 applies.
+ ...
+ 6. Let targetOffset be ? ToInteger(offset).
+ ...
+ 10. Let targetLength be the value of target's [[ArrayLength]] internal slot.
+ ...
+ 20. Let srcLength be the value of typedArray's [[ArrayLength]] internal slot.
+ ...
+ 22. If srcLength + targetOffset > targetLength, throw a RangeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample, src;
+
+ sample = new TA(2);
+ src = new TA(2);
+ assert.throws(RangeError, function() {
+ sample.set(src, 1);
+ }, "2 + 1 > 2");
+
+ sample = new TA(1);
+ src = new TA(2);
+ assert.throws(RangeError, function() {
+ sample.set(src, 0);
+ }, "2 + 0 > 1");
+
+ sample = new TA(1);
+ src = new TA(0);
+ assert.throws(RangeError, function() {
+ sample.set(src, 2);
+ }, "0 + 2 > 1");
+
+ sample = new TA(2);
+ src = new TA(2);
+ assert.throws(RangeError, function() {
+ sample.set(src, Infinity);
+ }, "2 + Infinity > 2");
+});
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-srcbuffer-detached-during-tointeger-offset-throws.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-srcbuffer-detached-during-tointeger-offset-throws.js
new file mode 100644
index 000000000..98ae8b2fa
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-srcbuffer-detached-during-tointeger-offset-throws.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set-typedarray-offset
+description: >
+ Throws a TypeError if srcBuffer is detached on ToInteger(offset)
+info: |
+ 22.2.3.23.2 %TypedArray%.prototype.set(typedArray [ , offset ] )
+
+ 1. Assert: typedArray has a [[TypedArrayName]] internal slot. If it does not,
+ the definition in 22.2.3.23.1 applies.
+ ...
+ 6. Let targetOffset be ? ToInteger(offset).
+ ...
+ 11. Let srcBuffer be the value of typedArray's [[ViewedArrayBuffer]] internal
+ slot.
+ 12. If IsDetachedBuffer(srcBuffer) is true, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA();
+ var target = new TA();
+ var calledOffset = 0;
+ var obj = {
+ valueOf: function() {
+ $DETACHBUFFER(target.buffer);
+ calledOffset += 1;
+ }
+ };
+
+ assert.throws(TypeError, function() {
+ sample.set(target, obj);
+ });
+
+ assert.sameValue(calledOffset, 1);
+});
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-target-arraylength-internal.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-target-arraylength-internal.js
new file mode 100644
index 000000000..9f13dc2b1
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-target-arraylength-internal.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set-typedarray-offset
+description: >
+ Uses target's internal [[ArrayLength]]
+info: |
+ 22.2.3.23.2 %TypedArray%.prototype.set(typedArray [ , offset ] )
+
+ 1. Assert: typedArray has a [[TypedArrayName]] internal slot. If it does not,
+ the definition in 22.2.3.23.1 applies.
+ 2. Let target be the this value.
+ ...
+ 10. Let targetLength be the value of target's [[ArrayLength]] internal slot.
+ ...
+ 22. If srcLength + targetOffset > targetLength, throw a RangeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var getCalls = 0;
+var desc = {
+ get: function() {
+ getCalls++;
+ return 0;
+ }
+};
+
+Object.defineProperty(TypedArray.prototype, "length", desc);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(2);
+ var src = new TA([42n, 43n]);
+
+ Object.defineProperty(TA.prototype, "length", desc);
+ Object.defineProperty(sample, "length", desc);
+
+ sample.set(src);
+
+ assert.sameValue(getCalls, 0, "ignores length properties");
+});
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-target-byteoffset-internal.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-target-byteoffset-internal.js
new file mode 100644
index 000000000..13b7978fc
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-target-byteoffset-internal.js
@@ -0,0 +1,44 @@
+// Copyright (C) 2017 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set-typedarray-offset
+description: >
+ Uses target's internal [[ArrayLength]]
+info: |
+ 22.2.3.23.2 %TypedArray%.prototype.set(typedArray [ , offset ] )
+ 1. Assert: typedArray has a [[TypedArrayName]] internal slot. If it does not,
+ the definition in 22.2.3.23.1 applies.
+ 2. Let target be the this value.
+ ...
+ 16. Let targetByteOffset be target.[[ByteOffset]].
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var getCalls = 0;
+var desc = {
+ get: function() {
+ getCalls++;
+ return 0;
+ }
+};
+
+Object.defineProperty(TypedArray.prototype, "byteOffset", desc);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(2);
+ var src = new TA([42n, 43n]);
+ var other = TA === BigInt64Array ? BigUint64Array : BigInt64Array;
+ var src2 = new other([42n, 43n]);
+ var src3 = new other(sample.buffer, 0, 2);
+
+ Object.defineProperty(TA.prototype, "byteOffset", desc);
+ Object.defineProperty(sample, "byteOffset", desc);
+
+ sample.set(src);
+ sample.set(src2);
+ sample.set(src3);
+
+ assert.sameValue(getCalls, 0, "ignores byteoffset properties");
+});
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-targetbuffer-detached-during-tointeger-offset-throws.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-targetbuffer-detached-during-tointeger-offset-throws.js
new file mode 100644
index 000000000..b57c24551
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-targetbuffer-detached-during-tointeger-offset-throws.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.set-typedarray-offset
+description: >
+ Throws a TypeError if targetBuffer is detached on ToInteger(offset)
+info: |
+ 22.2.3.23.2 %TypedArray%.prototype.set(typedArray [ , offset ] )
+
+ 1. Assert: typedArray has a [[TypedArrayName]] internal slot. If it does not,
+ the definition in 22.2.3.23.1 applies.
+ ...
+ 6. Let targetOffset be ? ToInteger(offset).
+ ...
+ 8. Let targetBuffer be the value of target's [[ViewedArrayBuffer]] internal
+ slot.
+ 9. If IsDetachedBuffer(targetBuffer) is true, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(2);
+ var src = new TA(1);
+ var calledOffset = 0;
+ var obj = {
+ valueOf: function() {
+ $DETACHBUFFER(sample.buffer);
+ calledOffset += 1;
+ }
+ };
+
+ assert.throws(TypeError, function() {
+ sample.set(src, obj);
+ });
+
+ assert.sameValue(calledOffset, 1);
+});
diff --git a/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-get-value.js b/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-get-value.js
index e47046247..afe080030 100644
--- a/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-get-value.js
+++ b/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-get-value.js
@@ -22,19 +22,19 @@ includes: [testTypedArray.js, compareArray.js]
features: [TypedArray]
---*/
-var obj = {
- length: 4,
- "0": 42,
- "1": 43,
- "3": 44
-};
-Object.defineProperty(obj, "2", {
- get: function() {
- throw new Test262Error();
- }
-});
-
testWithTypedArrayConstructors(function(TA) {
+ var obj = {
+ length: 4,
+ "0": 42,
+ "1": 43,
+ "3": 44
+ };
+ Object.defineProperty(obj, "2", {
+ get: function() {
+ throw new Test262Error();
+ }
+ });
+
var sample = new TA([1, 2, 3, 4]);
assert.throws(Test262Error, function() {
diff --git a/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-tonumber-value-symbol.js b/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-tonumber-value-symbol.js
index 250b66c0b..2afc27a6f 100644
--- a/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-tonumber-value-symbol.js
+++ b/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-tonumber-value-symbol.js
@@ -22,15 +22,15 @@ includes: [testTypedArray.js, compareArray.js]
features: [Symbol, TypedArray]
---*/
-var obj = {
- length: 4,
- "0": 42,
- "1": 43,
- "2": Symbol("1"),
- "3": 44
-};
-
testWithTypedArrayConstructors(function(TA) {
+ var obj = {
+ length: 4,
+ "0": 42,
+ "1": 43,
+ "2": Symbol("1"),
+ "3": 44
+ };
+
var sample = new TA([1, 2, 3, 4]);
assert.throws(TypeError, function() {
diff --git a/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-tonumber-value.js b/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-tonumber-value.js
index 535841f58..438001533 100644
--- a/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-tonumber-value.js
+++ b/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-tonumber-value.js
@@ -22,19 +22,19 @@ includes: [testTypedArray.js, compareArray.js]
features: [TypedArray]
---*/
-var obj = {
- length: 4,
- "0": 42,
- "1": 43,
- "2": {
- valueOf: function() {
- throw new Test262Error();
- }
- },
- "3": 44
-};
-
testWithTypedArrayConstructors(function(TA) {
+ var obj = {
+ length: 4,
+ "0": 42,
+ "1": 43,
+ "2": {
+ valueOf: function() {
+ throw new Test262Error();
+ }
+ },
+ "3": 44
+ };
+
var sample = new TA([1, 2, 3, 4]);
assert.throws(Test262Error, function() {
diff --git a/test/built-ins/TypedArray/prototype/set/array-arg-src-tonumber-value-conversions.js b/test/built-ins/TypedArray/prototype/set/array-arg-src-tonumber-value-conversions.js
index d5e346f11..f7b158c95 100644
--- a/test/built-ins/TypedArray/prototype/set/array-arg-src-tonumber-value-conversions.js
+++ b/test/built-ins/TypedArray/prototype/set/array-arg-src-tonumber-value-conversions.js
@@ -19,6 +19,7 @@ info: |
kNumber).
...
includes: [byteConversionValues.js, testTypedArray.js]
+features: [TypedArray]
---*/
testTypedArrayConversions(byteConversionValues, function(TA, value, expected, initial) {
diff --git a/test/built-ins/TypedArray/prototype/set/array-arg-src-tonumber-value-type-conversions.js b/test/built-ins/TypedArray/prototype/set/array-arg-src-tonumber-value-type-conversions.js
index 0256df84e..e9dce1b65 100644
--- a/test/built-ins/TypedArray/prototype/set/array-arg-src-tonumber-value-type-conversions.js
+++ b/test/built-ins/TypedArray/prototype/set/array-arg-src-tonumber-value-type-conversions.js
@@ -22,22 +22,28 @@ includes: [testTypedArray.js, compareArray.js]
features: [TypedArray]
---*/
-var obj1 = {
- valueOf: function() {
- return 42;
- }
-};
+testWithTypedArrayConstructors(function(TA) {
+ var obj1 = {
+ valueOf: function() {
+ return 42;
+ }
+ };
-var obj2 = {
- toString: function() {
- return 42;
- }
-};
+ var obj2 = {
+ toString: function() {
+ return "42";
+ }
+ };
-// undefined and NaN covered on typedArrayConversions
-var arr = ["1", "", false, true, null, obj1, obj2, [], [1]];
+ // undefined and NaN covered on typedArrayConversions
+ var nullish;
+ try {
+ nullish = null;
+ } catch (e) {
+ nullish = 0n;
+ }
+ var arr = ["1", "", false, true, nullish, obj1, obj2, [], [1]];
-testWithTypedArrayConstructors(function(TA) {
var sample = new TA(arr.length);
var expected = new TA([1, 0, 0, 1, 0, 42, 42, 0, 1]);
diff --git a/test/built-ins/TypedArray/prototype/set/bit-precision.js b/test/built-ins/TypedArray/prototype/set/bit-precision.js
index 29dc14629..0e9aac1c8 100644
--- a/test/built-ins/TypedArray/prototype/set/bit-precision.js
+++ b/test/built-ins/TypedArray/prototype/set/bit-precision.js
@@ -1,8 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-esid: sec-%typedarray%.prototype.set
-es6id: 22.2.3.22.2
+esid: sec-%typedarray%.prototype.set.2
description: Preservation of bit-level encoding
info: |
[...]
@@ -17,6 +16,7 @@ info: |
iii. Set srcByteIndex to srcByteIndex + 1.
iv. Set targetByteIndex to targetByteIndex + 1.
includes: [nans.js, compareArray.js, testTypedArray.js]
+features: [TypedArray]
---*/
function body(FloatArray) {
diff --git a/test/built-ins/TypedArray/prototype/set/invoked-as-func.js b/test/built-ins/TypedArray/prototype/set/invoked-as-func.js
index deae7a637..7a5b9e7bf 100644
--- a/test/built-ins/TypedArray/prototype/set/invoked-as-func.js
+++ b/test/built-ins/TypedArray/prototype/set/invoked-as-func.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.22
+esid: sec-%typedarray%.prototype.set
description: Throws a TypeError exception when invoked as a function
info: |
22.2.3.22 %TypedArray%.prototype.set ( overloaded [ , offset ])
diff --git a/test/built-ins/TypedArray/prototype/set/invoked-as-method.js b/test/built-ins/TypedArray/prototype/set/invoked-as-method.js
index 37b489687..586772a2c 100644
--- a/test/built-ins/TypedArray/prototype/set/invoked-as-method.js
+++ b/test/built-ins/TypedArray/prototype/set/invoked-as-method.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.22
+esid: sec-%typedarray%.prototype.set
description: Requires a [[TypedArrayName]] internal slot.
info: |
22.2.3.22 %TypedArray%.prototype.set ( overloaded [ , offset ])
diff --git a/test/built-ins/TypedArray/prototype/set/length.js b/test/built-ins/TypedArray/prototype/set/length.js
index 344b151f7..7e94fdc4f 100644
--- a/test/built-ins/TypedArray/prototype/set/length.js
+++ b/test/built-ins/TypedArray/prototype/set/length.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.22
+esid: sec-%typedarray%.prototype.set
description: >
%TypedArray%.prototype.set.length is 1.
info: |
@@ -20,6 +20,7 @@ info: |
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
[[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.set.length, 1);
diff --git a/test/built-ins/TypedArray/prototype/set/name.js b/test/built-ins/TypedArray/prototype/set/name.js
index 22e4c79cd..f7cbaf394 100644
--- a/test/built-ins/TypedArray/prototype/set/name.js
+++ b/test/built-ins/TypedArray/prototype/set/name.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.22
+esid: sec-%typedarray%.prototype.set
description: >
%TypedArray%.prototype.set.name is "set".
info: |
@@ -17,6 +17,7 @@ info: |
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.set.name, "set");
diff --git a/test/built-ins/TypedArray/prototype/set/prop-desc.js b/test/built-ins/TypedArray/prototype/set/prop-desc.js
index afce91c7d..5adf2b15f 100644
--- a/test/built-ins/TypedArray/prototype/set/prop-desc.js
+++ b/test/built-ins/TypedArray/prototype/set/prop-desc.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.22
+esid: sec-%typedarray%.prototype.set
description: >
"set" property of TypedArrayPrototype
info: |
@@ -9,6 +9,7 @@ info: |
and in Annex B.2 has the attributes { [[Writable]]: true,
[[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
var TypedArrayPrototype = TypedArray.prototype;
diff --git a/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-other-type-conversions.js b/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-other-type-conversions.js
index 26b00197b..5174b5528 100644
--- a/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-other-type-conversions.js
+++ b/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-other-type-conversions.js
@@ -22,6 +22,7 @@ info: |
ii. Perform SetValueInBuffer(targetBuffer, targetByteIndex, targetType,
value).
includes: [byteConversionValues.js, testTypedArray.js]
+features: [TypedArray]
---*/
testTypedArrayConversions(byteConversionValues, function(TA, value, expected, initial) {
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/arraylength-internal.js b/test/built-ins/TypedArray/prototype/slice/BigInt/arraylength-internal.js
new file mode 100644
index 000000000..505215fb0
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/arraylength-internal.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: Use internal ArrayLength instead of getting a length property
+info: |
+ 22.2.3.24 %TypedArray%.prototype.slice ( start, end )
+
+ ...
+ 3. Let len be the value of O's [[ArrayLength]] internal slot.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var getCalls = 0;
+var desc = {
+ get: function getLen() {
+ getCalls++;
+ return 0;
+ }
+};
+
+Object.defineProperty(TypedArray.prototype, "length", desc);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n]);
+
+ Object.defineProperty(TA.prototype, "length", desc);
+ Object.defineProperty(sample, "length", desc);
+
+ var result = sample.slice();
+
+ assert.sameValue(getCalls, 0, "ignores length properties");
+ assert.sameValue(result[0], 42n);
+ assert.sameValue(result[1], 43n);
+ assert.sameValue(result.hasOwnProperty(2), false);
+});
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/bit-precision.js b/test/built-ins/TypedArray/prototype/slice/BigInt/bit-precision.js
new file mode 100644
index 000000000..e27565331
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/bit-precision.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: Preservation of bit-level encoding
+info: |
+ [...]
+ 15. Else if count > 0, then
+ [...]
+ e. NOTE: If srcType and targetType are the same, the transfer must be
+ performed in a manner that preserves the bit-level encoding of the
+ source data.
+ f. Let srcByteOffet be the value of O's [[ByteOffset]] internal slot.
+ g. Let targetByteIndex be A's [[ByteOffset]] internal slot.
+ h. Let srcByteIndex be (k × elementSize) + srcByteOffet.
+ i. Let limit be targetByteIndex + count × elementSize.
+ j. Repeat, while targetByteIndex < limit
+ i. Let value be GetValueFromBuffer(srcBuffer, srcByteIndex, "Uint8").
+ ii. Perform SetValueInBuffer(targetBuffer, targetByteIndex, "Uint8",
+ value).
+ iii. Increase srcByteIndex by 1.
+ iv. Increase targetByteIndex by 1.
+includes: [nans.js, compareArray.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+function body(FloatArray) {
+ var subject = new FloatArray(distinctNaNs);
+ var sliced, subjectBytes, slicedBytes;
+
+ sliced = subject.slice();
+
+ subjectBytes = new Uint8Array(subject.buffer);
+ slicedBytes = new Uint8Array(sliced.buffer);
+
+ assert(compareArray(subjectBytes, slicedBytes));
+}
+
+testWithBigIntTypedArrayConstructors(body, [Float32Array, Float64Array]);
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-custom-ctor-other-targettype.js b/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-custom-ctor-other-targettype.js
new file mode 100644
index 000000000..5dee0faf7
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-custom-ctor-other-targettype.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: >
+ Throws a TypeError buffer is detached on Get custom constructor. Using other
+ targetType
+info: |
+ 22.2.3.24 %TypedArray%.prototype.slice ( start, end )
+
+ ...
+ 9. Let A be ? TypedArraySpeciesCreate(O, « count »).
+ ...
+ 14. If SameValue(srcType, targetType) is false, then
+ a. Let n be 0.
+ b. Repeat, while k < final
+ ...
+ ii. Let kValue be ? Get(O, Pk).
+ ...
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, Symbol.species, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+
+ sample.constructor = {};
+ sample.constructor[Symbol.species] = function(count) {
+ var other = TA === Int8Array ? Int16Array : Int8Array;
+ $DETACHBUFFER(sample.buffer);
+ return new other(count);
+ };
+
+ assert.throws(TypeError, function() {
+ sample.slice();
+ }, "step 14.b.ii - ? Get(O, Pk), O has a detached buffer");
+});
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-custom-ctor-same-targettype.js b/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-custom-ctor-same-targettype.js
new file mode 100644
index 000000000..a5e64a7d1
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-custom-ctor-same-targettype.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: Throws a TypeError buffer is detached on Get custom constructor.
+info: |
+ 22.2.3.24 %TypedArray%.prototype.slice ( start, end )
+
+ ...
+ 9. Let A be ? TypedArraySpeciesCreate(O, « count »).
+ ...
+ 14. If SameValue(srcType, targetType) is false, then
+ ...
+ 15. Else if count > 0, then
+ a. Let srcBuffer be the value of O's [[ViewedArrayBuffer]] internal slot.
+ b. If IsDetachedBuffer(srcBuffer) is true, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, Symbol.species, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+
+ sample.constructor = {};
+ sample.constructor[Symbol.species] = function(count) {
+ $DETACHBUFFER(sample.buffer);
+ return new TA(count);
+ };
+
+ assert.throws(TypeError, function() {
+ sample.slice();
+ }, "step 15.b, IsDetachedBuffer(srcBuffer) is true");
+});
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-get-ctor.js b/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-get-ctor.js
new file mode 100644
index 000000000..5ce258d5c
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-get-ctor.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: Throws a TypeError buffer is detached on Get constructor.
+info: |
+ 22.2.3.24 %TypedArray%.prototype.slice ( start, end )
+
+ ...
+ 9. Let A be ? TypedArraySpeciesCreate(O, « count »).
+ ...
+ 14. If SameValue(srcType, targetType) is false, then
+ ...
+ 15. Else if count > 0, then
+ a. Let srcBuffer be the value of O's [[ViewedArrayBuffer]] internal slot.
+ b. If IsDetachedBuffer(srcBuffer) is true, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+
+ Object.defineProperty(sample, "constructor", {
+ get: function() {
+ $DETACHBUFFER(sample.buffer);
+ }
+ });
+ assert.throws(TypeError, function() {
+ sample.slice();
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-speciesctor-get-species-custom-ctor-throws.js b/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-speciesctor-get-species-custom-ctor-throws.js
new file mode 100644
index 000000000..29258266b
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-speciesctor-get-species-custom-ctor-throws.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: >
+ Custom @@species constructor throws if it returns an instance with a detached
+ buffer
+info: |
+ 22.2.3.24 %TypedArray%.prototype.slice ( start, end )
+
+ ...
+ 9. Let A be ? TypedArraySpeciesCreate(O, « count »).
+ ...
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor).
+ 4. Return ? TypedArrayCreate(constructor, argumentList).
+
+ 22.2.4.6 TypedArrayCreate ( constructor, argumentList )
+
+ 1. Let newTypedArray be ? Construct(constructor, argumentList).
+ 2. Perform ? ValidateTypedArray(newTypedArray).
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, Symbol.species, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA();
+
+ sample.constructor = {};
+ sample.constructor[Symbol.species] = function(count) {
+ var other = new TA(count);
+ $DETACHBUFFER(other.buffer);
+ return other;
+ };
+
+ assert.throws(TypeError, function() {
+ sample.slice();
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-zero-count-custom-ctor-other-targettype.js b/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-zero-count-custom-ctor-other-targettype.js
new file mode 100644
index 000000000..adcd18b71
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-zero-count-custom-ctor-other-targettype.js
@@ -0,0 +1,48 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: >
+ Does not throw a TypeError if buffer is detached on custom constructor and
+ `k >= final`. Using other targetType.
+info: |
+ 22.2.3.24 %TypedArray%.prototype.slice ( start, end )
+
+ ...
+ 9. Let A be ? TypedArraySpeciesCreate(O, « count »).
+ ...
+ 14. If SameValue(srcType, targetType) is false, then
+ a. Let n be 0.
+ b. Repeat, while k < final
+ ...
+ ii. Let kValue be ? Get(O, Pk).
+ ...
+ ...
+ 16. Return A.
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, Symbol.species, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample, result, other;
+ var ctor = {};
+ ctor[Symbol.species] = function(count) {
+ other = TA === Int8Array ? Int16Array : Int8Array;
+ $DETACHBUFFER(sample.buffer);
+ return new other(count);
+ };
+
+ sample = new TA(0);
+ sample.constructor = ctor;
+ result = sample.slice();
+ assert.sameValue(result.length, 0, "#1: result.length");
+ assert.notSameValue(result.buffer, sample.buffer, "#1: creates a new buffer");
+ assert.sameValue(result.constructor, other, "#1: ctor");
+
+ sample = new TA(4);
+ sample.constructor = ctor;
+ result = sample.slice(1, 1);
+ assert.sameValue(result.length, 0, "#2: result.length");
+ assert.notSameValue(result.buffer, sample.buffer, "#2: creates a new buffer");
+ assert.sameValue(result.constructor, other, "#2: ctor");
+});
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-zero-count-custom-ctor-same-targettype.js b/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-zero-count-custom-ctor-same-targettype.js
new file mode 100644
index 000000000..67372bd73
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-zero-count-custom-ctor-same-targettype.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: >
+ Does not throw a TypeError if buffer is detached on custom constructor and
+ `k >= final`. Using same targetType.
+info: |
+ 22.2.3.24 %TypedArray%.prototype.slice ( start, end )
+
+ ...
+ 9. Let A be ? TypedArraySpeciesCreate(O, « count »).
+ ...
+ 14. If SameValue(srcType, targetType) is false, then
+ ...
+ 15. Else if count > 0, then
+ a. Let srcBuffer be the value of O's [[ViewedArrayBuffer]] internal slot.
+ b. If IsDetachedBuffer(srcBuffer) is true, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, Symbol.species, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample, result;
+ var ctor = {};
+ ctor[Symbol.species] = function(count) {
+ $DETACHBUFFER(sample.buffer);
+ return new TA(count);
+ };
+
+ sample = new TA(0);
+ sample.constructor = ctor;
+ result = sample.slice();
+ assert.sameValue(result.length, 0, "#1: result.length");
+ assert.notSameValue(result.buffer, sample.buffer, "#1: creates a new buffer");
+ assert.sameValue(result.constructor, TA, "#1: ctor");
+
+ sample = new TA(4);
+ sample.constructor = ctor;
+ result = sample.slice(1, 1);
+ assert.sameValue(result.length, 0, "#2: result.length");
+ assert.notSameValue(result.buffer, sample.buffer, "#2: creates a new buffer");
+ assert.sameValue(result.constructor, TA, "#2: ctor");
+});
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer.js
new file mode 100644
index 000000000..846386175
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: Throws a TypeError if this has a detached buffer
+info: |
+ 22.2.3.24 %TypedArray%.prototype.slice ( start, end )
+
+ 1. Let O be the this value.
+ 2. Perform ? ValidateTypedArray(O).
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ ...
+ 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+var obj = {
+ valueOf: function() {
+ throw new Test262Error();
+ }
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+ $DETACHBUFFER(sample.buffer);
+ assert.throws(TypeError, function() {
+ sample.slice(obj, obj);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/infinity.js b/test/built-ins/TypedArray/prototype/slice/BigInt/infinity.js
new file mode 100644
index 000000000..adad1dc0f
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/infinity.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: Infinity values on start and end
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([40n, 41n, 42n, 43n]);
+
+ assert(
+ compareArray(sample.slice(-Infinity), [40n, 41n, 42n, 43n]),
+ "start == -Infinity"
+ );
+ assert(
+ compareArray(sample.slice(Infinity), []),
+ "start == Infinity"
+ );
+ assert(
+ compareArray(sample.slice(0, -Infinity), []),
+ "end == -Infinity"
+ );
+ assert(
+ compareArray(sample.slice(0, Infinity), [40n, 41n, 42n, 43n]),
+ "end == Infinity"
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/slice/BigInt/invoked-as-func.js
new file mode 100644
index 000000000..31645fbb4
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/invoked-as-func.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: Throws a TypeError exception when invoked as a function
+info: |
+ 22.2.3.23 %TypedArray%.prototype.slice ( start, end )
+
+ 1. Let O be the this value.
+ 2. Let valid be ValidateTypedArray(O).
+ 3. ReturnIfAbrupt(valid).
+ ...
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var slice = TypedArray.prototype.slice;
+
+assert.sameValue(typeof slice, 'function');
+
+assert.throws(TypeError, function() {
+ slice();
+});
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/slice/BigInt/invoked-as-method.js
new file mode 100644
index 000000000..4b9c7c4ff
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/invoked-as-method.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: Requires a [[TypedArrayName]] internal slot.
+info: |
+ 22.2.3.23 %TypedArray%.prototype.slice ( start, end )
+
+ 1. Let O be the this value.
+ 2. Let valid be ValidateTypedArray(O).
+ 3. ReturnIfAbrupt(valid).
+ ...
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+assert.sameValue(typeof TypedArrayPrototype.slice, 'function');
+
+assert.throws(TypeError, function() {
+ TypedArrayPrototype.slice();
+});
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/length.js b/test/built-ins/TypedArray/prototype/slice/BigInt/length.js
new file mode 100644
index 000000000..57d76ac14
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/length.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: >
+ %TypedArray%.prototype.slice.length is 2.
+info: |
+ %TypedArray%.prototype.slice ( start, end )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, has a length
+ property whose value is an integer. Unless otherwise specified, this
+ value is equal to the largest number of named arguments shown in the
+ subclause headings for the function description, including optional
+ parameters. However, rest parameters shown using the form “...name”
+ are not included in the default argument count.
+
+ Unless otherwise specified, the length property of a built-in Function
+ object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.slice.length, 2);
+
+verifyNotEnumerable(TypedArray.prototype.slice, "length");
+verifyNotWritable(TypedArray.prototype.slice, "length");
+verifyConfigurable(TypedArray.prototype.slice, "length");
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/minus-zero.js b/test/built-ins/TypedArray/prototype/slice/BigInt/minus-zero.js
new file mode 100644
index 000000000..12245c6aa
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/minus-zero.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: -0 values on start and end
+info: |
+ 22.2.3.24 %TypedArray%.prototype.slice ( start, end )
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([40n, 41n, 42n, 43n]);
+
+ assert(
+ compareArray(sample.slice(-0), [40n, 41n, 42n, 43n]),
+ "start == -0"
+ );
+ assert(
+ compareArray(sample.slice(-0, 4), [40n, 41n, 42n, 43n]),
+ "start == -0, end == length"
+ );
+ assert(
+ compareArray(sample.slice(0, -0), []),
+ "start == 0, end == -0"
+ );
+ assert(
+ compareArray(sample.slice(-0, -0), []),
+ "start == -0, end == -0"
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/name.js b/test/built-ins/TypedArray/prototype/slice/BigInt/name.js
new file mode 100644
index 000000000..4021a1c50
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/name.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: >
+ %TypedArray%.prototype.slice.name is "slice".
+info: |
+ %TypedArray%.prototype.slice ( start, end )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, that is not
+ identified as an anonymous function has a name property whose value
+ is a String.
+
+ Unless otherwise specified, the name property of a built-in Function
+ object, if it exists, has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.slice.name, "slice");
+
+verifyNotEnumerable(TypedArray.prototype.slice, "name");
+verifyNotWritable(TypedArray.prototype.slice, "name");
+verifyConfigurable(TypedArray.prototype.slice, "name");
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/slice/BigInt/prop-desc.js
new file mode 100644
index 000000000..d97889d47
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/prop-desc.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: >
+ "slice" property of TypedArrayPrototype
+info: |
+ ES6 section 17: Every other data property described in clauses 18 through 26
+ and in Annex B.2 has the attributes { [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+verifyNotEnumerable(TypedArrayPrototype, 'slice');
+verifyWritable(TypedArrayPrototype, 'slice');
+verifyConfigurable(TypedArrayPrototype, 'slice');
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/result-does-not-copy-ordinary-properties.js b/test/built-ins/TypedArray/prototype/slice/BigInt/result-does-not-copy-ordinary-properties.js
new file mode 100644
index 000000000..32f3a2883
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/result-does-not-copy-ordinary-properties.js
@@ -0,0 +1,22 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: Result does not import own properties
+info: |
+ 22.2.3.24 %TypedArray%.prototype.slice( start , end )
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([41n, 42n, 43n, 44n]);
+ sample.foo = 42;
+
+ var result = sample.slice();
+ assert.sameValue(
+ result.hasOwnProperty("foo"),
+ false,
+ "does not import own property"
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/results-with-different-length.js b/test/built-ins/TypedArray/prototype/slice/BigInt/results-with-different-length.js
new file mode 100644
index 000000000..1db41d601
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/results-with-different-length.js
@@ -0,0 +1,53 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: slice may return a new instance with a smaller length
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([40n, 41n, 42n, 43n]);
+
+ function testRes(result, expected, msg) {
+ assert(compareArray(result, expected), msg + ", result: [" + result + "]");
+ }
+
+ testRes(sample.slice(1), [41n, 42n, 43n], "begin == 1");
+ testRes(sample.slice(2), [42n, 43n], "begin == 2");
+ testRes(sample.slice(3), [43n], "begin == 3");
+
+ testRes(sample.slice(1, 4), [41n, 42n, 43n], "begin == 1, end == length");
+ testRes(sample.slice(2, 4), [42n, 43n], "begin == 2, end == length");
+ testRes(sample.slice(3, 4), [43n], "begin == 3, end == length");
+
+ testRes(sample.slice(0, 1), [40n], "begin == 0, end == 1");
+ testRes(sample.slice(0, 2), [40n, 41n], "begin == 0, end == 2");
+ testRes(sample.slice(0, 3), [40n, 41n, 42n], "begin == 0, end == 3");
+
+ testRes(sample.slice(-1), [43n], "begin == -1");
+ testRes(sample.slice(-2), [42n, 43n], "begin == -2");
+ testRes(sample.slice(-3), [41n, 42n, 43n], "begin == -3");
+
+ testRes(sample.slice(-1, 4), [43n], "begin == -1, end == length");
+ testRes(sample.slice(-2, 4), [42n, 43n], "begin == -2, end == length");
+ testRes(sample.slice(-3, 4), [41n, 42n, 43n], "begin == -3, end == length");
+
+ testRes(sample.slice(0, -1), [40n, 41n, 42n], "begin == 0, end == -1");
+ testRes(sample.slice(0, -2), [40n, 41n], "begin == 0, end == -2");
+ testRes(sample.slice(0, -3), [40n], "begin == 0, end == -3");
+
+ testRes(sample.slice(-0, -1), [40n, 41n, 42n], "begin == -0, end == -1");
+ testRes(sample.slice(-0, -2), [40n, 41n], "begin == -0, end == -2");
+ testRes(sample.slice(-0, -3), [40n], "begin == -0, end == -3");
+
+ testRes(sample.slice(-2, -1), [42n], "length == 4, begin == -2, end == -1");
+ testRes(sample.slice(1, -1), [41n, 42n], "length == 4, begin == 1, end == -1");
+ testRes(sample.slice(1, -2), [41n], "length == 4, begin == 1, end == -2");
+ testRes(sample.slice(2, -1), [42n], "length == 4, begin == 2, end == -1");
+
+ testRes(sample.slice(-1, 5), [43n], "begin == -1, end > length");
+ testRes(sample.slice(-2, 4), [42n, 43n], "begin == -2, end > length");
+ testRes(sample.slice(-3, 4), [41n, 42n, 43n], "begin == -3, end > length");
+});
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/results-with-empty-length.js b/test/built-ins/TypedArray/prototype/slice/BigInt/results-with-empty-length.js
new file mode 100644
index 000000000..901805a84
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/results-with-empty-length.js
@@ -0,0 +1,52 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: slice may return a new empty instance
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([40n, 41n, 42n, 43n]);
+
+ function testRes(result, msg) {
+ assert.sameValue(result.length, 0, msg);
+ assert.sameValue(
+ result.hasOwnProperty(0),
+ false,
+ msg + " & result.hasOwnProperty(0) === false"
+ );
+ }
+
+ testRes(sample.slice(4), "begin == length");
+ testRes(sample.slice(5), "begin > length");
+
+ testRes(sample.slice(4, 4), "begin == length, end == length");
+ testRes(sample.slice(5, 4), "begin > length, end == length");
+
+ testRes(sample.slice(4, 5), "begin == length, end > length");
+ testRes(sample.slice(5, 5), "begin > length, end > length");
+
+ testRes(sample.slice(0, 0), "begin == 0, end == 0");
+ testRes(sample.slice(-0, -0), "begin == -0, end == -0");
+ testRes(sample.slice(1, 0), "begin > 0, end == 0");
+ testRes(sample.slice(-1, 0), "being < 0, end == 0");
+
+ testRes(sample.slice(2, 1), "begin > 0, begin < length, begin > end, end > 0");
+ testRes(sample.slice(2, 2), "begin > 0, begin < length, begin == end");
+
+ testRes(sample.slice(2, -2), "begin > 0, begin < length, end == -2");
+
+ testRes(sample.slice(-1, -1), "length = 4, begin == -1, end == -1");
+ testRes(sample.slice(-1, -2), "length = 4, begin == -1, end == -2");
+ testRes(sample.slice(-2, -2), "length = 4, begin == -2, end == -2");
+
+ testRes(sample.slice(0, -4), "begin == 0, end == -length");
+ testRes(sample.slice(-4, -4), "begin == -length, end == -length");
+ testRes(sample.slice(-5, -4), "begin < -length, end == -length");
+
+ testRes(sample.slice(0, -5), "begin == 0, end < -length");
+ testRes(sample.slice(-4, -5), "begin == -length, end < -length");
+ testRes(sample.slice(-5, -5), "begin < -length, end < -length");
+});
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/results-with-same-length.js b/test/built-ins/TypedArray/prototype/slice/BigInt/results-with-same-length.js
new file mode 100644
index 000000000..c351ef086
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/results-with-same-length.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: slice may return a new instance with the same length
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([40n, 41n, 42n, 43n]);
+
+ function testRes(result, msg) {
+ assert.sameValue(result.length, 4, msg);
+ assert.sameValue(result[0], 40n, msg + " & result[0] === 40");
+ assert.sameValue(result[1], 41n, msg + " & result[1] === 41");
+ assert.sameValue(result[2], 42n, msg + " & result[2] === 42");
+ assert.sameValue(result[3], 43n, msg + " & result[3] === 43");
+ }
+
+ testRes(sample.slice(0), "begin == 0");
+ testRes(sample.slice(-4), "begin == -srcLength");
+ testRes(sample.slice(-5), "begin < -srcLength");
+
+ testRes(sample.slice(0, 4), "begin == 0, end == srcLength");
+ testRes(sample.slice(-4, 4), "begin == -srcLength, end == srcLength");
+ testRes(sample.slice(-5, 4), "begin < -srcLength, end == srcLength");
+
+ testRes(sample.slice(0, 5), "begin == 0, end > srcLength");
+ testRes(sample.slice(-4, 5), "begin == -srcLength, end > srcLength");
+ testRes(sample.slice(-5, 5), "begin < -srcLength, end > srcLength");
+});
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/return-abrupt-from-end-symbol.js b/test/built-ins/TypedArray/prototype/slice/BigInt/return-abrupt-from-end-symbol.js
new file mode 100644
index 000000000..c0ec87e5a
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/return-abrupt-from-end-symbol.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: Return abrupt from ToInteger(end), end is symbol
+info: |
+ 22.2.3.24 %TypedArray%.prototype.slice ( start, end )
+
+ ...
+ 6. If end is undefined, let relativeEnd be len; else let relativeEnd be ?
+ ToInteger(end).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var s = Symbol("1");
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA();
+
+ assert.throws(TypeError, function() {
+ sample.slice(0, s);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/return-abrupt-from-end.js b/test/built-ins/TypedArray/prototype/slice/BigInt/return-abrupt-from-end.js
new file mode 100644
index 000000000..9fa211798
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/return-abrupt-from-end.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: Return abrupt from ToInteger(end)
+info: |
+ 22.2.3.24 %TypedArray%.prototype.slice ( start, end )
+
+ ...
+ 6. If end is undefined, let relativeEnd be len; else let relativeEnd be ?
+ ToInteger(end).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var o1 = {
+ valueOf: function() {
+ throw new Test262Error();
+ }
+};
+
+var o2 = {
+ toString: function() {
+ throw new Test262Error();
+ }
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA();
+
+ assert.throws(Test262Error, function() {
+ sample.slice(0, o1);
+ });
+
+ assert.throws(Test262Error, function() {
+ sample.slice(0, o2);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/return-abrupt-from-start-symbol.js b/test/built-ins/TypedArray/prototype/slice/BigInt/return-abrupt-from-start-symbol.js
new file mode 100644
index 000000000..6e003f8df
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/return-abrupt-from-start-symbol.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: Return abrupt from ToInteger(start), start is symbol
+info: |
+ 22.2.3.24 %TypedArray%.prototype.slice ( start, end )
+
+ ...
+ 4. Let relativeStart be ? ToInteger(start).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var s = Symbol("1");
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA();
+
+ assert.throws(TypeError, function() {
+ sample.slice(s);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/return-abrupt-from-start.js b/test/built-ins/TypedArray/prototype/slice/BigInt/return-abrupt-from-start.js
new file mode 100644
index 000000000..3b79f1375
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/return-abrupt-from-start.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: Return abrupt from ToInteger(start)
+info: |
+ 22.2.3.24 %TypedArray%.prototype.slice ( start, end )
+
+ ...
+ 4. Let relativeStart be ? ToInteger(start).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var o1 = {
+ valueOf: function() {
+ throw new Test262Error();
+ }
+};
+
+var o2 = {
+ toString: function() {
+ throw new Test262Error();
+ }
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA();
+
+ assert.throws(Test262Error, function() {
+ sample.slice(o1);
+ });
+
+ assert.throws(Test262Error, function() {
+ sample.slice(o2);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/set-values-from-different-ctor-type.js b/test/built-ins/TypedArray/prototype/slice/BigInt/set-values-from-different-ctor-type.js
new file mode 100644
index 000000000..53ee40eba
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/set-values-from-different-ctor-type.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: >
+ Perform regular set if target's uses a different element type
+info: |
+ 22.2.3.24 %TypedArray%.prototype.slice ( start, end )
+
+ ...
+ 9. Let A be ? TypedArraySpeciesCreate(O, « count »).
+ 10. Let srcName be the String value of O's [[TypedArrayName]] internal slot.
+ 11. Let srcType be the String value of the Element Type value in Table 50 for
+ srcName.
+ 12. Let targetName be the String value of A's [[TypedArrayName]] internal
+ slot.
+ 13. Let targetType be the String value of the Element Type value in Table 50
+ for targetName.
+ 14. If SameValue(srcType, targetType) is false, then
+ a. Let n be 0.
+ b. Repeat, while k < final
+ i. Let Pk be ! ToString(k).
+ ii. Let kValue be ? Get(O, Pk).
+ iii. Perform ? Set(A, ! ToString(n), kValue, true).
+ iv. Increase k by 1.
+ v. Increase n by 1.
+ ...
+ 16. Return A
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, Symbol.species, TypedArray]
+---*/
+
+var arr = [42n, 43n, 44n];
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(arr);
+ var other = TA === BigInt64Array ? BigUint64Array : BigInt64Array;
+
+ sample.constructor = {};
+ sample.constructor[Symbol.species] = other;
+
+ var result = sample.slice();
+
+ assert(compareArray(result, arr), "values are set");
+ assert.notSameValue(result.buffer, sample.buffer, "creates a new buffer");
+ assert.sameValue(result.constructor, other, "used the custom ctor");
+});
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor-abrupt.js b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor-abrupt.js
new file mode 100644
index 000000000..2a30c8664
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor-abrupt.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: Return abrupt from SpeciesConstructor's get Constructor
+info: |
+ 22.2.3.24 %TypedArray%.prototype.slice ( start, end )
+
+ ...
+ 9. Let A be ? TypedArraySpeciesCreate(O, « count »).
+ ...
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor).
+ ...
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+
+ 1. Assert: Type(O) is Object.
+ 2. Let C be ? Get(O, "constructor").
+ 3. If C is undefined, return defaultConstructor.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([40n, 41n, 42n, 43n]);
+
+ Object.defineProperty(sample, "constructor", {
+ get: function() {
+ throw new Test262Error();
+ }
+ });
+
+ assert.throws(Test262Error, function() {
+ sample.slice();
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor-inherited.js b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor-inherited.js
new file mode 100644
index 000000000..d686fe084
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor-inherited.js
@@ -0,0 +1,62 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: get inherited constructor on SpeciesConstructor
+info: |
+ 22.2.3.24 %TypedArray%.prototype.slice ( start, end )
+
+ ...
+ 9. Let A be ? TypedArraySpeciesCreate(O, « count »).
+ ...
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor).
+ ...
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+
+ 1. Assert: Type(O) is Object.
+ 2. Let C be ? Get(O, "constructor").
+ 3. If C is undefined, return defaultConstructor.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([40n, 41n, 42n, 43n]);
+ var calls = 0;
+ var result;
+
+ Object.defineProperty(TA.prototype, "constructor", {
+ get: function() {
+ calls++;
+ }
+ });
+
+ result = sample.slice();
+
+ assert.sameValue(calls, 1, "called custom ctor get accessor once");
+
+ assert.sameValue(
+ Object.getPrototypeOf(result),
+ Object.getPrototypeOf(sample),
+ "use defaultCtor on an undefined return - getPrototypeOf check"
+ );
+ assert.sameValue(
+ result.constructor,
+ undefined,
+ "used defaultCtor but still checks the inherited .constructor"
+ );
+
+ calls = 6;
+ result.constructor;
+ assert.sameValue(
+ calls,
+ 7,
+ "result.constructor triggers the inherited accessor property"
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor-returns-throws.js b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor-returns-throws.js
new file mode 100644
index 000000000..6c2a4b88f
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor-returns-throws.js
@@ -0,0 +1,63 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: >
+ Throws if O.constructor returns a non-Object and non-undefined value
+info: |
+ 22.2.3.24 %TypedArray%.prototype.slice ( start, end )
+
+ ...
+ 9. Let A be ? TypedArraySpeciesCreate(O, « count »).
+ ...
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor).
+ ...
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+
+ 1. Assert: Type(O) is Object.
+ 2. Let C be ? Get(O, "constructor").
+ 3. If C is undefined, return defaultConstructor.
+ 4. If Type(C) is not Object, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([40n, 41n, 42n, 43n]);
+
+ sample.constructor = 42;
+ assert.throws(TypeError, function() {
+ sample.slice();
+ }, "42");
+
+ sample.constructor = "1";
+ assert.throws(TypeError, function() {
+ sample.slice();
+ }, "string");
+
+ sample.constructor = null;
+ assert.throws(TypeError, function() {
+ sample.slice();
+ }, "null");
+
+ sample.constructor = NaN;
+ assert.throws(TypeError, function() {
+ sample.slice();
+ }, "NaN");
+
+ sample.constructor = false;
+ assert.throws(TypeError, function() {
+ sample.slice();
+ }, "false");
+
+ sample.constructor = Symbol("1");
+ assert.throws(TypeError, function() {
+ sample.slice();
+ }, "symbol");
+});
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor.js b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor.js
new file mode 100644
index 000000000..9d35910e5
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor.js
@@ -0,0 +1,54 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: get constructor on SpeciesConstructor
+info: |
+ 22.2.3.24 %TypedArray%.prototype.slice ( start, end )
+
+ ...
+ 9. Let A be ? TypedArraySpeciesCreate(O, « count »).
+ ...
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor).
+ ...
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+
+ 1. Assert: Type(O) is Object.
+ 2. Let C be ? Get(O, "constructor").
+ 3. If C is undefined, return defaultConstructor.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([40n, 41n, 42n, 43n]);
+ var calls = 0;
+ var result;
+
+ Object.defineProperty(sample, "constructor", {
+ get: function() {
+ calls++;
+ }
+ });
+
+ result = sample.slice();
+
+ assert.sameValue(calls, 1, "called custom ctor get accessor once");
+
+ assert.sameValue(
+ Object.getPrototypeOf(result),
+ Object.getPrototypeOf(sample),
+ "use defaultCtor on an undefined return - getPrototypeOf check"
+ );
+ assert.sameValue(
+ result.constructor,
+ TA,
+ "use defaultCtor on an undefined return - .constructor check"
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-abrupt.js b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-abrupt.js
new file mode 100644
index 000000000..74de9aceb
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-abrupt.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: >
+ Returns abrupt from get @@species on found constructor
+info: |
+ 22.2.3.24 %TypedArray%.prototype.slice ( start, end )
+
+ ...
+ 9. Let A be ? TypedArraySpeciesCreate(O, « count »).
+ ...
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor).
+ ...
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+
+ 1. Assert: Type(O) is Object.
+ 2. Let C be ? Get(O, "constructor").
+ ...
+ 5. Let S be ? Get(C, @@species).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol.species, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(2);
+
+ sample.constructor = {};
+
+ Object.defineProperty(sample.constructor, Symbol.species, {
+ get: function() {
+ throw new Test262Error();
+ }
+ });
+
+ assert.throws(Test262Error, function() {
+ sample.slice();
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-invocation.js b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-invocation.js
new file mode 100644
index 000000000..11ddad9e1
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-invocation.js
@@ -0,0 +1,59 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: >
+ Verify arguments on custom @@species construct call
+info: |
+ 22.2.3.24 %TypedArray%.prototype.slice ( start, end )
+
+ ...
+ 9. Let A be ? TypedArraySpeciesCreate(O, « count »).
+ ...
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor).
+ 4. Return ? TypedArrayCreate(constructor, argumentList).
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+
+ ...
+ 5. Let S be ? Get(C, @@species).
+ ...
+ 7. If IsConstructor(S) is true, return S.
+ ...
+
+ 22.2.4.6 TypedArrayCreate ( constructor, argumentList )
+
+ 1. Let newTypedArray be ? Construct(constructor, argumentList).
+ 2. Perform ? ValidateTypedArray(newTypedArray).
+ 3. If argumentList is a List of a single Number, then
+ ...
+ 4. Return newTypedArray.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol.species, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([40n, 41n, 42n]);
+ var result, ctorThis;
+
+ sample.constructor = {};
+ sample.constructor[Symbol.species] = function(count) {
+ result = arguments;
+ ctorThis = this;
+ return new TA(count);
+ };
+
+ sample.slice(1);
+
+ assert.sameValue(result.length, 1, "called with 1 arguments");
+ assert.sameValue(result[0], 2, "[0] is the new length count");
+
+ assert(
+ ctorThis instanceof sample.constructor[Symbol.species],
+ "`this` value in the @@species fn is an instance of the function itself"
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-length-throws.js b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-length-throws.js
new file mode 100644
index 000000000..6f699c2d3
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-length-throws.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: >
+ Throws a TypeError if new typedArray's length < count
+info: |
+ 22.2.3.24 %TypedArray%.prototype.slice ( start, end )
+
+ ...
+ 9. Let A be ? TypedArraySpeciesCreate(O, « count »).
+ ...
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 4. Return ? TypedArrayCreate(constructor, argumentList).
+
+ 22.2.4.6 TypedArrayCreate ( constructor, argumentList )
+
+ ...
+ 3. If argumentList is a List of a single Number, then
+ a. If the value of newTypedArray's [[ArrayLength]] internal slot <
+ argumentList[0], throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol.species, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(2);
+
+ sample.constructor = {};
+ sample.constructor[Symbol.species] = function() {
+ return new TA();
+ };
+
+ assert.throws(TypeError, function() {
+ sample.slice();
+ });
+}); \ No newline at end of file
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-length.js b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-length.js
new file mode 100644
index 000000000..5159487ae
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-length.js
@@ -0,0 +1,46 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: >
+ Does not throw a TypeError if new typedArray's length >= count
+info: |
+ 22.2.3.24 %TypedArray%.prototype.slice ( start, end )
+
+ ...
+ 9. Let A be ? TypedArraySpeciesCreate(O, « count »).
+ ...
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 4. Return ? TypedArrayCreate(constructor, argumentList).
+
+ 22.2.4.6 TypedArrayCreate ( constructor, argumentList )
+
+ ...
+ 3. If argumentList is a List of a single Number, then
+ a. If the value of newTypedArray's [[ArrayLength]] internal slot <
+ argumentList[0], throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol.species, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(2);
+ var customCount, result;
+
+ sample.constructor = {};
+ sample.constructor[Symbol.species] = function() {
+ return new TA(customCount);
+ };
+
+ customCount = 2;
+ result = sample.slice();
+ assert.sameValue(result.length, customCount, "length == count");
+
+ customCount = 5;
+ result = sample.slice();
+ assert.sameValue(result.length, customCount, "length > count");
+}); \ No newline at end of file
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js
new file mode 100644
index 000000000..81be8cd76
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js
@@ -0,0 +1,53 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: >
+ Custom @@species constructor may return a totally different TypedArray
+info: |
+ 22.2.3.24 %TypedArray%.prototype.slice ( start, end )
+
+ ...
+ 9. Let A be ? TypedArraySpeciesCreate(O, « count »).
+ ...
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor).
+ 4. Return ? TypedArrayCreate(constructor, argumentList).
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+
+ ...
+ 5. Let S be ? Get(C, @@species).
+ ...
+ 7. If IsConstructor(S) is true, return S.
+ ...
+
+ 22.2.4.6 TypedArrayCreate ( constructor, argumentList )
+
+ 1. Let newTypedArray be ? Construct(constructor, argumentList).
+ 2. Perform ? ValidateTypedArray(newTypedArray).
+ 3. If argumentList is a List of a single Number, then
+ ...
+ 4. Return newTypedArray.
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, Symbol.species, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([40n]);
+ var other = new Int8Array([1, 0, 1]);
+ var result;
+
+ sample.constructor = {};
+ sample.constructor[Symbol.species] = function() {
+ return other;
+ };
+
+ result = sample.slice(0, 0);
+
+ assert.sameValue(result, other, "returned another typedarray");
+ assert(compareArray(result, [1, 0, 1]), "the returned object is preserved");
+});
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-throws.js b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-throws.js
new file mode 100644
index 000000000..e35f1af62
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-throws.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: >
+ Custom @@species constructor throws if it does not return a compatible object
+info: |
+ 22.2.3.24 %TypedArray%.prototype.slice ( start, end )
+
+ ...
+ 9. Let A be ? TypedArraySpeciesCreate(O, « count »).
+ ...
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor).
+ 4. Return ? TypedArrayCreate(constructor, argumentList).
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+
+ ...
+ 5. Let S be ? Get(C, @@species).
+ ...
+ 7. If IsConstructor(S) is true, return S.
+ ...
+
+ 22.2.4.6 TypedArrayCreate ( constructor, argumentList )
+
+ 1. Let newTypedArray be ? Construct(constructor, argumentList).
+ 2. Perform ? ValidateTypedArray(newTypedArray).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol.species, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(2);
+ var ctor = function() {};
+
+ sample.constructor = {};
+ sample.constructor[Symbol.species] = ctor;
+
+ assert.throws(TypeError, function() {
+ sample.slice();
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor.js b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor.js
new file mode 100644
index 000000000..5965ce367
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor.js
@@ -0,0 +1,54 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: >
+ Use custom @@species constructor if available
+info: |
+ 22.2.3.24 %TypedArray%.prototype.slice ( start, end )
+
+ ...
+ 9. Let A be ? TypedArraySpeciesCreate(O, « count »).
+ ...
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor).
+ 4. Return ? TypedArrayCreate(constructor, argumentList).
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+
+ ...
+ 5. Let S be ? Get(C, @@species).
+ ...
+ 7. If IsConstructor(S) is true, return S.
+ ...
+
+ 22.2.4.6 TypedArrayCreate ( constructor, argumentList )
+
+ 1. Let newTypedArray be ? Construct(constructor, argumentList).
+ 2. Perform ? ValidateTypedArray(newTypedArray).
+ 3. If argumentList is a List of a single Number, then
+ ...
+ 4. Return newTypedArray.
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, Symbol.species, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([40n, 41n, 42n]);
+ var calls = 0;
+ var result;
+
+ sample.constructor = {};
+ sample.constructor[Symbol.species] = function(count) {
+ calls++;
+ return new TA(count);
+ };
+
+ result = sample.slice(1);
+
+ assert.sameValue(calls, 1, "ctor called once");
+ assert(compareArray(result, [41n, 42n]), "expected object");
+});
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-returns-throws.js b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-returns-throws.js
new file mode 100644
index 000000000..a24ba5a52
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-returns-throws.js
@@ -0,0 +1,66 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: >
+ Throws if returned @@species is not a constructor, null or undefined.
+info: |
+ 22.2.3.24 %TypedArray%.prototype.slice ( start, end )
+
+ ...
+ 9. Let A be ? TypedArraySpeciesCreate(O, « count »).
+ ...
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor).
+ ...
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+
+ ...
+ 5. Let S be ? Get(C, @@species).
+ 6. If S is either undefined or null, return defaultConstructor.
+ 7. If IsConstructor(S) is true, return S.
+ 8. Throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol.species, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(2);
+
+ sample.constructor = {};
+
+ sample.constructor[Symbol.species] = 0;
+ assert.throws(TypeError, function() {
+ sample.slice();
+ }, "0");
+
+ sample.constructor[Symbol.species] = "string";
+ assert.throws(TypeError, function() {
+ sample.slice();
+ }, "string");
+
+ sample.constructor[Symbol.species] = {};
+ assert.throws(TypeError, function() {
+ sample.slice();
+ }, "{}");
+
+ sample.constructor[Symbol.species] = NaN;
+ assert.throws(TypeError, function() {
+ sample.slice();
+ }, "NaN");
+
+ sample.constructor[Symbol.species] = false;
+ assert.throws(TypeError, function() {
+ sample.slice();
+ }, "false");
+
+ sample.constructor[Symbol.species] = true;
+ assert.throws(TypeError, function() {
+ sample.slice();
+ }, "true");
+});
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-use-default-ctor.js b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-use-default-ctor.js
new file mode 100644
index 000000000..4429f6336
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-use-default-ctor.js
@@ -0,0 +1,54 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: >
+ Use defaultConstructor if @@species is either undefined or null
+info: |
+ 22.2.3.24 %TypedArray%.prototype.slice ( start, end )
+
+ ...
+ 9. Let A be ? TypedArraySpeciesCreate(O, « count »).
+ ...
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor).
+ ...
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+
+ ...
+ 5. Let S be ? Get(C, @@species).
+ 6. If S is either undefined or null, return defaultConstructor.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol.species, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(2);
+ var result;
+
+ sample.constructor = {};
+
+ result = sample.slice();
+
+ assert.sameValue(
+ Object.getPrototypeOf(result),
+ Object.getPrototypeOf(sample),
+ "undefined @@species - prototype check "
+ );
+ assert.sameValue(result.constructor, TA, "undefined @@species - ctor check");
+
+ sample.constructor[Symbol.species] = null;
+ result = sample.slice();
+
+ assert.sameValue(
+ Object.getPrototypeOf(result),
+ Object.getPrototypeOf(sample),
+ "null @@species - prototype check "
+ );
+ assert.sameValue(result.constructor, TA, "null @@species - ctor check");
+});
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species.js b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species.js
new file mode 100644
index 000000000..a2cf9e131
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species.js
@@ -0,0 +1,46 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: >
+ get @@species from found constructor
+info: |
+ 22.2.3.24 %TypedArray%.prototype.slice ( start, end )
+
+ ...
+ 9. Let A be ? TypedArraySpeciesCreate(O, « count »).
+ ...
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor).
+ ...
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+
+ 1. Assert: Type(O) is Object.
+ 2. Let C be ? Get(O, "constructor").
+ ...
+ 5. Let S be ? Get(C, @@species).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol.species, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(2);
+ var calls = 0;
+
+ sample.constructor = {};
+
+ Object.defineProperty(sample.constructor, Symbol.species, {
+ get: function() {
+ calls++;
+ }
+ });
+
+ sample.slice();
+
+ assert.sameValue(calls, 1);
+});
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/slice/BigInt/this-is-not-object.js
new file mode 100644
index 000000000..a16cf1c8c
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/this-is-not-object.js
@@ -0,0 +1,52 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: Throws a TypeError exception when `this` is not Object
+info: |
+ 22.2.3.24 %TypedArray%.prototype.slice ( start, end )
+
+ The following steps are taken:
+
+ 1. Let O be the this value.
+ 2. Perform ? ValidateTypedArray(O).
+ ...
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var slice = TypedArray.prototype.slice;
+
+assert.throws(TypeError, function() {
+ slice.call(undefined, 0, 0);
+}, "this is undefined");
+
+assert.throws(TypeError, function() {
+ slice.call(null, 0, 0);
+}, "this is null");
+
+assert.throws(TypeError, function() {
+ slice.call(42, 0, 0);
+}, "this is 42");
+
+assert.throws(TypeError, function() {
+ slice.call("1", 0, 0);
+}, "this is a string");
+
+assert.throws(TypeError, function() {
+ slice.call(true, 0, 0);
+}, "this is true");
+
+assert.throws(TypeError, function() {
+ slice.call(false, 0, 0);
+}, "this is false");
+
+var s = Symbol("s");
+assert.throws(TypeError, function() {
+ slice.call(s, 0, 0);
+}, "this is a Symbol");
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/slice/BigInt/this-is-not-typedarray-instance.js
new file mode 100644
index 000000000..ad429c8a1
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/this-is-not-typedarray-instance.js
@@ -0,0 +1,44 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: >
+ Throws a TypeError exception when `this` is not a TypedArray instance
+info: |
+ 22.2.3.24 %TypedArray%.prototype.slice ( start, end )
+
+ The following steps are taken:
+
+ 1. Let O be the this value.
+ 2. Perform ? ValidateTypedArray(O).
+ ...
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var slice = TypedArray.prototype.slice;
+
+assert.throws(TypeError, function() {
+ slice.call({}, 0, 0);
+}, "this is an Object");
+
+assert.throws(TypeError, function() {
+ slice.call([], 0, 0);
+}, "this is an Array");
+
+var ab = new ArrayBuffer(8);
+assert.throws(TypeError, function() {
+ slice.call(ab, 0, 0);
+}, "this is an ArrayBuffer instance");
+
+var dv = new DataView(new ArrayBuffer(8), 0, 1);
+assert.throws(TypeError, function() {
+ slice.call(dv, 0, 0);
+}, "this is a DataView instance");
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/tointeger-end.js b/test/built-ins/TypedArray/prototype/slice/BigInt/tointeger-end.js
new file mode 100644
index 000000000..b43e92dc1
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/tointeger-end.js
@@ -0,0 +1,48 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: ToInteger(end)
+info: |
+ 22.2.3.24 %TypedArray%.prototype.slice( start , end )
+
+ ...
+ 6. If end is undefined, let relativeEnd be len; else let relativeEnd be ?
+ ToInteger(end).
+ ...
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var obj = {
+ valueOf: function() {
+ return 2;
+ }
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([40n, 41n, 42n, 43n]);
+
+ assert(compareArray(sample.slice(0, false), []), "false");
+ assert(compareArray(sample.slice(0, true), [40n]), "true");
+
+ assert(compareArray(sample.slice(0, NaN), []), "NaN");
+ assert(compareArray(sample.slice(0, null), []), "null");
+ assert(compareArray(sample.slice(0, undefined), [40n, 41n, 42n, 43n]), "undefined");
+
+ assert(compareArray(sample.slice(0, 0.6), []), "0.6");
+ assert(compareArray(sample.slice(0, 1.1), [40n]), "1.1");
+ assert(compareArray(sample.slice(0, 1.5), [40n]), "1.5");
+ assert(compareArray(sample.slice(0, -0.6), []), "-0.6");
+ assert(compareArray(sample.slice(0, -1.1), [40n, 41n, 42n]), "-1.1");
+ assert(compareArray(sample.slice(0, -1.5), [40n, 41n, 42n]), "-1.5");
+
+ assert(compareArray(sample.slice(0, "3"), [40n, 41n, 42n]), "string");
+ assert(
+ compareArray(
+ sample.slice(0, obj),
+ [40n, 41n]
+ ),
+ "object"
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/tointeger-start.js b/test/built-ins/TypedArray/prototype/slice/BigInt/tointeger-start.js
new file mode 100644
index 000000000..3b5bb606c
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/slice/BigInt/tointeger-start.js
@@ -0,0 +1,48 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.slice
+description: ToInteger(begin)
+info: |
+ 22.2.3.24 %TypedArray%.prototype.slice ( start, end )
+
+ ...
+ 4. Let relativeStart be ? ToInteger(start).
+ ...
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var obj = {
+ valueOf: function() {
+ return 2;
+ }
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([40n, 41n, 42n, 43n]);
+
+ assert(compareArray(sample.slice(false), [40n, 41n, 42n, 43n]), "false");
+ assert(compareArray(sample.slice(true), [41n, 42n, 43n]), "true");
+
+ assert(compareArray(sample.slice(NaN), [40n, 41n, 42n, 43n]), "NaN");
+ assert(compareArray(sample.slice(null), [40n, 41n, 42n, 43n]), "null");
+ assert(compareArray(sample.slice(undefined), [40n, 41n, 42n, 43n]), "undefined");
+
+ assert(compareArray(sample.slice(1.1), [41n, 42n, 43n]), "1.1");
+ assert(compareArray(sample.slice(1.5), [41n, 42n, 43n]), "1.5");
+ assert(compareArray(sample.slice(0.6), [40n, 41n, 42n, 43n]), "0.6");
+
+ assert(compareArray(sample.slice(-1.5), [43n]), "-1.5");
+ assert(compareArray(sample.slice(-1.1), [43n]), "-1.1");
+ assert(compareArray(sample.slice(-0.6), [40n, 41n, 42n, 43n]), "-0.6");
+
+ assert(compareArray(sample.slice("3"), [43n]), "string");
+ assert(
+ compareArray(
+ sample.slice(obj),
+ [42n, 43n]
+ ),
+ "object"
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/slice/bit-precision.js b/test/built-ins/TypedArray/prototype/slice/bit-precision.js
index 07c7e1fbb..6f86ad033 100644
--- a/test/built-ins/TypedArray/prototype/slice/bit-precision.js
+++ b/test/built-ins/TypedArray/prototype/slice/bit-precision.js
@@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.slice
-es6id: 22.2.3.23
description: Preservation of bit-level encoding
info: |
[...]
@@ -22,6 +21,7 @@ info: |
iii. Increase srcByteIndex by 1.
iv. Increase targetByteIndex by 1.
includes: [nans.js, compareArray.js, testTypedArray.js]
+features: [TypedArray]
---*/
function body(FloatArray) {
diff --git a/test/built-ins/TypedArray/prototype/slice/invoked-as-func.js b/test/built-ins/TypedArray/prototype/slice/invoked-as-func.js
index dca485714..564bad96e 100644
--- a/test/built-ins/TypedArray/prototype/slice/invoked-as-func.js
+++ b/test/built-ins/TypedArray/prototype/slice/invoked-as-func.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.23
+esid: sec-%typedarray%.prototype.slice
description: Throws a TypeError exception when invoked as a function
info: |
22.2.3.23 %TypedArray%.prototype.slice ( start, end )
diff --git a/test/built-ins/TypedArray/prototype/slice/invoked-as-method.js b/test/built-ins/TypedArray/prototype/slice/invoked-as-method.js
index 90e03f2f2..ab5941dcc 100644
--- a/test/built-ins/TypedArray/prototype/slice/invoked-as-method.js
+++ b/test/built-ins/TypedArray/prototype/slice/invoked-as-method.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.23
+esid: sec-%typedarray%.prototype.slice
description: Requires a [[TypedArrayName]] internal slot.
info: |
22.2.3.23 %TypedArray%.prototype.slice ( start, end )
diff --git a/test/built-ins/TypedArray/prototype/slice/length.js b/test/built-ins/TypedArray/prototype/slice/length.js
index 50b4cf8a9..a33abd745 100644
--- a/test/built-ins/TypedArray/prototype/slice/length.js
+++ b/test/built-ins/TypedArray/prototype/slice/length.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.23
+esid: sec-%typedarray%.prototype.slice
description: >
%TypedArray%.prototype.slice.length is 2.
info: |
@@ -20,6 +20,7 @@ info: |
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
[[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.slice.length, 2);
diff --git a/test/built-ins/TypedArray/prototype/slice/name.js b/test/built-ins/TypedArray/prototype/slice/name.js
index a2849cf78..69d319918 100644
--- a/test/built-ins/TypedArray/prototype/slice/name.js
+++ b/test/built-ins/TypedArray/prototype/slice/name.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.23
+esid: sec-%typedarray%.prototype.slice
description: >
%TypedArray%.prototype.slice.name is "slice".
info: |
@@ -17,6 +17,7 @@ info: |
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.slice.name, "slice");
diff --git a/test/built-ins/TypedArray/prototype/slice/prop-desc.js b/test/built-ins/TypedArray/prototype/slice/prop-desc.js
index afd6a374c..ad27545fc 100644
--- a/test/built-ins/TypedArray/prototype/slice/prop-desc.js
+++ b/test/built-ins/TypedArray/prototype/slice/prop-desc.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.23
+esid: sec-%typedarray%.prototype.slice
description: >
"slice" property of TypedArrayPrototype
info: |
@@ -9,6 +9,7 @@ info: |
and in Annex B.2 has the attributes { [[Writable]]: true,
[[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
var TypedArrayPrototype = TypedArray.prototype;
diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-arguments-with-thisarg.js b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-arguments-with-thisarg.js
new file mode 100644
index 000000000..737691cf6
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-arguments-with-thisarg.js
@@ -0,0 +1,57 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.some
+description: >
+ thisArg does not affect callbackfn arguments
+info: |
+ 22.2.3.25 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] )
+
+ %TypedArray%.prototype.some is a distinct function that implements the same
+ algorithm as Array.prototype.some as defined in 22.1.3.24 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length".
+
+ 22.1.3.24 Array.prototype.some ( callbackfn [ , thisArg ] )
+
+ ...
+ 4. If thisArg was supplied, let T be thisArg; else let T be undefined.
+ ...
+ 6. Repeat, while k < len
+ ...
+ c. If kPresent is true, then
+ i. Let kValue be ? Get(O, Pk).
+ ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n, 44n]);
+
+ var results = [];
+ var thisArg = ["test262", 0, "ecma262", 0];
+
+ sample.some(function() {
+ results.push(arguments);
+ }, thisArg);
+
+ assert.sameValue(results.length, 3, "results.length");
+ assert.sameValue(thisArg.length, 4, "thisArg.length");
+
+ assert.sameValue(results[0].length, 3, "results[0].length");
+ assert.sameValue(results[0][0], 42n, "results[0][0] - kValue");
+ assert.sameValue(results[0][1], 0, "results[0][1] - k");
+ assert.sameValue(results[0][2], sample, "results[0][2] - this");
+
+ assert.sameValue(results[1].length, 3, "results[1].length");
+ assert.sameValue(results[1][0], 43n, "results[1][0] - kValue");
+ assert.sameValue(results[1][1], 1, "results[1][1] - k");
+ assert.sameValue(results[1][2], sample, "results[1][2] - this");
+
+ assert.sameValue(results[2].length, 3, "results[2].length");
+ assert.sameValue(results[2][0], 44n, "results[2][0] - kValue");
+ assert.sameValue(results[2][1], 2, "results[2][1] - k");
+ assert.sameValue(results[2][2], sample, "results[2][2] - this");
+});
diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-arguments-without-thisarg.js b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-arguments-without-thisarg.js
new file mode 100644
index 000000000..08f138ace
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-arguments-without-thisarg.js
@@ -0,0 +1,55 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.some
+description: >
+ callbackfn arguments
+info: |
+ 22.2.3.25 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] )
+
+ %TypedArray%.prototype.some is a distinct function that implements the same
+ algorithm as Array.prototype.some as defined in 22.1.3.24 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length".
+
+ 22.1.3.24 Array.prototype.some ( callbackfn [ , thisArg ] )
+
+ ...
+ 4. If thisArg was supplied, let T be thisArg; else let T be undefined.
+ ...
+ 6. Repeat, while k < len
+ ...
+ c. If kPresent is true, then
+ i. Let kValue be ? Get(O, Pk).
+ ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n, 44n]);
+
+ var results = [];
+
+ sample.some(function() {
+ results.push(arguments);
+ });
+
+ assert.sameValue(results.length, 3, "results.length");
+
+ assert.sameValue(results[0].length, 3, "results[0].length");
+ assert.sameValue(results[0][0], 42n, "results[0][0] - kValue");
+ assert.sameValue(results[0][1], 0, "results[0][1] - k");
+ assert.sameValue(results[0][2], sample, "results[0][2] - this");
+
+ assert.sameValue(results[1].length, 3, "results[1].length");
+ assert.sameValue(results[1][0], 43n, "results[1][0] - kValue");
+ assert.sameValue(results[1][1], 1, "results[1][1] - k");
+ assert.sameValue(results[1][2], sample, "results[1][2] - this");
+
+ assert.sameValue(results[2].length, 3, "results[2].length");
+ assert.sameValue(results[2][0], 44n, "results[2][0] - kValue");
+ assert.sameValue(results[2][1], 2, "results[2][1] - k");
+ assert.sameValue(results[2][2], sample, "results[2][2] - this");
+});
diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-detachbuffer.js
new file mode 100644
index 000000000..9d504d2e3
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-detachbuffer.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.some
+description: >
+ Instance buffer can be detached during loop
+info: |
+ 22.2.3.25 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] )
+
+ %TypedArray%.prototype.some is a distinct function that implements the same
+ algorithm as Array.prototype.some as defined in 22.1.3.24 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length".
+
+ 22.1.3.24 Array.prototype.some ( callbackfn [ , thisArg ] )
+
+ ...
+ 6. Repeat, while k < len
+ ...
+ c. If kPresent is true, then
+ i. Let kValue be ? Get(O, Pk).
+ ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)).
+ ...
+includes: [detachArrayBuffer.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var loops = 0;
+ var sample = new TA(2);
+
+ assert.throws(TypeError, function() {
+ sample.some(function() {
+ if (loops === 1) {
+ throw new Test262Error("callbackfn called twice");
+ }
+ $DETACHBUFFER(sample.buffer);
+ loops++;
+ });
+ });
+
+ assert.sameValue(loops, 1);
+});
diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-no-interaction-over-non-integer.js b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-no-interaction-over-non-integer.js
new file mode 100644
index 000000000..df9b85c7c
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-no-interaction-over-non-integer.js
@@ -0,0 +1,40 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.some
+description: >
+ Does not interact over non-integer properties
+info: |
+ 22.2.3.7 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] )
+
+ ...
+ 6. Repeat, while k < len
+ ...
+ c. If kPresent is true, then
+ i. Let kValue be ? Get(O, Pk).
+ ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([7n, 8n]);
+
+ var results = [];
+
+ sample.foo = 42;
+ sample[Symbol("1")] = 43;
+
+ sample.some(function() {
+ results.push(arguments);
+ });
+
+ assert.sameValue(results.length, 2, "results.length");
+
+ assert.sameValue(results[0][1], 0, "results[0][1] - key");
+ assert.sameValue(results[1][1], 1, "results[1][1] - key");
+
+ assert.sameValue(results[0][0], 7n, "results[0][0] - value");
+ assert.sameValue(results[1][0], 8n, "results[1][0] - value");
+});
diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-not-callable-throws.js b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-not-callable-throws.js
new file mode 100644
index 000000000..ce453a2c6
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-not-callable-throws.js
@@ -0,0 +1,69 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.some
+description: Throws a TypeError if callbackfn is not callable
+info: |
+ 22.2.3.25 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] )
+
+ %TypedArray%.prototype.some is a distinct function that implements the same
+ algorithm as Array.prototype.some as defined in 22.1.3.24 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length".
+
+ 22.1.3.24 Array.prototype.some ( callbackfn [ , thisArg ] )
+
+ ...
+ 3. If IsCallable(callbackfn) is false, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(2);
+
+ assert.throws(TypeError, function() {
+ sample.some();
+ }, "no args");
+
+ assert.throws(TypeError, function() {
+ sample.some(null);
+ }, "null");
+
+ assert.throws(TypeError, function() {
+ sample.some(undefined);
+ }, "undefined");
+
+ assert.throws(TypeError, function() {
+ sample.some("abc");
+ }, "string");
+
+ assert.throws(TypeError, function() {
+ sample.some(1);
+ }, "number");
+
+ assert.throws(TypeError, function() {
+ sample.some(NaN);
+ }, "NaN");
+
+ assert.throws(TypeError, function() {
+ sample.some(false);
+ }, "false");
+
+ assert.throws(TypeError, function() {
+ sample.some(true);
+ }, "true");
+
+ assert.throws(TypeError, function() {
+ sample.some({});
+ }, "{}");
+
+ assert.throws(TypeError, function() {
+ sample.some(sample);
+ }, "same typedArray instance");
+
+ assert.throws(TypeError, function() {
+ sample.some(Symbol("1"));
+ }, "symbol");
+});
diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-not-called-on-empty.js b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-not-called-on-empty.js
new file mode 100644
index 000000000..4480beb4d
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-not-called-on-empty.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.some
+description: >
+ callbackfn is not called on empty instances
+info: |
+ 22.2.3.25 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] )
+
+ %TypedArray%.prototype.some is a distinct function that implements the same
+ algorithm as Array.prototype.some as defined in 22.1.3.24 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length".
+
+ 22.1.3.24 Array.prototype.some ( callbackfn [ , thisArg ] )
+
+ ...
+ 6. Repeat, while k < len
+ ..
+ c. If kPresent is true, then
+ i. Let kValue be ? Get(O, Pk).
+ ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var called = 0;
+
+ new TA().some(function() {
+ called++;
+ });
+
+ assert.sameValue(called, 0);
+});
diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-return-does-not-change-instance.js b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-return-does-not-change-instance.js
new file mode 100644
index 000000000..2ea584f16
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-return-does-not-change-instance.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.some
+description: >
+ The callbackfn return does not change the instance
+info: |
+ 22.2.3.25 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] )
+
+ %TypedArray%.prototype.some is a distinct function that implements the same
+ algorithm as Array.prototype.some as defined in 22.1.3.24 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length".
+
+ 22.1.3.24 Array.prototype.some ( callbackfn [ , thisArg ] )
+
+ ...
+ 6. Repeat, while k < len
+ ..
+ c. If kPresent is true, then
+ i. Let kValue be ? Get(O, Pk).
+ ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([40n, 41n, 42n]);
+
+ sample.some(function() {
+ return 0;
+ });
+
+ assert.sameValue(sample[0], 40n, "[0] == 40");
+ assert.sameValue(sample[1], 41n, "[1] == 41");
+ assert.sameValue(sample[2], 42n, "[2] == 42");
+});
diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-returns-abrupt.js b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-returns-abrupt.js
new file mode 100644
index 000000000..eef277bfb
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-returns-abrupt.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.some
+description: Returns abrupt from callbackfn
+info: |
+ 22.2.3.25 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] )
+
+ %TypedArray%.prototype.some is a distinct function that implements the same
+ algorithm as Array.prototype.some as defined in 22.1.3.24 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length".
+
+ 22.1.3.24 Array.prototype.some ( callbackfn [ , thisArg ] )
+
+ ...
+ 6. Repeat, while k < len
+ ..
+ c. If kPresent is true, then
+ i. Let kValue be ? Get(O, Pk).
+ ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(3);
+
+ assert.throws(Test262Error, function() {
+ sample.some(function() {
+ throw new Test262Error();
+ });
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-set-value-during-interaction.js b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-set-value-during-interaction.js
new file mode 100644
index 000000000..c248960d3
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-set-value-during-interaction.js
@@ -0,0 +1,56 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.some
+description: >
+ Integer indexed values changed during iteration
+info: |
+ 22.2.3.25 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] )
+
+ %TypedArray%.prototype.some is a distinct function that implements the same
+ algorithm as Array.prototype.some as defined in 22.1.3.24 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length".
+
+ 22.1.3.24 Array.prototype.some ( callbackfn [ , thisArg ] )
+
+ ...
+ 6. Repeat, while k < len
+ ..
+ c. If kPresent is true, then
+ i. Let kValue be ? Get(O, Pk).
+ ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Reflect.set, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n, 44n]);
+ var newVal = 0n;
+
+ sample.some(function(val, i) {
+ if (i > 0) {
+ assert.sameValue(
+ sample[i - 1], newVal - 1n,
+ "get the changed value during the loop"
+ );
+ assert.sameValue(
+ Reflect.set(sample, 0, 7n),
+ true,
+ "re-set a value for sample[0]"
+ );
+ }
+ assert.sameValue(
+ Reflect.set(sample, i, newVal),
+ true,
+ "set value during iteration"
+ );
+
+ newVal++;
+ });
+
+ assert.sameValue(sample[0], 7n, "changed values after iteration [0] == 7");
+ assert.sameValue(sample[1], 1n, "changed values after iteration [1] == 1");
+ assert.sameValue(sample[2], 2n, "changed values after iteration [2] == 2");
+});
diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-this.js b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-this.js
new file mode 100644
index 000000000..dc08ba4aa
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-this.js
@@ -0,0 +1,57 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.some
+description: >
+ callbackfn `this` value
+info: |
+ 22.2.3.25 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] )
+
+ %TypedArray%.prototype.some is a distinct function that implements the same
+ algorithm as Array.prototype.some as defined in 22.1.3.24 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length".
+
+ 22.1.3.24 Array.prototype.some ( callbackfn [ , thisArg ] )
+
+ ...
+ 4. If thisArg was supplied, let T be thisArg; else let T be undefined.
+ ...
+ 6. Repeat, while k < len
+ ...
+ c. If kPresent is true, then
+ ...
+ ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var expected = (function() { return this; })();
+var thisArg = {};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(3);
+
+ var results1 = [];
+
+ sample.some(function() {
+ results1.push(this);
+ });
+
+ assert.sameValue(results1.length, 3, "results1");
+ assert.sameValue(results1[0], expected, "without thisArg - [0]");
+ assert.sameValue(results1[1], expected, "without thisArg - [1]");
+ assert.sameValue(results1[2], expected, "without thisArg - [2]");
+
+ var results2 = [];
+
+ sample.some(function() {
+ results2.push(this);
+ }, thisArg);
+
+ assert.sameValue(results2.length, 3, "results2");
+ assert.sameValue(results2[0], thisArg, "using thisArg - [0]");
+ assert.sameValue(results2[1], thisArg, "using thisArg - [1]");
+ assert.sameValue(results2[2], thisArg, "using thisArg - [2]");
+});
diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/some/BigInt/detached-buffer.js
new file mode 100644
index 000000000..ec32a7df4
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/some/BigInt/detached-buffer.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.some
+description: Throws a TypeError if this has a detached buffer
+info: |
+ 22.2.3.25 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ ...
+ 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+var callbackfn = function() {
+ throw new Test262Error();
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+ $DETACHBUFFER(sample.buffer);
+ assert.throws(TypeError, function() {
+ sample.some(callbackfn);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/some/BigInt/get-length-uses-internal-arraylength.js
new file mode 100644
index 000000000..bca0d658f
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/some/BigInt/get-length-uses-internal-arraylength.js
@@ -0,0 +1,46 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.some
+description: Get "length" uses internal ArrayLength
+info: |
+ 22.2.3.25 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] )
+
+ %TypedArray%.prototype.some is a distinct function that implements the same
+ algorithm as Array.prototype.some as defined in 22.1.3.24 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length".
+
+ 22.1.3.24 Array.prototype.some ( callbackfn [ , thisArg ] )
+
+ 1. Let O be ? ToObject(this value).
+ 2. Let len be ? ToLength(? Get(O, "length")).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var getCalls = 0;
+var desc = {
+ get: function getLen() {
+ getCalls++;
+ return 0;
+ }
+};
+
+Object.defineProperty(TypedArray.prototype, "length", desc);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n]);
+ var calls = 0;
+
+ Object.defineProperty(TA.prototype, "length", desc);
+ Object.defineProperty(sample, "length", desc);
+
+ sample.some(function() {
+ calls++;
+ });
+
+ assert.sameValue(getCalls, 0, "ignores length properties");
+ assert.sameValue(calls, 2, "iterations are not affected by custom length");
+});
diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/some/BigInt/invoked-as-func.js
new file mode 100644
index 000000000..4be0d0c6c
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/some/BigInt/invoked-as-func.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.some
+description: Throws a TypeError exception when invoked as a function
+info: |
+ 22.2.3.24 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var some = TypedArray.prototype.some;
+
+assert.sameValue(typeof some, 'function');
+
+assert.throws(TypeError, function() {
+ some();
+});
diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/some/BigInt/invoked-as-method.js
new file mode 100644
index 000000000..71b8fd36d
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/some/BigInt/invoked-as-method.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.some
+description: Requires a [[TypedArrayName]] internal slot.
+info: |
+ 22.2.3.24 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+assert.sameValue(typeof TypedArrayPrototype.some, 'function');
+
+assert.throws(TypeError, function() {
+ TypedArrayPrototype.some();
+});
diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/length.js b/test/built-ins/TypedArray/prototype/some/BigInt/length.js
new file mode 100644
index 000000000..ee214df0f
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/some/BigInt/length.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.some
+description: >
+ %TypedArray%.prototype.some.length is 1.
+info: |
+ %TypedArray%.prototype.some ( callbackfn [ , thisArg ] )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, has a length
+ property whose value is an integer. Unless otherwise specified, this
+ value is equal to the largest number of named arguments shown in the
+ subclause headings for the function description, including optional
+ parameters. However, rest parameters shown using the form “...name”
+ are not included in the default argument count.
+
+ Unless otherwise specified, the length property of a built-in Function
+ object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.some.length, 1);
+
+verifyNotEnumerable(TypedArray.prototype.some, "length");
+verifyNotWritable(TypedArray.prototype.some, "length");
+verifyConfigurable(TypedArray.prototype.some, "length");
diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/name.js b/test/built-ins/TypedArray/prototype/some/BigInt/name.js
new file mode 100644
index 000000000..8bf75d8ea
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/some/BigInt/name.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.some
+description: >
+ %TypedArray%.prototype.some.name is "some".
+info: |
+ %TypedArray%.prototype.some ( callbackfn [ , thisArg ] )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, that is not
+ identified as an anonymous function has a name property whose value
+ is a String.
+
+ Unless otherwise specified, the name property of a built-in Function
+ object, if it exists, has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.some.name, "some");
+
+verifyNotEnumerable(TypedArray.prototype.some, "name");
+verifyNotWritable(TypedArray.prototype.some, "name");
+verifyConfigurable(TypedArray.prototype.some, "name");
diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/some/BigInt/prop-desc.js
new file mode 100644
index 000000000..59a567362
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/some/BigInt/prop-desc.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.some
+description: >
+ "some" property of TypedArrayPrototype
+info: |
+ ES6 section 17: Every other data property described in clauses 18 through 26
+ and in Annex B.2 has the attributes { [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+verifyNotEnumerable(TypedArrayPrototype, 'some');
+verifyWritable(TypedArrayPrototype, 'some');
+verifyConfigurable(TypedArrayPrototype, 'some');
diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/returns-false-if-every-cb-returns-false.js b/test/built-ins/TypedArray/prototype/some/BigInt/returns-false-if-every-cb-returns-false.js
new file mode 100644
index 000000000..ef733a11e
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/some/BigInt/returns-false-if-every-cb-returns-false.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.some
+description: >
+ Returns false if every callbackfn calls returns a coerced false.
+info: |
+ 22.2.3.25 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] )
+
+ %TypedArray%.prototype.some is a distinct function that implements the same
+ algorithm as Array.prototype.some as defined in 22.1.3.24 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length".
+
+ 22.1.3.24 Array.prototype.some ( callbackfn [ , thisArg ] )
+
+ ...
+ 7. Return true.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(42);
+
+ [
+ false,
+ "",
+ 0,
+ -0,
+ NaN,
+ undefined,
+ null
+ ].forEach(function(val) {
+ var called = 0;
+ var result = sample.some(function() {
+ called++;
+ return val;
+ });
+ assert.sameValue(called, 42, "callbackfn called for each index property");
+ assert.sameValue(result, false, "result is false - " + val);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/returns-true-if-any-cb-returns-true.js b/test/built-ins/TypedArray/prototype/some/BigInt/returns-true-if-any-cb-returns-true.js
new file mode 100644
index 000000000..da956be06
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/some/BigInt/returns-true-if-any-cb-returns-true.js
@@ -0,0 +1,59 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.some
+description: >
+ Returns true if any callbackfn returns a coerced true.
+info: |
+ 22.2.3.25 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] )
+
+ %TypedArray%.prototype.some is a distinct function that implements the same
+ algorithm as Array.prototype.some as defined in 22.1.3.24 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length".
+
+ 22.1.3.24 Array.prototype.some ( callbackfn [ , thisArg ] )
+
+ ...
+ 6. Repeat, while k < len
+ ...
+ c. If kPresent is true, then
+ i. Let kValue be ? Get(O, Pk).
+ ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)).
+ iii. If testResult is true, return true.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var s = Symbol("1");
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(42);
+ [
+ true,
+ 1,
+ "test262",
+ s,
+ {},
+ [],
+ -1,
+ Infinity,
+ -Infinity,
+ 0.1,
+ -0.1
+ ].forEach(function(val) {
+ var called = 0;
+ var result = sample.some(function() {
+ called++;
+ if (called == 1) {
+ return false;
+ }
+ return val;
+ });
+ assert.sameValue(called, 2, "callbackfn called for each index property");
+
+ var msg = "result is true - " + (val === s ? "symbol" : val);
+ assert.sameValue(result, true, msg);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/some/BigInt/this-is-not-object.js
new file mode 100644
index 000000000..cc7aba63f
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/some/BigInt/this-is-not-object.js
@@ -0,0 +1,51 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.some
+description: Throws a TypeError exception when `this` is not Object
+info: |
+ 22.2.3.25 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var some = TypedArray.prototype.some;
+var callbackfn = function() {};
+
+assert.throws(TypeError, function() {
+ some.call(undefined, callbackfn);
+}, "this is undefined");
+
+assert.throws(TypeError, function() {
+ some.call(null, callbackfn);
+}, "this is null");
+
+assert.throws(TypeError, function() {
+ some.call(42, callbackfn);
+}, "this is 42");
+
+assert.throws(TypeError, function() {
+ some.call("1", callbackfn);
+}, "this is a string");
+
+assert.throws(TypeError, function() {
+ some.call(true, callbackfn);
+}, "this is true");
+
+assert.throws(TypeError, function() {
+ some.call(false, callbackfn);
+}, "this is false");
+
+var s = Symbol("s");
+assert.throws(TypeError, function() {
+ some.call(s, callbackfn);
+}, "this is a Symbol");
diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/some/BigInt/this-is-not-typedarray-instance.js
new file mode 100644
index 000000000..3cc3bb41f
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/some/BigInt/this-is-not-typedarray-instance.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.some
+description: >
+ Throws a TypeError exception when `this` is not a TypedArray instance
+info: |
+ 22.2.3.25 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var some = TypedArray.prototype.some;
+var callbackfn = function () {};
+
+assert.throws(TypeError, function() {
+ some.call({}, callbackfn);
+}, "this is an Object");
+
+assert.throws(TypeError, function() {
+ some.call([], callbackfn);
+}, "this is an Array");
+
+var ab = new ArrayBuffer(8);
+assert.throws(TypeError, function() {
+ some.call(ab, callbackfn);
+}, "this is an ArrayBuffer instance");
+
+var dv = new DataView(new ArrayBuffer(8), 0, 1);
+assert.throws(TypeError, function() {
+ some.call(dv, callbackfn);
+}, "this is a DataView instance");
diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/values-are-not-cached.js b/test/built-ins/TypedArray/prototype/some/BigInt/values-are-not-cached.js
new file mode 100644
index 000000000..c4918d6bb
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/some/BigInt/values-are-not-cached.js
@@ -0,0 +1,40 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.some
+description: >
+ Integer indexed values are not cached before iteration
+info: |
+ 22.2.3.25 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] )
+
+ %TypedArray%.prototype.some is a distinct function that implements the same
+ algorithm as Array.prototype.some as defined in 22.1.3.24 except that the this
+ object's [[ArrayLength]] internal slot is accessed in place of performing a
+ [[Get]] of "length".
+
+ 22.1.3.24 Array.prototype.some ( callbackfn [ , thisArg ] )
+
+ ...
+ 6. Repeat, while k < len
+ ..
+ c. If kPresent is true, then
+ i. Let kValue be ? Get(O, Pk).
+ ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n, 44n]);
+
+ sample.some(function(v, i) {
+ if (i < sample.length - 1) {
+ sample[i+1] = 42n;
+ }
+
+ assert.sameValue(
+ v, 42n, "method does not cache values before callbackfn calls"
+ );
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/some/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/some/callbackfn-detachbuffer.js
index 053f96a32..495e2bc91 100644
--- a/test/built-ins/TypedArray/prototype/some/callbackfn-detachbuffer.js
+++ b/test/built-ins/TypedArray/prototype/some/callbackfn-detachbuffer.js
@@ -22,6 +22,7 @@ info: |
ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)).
...
includes: [detachArrayBuffer.js, testTypedArray.js]
+features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
diff --git a/test/built-ins/TypedArray/prototype/some/invoked-as-func.js b/test/built-ins/TypedArray/prototype/some/invoked-as-func.js
index 72baa34bb..ff1164de3 100644
--- a/test/built-ins/TypedArray/prototype/some/invoked-as-func.js
+++ b/test/built-ins/TypedArray/prototype/some/invoked-as-func.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.24
+esid: sec-%typedarray%.prototype.some
description: Throws a TypeError exception when invoked as a function
info: |
22.2.3.24 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] )
diff --git a/test/built-ins/TypedArray/prototype/some/invoked-as-method.js b/test/built-ins/TypedArray/prototype/some/invoked-as-method.js
index f93c41842..58d20fa96 100644
--- a/test/built-ins/TypedArray/prototype/some/invoked-as-method.js
+++ b/test/built-ins/TypedArray/prototype/some/invoked-as-method.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.24
+esid: sec-%typedarray%.prototype.some
description: Requires a [[TypedArrayName]] internal slot.
info: |
22.2.3.24 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] )
diff --git a/test/built-ins/TypedArray/prototype/some/length.js b/test/built-ins/TypedArray/prototype/some/length.js
index 344b61c2b..47560ff66 100644
--- a/test/built-ins/TypedArray/prototype/some/length.js
+++ b/test/built-ins/TypedArray/prototype/some/length.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.24
+esid: sec-%typedarray%.prototype.some
description: >
%TypedArray%.prototype.some.length is 1.
info: |
@@ -20,6 +20,7 @@ info: |
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
[[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.some.length, 1);
diff --git a/test/built-ins/TypedArray/prototype/some/name.js b/test/built-ins/TypedArray/prototype/some/name.js
index e9fa5f406..1d0ad6735 100644
--- a/test/built-ins/TypedArray/prototype/some/name.js
+++ b/test/built-ins/TypedArray/prototype/some/name.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.24
+esid: sec-%typedarray%.prototype.some
description: >
%TypedArray%.prototype.some.name is "some".
info: |
@@ -17,6 +17,7 @@ info: |
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.some.name, "some");
diff --git a/test/built-ins/TypedArray/prototype/some/prop-desc.js b/test/built-ins/TypedArray/prototype/some/prop-desc.js
index 21f449599..c4d9e30b0 100644
--- a/test/built-ins/TypedArray/prototype/some/prop-desc.js
+++ b/test/built-ins/TypedArray/prototype/some/prop-desc.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.24
+esid: sec-%typedarray%.prototype.some
description: >
"some" property of TypedArrayPrototype
info: |
@@ -9,6 +9,7 @@ info: |
and in Annex B.2 has the attributes { [[Writable]]: true,
[[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
var TypedArrayPrototype = TypedArray.prototype;
diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/arraylength-internal.js b/test/built-ins/TypedArray/prototype/sort/BigInt/arraylength-internal.js
new file mode 100644
index 000000000..8a3d5a7f8
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/sort/BigInt/arraylength-internal.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.sort
+description: Use internal ArrayLength instead of getting a length property
+info: |
+ 22.2.3.26 %TypedArray%.prototype.sort ( comparefn )
+
+ ...
+ 3. Let len be the value of obj's [[ArrayLength]] internal slot.
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var getCalls = 0;
+var desc = {
+ get: function getLen() {
+ getCalls++;
+ return 0;
+ }
+};
+
+Object.defineProperty(TypedArray.prototype, "length", desc);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 42n, 42n]);
+ getCalls = 0;
+
+ Object.defineProperty(TA.prototype, "length", desc);
+ Object.defineProperty(sample, "length", desc);
+
+ var result = sample.sort();
+
+ assert.sameValue(getCalls, 0, "ignores length properties");
+ assert(
+ compareArray(result, sample),
+ "result is not affected by custom length"
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-call-throws.js b/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-call-throws.js
new file mode 100644
index 000000000..668f33e06
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-call-throws.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.sort
+description: Returns abrupt from comparefn
+info: |
+ 22.2.3.26 %TypedArray%.prototype.sort ( comparefn )
+
+ When the TypedArray SortCompare abstract operation is called with two
+ arguments x and y, the following steps are taken:
+
+ ...
+ 2. If the argument comparefn is not undefined, then
+ a. Let v be ? Call(comparefn, undefined, « x, y »).
+ ...
+ ...
+
+ 22.1.3.25 Array.prototype.sort (comparefn)
+
+ The following steps are taken:
+
+ - If an abrupt completion is returned from any of these operations, it is
+ immediately returned as the value of this function.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n, 44n, 45n, 46n]);
+ var calls = 0;
+
+ var comparefn = function() {
+ calls += 1;
+ throw new Test262Error();
+ };
+
+ assert.throws(Test262Error, function() {
+ sample.sort(comparefn);
+ });
+
+ assert.sameValue(calls, 1, "immediately returned");
+});
diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-calls.js b/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-calls.js
new file mode 100644
index 000000000..0e8846c13
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-calls.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.sort
+description: comparefn is called if not undefined
+info: |
+ 22.2.3.26 %TypedArray%.prototype.sort ( comparefn )
+
+ When the TypedArray SortCompare abstract operation is called with two
+ arguments x and y, the following steps are taken:
+
+ ...
+ 2. If the argument comparefn is not undefined, then
+ a. Let v be ? Call(comparefn, undefined, « x, y »).
+ ...
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var expectedThis = (function() {
+ return this;
+})();
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 42n, 42n, 42n, 42n]);
+ var calls = [];
+
+ var comparefn = function() {
+ calls.push([this, arguments]);
+ };
+
+ sample.sort(comparefn);
+
+ assert(calls.length > 0, "calls comparefn");
+ calls.forEach(function(args) {
+ assert.sameValue(args[0], expectedThis, "comparefn is called no specific this");
+ assert.sameValue(args[1].length, 2, "comparefn is always called with 2 args");
+ assert.sameValue(args[1][0], 42n, "x is a listed value");
+ assert.sameValue(args[1][0], 42n, "y is a listed value");
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-nonfunction-call-throws.js b/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-nonfunction-call-throws.js
new file mode 100644
index 000000000..4770b66da
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-nonfunction-call-throws.js
@@ -0,0 +1,55 @@
+// Copyright (C) 2017 Jordan Harband. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.sort
+description: throws on a non-undefined non-function
+info: |
+ 22.2.3.26 %TypedArray%.prototype.sort ( comparefn )
+
+ Upon entry, the following steps are performed to initialize evaluation
+ of the sort function. These steps are used instead of the entry steps
+ in 22.1.3.25:
+
+ ...
+ 1. If _comparefn_ is not *undefined* and IsCallable(_comparefn_) is *false*, throw a *TypeError* exception.
+ ...
+
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n, 44n, 45n, 46n]);
+
+ assert.throws(TypeError, function() {
+ sample.sort(null);
+ });
+
+ assert.throws(TypeError, function() {
+ sample.sort(true);
+ });
+
+ assert.throws(TypeError, function() {
+ sample.sort(false);
+ });
+
+ assert.throws(TypeError, function() {
+ sample.sort('');
+ });
+
+ assert.throws(TypeError, function() {
+ sample.sort(/a/g);
+ });
+
+ assert.throws(TypeError, function() {
+ sample.sort(42);
+ });
+
+ assert.throws(TypeError, function() {
+ sample.sort([]);
+ });
+
+ assert.throws(TypeError, function() {
+ sample.sort({});
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/detached-buffer-comparefn.js b/test/built-ins/TypedArray/prototype/sort/BigInt/detached-buffer-comparefn.js
new file mode 100644
index 000000000..caa7f80a2
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/sort/BigInt/detached-buffer-comparefn.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.sort
+description: Throws a TypeError if comparefn detaches the object buffer
+info: |
+ 22.2.3.26 %TypedArray%.prototype.sort ( comparefn )
+
+ When the TypedArray SortCompare abstract operation is called with two
+ arguments x and y, the following steps are taken:
+
+ ...
+ 2. If the argument comparefn is not undefined, then
+ a. Let v be ? Call(comparefn, undefined, « x, y »).
+ b. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
+ ...
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(4);
+ var calls = 0;
+ var comparefn = function() {
+ if (calls > 0) {
+ throw new Test262Error();
+ }
+ calls++;
+ $DETACHBUFFER(sample.buffer);
+ };
+
+ assert.throws(TypeError, function() {
+ sample.sort(comparefn);
+ });
+
+ assert.sameValue(calls, 1);
+});
diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/sort/BigInt/detached-buffer.js
new file mode 100644
index 000000000..e49bb0883
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/sort/BigInt/detached-buffer.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.sort
+description: Throws a TypeError if this has a detached buffer
+info: |
+ 22.2.3.26 %TypedArray%.prototype.sort ( comparefn )
+
+ 1. Let obj be the this value.
+ 2. Let buffer be ? ValidateTypedArray(obj).
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ ...
+ 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+var comparefn = function() {
+ throw new Test262Error();
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+ $DETACHBUFFER(sample.buffer);
+ assert.throws(TypeError, function() {
+ sample.sort(comparefn);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/sort/BigInt/invoked-as-func.js
new file mode 100644
index 000000000..760443c6f
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/sort/BigInt/invoked-as-func.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.sort
+description: Throws a TypeError exception when invoked as a function
+info: |
+ 22.2.3.25 %TypedArray%.prototype.sort ( comparefn )
+
+ ...
+ This function is not generic. The this value must be an object with a
+ [[TypedArrayName]] internal slot.
+ ...
+
+ 1. Let obj be the this value as the argument.
+ 2. Let buffer be ValidateTypedArray(obj).
+ 3. ReturnIfAbrupt(buffer).
+ ...
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var sort = TypedArray.prototype.sort;
+
+assert.sameValue(typeof sort, 'function');
+
+assert.throws(TypeError, function() {
+ sort();
+});
diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/sort/BigInt/invoked-as-method.js
new file mode 100644
index 000000000..e288c99e5
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/sort/BigInt/invoked-as-method.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.sort
+description: Requires a [[TypedArrayName]] internal slot.
+info: |
+ 22.2.3.25 %TypedArray%.prototype.sort ( comparefn )
+
+ ...
+ This function is not generic. The this value must be an object with a
+ [[TypedArrayName]] internal slot.
+ ...
+
+ 1. Let obj be the this value as the argument.
+ 2. Let buffer be ValidateTypedArray(obj).
+ 3. ReturnIfAbrupt(buffer).
+ ...
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+assert.sameValue(typeof TypedArrayPrototype.sort, 'function');
+
+assert.throws(TypeError, function() {
+ TypedArrayPrototype.sort();
+});
diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/length.js b/test/built-ins/TypedArray/prototype/sort/BigInt/length.js
new file mode 100644
index 000000000..c6bbb9f28
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/sort/BigInt/length.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.sort
+description: >
+ %TypedArray%.prototype.sort.length is 1.
+info: |
+ %TypedArray%.prototype.sort ( comparefn )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, has a length
+ property whose value is an integer. Unless otherwise specified, this
+ value is equal to the largest number of named arguments shown in the
+ subclause headings for the function description, including optional
+ parameters. However, rest parameters shown using the form “...name”
+ are not included in the default argument count.
+
+ Unless otherwise specified, the length property of a built-in Function
+ object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.sort.length, 1);
+
+verifyNotEnumerable(TypedArray.prototype.sort, "length");
+verifyNotWritable(TypedArray.prototype.sort, "length");
+verifyConfigurable(TypedArray.prototype.sort, "length");
diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/name.js b/test/built-ins/TypedArray/prototype/sort/BigInt/name.js
new file mode 100644
index 000000000..5f516c540
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/sort/BigInt/name.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.sort
+description: >
+ %TypedArray%.prototype.sort.name is "sort".
+info: |
+ %TypedArray%.prototype.sort ( comparefn )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, that is not
+ identified as an anonymous function has a name property whose value
+ is a String.
+
+ Unless otherwise specified, the name property of a built-in Function
+ object, if it exists, has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.sort.name, "sort");
+
+verifyNotEnumerable(TypedArray.prototype.sort, "name");
+verifyNotWritable(TypedArray.prototype.sort, "name");
+verifyConfigurable(TypedArray.prototype.sort, "name");
diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/sort/BigInt/prop-desc.js
new file mode 100644
index 000000000..86fc9e32b
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/sort/BigInt/prop-desc.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.sort
+description: >
+ "sort" property of TypedArrayPrototype
+info: |
+ ES6 section 17: Every other data property described in clauses 18 through 26
+ and in Annex B.2 has the attributes { [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+verifyNotEnumerable(TypedArrayPrototype, 'sort');
+verifyWritable(TypedArrayPrototype, 'sort');
+verifyConfigurable(TypedArrayPrototype, 'sort');
diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/return-same-instance.js b/test/built-ins/TypedArray/prototype/sort/BigInt/return-same-instance.js
new file mode 100644
index 000000000..702f45015
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/sort/BigInt/return-same-instance.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.sort
+description: Returns the same instance
+info: |
+ 22.2.3.26 %TypedArray%.prototype.sort ( comparefn )
+
+ When the TypedArray SortCompare abstract operation is called with two
+ arguments x and y, the following steps are taken:
+
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([2n, 1n]);
+ var result = sample.sort();
+
+ assert.sameValue(sample, result, "without comparefn");
+
+ result = sample.sort(function() { return 0; });
+ assert.sameValue(sample, result, "with comparefn");
+});
diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/sortcompare-with-no-tostring.js b/test/built-ins/TypedArray/prototype/sort/BigInt/sortcompare-with-no-tostring.js
new file mode 100644
index 000000000..3f6402c66
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/sort/BigInt/sortcompare-with-no-tostring.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.sort
+description: TypedArrays sort does not cast values to String
+info: |
+ 22.2.3.26 %TypedArray%.prototype.sort ( comparefn )
+
+ When the TypedArray SortCompare abstract operation is called with two
+ arguments x and y, the following steps are taken:
+
+ ...
+ 2. If the argument comparefn is not undefined, then
+ a. Let v be ? Call(comparefn, undefined, « x, y »).
+ ...
+ ...
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var origToString = Number.prototype.toString;
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([20n, 100n, 3n]);
+ var result = sample.sort();
+ assert(compareArray(result, [3n, 20n, 100n]));
+});
diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/sorted-values-nan.js b/test/built-ins/TypedArray/prototype/sort/BigInt/sorted-values-nan.js
new file mode 100644
index 000000000..7a553b13e
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/sort/BigInt/sorted-values-nan.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.sort
+description: Sort values to numeric ascending order
+info: |
+ 22.2.3.26 %TypedArray%.prototype.sort ( comparefn )
+
+ When the TypedArray SortCompare abstract operation is called with two
+ arguments x and y, the following steps are taken:
+
+ ...
+
+ NOTE: Because NaN always compares greater than any other value, NaN property
+ values always sort to the end of the result when comparefn is not provided.
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample;
+
+ sample = new TA([2, NaN, NaN, 0, 1]).sort();
+ assert.sameValue(sample[0], 0, "#1 [0]");
+ assert.sameValue(sample[1], 1, "#1 [1]");
+ assert.sameValue(sample[2], 2, "#1 [2]");
+ assert.sameValue(sample[3], NaN, "#1 [3]");
+ assert.sameValue(sample[4], NaN, "#1 [4]");
+
+ sample = new TA([3, NaN, NaN, Infinity, 0, -Infinity, 2]).sort();
+ assert.sameValue(sample[0], -Infinity, "#2 [0]");
+ assert.sameValue(sample[1], 0, "#2 [1]");
+ assert.sameValue(sample[2], 2, "#2 [2]");
+ assert.sameValue(sample[3], 3, "#2 [3]");
+ assert.sameValue(sample[4], Infinity, "#2 [4]");
+ assert.sameValue(sample[5], NaN, "#2 [5]");
+ assert.sameValue(sample[6], NaN, "#2 [6]");
+}, [Float64Array, Float32Array]);
diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/sorted-values.js b/test/built-ins/TypedArray/prototype/sort/BigInt/sorted-values.js
new file mode 100644
index 000000000..57b491551
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/sort/BigInt/sorted-values.js
@@ -0,0 +1,53 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.sort
+description: Sort values to numeric ascending order
+info: |
+ 22.2.3.26 %TypedArray%.prototype.sort ( comparefn )
+
+ When the TypedArray SortCompare abstract operation is called with two
+ arguments x and y, the following steps are taken:
+
+ ...
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample;
+
+ sample = new TA([4n, 3n, 2n, 1n]).sort();
+ assert(compareArray(sample, [1n, 2n, 3n, 4n]), "descending values");
+
+ sample = new TA([3n, 4n, 1n, 2n]).sort();
+ assert(compareArray(sample, [1n, 2n, 3n, 4n]), "mixed numbers");
+
+ sample = new TA([3n, 4n, 3n, 1n, 0n, 1n, 2n]).sort();
+ assert(compareArray(sample, [0n, 1n, 1n, 2n, 3n, 3n, 4n]), "repeating numbers");
+
+ sample = new TA([1n, 0n, -0n, 2n]).sort();
+ assert(compareArray(sample, [0n, 0n, 1n, 2n]), "0s");
+});
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([-4, 3, 4, -3, 2, -2, 1, 0]).sort();
+ assert(compareArray(sample, [-4, -3, -2, 0, 1, 2, 3, 4]), "negative values");
+}, [Float64Array, Float32Array, Int8Array, Int16Array, Int32Array]);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample;
+
+ sample = new TA([0.5, 0, 1.5, 1]).sort();
+ assert(compareArray(sample, [0, 0.5, 1, 1.5]), "non integers");
+
+ sample = new TA([0.5, 0, 1.5, -0.5, -1, -1.5, 1]).sort();
+ assert(compareArray(sample, [-1.5, -1, -0.5, 0, 0.5, 1, 1.5]), "non integers + negatives");
+
+ sample = new TA([1, 0, -0, 2]).sort();
+ assert(compareArray(sample, [0, 0, 1, 2]), "0 and -0");
+
+ sample = new TA([3, 4, Infinity, -Infinity, 1, 2]).sort();
+ assert(compareArray(sample, [-Infinity, 1, 2, 3, 4, Infinity]), "infinities");
+
+}, [Float64Array, Float32Array]);
diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/sort/BigInt/this-is-not-object.js
new file mode 100644
index 000000000..9c8a4c7fb
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/sort/BigInt/this-is-not-object.js
@@ -0,0 +1,51 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.sort
+description: Throws a TypeError exception when `this` is not Object
+info: |
+ 22.2.3.26 %TypedArray%.prototype.sort ( comparefn )
+
+ 1. Let obj be the this value as the argument.
+ 2. Let buffer be ? ValidateTypedArray(obj).
+ ...
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var sort = TypedArray.prototype.sort;
+var comparefn = function() {};
+
+assert.throws(TypeError, function() {
+ sort.call(undefined, comparefn);
+}, "this is undefined");
+
+assert.throws(TypeError, function() {
+ sort.call(null, comparefn);
+}, "this is null");
+
+assert.throws(TypeError, function() {
+ sort.call(42, comparefn);
+}, "this is 42");
+
+assert.throws(TypeError, function() {
+ sort.call("1", comparefn);
+}, "this is a string");
+
+assert.throws(TypeError, function() {
+ sort.call(true, comparefn);
+}, "this is true");
+
+assert.throws(TypeError, function() {
+ sort.call(false, comparefn);
+}, "this is false");
+
+var s = Symbol("s");
+assert.throws(TypeError, function() {
+ sort.call(s, comparefn);
+}, "this is a Symbol");
diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/sort/BigInt/this-is-not-typedarray-instance.js
new file mode 100644
index 000000000..74e47bae5
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/sort/BigInt/this-is-not-typedarray-instance.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.sort
+description: >
+ Throws a TypeError exception when `this` is not a TypedArray instance
+info: |
+ 22.2.3.26 %TypedArray%.prototype.sort ( comparefn )
+
+ 1. Let obj be the this value as the argument.
+ 2. Let buffer be ? ValidateTypedArray(obj).
+ ...
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var sort = TypedArray.prototype.sort;
+var comparefn = function() {};
+
+assert.throws(TypeError, function() {
+ sort.call({}, comparefn);
+}, "this is an Object");
+
+assert.throws(TypeError, function() {
+ sort.call([], comparefn);
+}, "this is an Array");
+
+var ab = new ArrayBuffer(8);
+assert.throws(TypeError, function() {
+ sort.call(ab, comparefn);
+}, "this is an ArrayBuffer instance");
+
+var dv = new DataView(new ArrayBuffer(8), 0, 1);
+assert.throws(TypeError, function() {
+ sort.call(dv, comparefn);
+}, "this is a DataView instance");
diff --git a/test/built-ins/TypedArray/prototype/sort/invoked-as-func.js b/test/built-ins/TypedArray/prototype/sort/invoked-as-func.js
index b3e77e4cb..705ef3a3d 100644
--- a/test/built-ins/TypedArray/prototype/sort/invoked-as-func.js
+++ b/test/built-ins/TypedArray/prototype/sort/invoked-as-func.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.25
+esid: sec-%typedarray%.prototype.sort
description: Throws a TypeError exception when invoked as a function
info: |
22.2.3.25 %TypedArray%.prototype.sort ( comparefn )
diff --git a/test/built-ins/TypedArray/prototype/sort/invoked-as-method.js b/test/built-ins/TypedArray/prototype/sort/invoked-as-method.js
index 33edcc428..4f18b417e 100644
--- a/test/built-ins/TypedArray/prototype/sort/invoked-as-method.js
+++ b/test/built-ins/TypedArray/prototype/sort/invoked-as-method.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.25
+esid: sec-%typedarray%.prototype.sort
description: Requires a [[TypedArrayName]] internal slot.
info: |
22.2.3.25 %TypedArray%.prototype.sort ( comparefn )
diff --git a/test/built-ins/TypedArray/prototype/sort/length.js b/test/built-ins/TypedArray/prototype/sort/length.js
index d8237d233..8bd6a93ad 100644
--- a/test/built-ins/TypedArray/prototype/sort/length.js
+++ b/test/built-ins/TypedArray/prototype/sort/length.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.25
+esid: sec-%typedarray%.prototype.sort
description: >
%TypedArray%.prototype.sort.length is 1.
info: |
@@ -20,6 +20,7 @@ info: |
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
[[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.sort.length, 1);
diff --git a/test/built-ins/TypedArray/prototype/sort/name.js b/test/built-ins/TypedArray/prototype/sort/name.js
index e1785cd7e..d920126ec 100644
--- a/test/built-ins/TypedArray/prototype/sort/name.js
+++ b/test/built-ins/TypedArray/prototype/sort/name.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.25
+esid: sec-%typedarray%.prototype.sort
description: >
%TypedArray%.prototype.sort.name is "sort".
info: |
@@ -17,6 +17,7 @@ info: |
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.sort.name, "sort");
diff --git a/test/built-ins/TypedArray/prototype/sort/prop-desc.js b/test/built-ins/TypedArray/prototype/sort/prop-desc.js
index 681de6475..b8fecb045 100644
--- a/test/built-ins/TypedArray/prototype/sort/prop-desc.js
+++ b/test/built-ins/TypedArray/prototype/sort/prop-desc.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.25
+esid: sec-%typedarray%.prototype.sort
description: >
"sort" property of TypedArrayPrototype
info: |
@@ -9,6 +9,7 @@ info: |
and in Annex B.2 has the attributes { [[Writable]]: true,
[[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
var TypedArrayPrototype = TypedArray.prototype;
diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/detached-buffer.js
new file mode 100644
index 000000000..b8e4087e5
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/detached-buffer.js
@@ -0,0 +1,65 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.subarray
+description: Throws a TypeError creating a new instance with a detached buffer
+info: |
+ 22.2.3.27 %TypedArray%.prototype.subarray( begin , end )
+
+ ...
+ 7. Let relativeBegin be ? ToInteger(begin).
+ ...
+ 9. If end is undefined, let relativeEnd be srcLength; else, let relativeEnd be
+ ? ToInteger(end).
+ ...
+ 17. Return ? TypedArraySpeciesCreate(O, argumentsList).
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor).
+ 4. Return ? TypedArrayCreate(constructor, argumentList).
+
+ 22.2.4.6 TypedArrayCreate ( constructor, argumentList )
+
+ 1. Let newTypedArray be ? Construct(constructor, argumentList).
+ ...
+
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ ...
+ 11. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+var begin, end;
+
+var o1 = {
+ valueOf: function() {
+ begin = true;
+ return 0;
+ }
+};
+
+var o2 = {
+ valueOf: function() {
+ end = true;
+ return 2;
+ }
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(2);
+ begin = false;
+ end = false;
+
+ $DETACHBUFFER(sample.buffer);
+ assert.throws(TypeError, function() {
+ sample.subarray(o1, o2);
+ });
+
+ assert(begin, "observable ToInteger(begin)");
+ assert(end, "observable ToInteger(end)");
+});
diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/infinity.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/infinity.js
new file mode 100644
index 000000000..fc6786978
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/infinity.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.subarray
+description: Infinity values on begin and end
+info: |
+ 22.2.3.27 %TypedArray%.prototype.subarray( begin , end )
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([40n, 41n, 42n, 43n]);
+
+ assert(
+ compareArray(sample.subarray(-Infinity), [40n, 41n, 42n, 43n]),
+ "begin == -Infinity"
+ );
+ assert(
+ compareArray(sample.subarray(Infinity), []),
+ "being == Infinity"
+ );
+ assert(
+ compareArray(sample.subarray(0, -Infinity), []),
+ "end == -Infinity"
+ );
+ assert(
+ compareArray(sample.subarray(0, Infinity), [40n, 41n, 42n, 43n]),
+ "end == Infinity"
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/invoked-as-func.js
new file mode 100644
index 000000000..dc28bbf0e
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/invoked-as-func.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.subarray
+description: Throws a TypeError exception when invoked as a function
+info: |
+ 22.2.3.26 %TypedArray%.prototype.subarray( [ begin [ , end ] ] )
+
+ 1. Let O be the this value.
+ 2. If Type(O) is not Object, throw a TypeError exception.
+ 3. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var subarray = TypedArray.prototype.subarray;
+
+assert.sameValue(typeof subarray, 'function');
+
+assert.throws(TypeError, function() {
+ subarray();
+});
diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/invoked-as-method.js
new file mode 100644
index 000000000..887e139bc
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/invoked-as-method.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.subarray
+description: Requires a [[TypedArrayName]] internal slot.
+info: |
+ 22.2.3.26 %TypedArray%.prototype.subarray( [ begin [ , end ] ] )
+
+ 1. Let O be the this value.
+ 2. If Type(O) is not Object, throw a TypeError exception.
+ 3. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+assert.sameValue(typeof TypedArrayPrototype.subarray, 'function');
+
+assert.throws(TypeError, function() {
+ TypedArrayPrototype.subarray();
+});
diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/length.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/length.js
new file mode 100644
index 000000000..818891a63
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/length.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.subarray
+description: >
+ %TypedArray%.prototype.subarray.length is 2.
+info: |
+ %TypedArray%.prototype.subarray( [ begin [ , end ] ] )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, has a length
+ property whose value is an integer. Unless otherwise specified, this
+ value is equal to the largest number of named arguments shown in the
+ subclause headings for the function description, including optional
+ parameters. However, rest parameters shown using the form “...name”
+ are not included in the default argument count.
+
+ Unless otherwise specified, the length property of a built-in Function
+ object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.subarray.length, 2);
+
+verifyNotEnumerable(TypedArray.prototype.subarray, "length");
+verifyNotWritable(TypedArray.prototype.subarray, "length");
+verifyConfigurable(TypedArray.prototype.subarray, "length");
diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/minus-zero.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/minus-zero.js
new file mode 100644
index 000000000..b71e445c7
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/minus-zero.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.subarray
+description: -0 values on begin and end
+info: |
+ 22.2.3.27 %TypedArray%.prototype.subarray( begin , end )
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([40n, 41n, 42n, 43n]);
+
+ assert(
+ compareArray(sample.subarray(-0), [40n, 41n, 42n, 43n]),
+ "begin == -0"
+ );
+ assert(
+ compareArray(sample.subarray(-0, 4), [40n, 41n, 42n, 43n]),
+ "being == -0, end == length"
+ );
+ assert(
+ compareArray(sample.subarray(0, -0), []),
+ "being == 0, end == -0"
+ );
+ assert(
+ compareArray(sample.subarray(-0, -0), []),
+ "being == -0, end == -0"
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/name.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/name.js
new file mode 100644
index 000000000..30c47e577
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/name.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.subarray
+description: >
+ %TypedArray%.prototype.subarray.name is "subarray".
+info: |
+ %TypedArray%.prototype.subarray( [ begin [ , end ] ] )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, that is not
+ identified as an anonymous function has a name property whose value
+ is a String.
+
+ Unless otherwise specified, the name property of a built-in Function
+ object, if it exists, has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.subarray.name, "subarray");
+
+verifyNotEnumerable(TypedArray.prototype.subarray, "name");
+verifyNotWritable(TypedArray.prototype.subarray, "name");
+verifyConfigurable(TypedArray.prototype.subarray, "name");
diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/prop-desc.js
new file mode 100644
index 000000000..218949025
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/prop-desc.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.subarray
+description: >
+ "subarray" property of TypedArrayPrototype
+info: |
+ ES6 section 17: Every other data property described in clauses 18 through 26
+ and in Annex B.2 has the attributes { [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+verifyNotEnumerable(TypedArrayPrototype, 'subarray');
+verifyWritable(TypedArrayPrototype, 'subarray');
+verifyConfigurable(TypedArrayPrototype, 'subarray');
diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/result-does-not-copy-ordinary-properties.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/result-does-not-copy-ordinary-properties.js
new file mode 100644
index 000000000..af87b3756
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/result-does-not-copy-ordinary-properties.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.subarray
+description: Subarray result does not import own property
+info: |
+ 22.2.3.27 %TypedArray%.prototype.subarray( begin , end )
+
+ ...
+ 17. Return ? TypedArraySpeciesCreate(O, argumentsList).
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([41n, 42n, 43n, 44n]);
+ var result;
+
+ sample.foo = 42;
+
+ result = sample.subarray(0);
+ assert.sameValue(
+ result.hasOwnProperty("foo"),
+ false,
+ "does not import own property"
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/result-is-new-instance-from-same-ctor.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/result-is-new-instance-from-same-ctor.js
new file mode 100644
index 000000000..0d0362394
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/result-is-new-instance-from-same-ctor.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.subarray
+description: Returns a new instance from the same constructor
+info: |
+ 22.2.3.27 %TypedArray%.prototype.subarray( begin , end )
+
+ ...
+ 17. Return ? TypedArraySpeciesCreate(O, argumentsList).
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([40n, 41n, 42n, 43n]);
+ var result = sample.subarray(1);
+
+ assert.sameValue(
+ Object.getPrototypeOf(result),
+ Object.getPrototypeOf(sample),
+ "prototype"
+ );
+ assert.sameValue(result.constructor, sample.constructor, "constructor");
+ assert(result instanceof TA, "instanceof");
+
+ assert(
+ compareArray(sample, [40n, 41n, 42n, 43n]),
+ "original sample remains the same"
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/result-is-new-instance-with-shared-buffer.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/result-is-new-instance-with-shared-buffer.js
new file mode 100644
index 000000000..ee1198833
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/result-is-new-instance-with-shared-buffer.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.subarray
+description: Returns a new instance sharing the same buffer
+info: |
+ 22.2.3.27 %TypedArray%.prototype.subarray( begin , end )
+
+ ...
+ 17. Return ? TypedArraySpeciesCreate(O, argumentsList).
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([40n, 41n, 42n, 43n]);
+ var buffer = sample.buffer;
+ var result = sample.subarray(1);
+
+ assert.notSameValue(result, sample, "returns a new instance");
+ assert.sameValue(result.buffer, sample.buffer, "shared buffer");
+ assert.sameValue(sample.buffer, buffer, "original buffer is preserved");
+
+ sample[1] = 100n;
+ assert(
+ compareArray(result, [100n, 42n, 43n]),
+ "changes on the original sample values affect the new instance"
+ );
+
+ result[1] = 111n;
+ assert(
+ compareArray(sample, [40n, 100n, 111n, 43n]),
+ "changes on the new instance values affect the original sample"
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/results-with-different-length.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/results-with-different-length.js
new file mode 100644
index 000000000..ff0787469
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/results-with-different-length.js
@@ -0,0 +1,58 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.subarray
+description: Subarray may return a new instance with a smaller length
+info: |
+ 22.2.3.27 %TypedArray%.prototype.subarray( begin , end )
+
+ ...
+ 17. Return ? TypedArraySpeciesCreate(O, argumentsList).
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([40n, 41n, 42n, 43n]);
+
+ function testRes(result, expected, msg) {
+ assert(compareArray(result, expected), msg + ", result: [" + result + "]");
+ }
+
+ testRes(sample.subarray(1), [41n, 42n, 43n], "begin == 1");
+ testRes(sample.subarray(2), [42n, 43n], "begin == 2");
+ testRes(sample.subarray(3), [43n], "begin == 3");
+
+ testRes(sample.subarray(1, 4), [41n, 42n, 43n], "begin == 1, end == length");
+ testRes(sample.subarray(2, 4), [42n, 43n], "begin == 2, end == length");
+ testRes(sample.subarray(3, 4), [43n], "begin == 3, end == length");
+
+ testRes(sample.subarray(0, 1), [40n], "begin == 0, end == 1");
+ testRes(sample.subarray(0, 2), [40n, 41n], "begin == 0, end == 2");
+ testRes(sample.subarray(0, 3), [40n, 41n, 42n], "begin == 0, end == 3");
+
+ testRes(sample.subarray(-1), [43n], "begin == -1");
+ testRes(sample.subarray(-2), [42n, 43n], "begin == -2");
+ testRes(sample.subarray(-3), [41n, 42n, 43n], "begin == -3");
+
+ testRes(sample.subarray(-1, 4), [43n], "begin == -1, end == length");
+ testRes(sample.subarray(-2, 4), [42n, 43n], "begin == -2, end == length");
+ testRes(sample.subarray(-3, 4), [41n, 42n, 43n], "begin == -3, end == length");
+
+ testRes(sample.subarray(0, -1), [40n, 41n, 42n], "begin == 0, end == -1");
+ testRes(sample.subarray(0, -2), [40n, 41n], "begin == 0, end == -2");
+ testRes(sample.subarray(0, -3), [40n], "begin == 0, end == -3");
+
+ testRes(sample.subarray(-0, -1), [40n, 41n, 42n], "begin == -0, end == -1");
+ testRes(sample.subarray(-0, -2), [40n, 41n], "begin == -0, end == -2");
+ testRes(sample.subarray(-0, -3), [40n], "begin == -0, end == -3");
+
+ testRes(sample.subarray(-2, -1), [42n], "length == 4, begin == -2, end == -1");
+ testRes(sample.subarray(1, -1), [41n, 42n], "length == 4, begin == 1, end == -1");
+ testRes(sample.subarray(1, -2), [41n], "length == 4, begin == 1, end == -2");
+ testRes(sample.subarray(2, -1), [42n], "length == 4, begin == 2, end == -1");
+
+ testRes(sample.subarray(-1, 5), [43n], "begin == -1, end > length");
+ testRes(sample.subarray(-2, 4), [42n, 43n], "begin == -2, end > length");
+ testRes(sample.subarray(-3, 4), [41n, 42n, 43n], "begin == -3, end > length");
+});
diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/results-with-empty-length.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/results-with-empty-length.js
new file mode 100644
index 000000000..310d1bc6d
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/results-with-empty-length.js
@@ -0,0 +1,57 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.subarray
+description: Subarray may return a new empty instance
+info: |
+ 22.2.3.27 %TypedArray%.prototype.subarray( begin , end )
+
+ ...
+ 17. Return ? TypedArraySpeciesCreate(O, argumentsList).
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([40n, 41n, 42n, 43n]);
+
+ function testRes(result, msg) {
+ assert.sameValue(result.length, 0, msg);
+ assert.sameValue(
+ result.hasOwnProperty(0),
+ false,
+ msg + " & result.hasOwnProperty(0) === false"
+ );
+ }
+
+ testRes(sample.subarray(4), "begin == length");
+ testRes(sample.subarray(5), "begin > length");
+
+ testRes(sample.subarray(4, 4), "begin == length, end == length");
+ testRes(sample.subarray(5, 4), "begin > length, end == length");
+
+ testRes(sample.subarray(4, 4), "begin == length, end > length");
+ testRes(sample.subarray(5, 4), "begin > length, end > length");
+
+ testRes(sample.subarray(0, 0), "begin == 0, end == 0");
+ testRes(sample.subarray(-0, -0), "begin == -0, end == -0");
+ testRes(sample.subarray(1, 0), "begin > 0, end == 0");
+ testRes(sample.subarray(-1, 0), "being < 0, end == 0");
+
+ testRes(sample.subarray(2, 1), "begin > 0, begin < length, begin > end, end > 0");
+ testRes(sample.subarray(2, 2), "begin > 0, begin < length, begin == end");
+
+ testRes(sample.subarray(2, -2), "begin > 0, begin < length, end == -2");
+
+ testRes(sample.subarray(-1, -1), "length = 4, begin == -1, end == -1");
+ testRes(sample.subarray(-1, -2), "length = 4, begin == -1, end == -2");
+ testRes(sample.subarray(-2, -2), "length = 4, begin == -2, end == -2");
+
+ testRes(sample.subarray(0, -4), "begin == 0, end == -length");
+ testRes(sample.subarray(-4, -4), "begin == -length, end == -length");
+ testRes(sample.subarray(-5, -4), "begin < -length, end == -length");
+
+ testRes(sample.subarray(0, -5), "begin == 0, end < -length");
+ testRes(sample.subarray(-4, -5), "begin == -length, end < -length");
+ testRes(sample.subarray(-5, -5), "begin < -length, end < -length");
+});
diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/results-with-same-length.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/results-with-same-length.js
new file mode 100644
index 000000000..79e579374
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/results-with-same-length.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.subarray
+description: Subarray may return a new instance with the same length
+info: |
+ 22.2.3.27 %TypedArray%.prototype.subarray( begin , end )
+
+ ...
+ 17. Return ? TypedArraySpeciesCreate(O, argumentsList).
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([40n, 41n, 42n, 43n]);
+
+ function testRes(result, msg) {
+ assert.sameValue(result.length, 4, msg);
+ assert.sameValue(result[0], 40n, msg + " & result[0] === 40");
+ assert.sameValue(result[1], 41n, msg + " & result[1] === 41");
+ assert.sameValue(result[2], 42n, msg + " & result[2] === 42");
+ assert.sameValue(result[3], 43n, msg + " & result[3] === 43");
+ }
+
+ testRes(sample.subarray(0), "begin == 0");
+ testRes(sample.subarray(-4), "begin == -srcLength");
+ testRes(sample.subarray(-5), "begin < -srcLength");
+
+ testRes(sample.subarray(0, 4), "begin == 0, end == srcLength");
+ testRes(sample.subarray(-4, 4), "begin == -srcLength, end == srcLength");
+ testRes(sample.subarray(-5, 4), "begin < -srcLength, end == srcLength");
+
+ testRes(sample.subarray(0, 5), "begin == 0, end > srcLength");
+ testRes(sample.subarray(-4, 5), "begin == -srcLength, end > srcLength");
+ testRes(sample.subarray(-5, 5), "begin < -srcLength, end > srcLength");
+});
diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/return-abrupt-from-begin-symbol.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/return-abrupt-from-begin-symbol.js
new file mode 100644
index 000000000..a05ad6261
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/return-abrupt-from-begin-symbol.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.subarray
+description: Return abrupt from ToInteger(begin), begin is symbol
+info: |
+ 22.2.3.27 %TypedArray%.prototype.subarray( begin , end )
+
+ ...
+ 7. Let relativeBegin be ? ToInteger(begin).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var s = Symbol("1");
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA();
+
+ assert.throws(TypeError, function() {
+ sample.subarray(s);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/return-abrupt-from-begin.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/return-abrupt-from-begin.js
new file mode 100644
index 000000000..edff4831f
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/return-abrupt-from-begin.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.subarray
+description: Return abrupt from ToInteger(begin)
+info: |
+ 22.2.3.27 %TypedArray%.prototype.subarray( begin , end )
+
+ ...
+ 7. Let relativeBegin be ? ToInteger(begin).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var o1 = {
+ valueOf: function() {
+ throw new Test262Error();
+ }
+};
+
+var o2 = {
+ toString: function() {
+ throw new Test262Error();
+ }
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA();
+
+ assert.throws(Test262Error, function() {
+ sample.subarray(o1);
+ });
+
+ assert.throws(Test262Error, function() {
+ sample.subarray(o2);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/return-abrupt-from-end-symbol.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/return-abrupt-from-end-symbol.js
new file mode 100644
index 000000000..29f517746
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/return-abrupt-from-end-symbol.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.subarray
+description: Return abrupt from ToInteger(end), end is symbol
+info: |
+ 22.2.3.27 %TypedArray%.prototype.subarray( begin , end )
+
+ ...
+ 9. If end is undefined, let relativeEnd be srcLength; else, let relativeEnd
+ be ? ToInteger(end).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var s = Symbol("1");
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA();
+
+ assert.throws(TypeError, function() {
+ sample.subarray(0, s);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/return-abrupt-from-end.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/return-abrupt-from-end.js
new file mode 100644
index 000000000..d9f1bf3b5
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/return-abrupt-from-end.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.subarray
+description: Return abrupt from ToInteger(end)
+info: |
+ 22.2.3.27 %TypedArray%.prototype.subarray( begin , end )
+
+ ...
+ 9. If end is undefined, let relativeEnd be srcLength; else, let relativeEnd
+ be ? ToInteger(end).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var o1 = {
+ valueOf: function() {
+ throw new Test262Error();
+ }
+};
+
+var o2 = {
+ toString: function() {
+ throw new Test262Error();
+ }
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA();
+
+ assert.throws(Test262Error, function() {
+ sample.subarray(0, o1);
+ });
+
+ assert.throws(Test262Error, function() {
+ sample.subarray(0, o2);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor-abrupt.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor-abrupt.js
new file mode 100644
index 000000000..9ed4e0900
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor-abrupt.js
@@ -0,0 +1,40 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.subarray
+description: Return abrupt from SpeciesConstructor's get Constructor
+info: |
+ 22.2.3.27 %TypedArray%.prototype.subarray( begin , end )
+
+ ...
+ 17. Return ? TypedArraySpeciesCreate(O, argumentsList).
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor).
+ ...
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+
+ 1. Assert: Type(O) is Object.
+ 2. Let C be ? Get(O, "constructor").
+ 3. If C is undefined, return defaultConstructor.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([40n, 41n, 42n, 43n]);
+
+ Object.defineProperty(sample, "constructor", {
+ get: function() {
+ throw new Test262Error();
+ }
+ });
+
+ assert.throws(Test262Error, function() {
+ sample.subarray(0);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor-inherited.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor-inherited.js
new file mode 100644
index 000000000..67841f442
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor-inherited.js
@@ -0,0 +1,61 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.subarray
+description: get inherited constructor on SpeciesConstructor
+info: |
+ 22.2.3.27 %TypedArray%.prototype.subarray( begin , end )
+
+ ...
+ 17. Return ? TypedArraySpeciesCreate(O, argumentsList).
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor).
+ ...
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+
+ 1. Assert: Type(O) is Object.
+ 2. Let C be ? Get(O, "constructor").
+ 3. If C is undefined, return defaultConstructor.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([40n, 41n, 42n, 43n]);
+ var calls = 0;
+ var result;
+
+ Object.defineProperty(TA.prototype, "constructor", {
+ get: function() {
+ calls++;
+ }
+ });
+
+ result = sample.subarray(0);
+
+ assert.sameValue(calls, 1, "called custom ctor get accessor once");
+
+ assert.sameValue(
+ Object.getPrototypeOf(result),
+ Object.getPrototypeOf(sample),
+ "use defaultCtor on an undefined return - getPrototypeOf check"
+ );
+ assert.sameValue(
+ result.constructor,
+ undefined,
+ "used defaultCtor but still checks the inherited .constructor"
+ );
+
+ calls = 6;
+ result.constructor;
+ assert.sameValue(
+ calls,
+ 7,
+ "result.constructor triggers the inherited accessor property"
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor-returns-throws.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor-returns-throws.js
new file mode 100644
index 000000000..696732371
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor-returns-throws.js
@@ -0,0 +1,62 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.subarray
+description: >
+ Throws if O.constructor returns a non-Object and non-undefined value
+info: |
+ 22.2.3.27 %TypedArray%.prototype.subarray( begin , end )
+
+ ...
+ 17. Return ? TypedArraySpeciesCreate(O, argumentsList).
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor).
+ ...
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+
+ 1. Assert: Type(O) is Object.
+ 2. Let C be ? Get(O, "constructor").
+ 3. If C is undefined, return defaultConstructor.
+ 4. If Type(C) is not Object, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([40n, 41n, 42n, 43n]);
+
+ sample.constructor = 42;
+ assert.throws(TypeError, function() {
+ sample.subarray(0);
+ }, "42");
+
+ sample.constructor = "1";
+ assert.throws(TypeError, function() {
+ sample.subarray(0);
+ }, "string");
+
+ sample.constructor = null;
+ assert.throws(TypeError, function() {
+ sample.subarray(0);
+ }, "null");
+
+ sample.constructor = NaN;
+ assert.throws(TypeError, function() {
+ sample.subarray(0);
+ }, "NaN");
+
+ sample.constructor = false;
+ assert.throws(TypeError, function() {
+ sample.subarray(0);
+ }, "false");
+
+ sample.constructor = Symbol("1");
+ assert.throws(TypeError, function() {
+ sample.subarray(0);
+ }, "symbol");
+});
diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor.js
new file mode 100644
index 000000000..a05460004
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor.js
@@ -0,0 +1,53 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.subarray
+description: get constructor on SpeciesConstructor
+info: |
+ 22.2.3.27 %TypedArray%.prototype.subarray( begin , end )
+
+ ...
+ 17. Return ? TypedArraySpeciesCreate(O, argumentsList).
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor).
+ ...
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+
+ 1. Assert: Type(O) is Object.
+ 2. Let C be ? Get(O, "constructor").
+ 3. If C is undefined, return defaultConstructor.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([40n, 41n, 42n, 43n]);
+ var calls = 0;
+ var result;
+
+ Object.defineProperty(sample, "constructor", {
+ get: function() {
+ calls++;
+ }
+ });
+
+ result = sample.subarray(0);
+
+ assert.sameValue(calls, 1, "called custom ctor get accessor once");
+
+ assert.sameValue(
+ Object.getPrototypeOf(result),
+ Object.getPrototypeOf(sample),
+ "use defaultCtor on an undefined return - getPrototypeOf check"
+ );
+ assert.sameValue(
+ result.constructor,
+ TA,
+ "use defaultCtor on an undefined return - .constructor check"
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-abrupt.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-abrupt.js
new file mode 100644
index 000000000..c1b64586d
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-abrupt.js
@@ -0,0 +1,44 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.subarray
+description: >
+ Returns abrupt from get @@species on found constructor
+info: |
+ 22.2.3.27 %TypedArray%.prototype.subarray( begin , end )
+
+ ...
+ 17. Return ? TypedArraySpeciesCreate(O, argumentsList).
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor).
+ ...
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+
+ 1. Assert: Type(O) is Object.
+ 2. Let C be ? Get(O, "constructor").
+ ...
+ 5. Let S be ? Get(C, @@species).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol.species, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(2);
+
+ sample.constructor = {};
+
+ Object.defineProperty(sample.constructor, Symbol.species, {
+ get: function() {
+ throw new Test262Error();
+ }
+ });
+
+ assert.throws(Test262Error, function() {
+ sample.subarray(0);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor-invocation.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor-invocation.js
new file mode 100644
index 000000000..ebde38088
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor-invocation.js
@@ -0,0 +1,61 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.subarray
+description: >
+ Verify arguments on custom @@species construct call
+info: |
+ 22.2.3.27 %TypedArray%.prototype.subarray( begin , end )
+
+ ...
+ 17. Return ? TypedArraySpeciesCreate(O, argumentsList).
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor).
+ 4. Return ? TypedArrayCreate(constructor, argumentList).
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+
+ ...
+ 5. Let S be ? Get(C, @@species).
+ ...
+ 7. If IsConstructor(S) is true, return S.
+ ...
+
+ 22.2.4.6 TypedArrayCreate ( constructor, argumentList )
+
+ 1. Let newTypedArray be ? Construct(constructor, argumentList).
+ 2. Perform ? ValidateTypedArray(newTypedArray).
+ 3. If argumentList is a List of a single Number, then
+ ...
+ 4. Return newTypedArray.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol.species, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([40n, 41n, 42n]);
+ var expectedOffset = TA.BYTES_PER_ELEMENT;
+ var result, ctorThis;
+
+ sample.constructor = {};
+ sample.constructor[Symbol.species] = function(buffer, offset, length) {
+ result = arguments;
+ ctorThis = this;
+ return new TA(buffer, offset, length);
+ };
+
+ sample.subarray(1);
+
+ assert.sameValue(result.length, 3, "called with 3 arguments");
+ assert.sameValue(result[0], sample.buffer, "[0] is sample.buffer");
+ assert.sameValue(result[1], expectedOffset, "[1] is the byte offset pos");
+ assert.sameValue(result[2], 2, "[2] is expected length");
+
+ assert(
+ ctorThis instanceof sample.constructor[Symbol.species],
+ "`this` value in the @@species fn is an instance of the function itself"
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js
new file mode 100644
index 000000000..ee537263a
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js
@@ -0,0 +1,52 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.subarray
+description: >
+ Custom @@species constructor may return a totally different TypedArray
+info: |
+ 22.2.3.27 %TypedArray%.prototype.subarray( begin , end )
+
+ ...
+ 17. Return ? TypedArraySpeciesCreate(O, argumentsList).
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor).
+ 4. Return ? TypedArrayCreate(constructor, argumentList).
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+
+ ...
+ 5. Let S be ? Get(C, @@species).
+ ...
+ 7. If IsConstructor(S) is true, return S.
+ ...
+
+ 22.2.4.6 TypedArrayCreate ( constructor, argumentList )
+
+ 1. Let newTypedArray be ? Construct(constructor, argumentList).
+ 2. Perform ? ValidateTypedArray(newTypedArray).
+ 3. If argumentList is a List of a single Number, then
+ ...
+ 4. Return newTypedArray.
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, Symbol.species, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([40n]);
+ var other = new Int8Array([1, 0, 1]);
+ var result;
+
+ sample.constructor = {};
+ sample.constructor[Symbol.species] = function() {
+ return other;
+ };
+
+ result = sample.subarray(0, 0);
+
+ assert.sameValue(result, other, "returned another typedarray");
+ assert(compareArray(result, [1, 0, 1]), "the returned object is preserved");
+});
diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor-throws.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor-throws.js
new file mode 100644
index 000000000..958378556
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor-throws.js
@@ -0,0 +1,46 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.subarray
+description: >
+ Custom @@species constructor throws if it does not return a compatible object
+info: |
+ 22.2.3.27 %TypedArray%.prototype.subarray( begin , end )
+
+ ...
+ 17. Return ? TypedArraySpeciesCreate(O, argumentsList).
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor).
+ 4. Return ? TypedArrayCreate(constructor, argumentList).
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+
+ ...
+ 5. Let S be ? Get(C, @@species).
+ ...
+ 7. If IsConstructor(S) is true, return S.
+ ...
+
+ 22.2.4.6 TypedArrayCreate ( constructor, argumentList )
+
+ 1. Let newTypedArray be ? Construct(constructor, argumentList).
+ 2. Perform ? ValidateTypedArray(newTypedArray).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol.species, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(2);
+ var ctor = function() {};
+
+ sample.constructor = {};
+ sample.constructor[Symbol.species] = ctor;
+
+ assert.throws(TypeError, function() {
+ sample.subarray(0);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor.js
new file mode 100644
index 000000000..01b0dbd9b
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor.js
@@ -0,0 +1,53 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.subarray
+description: >
+ Use custom @@species constructor if available
+info: |
+ 22.2.3.27 %TypedArray%.prototype.subarray( begin , end )
+
+ ...
+ 17. Return ? TypedArraySpeciesCreate(O, argumentsList).
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor).
+ 4. Return ? TypedArrayCreate(constructor, argumentList).
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+
+ ...
+ 5. Let S be ? Get(C, @@species).
+ ...
+ 7. If IsConstructor(S) is true, return S.
+ ...
+
+ 22.2.4.6 TypedArrayCreate ( constructor, argumentList )
+
+ 1. Let newTypedArray be ? Construct(constructor, argumentList).
+ 2. Perform ? ValidateTypedArray(newTypedArray).
+ 3. If argumentList is a List of a single Number, then
+ ...
+ 4. Return newTypedArray.
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, Symbol.species, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([40n, 41n, 42n]);
+ var calls = 0;
+ var result;
+
+ sample.constructor = {};
+ sample.constructor[Symbol.species] = function(buffer, offset, length) {
+ calls++;
+ return new TA(buffer, offset, length);
+ };
+
+ result = sample.subarray(1);
+
+ assert.sameValue(calls, 1, "ctor called once");
+ assert(compareArray(result, [41n, 42n]), "expected subarray");
+});
diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-returns-throws.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-returns-throws.js
new file mode 100644
index 000000000..1a01c0460
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-returns-throws.js
@@ -0,0 +1,65 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.subarray
+description: >
+ Throws if returned @@species is not a constructor, null or undefined.
+info: |
+ 22.2.3.27 %TypedArray%.prototype.subarray( begin , end )
+
+ ...
+ 17. Return ? TypedArraySpeciesCreate(O, argumentsList).
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor).
+ ...
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+
+ ...
+ 5. Let S be ? Get(C, @@species).
+ 6. If S is either undefined or null, return defaultConstructor.
+ 7. If IsConstructor(S) is true, return S.
+ 8. Throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol.species, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(2);
+
+ sample.constructor = {};
+
+ sample.constructor[Symbol.species] = 0;
+ assert.throws(TypeError, function() {
+ sample.subarray(0);
+ }, "0");
+
+ sample.constructor[Symbol.species] = "string";
+ assert.throws(TypeError, function() {
+ sample.subarray(0);
+ }, "string");
+
+ sample.constructor[Symbol.species] = {};
+ assert.throws(TypeError, function() {
+ sample.subarray(0);
+ }, "{}");
+
+ sample.constructor[Symbol.species] = NaN;
+ assert.throws(TypeError, function() {
+ sample.subarray(0);
+ }, "NaN");
+
+ sample.constructor[Symbol.species] = false;
+ assert.throws(TypeError, function() {
+ sample.subarray(0);
+ }, "false");
+
+ sample.constructor[Symbol.species] = true;
+ assert.throws(TypeError, function() {
+ sample.subarray(0);
+ }, "true");
+});
diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-use-default-ctor.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-use-default-ctor.js
new file mode 100644
index 000000000..1b1a4e46f
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-use-default-ctor.js
@@ -0,0 +1,53 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.subarray
+description: >
+ Use defaultConstructor if @@species is either undefined or null
+info: |
+ 22.2.3.27 %TypedArray%.prototype.subarray( begin , end )
+
+ ...
+ 17. Return ? TypedArraySpeciesCreate(O, argumentsList).
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor).
+ ...
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+
+ ...
+ 5. Let S be ? Get(C, @@species).
+ 6. If S is either undefined or null, return defaultConstructor.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol.species, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(2);
+ var result;
+
+ sample.constructor = {};
+
+ result = sample.subarray(0);
+
+ assert.sameValue(
+ Object.getPrototypeOf(result),
+ Object.getPrototypeOf(sample),
+ "undefined @@species - prototype check "
+ );
+ assert.sameValue(result.constructor, TA, "undefined @@species - ctor check");
+
+ sample.constructor[Symbol.species] = null;
+ result = sample.subarray(0);
+
+ assert.sameValue(
+ Object.getPrototypeOf(result),
+ Object.getPrototypeOf(sample),
+ "null @@species - prototype check "
+ );
+ assert.sameValue(result.constructor, TA, "null @@species - ctor check");
+});
diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species.js
new file mode 100644
index 000000000..01f3427bf
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.subarray
+description: >
+ get @@species from found constructor
+info: |
+ 22.2.3.27 %TypedArray%.prototype.subarray( begin , end )
+
+ ...
+ 17. Return ? TypedArraySpeciesCreate(O, argumentsList).
+
+ 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
+
+ ...
+ 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor).
+ ...
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+
+ 1. Assert: Type(O) is Object.
+ 2. Let C be ? Get(O, "constructor").
+ ...
+ 5. Let S be ? Get(C, @@species).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol.species, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(2);
+ var calls = 0;
+
+ sample.constructor = {};
+
+ Object.defineProperty(sample.constructor, Symbol.species, {
+ get: function() {
+ calls++;
+ }
+ });
+
+ sample.subarray(0);
+
+ assert.sameValue(calls, 1);
+});
diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/this-is-not-object.js
new file mode 100644
index 000000000..976731c66
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/this-is-not-object.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.subarray
+description: Throws a TypeError exception when `this` is not Object
+info: |
+ 22.2.3.27 %TypedArray%.prototype.subarray( begin , end )
+
+ The following steps are taken:
+
+ 1. Let O be the this value.
+ 2. If Type(O) is not Object, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var subarray = TypedArray.prototype.subarray;
+
+assert.throws(TypeError, function() {
+ subarray.call(undefined, 0, 0);
+}, "this is undefined");
+
+assert.throws(TypeError, function() {
+ subarray.call(null, 0, 0);
+}, "this is null");
+
+assert.throws(TypeError, function() {
+ subarray.call(42, 0, 0);
+}, "this is 42");
+
+assert.throws(TypeError, function() {
+ subarray.call("1", 0, 0);
+}, "this is a string");
+
+assert.throws(TypeError, function() {
+ subarray.call(true, 0, 0);
+}, "this is true");
+
+assert.throws(TypeError, function() {
+ subarray.call(false, 0, 0);
+}, "this is false");
+
+var s = Symbol("s");
+assert.throws(TypeError, function() {
+ subarray.call(s, 0, 0);
+}, "this is a Symbol");
diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/this-is-not-typedarray-instance.js
new file mode 100644
index 000000000..275f5e2bd
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/this-is-not-typedarray-instance.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.subarray
+description: >
+ Throws a TypeError exception when `this` is not a TypedArray instance
+info: |
+ 22.2.3.9 %TypedArray%.prototype.subarray( begin , end )
+
+ The following steps are taken:
+
+ 1. Let O be the this value.
+ 2. If Type(O) is not Object, throw a TypeError exception.
+ 3. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var subarray = TypedArray.prototype.subarray;
+
+assert.throws(TypeError, function() {
+ subarray.call({}, 0, 0);
+}, "this is an Object");
+
+assert.throws(TypeError, function() {
+ subarray.call([], 0, 0);
+}, "this is an Array");
+
+var ab = new ArrayBuffer(8);
+assert.throws(TypeError, function() {
+ subarray.call(ab, 0, 0);
+}, "this is an ArrayBuffer instance");
+
+var dv = new DataView(new ArrayBuffer(8), 0, 1);
+assert.throws(TypeError, function() {
+ subarray.call(dv, 0, 0);
+}, "this is a DataView instance");
diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/tointeger-begin.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/tointeger-begin.js
new file mode 100644
index 000000000..3d9ff3c0f
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/tointeger-begin.js
@@ -0,0 +1,48 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.subarray
+description: ToInteger(begin)
+info: |
+ 22.2.3.27 %TypedArray%.prototype.subarray( begin , end )
+
+ ...
+ 7. Let relativeBegin be ? ToInteger(begin).
+ ...
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var obj = {
+ valueOf: function() {
+ return 2;
+ }
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([40n, 41n, 42n, 43n]);
+
+ assert(compareArray(sample.subarray(false), [40n, 41n, 42n, 43n]), "false");
+ assert(compareArray(sample.subarray(true), [41n, 42n, 43n]), "true");
+
+ assert(compareArray(sample.subarray(NaN), [40n, 41n, 42n, 43n]), "NaN");
+ assert(compareArray(sample.subarray(null), [40n, 41n, 42n, 43n]), "null");
+ assert(compareArray(sample.subarray(undefined), [40n, 41n, 42n, 43n]), "undefined");
+
+ assert(compareArray(sample.subarray(1.1), [41n, 42n, 43n]), "1.1");
+ assert(compareArray(sample.subarray(1.5), [41n, 42n, 43n]), "1.5");
+ assert(compareArray(sample.subarray(0.6), [40n, 41n, 42n, 43n]), "0.6");
+
+ assert(compareArray(sample.subarray(-1.5), [43n]), "-1.5");
+ assert(compareArray(sample.subarray(-1.1), [43n]), "-1.1");
+ assert(compareArray(sample.subarray(-0.6), [40n, 41n, 42n, 43n]), "-0.6");
+
+ assert(compareArray(sample.subarray("3"), [43n]), "string");
+ assert(
+ compareArray(
+ sample.subarray(obj),
+ [42n, 43n]
+ ),
+ "object"
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/tointeger-end.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/tointeger-end.js
new file mode 100644
index 000000000..8885220a3
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/tointeger-end.js
@@ -0,0 +1,48 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.subarray
+description: ToInteger(end)
+info: |
+ 22.2.3.27 %TypedArray%.prototype.subarray( begin , end )
+
+ ...
+ 9. If end is undefined, let relativeEnd be srcLength; else, let relativeEnd be
+ ? ToInteger(end).
+ ...
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var obj = {
+ valueOf: function() {
+ return 2;
+ }
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([40n, 41n, 42n, 43n]);
+
+ assert(compareArray(sample.subarray(0, false), []), "false");
+ assert(compareArray(sample.subarray(0, true), [40n]), "true");
+
+ assert(compareArray(sample.subarray(0, NaN), []), "NaN");
+ assert(compareArray(sample.subarray(0, null), []), "null");
+ assert(compareArray(sample.subarray(0, undefined), [40n, 41n, 42n, 43n]), "undefined");
+
+ assert(compareArray(sample.subarray(0, 0.6), []), "0.6");
+ assert(compareArray(sample.subarray(0, 1.1), [40n]), "1.1");
+ assert(compareArray(sample.subarray(0, 1.5), [40n]), "1.5");
+ assert(compareArray(sample.subarray(0, -0.6), []), "-0.6");
+ assert(compareArray(sample.subarray(0, -1.1), [40n, 41n, 42n]), "-1.1");
+ assert(compareArray(sample.subarray(0, -1.5), [40n, 41n, 42n]), "-1.5");
+
+ assert(compareArray(sample.subarray(0, "3"), [40n, 41n, 42n]), "string");
+ assert(
+ compareArray(
+ sample.subarray(0, obj),
+ [40n, 41n]
+ ),
+ "object"
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/subarray/invoked-as-func.js b/test/built-ins/TypedArray/prototype/subarray/invoked-as-func.js
index 702976ece..4a13c6f31 100644
--- a/test/built-ins/TypedArray/prototype/subarray/invoked-as-func.js
+++ b/test/built-ins/TypedArray/prototype/subarray/invoked-as-func.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.26
+esid: sec-%typedarray%.prototype.subarray
description: Throws a TypeError exception when invoked as a function
info: |
22.2.3.26 %TypedArray%.prototype.subarray( [ begin [ , end ] ] )
diff --git a/test/built-ins/TypedArray/prototype/subarray/invoked-as-method.js b/test/built-ins/TypedArray/prototype/subarray/invoked-as-method.js
index 2195190d7..cf195a76c 100644
--- a/test/built-ins/TypedArray/prototype/subarray/invoked-as-method.js
+++ b/test/built-ins/TypedArray/prototype/subarray/invoked-as-method.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.26
+esid: sec-%typedarray%.prototype.subarray
description: Requires a [[TypedArrayName]] internal slot.
info: |
22.2.3.26 %TypedArray%.prototype.subarray( [ begin [ , end ] ] )
diff --git a/test/built-ins/TypedArray/prototype/subarray/length.js b/test/built-ins/TypedArray/prototype/subarray/length.js
index 8ce548c5a..8328dc699 100644
--- a/test/built-ins/TypedArray/prototype/subarray/length.js
+++ b/test/built-ins/TypedArray/prototype/subarray/length.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.26
+esid: sec-%typedarray%.prototype.subarray
description: >
%TypedArray%.prototype.subarray.length is 2.
info: |
@@ -20,6 +20,7 @@ info: |
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
[[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.subarray.length, 2);
diff --git a/test/built-ins/TypedArray/prototype/subarray/name.js b/test/built-ins/TypedArray/prototype/subarray/name.js
index 9bb40df38..fb51a5f53 100644
--- a/test/built-ins/TypedArray/prototype/subarray/name.js
+++ b/test/built-ins/TypedArray/prototype/subarray/name.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.26
+esid: sec-%typedarray%.prototype.subarray
description: >
%TypedArray%.prototype.subarray.name is "subarray".
info: |
@@ -17,6 +17,7 @@ info: |
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.subarray.name, "subarray");
diff --git a/test/built-ins/TypedArray/prototype/subarray/prop-desc.js b/test/built-ins/TypedArray/prototype/subarray/prop-desc.js
index 7891c7d77..776e57ad7 100644
--- a/test/built-ins/TypedArray/prototype/subarray/prop-desc.js
+++ b/test/built-ins/TypedArray/prototype/subarray/prop-desc.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.26
+esid: sec-%typedarray%.prototype.subarray
description: >
"subarray" property of TypedArrayPrototype
info: |
@@ -9,6 +9,7 @@ info: |
and in Annex B.2 has the attributes { [[Writable]]: true,
[[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
var TypedArrayPrototype = TypedArray.prototype;
diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/calls-tolocalestring-from-each-value.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/calls-tolocalestring-from-each-value.js
new file mode 100644
index 000000000..82cd346b9
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/calls-tolocalestring-from-each-value.js
@@ -0,0 +1,52 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.tolocalestring
+description: Calls toLocaleString from each property's value
+info: |
+ 22.2.3.28 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ])
+
+ %TypedArray%.prototype.toLocaleString is a distinct function that implements
+ the same algorithm as Array.prototype.toLocaleString as defined in 22.1.3.27
+ except that the this object's [[ArrayLength]] internal slot is accessed in
+ place of performing a [[Get]] of "length".
+
+ 22.1.3.27 Array.prototype.toLocaleString ( [ reserved1 [ , reserved2 ] ] )
+
+ ...
+ 5. Let firstElement be ? Get(array, "0").
+ 6. If firstElement is undefined or null, then
+ a. Let R be the empty String.
+ 7. Else,
+ a. Let R be ? ToString(? Invoke(firstElement, "toLocaleString")).
+ 8. Let k be 1.
+ 9.Repeat, while k < len
+ a. Let S be a String value produced by concatenating R and separator.
+ b. Let nextElement be ? Get(array, ! ToString(k)).
+ c. If nextElement is undefined or null, then
+ i. Let R be the empty String.
+ d. Else,
+ i. Let R be ? ToString(? Invoke(nextElement, "toLocaleString")).
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var separator = ["", ""].toLocaleString();
+var calls;
+
+BigInt.prototype.toLocaleString = function() {
+ calls.push(this);
+ return "hacks" + calls.length;
+};
+
+var expected = ["hacks1", "hacks2"].join(separator);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 0n]);
+ calls = [];
+ assert.sameValue(sample.toLocaleString(), expected, "returns expected value");
+ assert(
+ compareArray(new TA(calls), sample),
+ "toLocaleString called for each item"
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/calls-tostring-from-each-value.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/calls-tostring-from-each-value.js
new file mode 100644
index 000000000..7fb9d6393
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/calls-tostring-from-each-value.js
@@ -0,0 +1,58 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.tolocalestring
+description: >
+ Calls toString from each property's value return from toLocaleString
+info: |
+ 22.2.3.28 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ])
+
+ %TypedArray%.prototype.toLocaleString is a distinct function that implements
+ the same algorithm as Array.prototype.toLocaleString as defined in 22.1.3.27
+ except that the this object's [[ArrayLength]] internal slot is accessed in
+ place of performing a [[Get]] of "length".
+
+ 22.1.3.27 Array.prototype.toLocaleString ( [ reserved1 [ , reserved2 ] ] )
+
+ ...
+ 5. Let firstElement be ? Get(array, "0").
+ 6. If firstElement is undefined or null, then
+ a. Let R be the empty String.
+ 7. Else,
+ a. Let R be ? ToString(? Invoke(firstElement, "toLocaleString")).
+ 8. Let k be 1.
+ 9.Repeat, while k < len
+ a. Let S be a String value produced by concatenating R and separator.
+ b. Let nextElement be ? Get(array, ! ToString(k)).
+ c. If nextElement is undefined or null, then
+ i. Let R be the empty String.
+ d. Else,
+ i. Let R be ? ToString(? Invoke(nextElement, "toLocaleString")).
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var separator = ["", ""].toLocaleString();
+var calls;
+
+BigInt.prototype.toLocaleString = function() {
+ return {
+ toString: function() {
+ calls++;
+ return "hacks" + calls;
+ },
+ valueOf: function() {
+ throw new Test262Error("should not call valueOf if toString is present");
+ }
+ };
+};
+
+var arr = [42n, 0n];
+var expected = ["hacks1", "hacks2"].join(separator);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(arr);
+ calls = 0;
+ assert.sameValue(sample.toLocaleString(), expected, "returns expected value");
+ assert.sameValue(calls, 2, "toString called once for each item");
+});
diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/calls-valueof-from-each-value.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/calls-valueof-from-each-value.js
new file mode 100644
index 000000000..ea5464d98
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/calls-valueof-from-each-value.js
@@ -0,0 +1,55 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.tolocalestring
+description: >
+ Calls valueOf from each property's value return from toLocaleString
+info: |
+ 22.2.3.28 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ])
+
+ %TypedArray%.prototype.toLocaleString is a distinct function that implements
+ the same algorithm as Array.prototype.toLocaleString as defined in 22.1.3.27
+ except that the this object's [[ArrayLength]] internal slot is accessed in
+ place of performing a [[Get]] of "length".
+
+ 22.1.3.27 Array.prototype.toLocaleString ( [ reserved1 [ , reserved2 ] ] )
+
+ ...
+ 5. Let firstElement be ? Get(array, "0").
+ 6. If firstElement is undefined or null, then
+ a. Let R be the empty String.
+ 7. Else,
+ a. Let R be ? ToString(? Invoke(firstElement, "toLocaleString")).
+ 8. Let k be 1.
+ 9.Repeat, while k < len
+ a. Let S be a String value produced by concatenating R and separator.
+ b. Let nextElement be ? Get(array, ! ToString(k)).
+ c. If nextElement is undefined or null, then
+ i. Let R be the empty String.
+ d. Else,
+ i. Let R be ? ToString(? Invoke(nextElement, "toLocaleString")).
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var separator = ["", ""].toLocaleString();
+var calls;
+
+BigInt.prototype.toLocaleString = function() {
+ return {
+ toString: undefined,
+ valueOf: function() {
+ calls++;
+ return "hacks" + calls;
+ }
+ };
+};
+
+var expected = ["hacks1", "hacks2"].join(separator);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 0n]);
+ calls = 0;
+ assert.sameValue(sample.toLocaleString(), expected, "returns expected value");
+ assert.sameValue(calls, 2, "valueOf called once for each item");
+});
diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/detached-buffer.js
new file mode 100644
index 000000000..debd112e6
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/detached-buffer.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.tolocalestring
+description: Throws a TypeError if this has a detached buffer
+info: |
+ 22.2.3.28 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ])
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ ...
+ 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+ $DETACHBUFFER(sample.buffer);
+ assert.throws(TypeError, function() {
+ sample.toLocaleString();
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/empty-instance-returns-empty-string.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/empty-instance-returns-empty-string.js
new file mode 100644
index 000000000..e933bce82
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/empty-instance-returns-empty-string.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.tolocalestring
+description: Returns an empty string if called on an empty instance
+info: |
+ 22.2.3.28 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ])
+
+ %TypedArray%.prototype.toLocaleString is a distinct function that implements
+ the same algorithm as Array.prototype.toLocaleString as defined in 22.1.3.27
+ except that the this object's [[ArrayLength]] internal slot is accessed in
+ place of performing a [[Get]] of "length".
+
+ 22.1.3.27 Array.prototype.toLocaleString ( [ reserved1 [ , reserved2 ] ] )
+
+ ...
+ 4. If len is zero, return the empty String.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA();
+ assert.sameValue(sample.toLocaleString(), "");
+});
diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/get-length-uses-internal-arraylength.js
new file mode 100644
index 000000000..688cfb239
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/get-length-uses-internal-arraylength.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.tolocalestring
+description: Get "length" uses internal ArrayLength
+info: |
+ 22.2.3.28 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ])
+
+ %TypedArray%.prototype.toLocaleString is a distinct function that implements
+ the same algorithm as Array.prototype.toLocaleString as defined in 22.1.3.27
+ except that the this object's [[ArrayLength]] internal slot is accessed in
+ place of performing a [[Get]] of "length".
+
+ 22.1.3.27 Array.prototype.toLocaleString ( [ reserved1 [ , reserved2 ] ] )
+
+ 1. Let array be ? ToObject(this value).
+ 2.Let len be ? ToLength(? Get(array, "length")).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var getCalls = 0;
+var desc = {
+ get: function getLen() {
+ getCalls++;
+ return 0;
+ }
+};
+
+Object.defineProperty(TypedArray.prototype, "length", desc);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 43n]);
+
+ Object.defineProperty(TA.prototype, "length", desc);
+ Object.defineProperty(sample, "length", desc);
+
+ sample.toLocaleString();
+
+ assert.sameValue(getCalls, 0, "ignores length properties");
+});
diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/invoked-as-func.js
new file mode 100644
index 000000000..f8e43830d
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/invoked-as-func.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.tolocalestring
+description: Throws a TypeError exception when invoked as a function
+info: |
+ 22.2.3.27 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ])
+
+ ...
+
+ This function is not generic. ValidateTypedArray is applied to the this
+ value prior to evaluating the algorithm. If its result is an abrupt
+ completion that exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var toLocaleString = TypedArray.prototype.toLocaleString;
+
+assert.sameValue(typeof toLocaleString, 'function');
+
+assert.throws(TypeError, function() {
+ toLocaleString();
+});
diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/invoked-as-method.js
new file mode 100644
index 000000000..977734f74
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/invoked-as-method.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.tolocalestring
+description: Requires a [[TypedArrayName]] internal slot.
+info: |
+ 22.2.3.27 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ])
+
+ ...
+
+ This function is not generic. ValidateTypedArray is applied to the this
+ value prior to evaluating the algorithm. If its result is an abrupt
+ completion that exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+assert.sameValue(typeof TypedArrayPrototype.toLocaleString, 'function');
+
+assert.throws(TypeError, function() {
+ TypedArrayPrototype.toLocaleString();
+});
diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/length.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/length.js
new file mode 100644
index 000000000..1bf9e889b
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/length.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.tolocalestring
+description: >
+ %TypedArray%.prototype.toLocaleString.length is 0.
+info: |
+ %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ])
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, has a length
+ property whose value is an integer. Unless otherwise specified, this
+ value is equal to the largest number of named arguments shown in the
+ subclause headings for the function description, including optional
+ parameters. However, rest parameters shown using the form “...name”
+ are not included in the default argument count.
+
+ Unless otherwise specified, the length property of a built-in Function
+ object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.toLocaleString.length, 0);
+
+verifyNotEnumerable(TypedArray.prototype.toLocaleString, "length");
+verifyNotWritable(TypedArray.prototype.toLocaleString, "length");
+verifyConfigurable(TypedArray.prototype.toLocaleString, "length");
diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/name.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/name.js
new file mode 100644
index 000000000..87a238ad1
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/name.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.tolocalestring
+description: >
+ %TypedArray%.prototype.toLocaleString.name is "toLocaleString".
+info: |
+ %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ])
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, that is not
+ identified as an anonymous function has a name property whose value
+ is a String.
+
+ Unless otherwise specified, the name property of a built-in Function
+ object, if it exists, has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.toLocaleString.name, "toLocaleString");
+
+verifyNotEnumerable(TypedArray.prototype.toLocaleString, "name");
+verifyNotWritable(TypedArray.prototype.toLocaleString, "name");
+verifyConfigurable(TypedArray.prototype.toLocaleString, "name");
diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/prop-desc.js
new file mode 100644
index 000000000..81d0cd374
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/prop-desc.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.tolocalestring
+description: >
+ "toLocaleString" property of TypedArrayPrototype
+info: |
+ ES6 section 17: Every other data property described in clauses 18 through 26
+ and in Annex B.2 has the attributes { [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+verifyNotEnumerable(TypedArrayPrototype, 'toLocaleString');
+verifyWritable(TypedArrayPrototype, 'toLocaleString');
+verifyConfigurable(TypedArrayPrototype, 'toLocaleString');
diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-firstelement-tolocalestring.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-firstelement-tolocalestring.js
new file mode 100644
index 000000000..e018468cc
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-firstelement-tolocalestring.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.tolocalestring
+description: Returns abrupt from firstElement's toLocaleString
+info: |
+ 22.2.3.28 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ])
+
+ %TypedArray%.prototype.toLocaleString is a distinct function that implements
+ the same algorithm as Array.prototype.toLocaleString as defined in 22.1.3.27
+ except that the this object's [[ArrayLength]] internal slot is accessed in
+ place of performing a [[Get]] of "length".
+
+ 22.1.3.27 Array.prototype.toLocaleString ( [ reserved1 [ , reserved2 ] ] )
+
+ ...
+ 4. If len is zero, return the empty String.
+ 5. Let firstElement be ? Get(array, "0").
+ 6. If firstElement is undefined or null, then
+ a. Let R be the empty String.
+ 7. Else,
+ a. Let R be ? ToString(? Invoke(firstElement, "toLocaleString")).
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var calls;
+
+BigInt.prototype.toLocaleString = function() {
+ calls++;
+ throw new Test262Error();
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ calls = 0;
+ var sample = new TA([42n, 0n]);
+ assert.throws(Test262Error, function() {
+ sample.toLocaleString();
+ });
+ assert.sameValue(calls, 1, "abrupt from first element");
+});
diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-firstelement-tostring.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-firstelement-tostring.js
new file mode 100644
index 000000000..058f684c3
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-firstelement-tostring.js
@@ -0,0 +1,53 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.tolocalestring
+description: >
+ Return abrupt from firstElement's toLocaleString => toString
+info: |
+ 22.2.3.28 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ])
+
+ %TypedArray%.prototype.toLocaleString is a distinct function that implements
+ the same algorithm as Array.prototype.toLocaleString as defined in 22.1.3.27
+ except that the this object's [[ArrayLength]] internal slot is accessed in
+ place of performing a [[Get]] of "length".
+
+ 22.1.3.27 Array.prototype.toLocaleString ( [ reserved1 [ , reserved2 ] ] )
+
+ ...
+ 5. Let firstElement be ? Get(array, "0").
+ 6. If firstElement is undefined or null, then
+ a. Let R be the empty String.
+ 7. Else,
+ a. Let R be ? ToString(? Invoke(firstElement, "toLocaleString")).
+ 8. Let k be 1.
+ 9.Repeat, while k < len
+ a. Let S be a String value produced by concatenating R and separator.
+ b. Let nextElement be ? Get(array, ! ToString(k)).
+ c. If nextElement is undefined or null, then
+ i. Let R be the empty String.
+ d. Else,
+ i. Let R be ? ToString(? Invoke(nextElement, "toLocaleString")).
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var calls = 0;
+
+BigInt.prototype.toLocaleString = function() {
+ return {
+ toString: function() {
+ calls++;
+ throw new Test262Error();
+ }
+ };
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 0n]);
+ calls = 0;
+ assert.throws(Test262Error, function() {
+ sample.toLocaleString();
+ });
+ assert.sameValue(calls, 1, "toString called once");
+});
diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-firstelement-valueof.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-firstelement-valueof.js
new file mode 100644
index 000000000..96259ba5d
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-firstelement-valueof.js
@@ -0,0 +1,54 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.tolocalestring
+description: >
+ Return abrupt from firstElement's toLocaleString => valueOf
+info: |
+ 22.2.3.28 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ])
+
+ %TypedArray%.prototype.toLocaleString is a distinct function that implements
+ the same algorithm as Array.prototype.toLocaleString as defined in 22.1.3.27
+ except that the this object's [[ArrayLength]] internal slot is accessed in
+ place of performing a [[Get]] of "length".
+
+ 22.1.3.27 Array.prototype.toLocaleString ( [ reserved1 [ , reserved2 ] ] )
+
+ ...
+ 5. Let firstElement be ? Get(array, "0").
+ 6. If firstElement is undefined or null, then
+ a. Let R be the empty String.
+ 7. Else,
+ a. Let R be ? ToString(? Invoke(firstElement, "toLocaleString")).
+ 8. Let k be 1.
+ 9.Repeat, while k < len
+ a. Let S be a String value produced by concatenating R and separator.
+ b. Let nextElement be ? Get(array, ! ToString(k)).
+ c. If nextElement is undefined or null, then
+ i. Let R be the empty String.
+ d. Else,
+ i. Let R be ? ToString(? Invoke(nextElement, "toLocaleString")).
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var calls = 0;
+
+BigInt.prototype.toLocaleString = function() {
+ return {
+ toString: undefined,
+ valueOf: function() {
+ calls++;
+ throw new Test262Error();
+ }
+ };
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 0n]);
+ calls = 0;
+ assert.throws(Test262Error, function() {
+ sample.toLocaleString();
+ });
+ assert.sameValue(calls, 1, "toString called once");
+});
diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-nextelement-tolocalestring.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-nextelement-tolocalestring.js
new file mode 100644
index 000000000..987146990
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-nextelement-tolocalestring.js
@@ -0,0 +1,44 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.tolocalestring
+description: Returns abrupt from a nextElement's toLocaleString
+info: |
+ 22.2.3.28 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ])
+
+ %TypedArray%.prototype.toLocaleString is a distinct function that implements
+ the same algorithm as Array.prototype.toLocaleString as defined in 22.1.3.27
+ except that the this object's [[ArrayLength]] internal slot is accessed in
+ place of performing a [[Get]] of "length".
+
+ 22.1.3.27 Array.prototype.toLocaleString ( [ reserved1 [ , reserved2 ] ] )
+
+ ...
+ 9.Repeat, while k < len
+ a. Let S be a String value produced by concatenating R and separator.
+ b. Let nextElement be ? Get(array, ! ToString(k)).
+ c. If nextElement is undefined or null, then
+ i. Let R be the empty String.
+ d. Else,
+ i. Let R be ? ToString(? Invoke(nextElement, "toLocaleString")).
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var calls = 0;
+
+BigInt.prototype.toLocaleString = function() {
+ calls++;
+ if (calls > 1) {
+ throw new Test262Error();
+ }
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ calls = 0;
+ var sample = new TA([42n, 0n]);
+ assert.throws(Test262Error, function() {
+ sample.toLocaleString();
+ });
+ assert.sameValue(calls, 2, "abrupt from a next element");
+});
diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-nextelement-tostring.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-nextelement-tostring.js
new file mode 100644
index 000000000..cc0bd5ee6
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-nextelement-tostring.js
@@ -0,0 +1,55 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.tolocalestring
+description: >
+ Return abrupt from nextElement's toLocaleString => valueOf
+info: |
+ 22.2.3.28 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ])
+
+ %TypedArray%.prototype.toLocaleString is a distinct function that implements
+ the same algorithm as Array.prototype.toLocaleString as defined in 22.1.3.27
+ except that the this object's [[ArrayLength]] internal slot is accessed in
+ place of performing a [[Get]] of "length".
+
+ 22.1.3.27 Array.prototype.toLocaleString ( [ reserved1 [ , reserved2 ] ] )
+
+ ...
+ 5. Let firstElement be ? Get(array, "0").
+ 6. If firstElement is undefined or null, then
+ a. Let R be the empty String.
+ 7. Else,
+ a. Let R be ? ToString(? Invoke(firstElement, "toLocaleString")).
+ 8. Let k be 1.
+ 9.Repeat, while k < len
+ a. Let S be a String value produced by concatenating R and separator.
+ b. Let nextElement be ? Get(array, ! ToString(k)).
+ c. If nextElement is undefined or null, then
+ i. Let R be the empty String.
+ d. Else,
+ i. Let R be ? ToString(? Invoke(nextElement, "toLocaleString")).
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var calls = 0;
+
+BigInt.prototype.toLocaleString = function() {
+ return {
+ toString: function() {
+ calls++;
+ if (calls > 1) {
+ throw new Test262Error();
+ }
+ }
+ };
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 0n]);
+ calls = 0;
+ assert.throws(Test262Error, function() {
+ sample.toLocaleString();
+ });
+ assert.sameValue(calls, 2, "abrupt from a nextElement");
+});
diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-nextelement-valueof.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-nextelement-valueof.js
new file mode 100644
index 000000000..152095ebe
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-nextelement-valueof.js
@@ -0,0 +1,56 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.tolocalestring
+description: >
+ Return abrupt from nextElement's toLocaleString => valueOf
+info: |
+ 22.2.3.28 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ])
+
+ %TypedArray%.prototype.toLocaleString is a distinct function that implements
+ the same algorithm as Array.prototype.toLocaleString as defined in 22.1.3.27
+ except that the this object's [[ArrayLength]] internal slot is accessed in
+ place of performing a [[Get]] of "length".
+
+ 22.1.3.27 Array.prototype.toLocaleString ( [ reserved1 [ , reserved2 ] ] )
+
+ ...
+ 5. Let firstElement be ? Get(array, "0").
+ 6. If firstElement is undefined or null, then
+ a. Let R be the empty String.
+ 7. Else,
+ a. Let R be ? ToString(? Invoke(firstElement, "toLocaleString")).
+ 8. Let k be 1.
+ 9.Repeat, while k < len
+ a. Let S be a String value produced by concatenating R and separator.
+ b. Let nextElement be ? Get(array, ! ToString(k)).
+ c. If nextElement is undefined or null, then
+ i. Let R be the empty String.
+ d. Else,
+ i. Let R be ? ToString(? Invoke(nextElement, "toLocaleString")).
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var calls = 0;
+
+BigInt.prototype.toLocaleString = function() {
+ return {
+ toString: undefined,
+ valueOf: function() {
+ calls++;
+ if (calls > 1) {
+ throw new Test262Error();
+ }
+ }
+ };
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 0n]);
+ calls = 0;
+ assert.throws(Test262Error, function() {
+ sample.toLocaleString();
+ });
+ assert.sameValue(calls, 2, "abrupt from a nextElement");
+});
diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-result.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-result.js
new file mode 100644
index 000000000..99772306f
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-result.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.tolocalestring
+description: Returns a string
+info: |
+ 22.2.3.28 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ])
+
+ %TypedArray%.prototype.toLocaleString is a distinct function that implements
+ the same algorithm as Array.prototype.toLocaleString as defined in 22.1.3.27
+ except that the this object's [[ArrayLength]] internal slot is accessed in
+ place of performing a [[Get]] of "length".
+
+ 22.1.3.27 Array.prototype.toLocaleString ( [ reserved1 [ , reserved2 ] ] )
+
+ ...
+ 5. Let firstElement be ? Get(array, "0").
+ 6. If firstElement is undefined or null, then
+ a. Let R be the empty String.
+ 7. Else,
+ a. Let R be ? ToString(? Invoke(firstElement, "toLocaleString")).
+ 8. Let k be 1.
+ 9.Repeat, while k < len
+ a. Let S be a String value produced by concatenating R and separator.
+ b. Let nextElement be ? Get(array, ! ToString(k)).
+ c. If nextElement is undefined or null, then
+ i. Let R be the empty String.
+ d. Else,
+ i. Let R be ? ToString(? Invoke(nextElement, "toLocaleString")).
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var separator = ["", ""].toLocaleString();
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([42n, 0n, 43n]);
+ var expected =
+ sample[0].toLocaleString().toString() +
+ separator +
+ sample[1].toLocaleString().toString() +
+ separator +
+ sample[2].toLocaleString().toString();
+ assert.sameValue(sample.toLocaleString(), expected);
+});
diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/this-is-not-object.js
new file mode 100644
index 000000000..b67bf77c4
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/this-is-not-object.js
@@ -0,0 +1,50 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.tolocalestring
+description: Throws a TypeError exception when `this` is not Object
+info: |
+ 22.2.3.28 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ])
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var toLocaleString = TypedArray.prototype.toLocaleString;
+
+assert.throws(TypeError, function() {
+ toLocaleString.call(undefined);
+}, "this is undefined");
+
+assert.throws(TypeError, function() {
+ toLocaleString.call(null);
+}, "this is null");
+
+assert.throws(TypeError, function() {
+ toLocaleString.call(42);
+}, "this is 42");
+
+assert.throws(TypeError, function() {
+ toLocaleString.call("1");
+}, "this is a string");
+
+assert.throws(TypeError, function() {
+ toLocaleString.call(true);
+}, "this is true");
+
+assert.throws(TypeError, function() {
+ toLocaleString.call(false);
+}, "this is false");
+
+var s = Symbol("s");
+assert.throws(TypeError, function() {
+ toLocaleString.call(s);
+}, "this is a Symbol");
diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/this-is-not-typedarray-instance.js
new file mode 100644
index 000000000..f98c9b5c0
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/this-is-not-typedarray-instance.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.tolocalestring
+description: >
+ Throws a TypeError exception when `this` is not a TypedArray instance
+info: |
+ 22.2.3.28 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ])
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var toLocaleString = TypedArray.prototype.toLocaleString;
+
+assert.throws(TypeError, function() {
+ toLocaleString.call({});
+}, "this is an Object");
+
+assert.throws(TypeError, function() {
+ toLocaleString.call([]);
+}, "this is an Array");
+
+var ab = new ArrayBuffer(8);
+assert.throws(TypeError, function() {
+ toLocaleString.call(ab);
+}, "this is an ArrayBuffer instance");
+
+var dv = new DataView(new ArrayBuffer(8), 0, 1);
+assert.throws(TypeError, function() {
+ toLocaleString.call(dv);
+}, "this is a DataView instance");
diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/calls-tostring-from-each-value.js b/test/built-ins/TypedArray/prototype/toLocaleString/calls-tostring-from-each-value.js
index 1329e4bd2..530ec1055 100644
--- a/test/built-ins/TypedArray/prototype/toLocaleString/calls-tostring-from-each-value.js
+++ b/test/built-ins/TypedArray/prototype/toLocaleString/calls-tostring-from-each-value.js
@@ -50,7 +50,7 @@ Number.prototype.toLocaleString = function() {
var arr = [42, 0];
var expected = ["hacks1", "hacks2"].join(separator);
-testWithTypedArrayConstructors(function(TA) {
+testWithTypedArrayConstructors(function(TA, N) {
var sample = new TA(arr);
calls = 0;
assert.sameValue(sample.toLocaleString(), expected, "returns expected value");
diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/calls-valueof-from-each-value.js b/test/built-ins/TypedArray/prototype/toLocaleString/calls-valueof-from-each-value.js
index 06f7bc0e0..328bbbf4e 100644
--- a/test/built-ins/TypedArray/prototype/toLocaleString/calls-valueof-from-each-value.js
+++ b/test/built-ins/TypedArray/prototype/toLocaleString/calls-valueof-from-each-value.js
@@ -48,7 +48,7 @@ Number.prototype.toLocaleString = function() {
var arr = [42, 0];
var expected = ["hacks1", "hacks2"].join(separator);
-testWithTypedArrayConstructors(function(TA) {
+testWithTypedArrayConstructors(function(TA, N) {
var sample = new TA(arr);
calls = 0;
assert.sameValue(sample.toLocaleString(), expected, "returns expected value");
diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/toLocaleString/get-length-uses-internal-arraylength.js
index 5d061ebaf..04ee64e7c 100644
--- a/test/built-ins/TypedArray/prototype/toLocaleString/get-length-uses-internal-arraylength.js
+++ b/test/built-ins/TypedArray/prototype/toLocaleString/get-length-uses-internal-arraylength.js
@@ -30,7 +30,7 @@ var desc = {
Object.defineProperty(TypedArray.prototype, "length", desc);
-testWithTypedArrayConstructors(function(TA) {
+testWithTypedArrayConstructors(function(TA, N) {
var sample = new TA([42, 43]);
Object.defineProperty(TA.prototype, "length", desc);
diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/invoked-as-func.js b/test/built-ins/TypedArray/prototype/toLocaleString/invoked-as-func.js
index 062547bc4..935d87c42 100644
--- a/test/built-ins/TypedArray/prototype/toLocaleString/invoked-as-func.js
+++ b/test/built-ins/TypedArray/prototype/toLocaleString/invoked-as-func.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.27
+esid: sec-%typedarray%.prototype.tolocalestring
description: Throws a TypeError exception when invoked as a function
info: |
22.2.3.27 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ])
diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/invoked-as-method.js b/test/built-ins/TypedArray/prototype/toLocaleString/invoked-as-method.js
index be172381a..34e97df8f 100644
--- a/test/built-ins/TypedArray/prototype/toLocaleString/invoked-as-method.js
+++ b/test/built-ins/TypedArray/prototype/toLocaleString/invoked-as-method.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.27
+esid: sec-%typedarray%.prototype.tolocalestring
description: Requires a [[TypedArrayName]] internal slot.
info: |
22.2.3.27 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ])
diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/length.js b/test/built-ins/TypedArray/prototype/toLocaleString/length.js
index 8780643ee..deadce49f 100644
--- a/test/built-ins/TypedArray/prototype/toLocaleString/length.js
+++ b/test/built-ins/TypedArray/prototype/toLocaleString/length.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.27
+esid: sec-%typedarray%.prototype.tolocalestring
description: >
%TypedArray%.prototype.toLocaleString.length is 0.
info: |
@@ -20,6 +20,7 @@ info: |
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
[[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.toLocaleString.length, 0);
diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/name.js b/test/built-ins/TypedArray/prototype/toLocaleString/name.js
index 6a126f0ff..20a8dfe16 100644
--- a/test/built-ins/TypedArray/prototype/toLocaleString/name.js
+++ b/test/built-ins/TypedArray/prototype/toLocaleString/name.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.27
+esid: sec-%typedarray%.prototype.tolocalestring
description: >
%TypedArray%.prototype.toLocaleString.name is "toLocaleString".
info: |
@@ -17,6 +17,7 @@ info: |
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.toLocaleString.name, "toLocaleString");
diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/prop-desc.js b/test/built-ins/TypedArray/prototype/toLocaleString/prop-desc.js
index 3d5ecac07..d5e4a414d 100644
--- a/test/built-ins/TypedArray/prototype/toLocaleString/prop-desc.js
+++ b/test/built-ins/TypedArray/prototype/toLocaleString/prop-desc.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.27
+esid: sec-%typedarray%.prototype.tolocalestring
description: >
"toLocaleString" property of TypedArrayPrototype
info: |
@@ -9,6 +9,7 @@ info: |
and in Annex B.2 has the attributes { [[Writable]]: true,
[[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
var TypedArrayPrototype = TypedArray.prototype;
diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-tolocalestring.js b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-tolocalestring.js
index ab58c6eac..d934b70da 100644
--- a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-tolocalestring.js
+++ b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-tolocalestring.js
@@ -33,7 +33,7 @@ Number.prototype.toLocaleString = function() {
var arr = [42, 0];
-testWithTypedArrayConstructors(function(TA) {
+testWithTypedArrayConstructors(function(TA, N) {
calls = 0;
var sample = new TA(arr);
assert.throws(Test262Error, function() {
diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-tostring.js b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-tostring.js
index 736d7ff06..394105ef3 100644
--- a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-tostring.js
+++ b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-tostring.js
@@ -45,7 +45,7 @@ Number.prototype.toLocaleString = function() {
var arr = [42, 0];
-testWithTypedArrayConstructors(function(TA) {
+testWithTypedArrayConstructors(function(TA, N) {
var sample = new TA(arr);
calls = 0;
assert.throws(Test262Error, function() {
diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-valueof.js b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-valueof.js
index 81102c73d..ae7e4169e 100644
--- a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-valueof.js
+++ b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-valueof.js
@@ -46,7 +46,7 @@ Number.prototype.toLocaleString = function() {
var arr = [42, 0];
-testWithTypedArrayConstructors(function(TA) {
+testWithTypedArrayConstructors(function(TA, N) {
var sample = new TA(arr);
calls = 0;
assert.throws(Test262Error, function() {
diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-tolocalestring.js b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-tolocalestring.js
index 0909a1dcd..49e02d09a 100644
--- a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-tolocalestring.js
+++ b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-tolocalestring.js
@@ -36,7 +36,7 @@ Number.prototype.toLocaleString = function() {
var arr = [42, 0];
-testWithTypedArrayConstructors(function(TA) {
+testWithTypedArrayConstructors(function(TA, N) {
calls = 0;
var sample = new TA(arr);
assert.throws(Test262Error, function() {
diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-tostring.js b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-tostring.js
index 1b7330e92..d872475c7 100644
--- a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-tostring.js
+++ b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-tostring.js
@@ -47,7 +47,7 @@ Number.prototype.toLocaleString = function() {
var arr = [42, 0];
-testWithTypedArrayConstructors(function(TA) {
+testWithTypedArrayConstructors(function(TA, N) {
var sample = new TA(arr);
calls = 0;
assert.throws(Test262Error, function() {
diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-valueof.js b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-valueof.js
index 336b4b49b..7df9a09d4 100644
--- a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-valueof.js
+++ b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-valueof.js
@@ -48,7 +48,7 @@ Number.prototype.toLocaleString = function() {
var arr = [42, 0];
-testWithTypedArrayConstructors(function(TA) {
+testWithTypedArrayConstructors(function(TA, N) {
var sample = new TA(arr);
calls = 0;
assert.throws(Test262Error, function() {
diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/return-result.js b/test/built-ins/TypedArray/prototype/toLocaleString/return-result.js
index 3880798df..fca0e70b3 100644
--- a/test/built-ins/TypedArray/prototype/toLocaleString/return-result.js
+++ b/test/built-ins/TypedArray/prototype/toLocaleString/return-result.js
@@ -35,7 +35,7 @@ var separator = ["", ""].toLocaleString();
var arr = [42, 0, 43];
-testWithTypedArrayConstructors(function(TA) {
+testWithTypedArrayConstructors(function(TA, N) {
var sample = new TA(arr);
var expected =
sample[0].toLocaleString().toString() +
diff --git a/test/built-ins/TypedArray/prototype/toString.js b/test/built-ins/TypedArray/prototype/toString.js
index 2b880503d..48ef729bd 100644
--- a/test/built-ins/TypedArray/prototype/toString.js
+++ b/test/built-ins/TypedArray/prototype/toString.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.28
+esid: sec-%typedarray%.prototype.tostring
description: >
"toString" property of TypedArrayPrototype
info: |
@@ -15,6 +15,7 @@ info: |
and in Annex B.2 has the attributes { [[Writable]]: true,
[[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
var TypedArrayPrototype = TypedArray.prototype;
diff --git a/test/built-ins/TypedArray/prototype/toString/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/toString/BigInt/detached-buffer.js
new file mode 100644
index 000000000..5b9e0cedc
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/toString/BigInt/detached-buffer.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.tostring
+description: Throws a TypeError if this has a detached buffer
+info: |
+ 22.2.3.29 %TypedArray%.prototype.toString ()
+
+ ...
+
+ 22.2.3.15 %TypedArray%.prototype.join ( separator )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ ...
+ 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+ $DETACHBUFFER(sample.buffer);
+ assert.throws(TypeError, function() {
+ sample.toString();
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/values/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/values/BigInt/detached-buffer.js
new file mode 100644
index 000000000..6c31b6bce
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/values/BigInt/detached-buffer.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.values
+description: Throws a TypeError if this has a detached buffer
+info: |
+ 22.2.3.30 %TypedArray%.prototype.values ( )
+
+ 1. Let O be the this value.
+ 2. Perform ? ValidateTypedArray(O).
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ ...
+ 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+ $DETACHBUFFER(sample.buffer);
+ assert.throws(TypeError, function() {
+ sample.values();
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/values/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/values/BigInt/invoked-as-func.js
new file mode 100644
index 000000000..26607d78a
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/values/BigInt/invoked-as-func.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.values
+description: Throws a TypeError exception when invoked as a function
+info: |
+ 22.2.3.29 %TypedArray%.prototype.values ( )
+
+ 1. Let O be the this value.
+ 2. Let valid be ValidateTypedArray(O).
+ 3. ReturnIfAbrupt(valid).
+ ...
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var values = TypedArray.prototype.values;
+
+assert.sameValue(typeof values, 'function');
+
+assert.throws(TypeError, function() {
+ values();
+});
diff --git a/test/built-ins/TypedArray/prototype/values/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/values/BigInt/invoked-as-method.js
new file mode 100644
index 000000000..cec67a6de
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/values/BigInt/invoked-as-method.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.values
+description: Requires a [[TypedArrayName]] internal slot.
+info: |
+ 22.2.3.29 %TypedArray%.prototype.values ( )
+
+ 1. Let O be the this value.
+ 2. Let valid be ValidateTypedArray(O).
+ 3. ReturnIfAbrupt(valid).
+ ...
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+assert.sameValue(typeof TypedArrayPrototype.values, 'function');
+
+assert.throws(TypeError, function() {
+ TypedArrayPrototype.values();
+});
diff --git a/test/built-ins/TypedArray/prototype/values/BigInt/iter-prototype.js b/test/built-ins/TypedArray/prototype/values/BigInt/iter-prototype.js
new file mode 100644
index 000000000..607aa0256
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/values/BigInt/iter-prototype.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 22.2.3.30
+esid: sec-%typedarray%.prototype.values
+description: >
+ The prototype of the returned iterator is ArrayIteratorPrototype
+info: |
+ 22.2.3.30 %TypedArray%.prototype.values ( )
+
+ ...
+ 3. Return CreateArrayIterator(O, "value").
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol.iterator, TypedArray]
+---*/
+
+var ArrayIteratorProto = Object.getPrototypeOf([][Symbol.iterator]());
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA([0n, 42n, 64n]);
+ var iter = sample.values();
+
+ assert.sameValue(Object.getPrototypeOf(iter), ArrayIteratorProto);
+});
diff --git a/test/built-ins/TypedArray/prototype/values/BigInt/length.js b/test/built-ins/TypedArray/prototype/values/BigInt/length.js
new file mode 100644
index 000000000..ce420f0ae
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/values/BigInt/length.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.values
+description: >
+ %TypedArray%.prototype.values.length is 0.
+info: |
+ %TypedArray%.prototype.values ( )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, has a length
+ property whose value is an integer. Unless otherwise specified, this
+ value is equal to the largest number of named arguments shown in the
+ subclause headings for the function description, including optional
+ parameters. However, rest parameters shown using the form “...name”
+ are not included in the default argument count.
+
+ Unless otherwise specified, the length property of a built-in Function
+ object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.values.length, 0);
+
+verifyNotEnumerable(TypedArray.prototype.values, "length");
+verifyNotWritable(TypedArray.prototype.values, "length");
+verifyConfigurable(TypedArray.prototype.values, "length");
diff --git a/test/built-ins/TypedArray/prototype/values/BigInt/name.js b/test/built-ins/TypedArray/prototype/values/BigInt/name.js
new file mode 100644
index 000000000..cc8ad3aed
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/values/BigInt/name.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.values
+description: >
+ %TypedArray%.prototype.values.name is "values".
+info: |
+ %TypedArray%.prototype.values ( )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, that is not
+ identified as an anonymous function has a name property whose value
+ is a String.
+
+ Unless otherwise specified, the name property of a built-in Function
+ object, if it exists, has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.values.name, "values");
+
+verifyNotEnumerable(TypedArray.prototype.values, "name");
+verifyNotWritable(TypedArray.prototype.values, "name");
+verifyConfigurable(TypedArray.prototype.values, "name");
diff --git a/test/built-ins/TypedArray/prototype/values/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/values/BigInt/prop-desc.js
new file mode 100644
index 000000000..b805b7e8c
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/values/BigInt/prop-desc.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.values
+description: >
+ "values" property of TypedArrayPrototype
+info: |
+ ES6 section 17: Every other data property described in clauses 18 through
+ 26 and in Annex B.2 has the attributes { [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+verifyNotEnumerable(TypedArrayPrototype, 'values');
+verifyWritable(TypedArrayPrototype, 'values');
+verifyConfigurable(TypedArrayPrototype, 'values');
diff --git a/test/built-ins/TypedArray/prototype/values/BigInt/return-itor.js b/test/built-ins/TypedArray/prototype/values/BigInt/return-itor.js
new file mode 100644
index 000000000..3924cb3b4
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/values/BigInt/return-itor.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 22.2.3.30
+esid: sec-%typedarray%.prototype.values
+description: Return an iterator for the values.
+info: |
+ 22.2.3.30 %TypedArray%.prototype.values ( )
+
+ ...
+ 3. Return CreateArrayIterator(O, "value").
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var typedArray = new TA([0n, 42n, 64n]);
+ var itor = typedArray.values();
+
+ var next = itor.next();
+ assert.sameValue(next.value, 0n);
+ assert.sameValue(next.done, false);
+
+ next = itor.next();
+ assert.sameValue(next.value, 42n);
+ assert.sameValue(next.done, false);
+
+ next = itor.next();
+ assert.sameValue(next.value, 64n);
+ assert.sameValue(next.done, false);
+
+ next = itor.next();
+ assert.sameValue(next.value, undefined);
+ assert.sameValue(next.done, true);
+});
diff --git a/test/built-ins/TypedArray/prototype/values/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/values/BigInt/this-is-not-object.js
new file mode 100644
index 000000000..57b57a78b
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/values/BigInt/this-is-not-object.js
@@ -0,0 +1,52 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.values
+description: Throws a TypeError exception when `this` is not Object
+info: |
+ 22.2.3.30 %TypedArray%.prototype.values ( )
+
+ The following steps are taken:
+
+ 1. Let O be the this value.
+ 2. Perform ? ValidateTypedArray(O).
+ ...
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var values = TypedArray.prototype.values;
+
+assert.throws(TypeError, function() {
+ values.call(undefined);
+}, "this is undefined");
+
+assert.throws(TypeError, function() {
+ values.call(null);
+}, "this is null");
+
+assert.throws(TypeError, function() {
+ values.call(42);
+}, "this is 42");
+
+assert.throws(TypeError, function() {
+ values.call("1");
+}, "this is a string");
+
+assert.throws(TypeError, function() {
+ values.call(true);
+}, "this is true");
+
+assert.throws(TypeError, function() {
+ values.call(false);
+}, "this is false");
+
+var s = Symbol("s");
+assert.throws(TypeError, function() {
+ values.call(s);
+}, "this is a Symbol");
diff --git a/test/built-ins/TypedArray/prototype/values/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/values/BigInt/this-is-not-typedarray-instance.js
new file mode 100644
index 000000000..68b78aedd
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/values/BigInt/this-is-not-typedarray-instance.js
@@ -0,0 +1,44 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.values
+description: >
+ Throws a TypeError exception when `this` is not a TypedArray instance
+info: |
+ 22.2.3.30 %TypedArray%.prototype.values ( )
+
+ The following steps are taken:
+
+ 1. Let O be the this value.
+ 2. Perform ? ValidateTypedArray(O).
+ ...
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var values = TypedArray.prototype.values;
+
+assert.throws(TypeError, function() {
+ values.call({});
+}, "this is an Object");
+
+assert.throws(TypeError, function() {
+ values.call([]);
+}, "this is an Array");
+
+var ab = new ArrayBuffer(8);
+assert.throws(TypeError, function() {
+ values.call(ab);
+}, "this is an ArrayBuffer instance");
+
+var dv = new DataView(new ArrayBuffer(8), 0, 1);
+assert.throws(TypeError, function() {
+ values.call(dv);
+}, "this is a DataView instance");
diff --git a/test/built-ins/TypedArray/prototype/values/invoked-as-func.js b/test/built-ins/TypedArray/prototype/values/invoked-as-func.js
index 8d8697662..bb01f5daa 100644
--- a/test/built-ins/TypedArray/prototype/values/invoked-as-func.js
+++ b/test/built-ins/TypedArray/prototype/values/invoked-as-func.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.29
+esid: sec-%typedarray%.prototype.values
description: Throws a TypeError exception when invoked as a function
info: |
22.2.3.29 %TypedArray%.prototype.values ( )
diff --git a/test/built-ins/TypedArray/prototype/values/invoked-as-method.js b/test/built-ins/TypedArray/prototype/values/invoked-as-method.js
index 5402d2267..177ca3016 100644
--- a/test/built-ins/TypedArray/prototype/values/invoked-as-method.js
+++ b/test/built-ins/TypedArray/prototype/values/invoked-as-method.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.29
+esid: sec-%typedarray%.prototype.values
description: Requires a [[TypedArrayName]] internal slot.
info: |
22.2.3.29 %TypedArray%.prototype.values ( )
diff --git a/test/built-ins/TypedArray/prototype/values/iter-prototype.js b/test/built-ins/TypedArray/prototype/values/iter-prototype.js
index 4bf31e184..df764e002 100644
--- a/test/built-ins/TypedArray/prototype/values/iter-prototype.js
+++ b/test/built-ins/TypedArray/prototype/values/iter-prototype.js
@@ -17,7 +17,7 @@ features: [Symbol.iterator, TypedArray]
var ArrayIteratorProto = Object.getPrototypeOf([][Symbol.iterator]());
-testWithTypedArrayConstructors(function(TA) {
+testWithTypedArrayConstructors(function(TA, N) {
var sample = new TA([0, 42, 64]);
var iter = sample.values();
diff --git a/test/built-ins/TypedArray/prototype/values/length.js b/test/built-ins/TypedArray/prototype/values/length.js
index cc260277f..deae67fbd 100644
--- a/test/built-ins/TypedArray/prototype/values/length.js
+++ b/test/built-ins/TypedArray/prototype/values/length.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.29
+esid: sec-%typedarray%.prototype.values
description: >
%TypedArray%.prototype.values.length is 0.
info: |
@@ -20,6 +20,7 @@ info: |
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
[[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.values.length, 0);
diff --git a/test/built-ins/TypedArray/prototype/values/name.js b/test/built-ins/TypedArray/prototype/values/name.js
index ccafda816..43b3d9dbb 100644
--- a/test/built-ins/TypedArray/prototype/values/name.js
+++ b/test/built-ins/TypedArray/prototype/values/name.js
@@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.29
+esid: sec-%typedarray%.prototype.values
description: >
%TypedArray%.prototype.values.name is "values".
info: |
@@ -17,6 +17,7 @@ info: |
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
assert.sameValue(TypedArray.prototype.values.name, "values");
diff --git a/test/built-ins/TypedArray/prototype/values/prop-desc.js b/test/built-ins/TypedArray/prototype/values/prop-desc.js
index 9eecfde59..7080c970d 100644
--- a/test/built-ins/TypedArray/prototype/values/prop-desc.js
+++ b/test/built-ins/TypedArray/prototype/values/prop-desc.js
@@ -1,7 +1,7 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
-es6id: 22.2.3.29
+esid: sec-%typedarray%.prototype.values
description: >
"values" property of TypedArrayPrototype
info: |
@@ -9,6 +9,7 @@ info: |
26 and in Annex B.2 has the attributes { [[Writable]]: true,
[[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray]
---*/
var TypedArrayPrototype = TypedArray.prototype;
diff --git a/test/built-ins/TypedArray/prototype/values/return-itor.js b/test/built-ins/TypedArray/prototype/values/return-itor.js
index 1877d7bec..b1f3c2d50 100644
--- a/test/built-ins/TypedArray/prototype/values/return-itor.js
+++ b/test/built-ins/TypedArray/prototype/values/return-itor.js
@@ -13,7 +13,7 @@ includes: [testTypedArray.js]
features: [TypedArray]
---*/
-var sample = new Int8Array([0, 42, 64]);
+var sample = [0, 42, 64];
testWithTypedArrayConstructors(function(TA) {
var typedArray = new TA(sample);