mirror of
https://github.com/tc39/test262.git
synced 2025-07-20 12:34:41 +02:00
Added case when Object has valueOf and toString
This commit is contained in:
parent
349baebc01
commit
dd72bf0d26
@ -0,0 +1,25 @@
|
|||||||
|
// 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]
|
|||||||
|
|
||||||
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(); }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user