mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-08 01:00:05 +00:00
LibJS: Throw RangeError on BigInt division/modulo by zero
https://tc39.es/ecma262/#sec-numeric-types-bigint-divide https://tc39.es/ecma262/#sec-numeric-types-bigint-remainder
This commit is contained in:
parent
1d8ab74cbf
commit
11138f5c1f
Notes:
sideshowbarker
2024-07-18 21:17:35 +09:00
Author: https://github.com/linusg
Commit: 11138f5c1f
Pull-request: https://github.com/SerenityOS/serenity/pull/5833
3 changed files with 30 additions and 8 deletions
|
@ -87,4 +87,13 @@ describe("errors", () => {
|
|||
+123n;
|
||||
}).toThrowWithMessage(TypeError, "Cannot convert BigInt to number");
|
||||
});
|
||||
|
||||
test("division by zero", () => {
|
||||
expect(() => {
|
||||
1n / 0n;
|
||||
}).toThrowWithMessage(RangeError, "Division by zero");
|
||||
expect(() => {
|
||||
1n % 0n;
|
||||
}).toThrowWithMessage(RangeError, "Division by zero");
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue