ladybird/Tests/LibJS/Runtime/permanently-screwed-by-eval.js
2026-01-22 07:46:48 -05:00

13 lines
345 B
JavaScript

test("basic that non-strict direct eval() prevents non-local access caching", () => {
function foo(do_eval) {
var c = 1;
function bar(do_eval) {
if (do_eval) eval("var c = 2;");
return c;
}
return bar(do_eval);
}
expect(foo(false)).toBe(1);
expect(foo(true)).toBe(2);
});