1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit-test/tests/parser/yield-without-operand.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,22 @@ 1.4 +// yield without an operand causes a warning. See bug 885463. 1.5 + 1.6 +load(libdir + "asserts.js"); 1.7 + 1.8 +assertWarning(() => Function("yield"), SyntaxError, 1.9 + "yield followed by EOF should cause a warning"); 1.10 +assertWarning(() => Function("yield;"), SyntaxError, 1.11 + "yield followed by semicolon should cause a warning"); 1.12 +assertWarning(() => Function("yield\n print('ok');"), SyntaxError, 1.13 + "yield followed by newline should cause a warning"); 1.14 + 1.15 +assertWarning(() => eval("(function () { yield; })"), SyntaxError, 1.16 + "yield followed by semicolon in eval code should cause a warning"); 1.17 +assertWarning(() => eval("(function () { yield })"), SyntaxError, 1.18 + "yield followed by } in eval code should cause a warning"); 1.19 + 1.20 +assertNoWarning(() => Function("yield 0;"), 1.21 + "yield with an operand should be fine"); 1.22 +assertNoWarning(() => Function("yield 0"), 1.23 + "yield with an operand should be fine, even without a semicolon"); 1.24 + 1.25 +print("\npassed - all those warnings are normal and there's no real way to suppress them");