blob: 8a5802c77400be7b321d42c30201ae174a7a81b8 [file] [log] [blame]
Tests for ES6 arrow function syntax errors
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS =>{} threw exception SyntaxError: Unexpected token '=>'.
PASS x=> threw exception SyntaxError: Unexpected end of script.
PASS x=>* threw exception SyntaxError: Unexpected token '*'.
PASS x=>/ threw exception SyntaxError: Unterminated regular expression literal '/'.
PASS x=>% threw exception SyntaxError: Unexpected token '%'.
PASS x=>+ threw exception SyntaxError: Unexpected end of script.
PASS x=>- threw exception SyntaxError: Unexpected end of script.
PASS x=><< threw exception SyntaxError: Unexpected token '<<'.
PASS x=>>> threw exception SyntaxError: Unexpected token '>>'.
PASS x=>>>> threw exception SyntaxError: Unexpected token '>>>'.
PASS x=>< threw exception SyntaxError: Unexpected token '<'.
PASS x=>> threw exception SyntaxError: Unexpected token '>'.
PASS x=><= threw exception SyntaxError: Unexpected token '<='.
PASS x=>>= threw exception SyntaxError: Unexpected token '>='.
PASS x=>instanceof threw exception SyntaxError: Unexpected keyword 'instanceof'.
PASS x=>in threw exception SyntaxError: Unexpected keyword 'in'.
PASS x=>== threw exception SyntaxError: Unexpected token '=='.
PASS x=>!= threw exception SyntaxError: Unexpected token '!='.
PASS x=>=== threw exception SyntaxError: Unexpected token '==='.
PASS x=>!== threw exception SyntaxError: Unexpected token '!=='.
PASS x=>& threw exception SyntaxError: Unexpected token '&'.
PASS x=>^ threw exception SyntaxError: Unexpected token '^'.
PASS x=>| threw exception SyntaxError: Unexpected token '|'.
PASS x=>&& threw exception SyntaxError: Unexpected token '&&'.
PASS x=>|| threw exception SyntaxError: Unexpected token '||'.
PASS x=>; threw exception SyntaxError: Unexpected token ';'.
PASS x=>, threw exception SyntaxError: Unexpected token ','.
PASS x=>{ threw exception SyntaxError: Unexpected end of script.
PASS x=>{* threw exception SyntaxError: Unexpected token '*'.
PASS x=>{/ threw exception SyntaxError: Unterminated regular expression literal '/'.
PASS x=>{% threw exception SyntaxError: Unexpected token '%'.
PASS x=>{+ threw exception SyntaxError: Unexpected end of script.
PASS x=>{- threw exception SyntaxError: Unexpected end of script.
PASS x=>{<< threw exception SyntaxError: Unexpected token '<<'.
PASS x=>{>> threw exception SyntaxError: Unexpected token '>>'.
PASS x=>{>>> threw exception SyntaxError: Unexpected token '>>>'.
PASS x=>{< threw exception SyntaxError: Unexpected token '<'.
PASS x=>{> threw exception SyntaxError: Unexpected token '>'.
PASS x=>{<= threw exception SyntaxError: Unexpected token '<='.
PASS x=>{>= threw exception SyntaxError: Unexpected token '>='.
PASS x=>{instanceof threw exception SyntaxError: Unexpected keyword 'instanceof'.
PASS x=>{in threw exception SyntaxError: Unexpected keyword 'in'.
PASS x=>{== threw exception SyntaxError: Unexpected token '=='.
PASS x=>{!= threw exception SyntaxError: Unexpected token '!='.
PASS x=>{=== threw exception SyntaxError: Unexpected token '==='.
PASS x=>{!== threw exception SyntaxError: Unexpected token '!=='.
PASS x=>{& threw exception SyntaxError: Unexpected token '&'.
PASS x=>{^ threw exception SyntaxError: Unexpected token '^'.
PASS x=>{| threw exception SyntaxError: Unexpected token '|'.
PASS x=>{&& threw exception SyntaxError: Unexpected token '&&'.
PASS x=>{|| threw exception SyntaxError: Unexpected token '||'.
PASS x=>{; threw exception SyntaxError: Unexpected end of script.
PASS x=>{, threw exception SyntaxError: Unexpected token ','.
PASS x=>} threw exception SyntaxError: Unexpected token '}'.
PASS var y = x=> threw exception SyntaxError: Unexpected end of script.
PASS var y = x=>* threw exception SyntaxError: Unexpected token '*'.
PASS var y = x=>/ threw exception SyntaxError: Unterminated regular expression literal '/'.
PASS var y = x=>% threw exception SyntaxError: Unexpected token '%'.
PASS var y = x=>+ threw exception SyntaxError: Unexpected end of script.
PASS var y = x=>- threw exception SyntaxError: Unexpected end of script.
PASS var y = x=><< threw exception SyntaxError: Unexpected token '<<'.
PASS var y = x=>>> threw exception SyntaxError: Unexpected token '>>'.
PASS var y = x=>>>> threw exception SyntaxError: Unexpected token '>>>'.
PASS var y = x=>< threw exception SyntaxError: Unexpected token '<'.
PASS var y = x=>> threw exception SyntaxError: Unexpected token '>'.
PASS var y = x=><= threw exception SyntaxError: Unexpected token '<='.
PASS var y = x=>>= threw exception SyntaxError: Unexpected token '>='.
PASS var y = x=>instanceof threw exception SyntaxError: Unexpected keyword 'instanceof'.
PASS var y = x=>in threw exception SyntaxError: Unexpected keyword 'in'.
PASS var y = x=>== threw exception SyntaxError: Unexpected token '=='.
PASS var y = x=>!= threw exception SyntaxError: Unexpected token '!='.
PASS var y = x=>=== threw exception SyntaxError: Unexpected token '==='.
PASS var y = x=>!== threw exception SyntaxError: Unexpected token '!=='.
PASS var y = x=>& threw exception SyntaxError: Unexpected token '&'.
PASS var y = x=>^ threw exception SyntaxError: Unexpected token '^'.
PASS var y = x=>| threw exception SyntaxError: Unexpected token '|'.
PASS var y = x=>&& threw exception SyntaxError: Unexpected token '&&'.
PASS var y = x=>|| threw exception SyntaxError: Unexpected token '||'.
PASS var y = x=>; threw exception SyntaxError: Unexpected token ';'.
PASS var y = x=>, threw exception SyntaxError: Unexpected token ','.
PASS var y = x=>{ threw exception SyntaxError: Unexpected end of script.
PASS var y = x=>{* threw exception SyntaxError: Unexpected token '*'.
PASS var y = x=>{/ threw exception SyntaxError: Unterminated regular expression literal '/'.
PASS var y = x=>{% threw exception SyntaxError: Unexpected token '%'.
PASS var y = x=>{+ threw exception SyntaxError: Unexpected end of script.
PASS var y = x=>{- threw exception SyntaxError: Unexpected end of script.
PASS var y = x=>{<< threw exception SyntaxError: Unexpected token '<<'.
PASS var y = x=>{>> threw exception SyntaxError: Unexpected token '>>'.
PASS var y = x=>{>>> threw exception SyntaxError: Unexpected token '>>>'.
PASS var y = x=>{< threw exception SyntaxError: Unexpected token '<'.
PASS var y = x=>{> threw exception SyntaxError: Unexpected token '>'.
PASS var y = x=>{<= threw exception SyntaxError: Unexpected token '<='.
PASS var y = x=>{>= threw exception SyntaxError: Unexpected token '>='.
PASS var y = x=>{instanceof threw exception SyntaxError: Unexpected keyword 'instanceof'.
PASS var y = x=>{in threw exception SyntaxError: Unexpected keyword 'in'.
PASS var y = x=>{== threw exception SyntaxError: Unexpected token '=='.
PASS var y = x=>{!= threw exception SyntaxError: Unexpected token '!='.
PASS var y = x=>{=== threw exception SyntaxError: Unexpected token '==='.
PASS var y = x=>{!== threw exception SyntaxError: Unexpected token '!=='.
PASS var y = x=>{& threw exception SyntaxError: Unexpected token '&'.
PASS var y = x=>{^ threw exception SyntaxError: Unexpected token '^'.
PASS var y = x=>{| threw exception SyntaxError: Unexpected token '|'.
PASS var y = x=>{&& threw exception SyntaxError: Unexpected token '&&'.
PASS var y = x=>{|| threw exception SyntaxError: Unexpected token '||'.
PASS var y = x=>{; threw exception SyntaxError: Unexpected end of script.
PASS var y = x=>{, threw exception SyntaxError: Unexpected token ','.
PASS var y = x=>} threw exception SyntaxError: Unexpected token '}'.
PASS var t = x=>x+1; =>{} threw exception SyntaxError: Unexpected token '=>'.
PASS [=>x+1] threw exception SyntaxError: Unexpected token '=>'.
PASS [x=>x+1, =>x+1] threw exception SyntaxError: Unexpected token '=>'.
PASS var f=>x+1; threw exception SyntaxError: Unexpected token '=>'. Expected ';' after variable declaration..
PASS var x, y=>y+1; threw exception SyntaxError: Unexpected token '=>'. Expected ';' after variable declaration..
PASS debug(=>x+1) threw exception SyntaxError: Unexpected token '=>'.
PASS debug("xyz", =>x+1) threw exception SyntaxError: Unexpected token '=>'.
PASS var af1=y
=>y+1 threw exception SyntaxError: Unexpected token '=>'.
PASS var af2=(y)
=>y+1 threw exception SyntaxError: Unexpected token '=>'.
PASS var af3=(x, y)
=>y+1 threw exception SyntaxError: Unexpected token '=>'.
PASS ([a, b] => a + b)(["a_", "b_"]) threw exception SyntaxError: Unexpected token '=>'. Expected ')' to end a compound expression..
PASS ({a, b} => a + b)({a:"a_", b:"b_"}) threw exception SyntaxError: Unexpected token '=>'. Expected ')' to end a compound expression..
PASS ({c:a,d:b} => a + b)({c:"a_", d:"b_"}) threw exception SyntaxError: Unexpected token '=>'. Expected ')' to end a compound expression..
PASS ({c:b,d:a} => a + b)({c:"a_", d:"b_"}) threw exception SyntaxError: Unexpected token '=>'. Expected ')' to end a compound expression..
PASS var arr1 = [a, b] => a + b; threw exception SyntaxError: Unexpected token '=>'. Expected ';' after variable declaration..
PASS var arr2 = {a, b} => a + b; threw exception SyntaxError: Unexpected token '=>'. Expected ';' after variable declaration..
PASS var arr3 = {c:a,d:b} => a + b; threw exception SyntaxError: Unexpected token '=>'. Expected ';' after variable declaration..
PASS var arr3 = {c:b,d:a} => a + b; threw exception SyntaxError: Unexpected token '=>'. Expected ';' after variable declaration..
PASS var arr4 = () => { super(); }; threw exception SyntaxError: super is not valid in this context..
PASS var arr4 = () => { super; }; threw exception SyntaxError: super is not valid in this context..
PASS var arr5 = () => { super.getValue(); }; threw exception SyntaxError: super is not valid in this context..
PASS var arr6 = () => super(); threw exception SyntaxError: super is not valid in this context..
PASS var arr7 = () => super; threw exception SyntaxError: super is not valid in this context..
PASS var arr8 = () => super.getValue(); threw exception SyntaxError: super is not valid in this context..
PASS class A { constructor() { function a () { return () => { super(); };}} threw exception SyntaxError: super is not valid in this context..
PASS class B { constructor() { function b () { return () => { super; }; }; }} threw exception SyntaxError: super is not valid in this context..
PASS class C { constructor() { function c () { return () => { super.getValue(); };}} threw exception SyntaxError: super is not valid in this context..
PASS class D { constructor() { function a () { return () => super(); }} threw exception SyntaxError: super is not valid in this context..
PASS class E { constructor() { function b () { return () => super; }; }} threw exception SyntaxError: super is not valid in this context..
PASS class F { constructor() { function c () { return () => super.getValue(); }} threw exception SyntaxError: super is not valid in this context..
PASS class G {}; class G2 extends G { getValue() { function c () { return () => super.getValue(); }} threw exception SyntaxError: super is not valid in this context..
PASS class H {}; class H2 extends H { method() { function *gen() { let arr = () => super.getValue(); arr(); } } } threw exception SyntaxError: super is not valid in this context..
PASS successfullyParsed is true
TEST COMPLETE