mirror of
https://github.com/tc39/test262.git
synced 2025-05-03 14:30:27 +02:00
* [javascriptcore-test262-automation] changes from git@github.com:WebKit/webkit.git at sha 949e26452cfa153a7f4afe593da97e2fe9e1b706 on Tue Jul 03 2018 14:35:15 GMT-0400 (Eastern Daylight Time)
39 lines
824 B
JavaScript
39 lines
824 B
JavaScript
//@ runBigIntEnabled
|
|
|
|
assert = {
|
|
sameValue: function (input, expected, message) {
|
|
if (input !== expected)
|
|
throw new Error(message);
|
|
}
|
|
};
|
|
|
|
function testMod(x, y, z, message) {
|
|
assert.sameValue(x % y, z, message);
|
|
}
|
|
|
|
testMod(Object(33n), 10n, 3n, "ToPrimitive: unbox object with internal slot");
|
|
|
|
let o = {
|
|
[Symbol.toPrimitive]: function() {
|
|
return 33n;
|
|
},
|
|
valueOf: function () {
|
|
throw new Error("Should never execute it");
|
|
},
|
|
toString: function () {
|
|
throw new Error("Should never execute it");
|
|
}
|
|
};
|
|
testMod(o, 10n, 3n, "ToPrimitive: @@toPrimitive");
|
|
|
|
o = {
|
|
valueOf: function() {
|
|
return 33n;
|
|
},
|
|
toString: function () {
|
|
throw new Error("Should never execute it");
|
|
}
|
|
};
|
|
testMod(o, 10n, 3n, "ToPrimitive: valueOf");
|
|
|