test262/implementation-contributed/javascriptcore/stress/ensure-proper-strict-mode-parsing.js
test262-automation e9a5a7f918 [javascriptcore-test262-automation] changes from git@github.com:WebKit/webkit.git at sha 949e26452cfa153a7f4afe593da97e2fe9e1b706 on Tue Jul 03 2018 14:35:15 GMT-0400 (Eastern Daylight Time) (#1620)
* [javascriptcore-test262-automation] changes from git@github.com:WebKit/webkit.git at sha 949e26452cfa153a7f4afe593da97e2fe9e1b706 on Tue Jul 03 2018 14:35:15 GMT-0400 (Eastern Daylight Time)
2018-07-03 15:59:58 -04:00

91 lines
1.7 KiB
JavaScript

function foo() {
"hello world i'm not use strict.";
function bar() {
return 25;
}
bar();
"use strict";
return this;
}
if (foo.call(undefined) !== this)
throw new Error("Bad parsing strict mode.");
function bar() {
"hello world i'm not use strict.";
function foo() {
return this;
}
"use strict";
return foo.call(undefined);
}
if (bar.call(undefined) !== this)
throw new Error("Bad parsing strict mode.")
function baz() {
"foo";
"bar";
"baz";
"foo";
"bar";
"baz";
"foo";
"bar";
"baz";
"use strict";
return this;
}
if (baz.call(undefined) !== undefined)
throw new Error("Bad parsing strict mode.")
function jaz() {
"foo";
`bar`;
"use strict";
return this;
}
if (jaz.call(undefined) !== this)
throw new Error("Bad parsing strict mode.")
function vaz() {
"foo";
"use strict";
`bar`;
return this;
}
if (vaz.call(undefined) !== undefined)
throw new Error("Bad parsing strict mode.")
function hello() {
"foo";
2 + 2
"use strict";
return this;
}
if (hello.call(undefined) !== this)
throw new Error("Bad parsing strict mode.")
function world() {
"foo";
let x;
"use strict";
return this;
}
if (world.call(undefined) !== this)
throw new Error("Bad parsing strict mode.")
function a() {
"foo";
world;
"use strict";
return this;
}
if (a.call(undefined) !== this)
throw new Error("Bad parsing strict mode.")
if (eval("'foo'; 'use strict'; 'bar';") !== "bar")
throw new Error("Bad parsing strict mode.");
if (eval("'foo'; 'use strict'; 'bar'; this;") !== this)
throw new Error("Bad parsing strict mode.");