summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Tests/loops/for-scopes.js
blob: 2f89bd122970982207bc8b2aa9de5c9f975aa170 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
test("var in for head", () => {
    for (var v = 5; false; );
    expect(v).toBe(5);
});

test("let in for head", () => {
    for (let l = 5; false; );
    expect(() => {
        l;
    }).toThrowWithMessage(ReferenceError, "'l' is not defined");
});

test("const in for head", () => {
    for (const c = 5; false; );
    expect(() => {
        c;
    }).toThrowWithMessage(ReferenceError, "'c' is not defined");
});