Commit 8e89e820 authored by neis's avatar neis Committed by Commit bot

Adapt tests in preparation of shipping --harmony-completion.

R=rossberg
BUG=

Review URL: https://codereview.chromium.org/1415283003

Cr-Commit-Position: refs/heads/master@{#31507}
parent 22100599
...@@ -24,6 +24,9 @@ ...@@ -24,6 +24,9 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --harmony-completion
"use strict"; "use strict";
function props(x) { function props(x) {
...@@ -189,10 +192,18 @@ assertEquals(undefined, eval("for (let i = 0; i < 10; i++) { continue; i; }")); ...@@ -189,10 +192,18 @@ assertEquals(undefined, eval("for (let i = 0; i < 10; i++) { continue; i; }"));
assertEquals(0, eval("for (let i = 0; true;) { i; break; }")); assertEquals(0, eval("for (let i = 0; true;) { i; break; }"));
assertEquals(0, eval("for (const i = 0; true;) { i; break; }")); assertEquals(0, eval("for (const i = 0; true;) { i; break; }"));
assertEquals(9, eval("for (let i = 0; i < 10; i++) { i; continue; }")); assertEquals(9, eval("for (let i = 0; i < 10; i++) { i; continue; }"));
assertEquals(3, eval("for (let i = 0; true; i++) { i; if (i >= 3) break; }")); // --harmony-completion: undefined assertEquals(undefined,
assertEquals(2, eval("for (let i = 0; true; i++) { if (i >= 3) break; i; }")); // --harmony-completion: undefined eval("for (let i = 0; true; i++) { i; if (i >= 3) break; }"));
assertEquals( assertEquals(3,
2, eval("for (let i = 0; i < 10; i++) { if (i >= 3) continue; i; }")); // --harmony-completion: undefined eval("for (let i = 0; true; i++) { i; if (i >= 3) { i; break; } }"));
assertEquals(undefined,
eval("for (let i = 0; true; i++) { if (i >= 3) break; i; }"));
assertEquals(3,
eval("for (let i = 0; true; i++) { if (i >= 3) { i; break; }; i; }"));
assertEquals(undefined,
eval("for (let i = 0; i < 10; i++) { if (i >= 3) continue; i; }"));
assertEquals(9,
eval("for (let i = 0; i < 10; i++) { if (i >= 3) {i; continue; }; i; }"));
assertEquals(undefined, eval("foo: for (let i = 0; true;) { break foo; }")); assertEquals(undefined, eval("foo: for (let i = 0; true;) { break foo; }"));
assertEquals(undefined, eval("foo: for (const i = 0; true;) { break foo; }")); assertEquals(undefined, eval("foo: for (const i = 0; true;) { break foo; }"));
assertEquals(3, eval("foo: for (let i = 3; true;) { i; break foo; }")); assertEquals(3, eval("foo: for (let i = 3; true;) { i; break foo; }"));
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
// Flags: --harmony-do-expressions --harmony-sloppy-let --allow-natives-syntax // Flags: --harmony-do-expressions --harmony-sloppy-let --allow-natives-syntax
// Flags: --harmony-default-parameters --harmony-destructuring // Flags: --harmony-default-parameters --harmony-destructuring
// Flags: --harmony-completion
function returnValue(v) { return v; } function returnValue(v) { return v; }
function MyError() {} function MyError() {}
...@@ -167,7 +168,10 @@ function TestInParameterInitializers() { ...@@ -167,7 +168,10 @@ function TestInParameterInitializers() {
function fn2(items = do { function fn2(items = do {
let items = []; let items = [];
for (var el of _items) { for (var el of _items) {
if (el !== el) break; if (el !== el) {
items;
break;
}
items.push(el), items; items.push(el), items;
} }
}) { }) {
......
...@@ -27,9 +27,6 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE ...@@ -27,9 +27,6 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
PASS eval("1;") is 1 PASS eval("1;") is 1
PASS eval("1; try { foo = [2,3,throwFunc(), 4]; } catch (e){}") is 1
PASS eval("1; try { 2; throw \"\"; } catch (e){}") is 1
PASS eval("1; try { 2; throwFunc(); } catch (e){}") is 1
PASS eval("1; try { 2; throwFunc(); } catch (e){3;} finally {}") is 3 PASS eval("1; try { 2; throwFunc(); } catch (e){3;} finally {}") is 3
PASS eval("1; try { 2; throwFunc(); } catch (e){3;} finally {4;}") is 3 PASS eval("1; try { 2; throwFunc(); } catch (e){3;} finally {4;}") is 3
PASS eval("function blah() { 1; }\n blah();") is undefined PASS eval("function blah() { 1; }\n blah();") is undefined
...@@ -38,8 +35,6 @@ PASS eval("if (true) { 1; } else { 2; }") is 1 ...@@ -38,8 +35,6 @@ PASS eval("if (true) { 1; } else { 2; }") is 1
PASS eval("if (false) { 1; } else { 2; }") is 2 PASS eval("if (false) { 1; } else { 2; }") is 2
PASS eval("try{1; if (true) { 2; throw \"\"; } else { 2; }} catch(e){}") is undefined PASS eval("try{1; if (true) { 2; throw \"\"; } else { 2; }} catch(e){}") is undefined
PASS eval("1; var i = 0; do { ++i; 2; } while(i!=1);") is 2 PASS eval("1; var i = 0; do { ++i; 2; } while(i!=1);") is 2
#PASS eval("try{1; var i = 0; do { ++i; 2; throw \"\"; } while(i!=1);} catch(e){}") is undefined
PASS eval("1; try{2; throwOnReturn();} catch(e){}") is 1
PASS eval("1; twoFunc();") is undefined PASS eval("1; twoFunc();") is undefined
PASS eval("1; with ( { a: 0 } ) { 2; }") is 2 PASS eval("1; with ( { a: 0 } ) { 2; }") is 2
PASS successfullyParsed is true PASS successfullyParsed is true
......
...@@ -37,9 +37,6 @@ function twoFunc() { ...@@ -37,9 +37,6 @@ function twoFunc() {
} }
shouldBe('eval("1;")', "1"); shouldBe('eval("1;")', "1");
shouldBe('eval("1; try { foo = [2,3,throwFunc(), 4]; } catch (e){}")', "1");
shouldBe('eval("1; try { 2; throw \\"\\"; } catch (e){}")', "1");
shouldBe('eval("1; try { 2; throwFunc(); } catch (e){}")', "1");
shouldBe('eval("1; try { 2; throwFunc(); } catch (e){3;} finally {}")', "3"); shouldBe('eval("1; try { 2; throwFunc(); } catch (e){3;} finally {}")', "3");
shouldBe('eval("1; try { 2; throwFunc(); } catch (e){3;} finally {4;}")', "3"); shouldBe('eval("1; try { 2; throwFunc(); } catch (e){3;} finally {4;}")', "3");
shouldBe('eval("function blah() { 1; }\\n blah();")', "undefined"); shouldBe('eval("function blah() { 1; }\\n blah();")', "undefined");
...@@ -48,7 +45,5 @@ shouldBe('eval("if (true) { 1; } else { 2; }")', "1"); ...@@ -48,7 +45,5 @@ shouldBe('eval("if (true) { 1; } else { 2; }")', "1");
shouldBe('eval("if (false) { 1; } else { 2; }")', "2"); shouldBe('eval("if (false) { 1; } else { 2; }")', "2");
shouldBe('eval("try{1; if (true) { 2; throw \\"\\"; } else { 2; }} catch(e){}")', "undefined"); shouldBe('eval("try{1; if (true) { 2; throw \\"\\"; } else { 2; }} catch(e){}")', "undefined");
shouldBe('eval("1; var i = 0; do { ++i; 2; } while(i!=1);")', "2"); shouldBe('eval("1; var i = 0; do { ++i; 2; } while(i!=1);")', "2");
//shouldBe('eval("try{1; var i = 0; do { ++i; 2; throw \\"\\"; } while(i!=1);} catch(e){}")', "undefined");
shouldBe('eval("1; try{2; throwOnReturn();} catch(e){}")', "1");
shouldBe('eval("1; twoFunc();")', "undefined"); shouldBe('eval("1; twoFunc();")', "undefined");
shouldBe('eval("1; with ( { a: 0 } ) { 2; }")', "2"); shouldBe('eval("1; with ( { a: 0 } ) { 2; }")', "2");
...@@ -169,12 +169,12 @@ PASS 'use strict'; function f() { --(1, arguments) } threw exception ReferenceEr ...@@ -169,12 +169,12 @@ PASS 'use strict'; function f() { --(1, arguments) } threw exception ReferenceEr
PASS (function(){'use strict'; function f() { --(1, arguments) }}) threw exception ReferenceError: Invalid left-hand side expression in prefix operation. PASS (function(){'use strict'; function f() { --(1, arguments) }}) threw exception ReferenceError: Invalid left-hand side expression in prefix operation.
PASS 'use strict'; function f() { (1, arguments)-- } threw exception ReferenceError: Invalid left-hand side expression in postfix operation. PASS 'use strict'; function f() { (1, arguments)-- } threw exception ReferenceError: Invalid left-hand side expression in postfix operation.
PASS (function(){'use strict'; function f() { (1, arguments)-- }}) threw exception ReferenceError: Invalid left-hand side expression in postfix operation. PASS (function(){'use strict'; function f() { (1, arguments)-- }}) threw exception ReferenceError: Invalid left-hand side expression in postfix operation.
FAIL 'use strict'; if (0) delete +a.b should throw an exception. Was use strict. FAIL 'use strict'; undefined; if (0) delete +a.b should throw an exception. Was undefined.
FAIL (function(){'use strict'; if (0) delete +a.b}) should throw an exception. Was function (){'use strict'; if (0) delete +a.b}. FAIL (function(){'use strict'; undefined; if (0) delete +a.b}) should throw an exception. Was function (){'use strict'; undefined; if (0) delete +a.b}.
FAIL 'use strict'; if (0) delete ++a.b should throw an exception. Was use strict. FAIL 'use strict'; undefined; if (0) delete ++a.b should throw an exception. Was undefined.
FAIL (function(){'use strict'; if (0) delete ++a.b}) should throw an exception. Was function (){'use strict'; if (0) delete ++a.b}. FAIL (function(){'use strict'; undefined; if (0) delete ++a.b}) should throw an exception. Was function (){'use strict'; undefined; if (0) delete ++a.b}.
FAIL 'use strict'; if (0) delete void a.b should throw an exception. Was use strict. FAIL 'use strict'; undefined; if (0) delete void a.b should throw an exception. Was undefined.
FAIL (function(){'use strict'; if (0) delete void a.b}) should throw an exception. Was function (){'use strict'; if (0) delete void a.b}. FAIL (function(){'use strict'; undefined; if (0) delete void a.b}) should throw an exception. Was function (){'use strict'; undefined; if (0) delete void a.b}.
PASS (function (a){'use strict'; a = false; return a !== arguments[0]; })(true) is true PASS (function (a){'use strict'; a = false; return a !== arguments[0]; })(true) is true
PASS (function (a){'use strict'; arguments[0] = false; return a !== arguments[0]; })(true) is true PASS (function (a){'use strict'; arguments[0] = false; return a !== arguments[0]; })(true) is true
PASS (function (a){'use strict'; a=false; return arguments; })(true)[0] is true PASS (function (a){'use strict'; a=false; return arguments; })(true)[0] is true
......
...@@ -166,9 +166,9 @@ shouldBeSyntaxError("'use strict'; function f() { ++(1, arguments) }"); ...@@ -166,9 +166,9 @@ shouldBeSyntaxError("'use strict'; function f() { ++(1, arguments) }");
shouldBeSyntaxError("'use strict'; function f() { (1, arguments)++ }"); shouldBeSyntaxError("'use strict'; function f() { (1, arguments)++ }");
shouldBeSyntaxError("'use strict'; function f() { --(1, arguments) }"); shouldBeSyntaxError("'use strict'; function f() { --(1, arguments) }");
shouldBeSyntaxError("'use strict'; function f() { (1, arguments)-- }"); shouldBeSyntaxError("'use strict'; function f() { (1, arguments)-- }");
shouldBeSyntaxError("'use strict'; if (0) delete +a.b"); shouldBeSyntaxError("'use strict'; undefined; if (0) delete +a.b");
shouldBeSyntaxError("'use strict'; if (0) delete ++a.b"); shouldBeSyntaxError("'use strict'; undefined; if (0) delete ++a.b");
shouldBeSyntaxError("'use strict'; if (0) delete void a.b"); shouldBeSyntaxError("'use strict'; undefined; if (0) delete void a.b");
shouldBeTrue("(function (a){'use strict'; a = false; return a !== arguments[0]; })(true)"); shouldBeTrue("(function (a){'use strict'; a = false; return a !== arguments[0]; })(true)");
shouldBeTrue("(function (a){'use strict'; arguments[0] = false; return a !== arguments[0]; })(true)"); shouldBeTrue("(function (a){'use strict'; arguments[0] = false; return a !== arguments[0]; })(true)");
......
...@@ -30,7 +30,6 @@ PASS foo(), i is 2 ...@@ -30,7 +30,6 @@ PASS foo(), i is 2
PASS caught is true PASS caught is true
PASS val is 11 PASS val is 11
PASS val is 12 PASS val is 12
PASS val is 13
PASS val is 14 PASS val is 14
PASS val is 15 PASS val is 15
PASS successfullyParsed is true PASS successfullyParsed is true
......
...@@ -41,8 +41,6 @@ var val = eval("11; { }"); ...@@ -41,8 +41,6 @@ var val = eval("11; { }");
shouldBe("val", "11"); shouldBe("val", "11");
val = eval("12; ;"); val = eval("12; ;");
shouldBe("val", "12"); shouldBe("val", "12");
val = eval("13; if(false);");
shouldBe("val", "13");
val = eval("14; function f() {}"); val = eval("14; function f() {}");
shouldBe("val", "14"); shouldBe("val", "14");
val = eval("15; var v = 0"); val = eval("15; var v = 0");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment