From 0f87349505a968e438736eb7d6cdcf0ea62d3d0b Mon Sep 17 00:00:00 2001 From: marja Date: Tue, 22 Nov 2016 07:45:53 -0800 Subject: [PATCH] Update tests which are now failing with FLAG_lazy_inner_functions. The tests were relying on early errors which we don't produce since we now preparse more often. BUG=v8:2728, v8:5501, v8:5663 Review-Url: https://codereview.chromium.org/2523683002 Cr-Commit-Position: refs/heads/master@{#41189} --- test/mjsunit/bugs/bug-2728.js | 18 ++++++++++++++++++ test/mjsunit/es6/destructuring.js | 9 +++++---- test/mjsunit/es6/generator-destructuring.js | 9 +++++---- test/mjsunit/harmony/async-destructuring.js | 9 +++++---- 4 files changed, 33 insertions(+), 12 deletions(-) diff --git a/test/mjsunit/bugs/bug-2728.js b/test/mjsunit/bugs/bug-2728.js index 7d549ece91..4e0cb59190 100644 --- a/test/mjsunit/bugs/bug-2728.js +++ b/test/mjsunit/bugs/bug-2728.js @@ -19,3 +19,21 @@ assertThrows("L: L1: L: ;"); assertThrows("function f() { L: L1: L: ; }"); assertThrows("L: L1: L2: L3: L4: L: ;"); assertThrows("function f() { L: L1: L2: L3: L4: L: ; }"); + +// from test/mjsunit/es6/async-destructuring.js +assertThrows("'use strict'; async function f(x) { let x = 0; }", SyntaxError); +assertThrows("'use strict'; async function f({x}) { let x = 0; }", SyntaxError); +assertThrows("'use strict'; async function f(x) { const x = 0; }", SyntaxError); +assertThrows("'use strict'; async function f({x}) { const x = 0; }", SyntaxError); + +// from test/mjsunit/es6/destructuring.js +assertThrows("'use strict'; function f(x) { let x = 0; }", SyntaxError); +assertThrows("'use strict'; function f({x}) { let x = 0; }", SyntaxError); +assertThrows("'use strict'; function f(x) { const x = 0; }", SyntaxError); +assertThrows("'use strict'; function f({x}) { const x = 0; }", SyntaxError); + +// from test/mjsunit/es6/generator-destructuring.js +assertThrows("'use strict'; function* f(x) { let x = 0; }", SyntaxError); +assertThrows("'use strict'; function* f({x}) { let x = 0; }", SyntaxError); +assertThrows("'use strict'; function* f(x) { const x = 0; }", SyntaxError); +assertThrows("'use strict'; function* f({x}) { const x = 0; }", SyntaxError); diff --git a/test/mjsunit/es6/destructuring.js b/test/mjsunit/es6/destructuring.js index a4f88844d4..f09165a24e 100644 --- a/test/mjsunit/es6/destructuring.js +++ b/test/mjsunit/es6/destructuring.js @@ -1082,10 +1082,11 @@ var g21 = ({x}) => { { function x() { return 2 } } return x(); } assertThrows(() => g21({x: 1}), TypeError); - assertThrows("'use strict'; function f(x) { let x = 0; }", SyntaxError); - assertThrows("'use strict'; function f({x}) { let x = 0; }", SyntaxError); - assertThrows("'use strict'; function f(x) { const x = 0; }", SyntaxError); - assertThrows("'use strict'; function f({x}) { const x = 0; }", SyntaxError); + // These errors are not recognized in lazy parsing; see mjsunit/bugs/bug-2728.js + assertThrows("'use strict'; (function f(x) { let x = 0; })()", SyntaxError); + assertThrows("'use strict'; (function f({x}) { let x = 0; })()", SyntaxError); + assertThrows("'use strict'; (function f(x) { const x = 0; })()", SyntaxError); + assertThrows("'use strict'; (function f({x}) { const x = 0; })()", SyntaxError); assertThrows("'use strict'; let g = (x) => { let x = 0; }", SyntaxError); assertThrows("'use strict'; let g = ({x}) => { let x = 0; }", SyntaxError); diff --git a/test/mjsunit/es6/generator-destructuring.js b/test/mjsunit/es6/generator-destructuring.js index 7228782c09..44730ac970 100644 --- a/test/mjsunit/es6/generator-destructuring.js +++ b/test/mjsunit/es6/generator-destructuring.js @@ -51,10 +51,11 @@ function* f21({x}) { { function x() { return 2 } } return x; } assertEquals(1, f21({x: 1}).next().value); - assertThrows("'use strict'; function* f(x) { let x = 0; }", SyntaxError); - assertThrows("'use strict'; function* f({x}) { let x = 0; }", SyntaxError); - assertThrows("'use strict'; function* f(x) { const x = 0; }", SyntaxError); - assertThrows("'use strict'; function* f({x}) { const x = 0; }", SyntaxError); + // These errors are not recognized in lazy parsing; see mjsunit/bugs/bug-2728.js + assertThrows("'use strict'; (function* f(x) { let x = 0; })()", SyntaxError); + assertThrows("'use strict'; (function* f({x}) { let x = 0; })()", SyntaxError); + assertThrows("'use strict'; (function* f(x) { const x = 0; })()", SyntaxError); + assertThrows("'use strict'; (function* f({x}) { const x = 0; })()", SyntaxError); }()); (function TestDefaults() { diff --git a/test/mjsunit/harmony/async-destructuring.js b/test/mjsunit/harmony/async-destructuring.js index 95dbc18c7b..dac214d6ff 100644 --- a/test/mjsunit/harmony/async-destructuring.js +++ b/test/mjsunit/harmony/async-destructuring.js @@ -151,10 +151,11 @@ function assertEqualsAsync(expected, run, msg) { var g21 = async ({x}) => { { function x() { return 2 } } return x(); } assertThrowsAsync(() => g21({x: 1}), TypeError); - assertThrows("'use strict'; async function f(x) { let x = 0; }", SyntaxError); - assertThrows("'use strict'; async function f({x}) { let x = 0; }", SyntaxError); - assertThrows("'use strict'; async function f(x) { const x = 0; }", SyntaxError); - assertThrows("'use strict'; async function f({x}) { const x = 0; }", SyntaxError); + // These errors are not recognized in lazy parsing; see mjsunit/bugs/bug-2728.js + assertThrows("'use strict'; (async function f(x) { let x = 0; })()", SyntaxError); + assertThrows("'use strict'; (async function f({x}) { let x = 0; })()", SyntaxError); + assertThrows("'use strict'; (async function f(x) { const x = 0; })()", SyntaxError); + assertThrows("'use strict'; (async function f({x}) { const x = 0; })()", SyntaxError); assertThrows("'use strict'; let g = async (x) => { let x = 0; }", SyntaxError); assertThrows("'use strict'; let g = async ({x}) => { let x = 0; }", SyntaxError);