summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Tests/computed-property-throws.js
blob: 2f8e35eb63cc0fcd6f9e0fa030f5eff62fe7add2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
test("Issue #3459, exception in computed property expression", () => {
    expect(() => {
        "foo"[bar];
    }).toThrow(ReferenceError);
    expect(() => {
        "foo"[bar]();
    }).toThrow(ReferenceError);
});

test("Issue #3941, exception in computed property's toString()", () => {
    expect(() => {
        const o = {
            toString() {
                throw Error();
            },
        };
        "foo"[o];
    }).toThrow(Error);
});