summaryrefslogtreecommitdiff
path: root/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex.js')
-rw-r--r--test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex.js
new file mode 100644
index 000000000..5f994cd86
--- /dev/null
+++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex.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-integer-indexed-exotic-objects-defineownproperty-p-desc
+description: >
+ Returns true after setting a valid numeric index key
+info: |
+ 9.4.5.3 [[DefineOwnProperty]] ( P, Desc)
+ ...
+ 3. If Type(P) is String, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ ...
+ x. If Desc has a [[Writable]] field and if Desc.[[Writable]] is false,
+ return false.
+ ...
+includes: [testBigIntTypedArray.js, propertyHelper.js]
+features: [BigInt, Reflect, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(convertToBigInt([42, 42]));
+
+ assert.sameValue(
+ Reflect.defineProperty(sample, "0", {
+ value: convertToBigInt(8),
+ configurable: false,
+ enumerable: true,
+ writable: true
+ }),
+ true
+ );
+
+ assert.sameValue(sample[0], convertToBigInt(8), "property value was set");
+ var desc = Object.getOwnPropertyDescriptor(sample, "0");
+
+ assert.sameValue(desc.value, convertToBigInt(8), "desc.value");
+ assert.sameValue(desc.writable, true, "property is writable");
+
+ verifyEnumerable(sample, "0");
+ verifyNotConfigurable(sample, "0");
+});