diff options
Diffstat (limited to 'Libraries/LibJS/Tests/strict-mode-blocks.js')
-rw-r--r-- | Libraries/LibJS/Tests/strict-mode-blocks.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Libraries/LibJS/Tests/strict-mode-blocks.js b/Libraries/LibJS/Tests/strict-mode-blocks.js new file mode 100644 index 0000000000..c1fe1a7d24 --- /dev/null +++ b/Libraries/LibJS/Tests/strict-mode-blocks.js @@ -0,0 +1,22 @@ +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(); +}); |