Bug 1892041 - Part 2: Update test262. r=spidermonkey-reviewers,dminor
[gecko.git] / js / src / tests / test262 / built-ins / TypedArrayConstructors / internals / Set / key-is-not-numeric-index-set-throws.js
blobc935cb7cf39927f700b68d7bb39cdbeb6d56f6ac
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   Returns abrupt from OrdinarySet when key is not a numeric index
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).
17   9.1.9.1 OrdinarySet (O, P, V, Receiver)
19   ...
20   8. Perform ? Call(setter, Receiver, « V »).
21   ...
22 includes: [testTypedArray.js]
23 features: [align-detached-buffer-semantics-with-web-reality, TypedArray]
24 ---*/
26 testWithTypedArrayConstructors(function(TA) {
27   var sample = new TA(1);
29   Object.defineProperty(sample, "test262", {
30     set: function() {
31       throw new Test262Error();
32     }
33   });
35   assert.throws(Test262Error, function() {
36     sample.test262 = 1;
37   });
39   assert.sameValue(sample.test262, undefined, 'The value of sample.test262 is expected to equal `undefined`');
40 });
42 reportCompare(0, 0);