Commit bb6bee32 authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

[bigint] Add tests for ToObject.

R=jkummerow@chromium.org

Bug: v8:6791
Change-Id: I2e9876577103d72cd5e2412e958b4bd832373899
Reviewed-on: https://chromium-review.googlesource.com/733132
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48864}
parent 4d932032
......@@ -277,6 +277,37 @@ const six = BigInt(6);
assertThrows(() => +One, TypeError);
}
// ToObject
{
const ToObject = x => (new Function("", "return this")).call(x);
function test(x) {
const X = ToObject(x);
assertEquals(typeof x, "bigint");
assertEquals(typeof X, 'object');
assertEquals(X.constructor, BigInt);
assertTrue(X == x);
}
test(0n);
test(-1n);
test(1n);
test(2343423423423423423424234234234235234524353453452345324523452345234534n);
}{
function test(x) {
const X = Object(x);
assertEquals(typeof x, "bigint");
assertEquals(typeof X, 'object');
assertEquals(X.constructor, BigInt);
assertTrue(X == x);
}
test(0n);
test(-1n);
test(1n);
test(2343423423423423423424234234234235234524353453452345324523452345234534n);
}
// Literals
{
// Invalid literals.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment