Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/left-shift/bigint-wrapped-values.js

raw
1 // Copyright (C) 2017 Josh Wolfe. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 description: left-shift operator ToNumeric with BigInt operands
5 esid: sec-left-shift-operator-runtime-semantics-evaluation
6 features: [BigInt, Symbol.toPrimitive, computed-property-names]
7 ---*/
8
9 assert.sameValue(Object(2n) << 1n, 4n, "ToPrimitive: unbox object with internal slot");
10 assert.sameValue(1n << Object(2n), 4n, "ToPrimitive: unbox object with internal slot");
11 assert.sameValue(({
12 [Symbol.toPrimitive]: function() {
13 return 2n;
14 }
15 }) << 1n, 4n, "ToPrimitive: @@toPrimitive");
16 assert.sameValue(1n << {
17 [Symbol.toPrimitive]: function() {
18 return 2n;
19 }
20 }, 4n, "ToPrimitive: @@toPrimitive");
21 assert.sameValue(({
22 valueOf: function() {
23 return 2n;
24 }
25 }) << 1n, 4n, "ToPrimitive: valueOf");
26 assert.sameValue(1n << {
27 valueOf: function() {
28 return 2n;
29 }
30 }, 4n, "ToPrimitive: valueOf");
31 assert.sameValue(({
32 toString: function() {
33 return 2n;
34 }
35 }) << 1n, 4n, "ToPrimitive: toString");
36 assert.sameValue(1n << {
37 toString: function() {
38 return 2n;
39 }
40 }, 4n, "ToPrimitive: toString");