summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Tests/eval-aliasing.js
blob: 2779783535e079dfd9bb25a3281c1c88471165a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
test("variable named 'eval' pointing to another function calls that function", function () {
    var testValue = "inner";
    // This breaks prettier as it considers this to be a parse error
    // before even trying to do any linting
    var eval = () => {
        return "wat";
    };
    expect(eval("testValue")).toEqual("wat");
});

test("variable named 'eval' pointing to real eval works as a direct eval", function () {
    var testValue = "inner";
    var eval = globalThis.eval;
    expect(eval("testValue")).toEqual("inner");
});