LibJS: Support numeric literal expressions in nullish object exceptions

This commit is contained in:
Timothy Flynn 2024-04-01 22:02:03 -04:00 committed by Andreas Kling
commit bfcfe6ce35
Notes: sideshowbarker 2024-07-16 23:34:49 +09:00
3 changed files with 16 additions and 2 deletions

View file

@ -47,11 +47,17 @@ test("null/undefined array index", () => {
expect(() => {
foo[0].bar;
}).toThrowWithMessage(TypeError, `Cannot access property "bar" on ${value} object`);
}).toThrowWithMessage(
TypeError,
`Cannot access property "bar" on ${value} object "foo[0]"`
);
expect(() => {
foo[0].bar = 1;
}).toThrowWithMessage(TypeError, `Cannot access property "bar" on ${value} object`);
}).toThrowWithMessage(
TypeError,
`Cannot access property "bar" on ${value} object "foo[0]"`
);
expect(() => {
foo[index].bar;