js/src/jit-test/tests/arguments/defaults-invalid-syntax.js

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

michael@0 1 load(libdir + "asserts.js");
michael@0 2
michael@0 3 assertThrowsInstanceOf(function () {
michael@0 4 eval("function f(...rest=23) {}");
michael@0 5 }, SyntaxError);
michael@0 6 assertThrowsInstanceOf(function () {
michael@0 7 eval("function f([a]=4) {}");
michael@0 8 }, SyntaxError);
michael@0 9 assertThrowsInstanceOf(function () {
michael@0 10 eval("function f(a=4, [b]) {}");
michael@0 11 }, SyntaxError);
michael@0 12 assertThrowsInstanceOf(function () {
michael@0 13 eval("function f(a=yield 24) {}");
michael@0 14 }, SyntaxError);
michael@0 15 assertThrowsInstanceOf(function () {
michael@0 16 eval("function f(a={a : 19 + (yield 24).prop}) {}");
michael@0 17 }, SyntaxError);
michael@0 18 assertThrowsInstanceOf(function () {
michael@0 19 eval("function f(a=1,a=1) {}");
michael@0 20 }, SyntaxError);
michael@0 21 assertThrowsInstanceOf(function () {
michael@0 22 eval("function f(a,a=1) {}");
michael@0 23 }, SyntaxError);
michael@0 24 assertThrowsInstanceOf(function () {
michael@0 25 eval("function f(a=1,a) {}");
michael@0 26 }, SyntaxError);
michael@0 27 assertThrowsInstanceOf(function () {
michael@0 28 eval("function f(a,a,b=1) {}");
michael@0 29 }, SyntaxError);
michael@0 30 assertThrowsInstanceOf(function () {
michael@0 31 eval("function f(a,b=1,a=1) {}");
michael@0 32 }, SyntaxError);
michael@0 33 assertThrowsInstanceOf(function () {
michael@0 34 eval("function f(a=1,b=1,a=1) {}");
michael@0 35 }, SyntaxError);
michael@0 36 function silly_but_okay(a=(function () { yield 97; })) {}

mercurial