ladybird/Libraries/LibJS/Tests/strict-mode-blocks.js
Matthew Olsson 6eb6752c4c LibJS: Strict mode is now handled by Functions and Programs, not Blocks
Since blocks can't be strict by themselves, it makes no sense for them
to store whether or not they are strict. Strict-ness is now stored in
the Program and FunctionNode ASTNodes. Fixes issue #3641
2020-10-04 10:46:12 +02:00

22 lines
497 B
JavaScript

test("Issue #3641, strict mode should be function- or program-level, not block-level", () => {
function func() {
expect(isStrictMode()).toBeFalse();
{
"use strict";
expect(isStrictMode()).toBeFalse();
}
if (true) {
"use strict";
expect(isStrictMode()).toBeFalse();
}
do {
"use strict";
expect(isStrictMode()).toBeFalse();
} while (false);
}
func();
});