summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Tests/strict-mode-blocks.js
blob: 35d0264664320f2bf6301412e35f55e03c71fe41 (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
test("Issue #3641, strict mode should be function- or program-level, not block-level", () => {
    function func() {
        expect(isStrictMode()).toBeFalse();

        // prettier-ignore
        {
            "use strict";
            expect(isStrictMode()).toBeFalse();
        }

        // prettier-ignore
        if (true) {
            "use strict";
            expect(isStrictMode()).toBeFalse();
        }

        // prettier-ignore
        do {
            "use strict";
            expect(isStrictMode()).toBeFalse();
        } while (false);
    }

    func();
});