diff options
author | 迷渡 <justjavac@gmail.com> | 2019-08-29 22:57:09 +0800 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-08-29 10:57:09 -0400 |
commit | 590463bd4a8d71330ab808774b63dd6b366bba1f (patch) | |
tree | 7b30b398c9f15c5b0136f3a582957d3e59d433de /js/timers_test.ts | |
parent | b5a5e973842fed271210ce919a309745b9bfa30a (diff) |
setTimeout's params should not be bigint (#2834)
Diffstat (limited to 'js/timers_test.ts')
-rw-r--r-- | js/timers_test.ts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/js/timers_test.ts b/js/timers_test.ts index 2b10d9dad..f4757bdb2 100644 --- a/js/timers_test.ts +++ b/js/timers_test.ts @@ -244,6 +244,21 @@ test(async function clearTimeoutShouldConvertToNumber(): Promise<void> { assert(called); }); +test(function setTimeoutShouldThrowWithBigint(): void { + let hasThrown = 0; + try { + setTimeout((): void => {}, (1n as unknown) as number); + hasThrown = 1; + } catch (err) { + if (err instanceof TypeError) { + hasThrown = 2; + } else { + hasThrown = 3; + } + } + assertEquals(hasThrown, 2); +}); + test(function testFunctionName(): void { assertEquals(clearTimeout.name, "clearTimeout"); assertEquals(clearInterval.name, "clearInterval"); |