mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 03:17:34 +00:00
LibJS: Don't coerce this value to an object in Function.prototype.call
This commit is contained in:
parent
12231068bd
commit
1bfbc0b6af
2 changed files with 29 additions and 4 deletions
|
@ -51,3 +51,19 @@ test("basic functionality", () => {
|
|||
|
||||
expect((() => this).call("foo")).toBe(globalThis);
|
||||
});
|
||||
|
||||
describe("errors", () => {
|
||||
test("does not accept non-function values", () => {
|
||||
expect(() => {
|
||||
Function.prototype.call.call("foo");
|
||||
}).toThrowWithMessage(TypeError, "foo is not a function");
|
||||
|
||||
expect(() => {
|
||||
Function.prototype.call.call(undefined);
|
||||
}).toThrowWithMessage(TypeError, "undefined is not a function");
|
||||
|
||||
expect(() => {
|
||||
Function.prototype.call.call(null);
|
||||
}).toThrowWithMessage(TypeError, "null is not a function");
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue