Bug 1892041 - Part 2: Update test262. r=spidermonkey-reviewers,dminor
[gecko.git] / js / src / tests / test262 / built-ins / TypedArrayConstructors / internals / Set / detached-buffer-key-is-not-numeric-index.js
blob81a22ef4376c9a578c962b23bb7ced29eb805dcf
1 // Copyright (C) 2016 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 esid: sec-integer-indexed-exotic-objects-set-p-v-receiver
5 description: >
6   Does not throw on an instance with a detached buffer if key is not a number
7 info: |
8   9.4.5.5 [[Set]] ( P, V, Receiver)
10   ...
11   2. If Type(P) is String, then
12     a. Let numericIndex be ! CanonicalNumericIndexString(P).
13     b. If numericIndex is not undefined, then
14     ...
15   3. Return ? OrdinarySet(O, P, V, Receiver).
16 includes: [testTypedArray.js, detachArrayBuffer.js]
17 features: [align-detached-buffer-semantics-with-web-reality, Reflect, TypedArray]
18 ---*/
20 testWithTypedArrayConstructors(function(TA) {
21   var sample = new TA(2);
22   $DETACHBUFFER(sample.buffer);
24   assert.sameValue(
25     Reflect.set(sample, "foo", "test262"),
26     true,
27     'Reflect.set(sample, "foo", "test262") must return true'
28   );
29   assert.sameValue(sample.foo, "test262", 'The value of sample.foo is "test262"');
30 });
32 reportCompare(0, 0);