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