summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Tests/modules/declarations-tests.mjs
blob: 1cccb86b8bf2d97482dbfafb5af20b4963a99c8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
export function returnsOne() {
    return 1;
}

export class hasStaticFieldTwo {
    static two = 2;
}

const expectedValue = 10;
const didNotHoistClass = (() => {
    try {
        new ShouldNotBeHoisted();
    } catch (e) {
        if (e instanceof ReferenceError) return 4;
    }
    return 0;
})();

export const passed =
    returnsOne() + hasStaticFieldTwo.two + shouldBeHoisted() + didNotHoistClass === expectedValue;

export function shouldBeHoisted() {
    return 3;
}

export class ShouldNotBeHoisted {
    static no = 5;
}