Index: test/mjsunit/regress/regress-parse-use-strict.js |
diff --git a/test/mjsunit/regress/regress-crbug-248025.js b/test/mjsunit/regress/regress-parse-use-strict.js |
similarity index 71% |
copy from test/mjsunit/regress/regress-crbug-248025.js |
copy to test/mjsunit/regress/regress-parse-use-strict.js |
index c5988595663c9622853e98585ed4a4e9bed089b1..9dd0f4c97c026d74f2c2cc0213eb22d0e2a8a87e 100644 |
--- a/test/mjsunit/regress/regress-crbug-248025.js |
+++ b/test/mjsunit/regress/regress-parse-use-strict.js |
@@ -25,16 +25,18 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-// Flags: --harmony-iteration |
- |
// Filler long enough to trigger lazy parsing. |
-var filler = "//" + new Array(1024).join('x'); |
+var filler = "/*" + new Array(1024).join('x') + "*/"; |
+ |
+// Snippet trying to switch to strict mode. |
+var strict = '"use strict"; with({}) {}'; |
+ |
+// Test switching to strict mode after string literal. |
+assertThrows('function f() { "use sanity";' + strict + '}'); |
+assertThrows('function f() { "use sanity";' + strict + filler + '}'); |
-// Test that the pre-parser does not crash when the expected contextual |
-// keyword as part if a 'for' statement is not and identifier. |
-try { |
- eval(filler + "\nfunction f() { for (x : y) { } }"); |
- throw "not reached"; |
-} catch (e) { |
- if (!(e instanceof SyntaxError)) throw e; |
-} |
+// Test switching to strict mode after function declaration. |
+// We must use eval instead of assertDoesNotThrow here to make sure that |
+// lazy parsing is triggered. Otherwise the bug won't reproduce. |
+eval('function f() { function g() {}' + strict + '}'); |
+eval('function f() { function g() {}' + strict + filler + '}'); |