Skip to content
Snippets Groups Projects
Commit dd72bf0d authored by Caio Lima's avatar Caio Lima
Browse files

Added case when Object has valueOf and toString

parent 349baebc
No related branches found
No related tags found
No related merge requests found
// Copyright (C) 2017 Caio Lima. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: ToPrimitive receives "hint Number" as parameter, then valueOf needs to be called
esid: sec-bigint-constructor-number-value
info: |
1. If NewTarget is not undefined, throw a TypeError exception.
2. Let prim be ? ToPrimitive(value, hint Number).
...
features: [BigInt]
---*/
let o = {
valueOf: function() {
return 44;
},
toString: function() {
throw new Test262Error("unreachable");
}
}
assert.sameValue(BigInt(o), 44n);
...@@ -14,13 +14,13 @@ features: [BigInt] ...@@ -14,13 +14,13 @@ features: [BigInt]
assert.throws(Test262Error, function() { assert.throws(Test262Error, function() {
BigInt({ BigInt({
valueOf: function() { throw new Test262Error("unreachable"); } valueOf: function() { throw new Test262Error(); }
}); });
} }
assert.throws(Test262Error, function() { assert.throws(Test262Error, function() {
BigInt({ BigInt({
toString: function() { throw new Test262Error("unreachable"); } toString: function() { throw new Test262Error(); }
}); });
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment