diff -r 000000000000 -r 6474c204b198 js/src/jit-test/tests/parser/yield-without-operand.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/js/src/jit-test/tests/parser/yield-without-operand.js Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,22 @@ +// yield without an operand causes a warning. See bug 885463. + +load(libdir + "asserts.js"); + +assertWarning(() => Function("yield"), SyntaxError, + "yield followed by EOF should cause a warning"); +assertWarning(() => Function("yield;"), SyntaxError, + "yield followed by semicolon should cause a warning"); +assertWarning(() => Function("yield\n print('ok');"), SyntaxError, + "yield followed by newline should cause a warning"); + +assertWarning(() => eval("(function () { yield; })"), SyntaxError, + "yield followed by semicolon in eval code should cause a warning"); +assertWarning(() => eval("(function () { yield })"), SyntaxError, + "yield followed by } in eval code should cause a warning"); + +assertNoWarning(() => Function("yield 0;"), + "yield with an operand should be fine"); +assertNoWarning(() => Function("yield 0"), + "yield with an operand should be fine, even without a semicolon"); + +print("\npassed - all those warnings are normal and there's no real way to suppress them");