diff options
Diffstat (limited to 'js/src/tests/test262/ch11/11.2/11.2.4')
11 files changed, 254 insertions, 0 deletions
diff --git a/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.1_T1.js b/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.1_T1.js new file mode 100644 index 000000000..0d31a6c22 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.1_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Arguments : () + * + * @path ch11/11.2/11.2.4/S11.2.4_A1.1_T1.js + * @description Function is declared with no FormalParameterList + */ + +function f_arg() { + return arguments; +} + +//CHECK#1 +if (f_arg().length !== 0) { + $ERROR('#1: function f_arg() {return arguments;} f_arg().length === 0. Actual: ' + (f_arg().length)); +} + +//CHECK#2 +if (f_arg()[0] !== undefined) { + $ERROR('#2: function f_arg() {return arguments;} f_arg()[0] === undefined. Actual: ' + (f_arg()[0])); +} + diff --git a/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.1_T2.js b/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.1_T2.js new file mode 100644 index 000000000..6be2a9937 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.1_T2.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Arguments : () + * + * @path ch11/11.2/11.2.4/S11.2.4_A1.1_T2.js + * @description Function is declared with FormalParameterList + */ + +function f_arg(x,y) { + return arguments; +} + +//CHECK#1 +if (f_arg().length !== 0) { + $ERROR('#1: function f_arg(x,y) {return arguments;} f_arg().length === 0. Actual: ' + (f_arg().length)); +} + +//CHECK#2 +if (f_arg()[0] !== undefined) { + $ERROR('#2: function f_arg(x,y) {return arguments;} f_arg()[0] === undefined. Actual: ' + (f_arg()[0])); +} + +//CHECK#3 +if (f_arg.length !== 2) { + $ERROR('#3: function f_arg(x,y) {return arguments;} f_arg.length === 2. Actual: ' + (f_arg.length)); +} + diff --git a/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.2_T1.js b/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.2_T1.js new file mode 100644 index 000000000..aa419e295 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.2_T1.js @@ -0,0 +1,39 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Arguments : (ArgumentList) + * + * @path ch11/11.2/11.2.4/S11.2.4_A1.2_T1.js + * @description Function is declared with no FormalParameterList + */ + +f_arg = function() { + return arguments; +} + +//CHECK#1 +if (f_arg(1,2,3).length !== 3) { + $ERROR('#1: f_arg = function()() {return arguments;} f_arg(1,2,3).length === 3. Actual: ' + (f_arg(1,2,3).length)); +} + +//CHECK#2 +if (f_arg(1,2,3)[0] !== 1) { + $ERROR('#1: f_arg = function()() {return arguments;} f_arg(1,2,3)[0] === 1. Actual: ' + (f_arg(1,2,3)[0])); +} + +//CHECK#3 +if (f_arg(1,2,3)[1] !== 2) { + $ERROR('#3: f_arg = function()() {return arguments;} f_arg(1,2,3)[1] === 2. Actual: ' + (f_arg(1,2,3)[1])); +} + +//CHECK#4 +if (f_arg(1,2,3)[2] !== 3) { + $ERROR('#4: f_arg = function()() {return arguments;} f_arg(1,2,3)[2] === 3. Actual: ' + (f_arg(1,2,3)[2])); +} + +//CHECK#5 +if (f_arg(1,2,3)[3] !== undefined) { + $ERROR('#5: f_arg = function()() {return arguments;} f_arg(1,2,3)[3] === undefined. Actual: ' + (f_arg(1,2,3)[3])); +} + diff --git a/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.2_T2.js b/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.2_T2.js new file mode 100644 index 000000000..2541df3d1 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.2_T2.js @@ -0,0 +1,44 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Arguments : (ArgumentList) + * + * @path ch11/11.2/11.2.4/S11.2.4_A1.2_T2.js + * @description Function is declared with FormalParameterList + */ + +f_arg = function(x,y) { + return arguments; +} + +//CHECK#1 +if (f_arg(1,2,3).length !== 3) { + $ERROR('#1: f_arg = function(x,y) {return arguments;} f_arg(1,2,3).length === 3. Actual: ' + (f_arg(1,2,3).length)); +} + +//CHECK#2 +if (f_arg(1)[0] !== 1) { + $ERROR('#1: f_arg = function(x,y) {return arguments;} f_arg(1)[0] === 1. Actual: ' + (f_arg(1)[0])); +} + +//CHECK#3 +if (f_arg(1,2)[1] !== 2) { + $ERROR('#3: f_arg = function(x,y) {return arguments;} f_arg(1,2)[1] === 2. Actual: ' + (f_arg(1,2)[1])); +} + +//CHECK#4 +if (f_arg(1,2,3)[2] !== 3) { + $ERROR('#4: f_arg = function(x,y) {return arguments;} f_arg(1,2,3)[2] === 3. Actual: ' + (f_arg(1,2,3)[2])); +} + +//CHECK#5 +if (f_arg(1,2,3)[3] !== undefined) { + $ERROR('#5: f_arg = function(x,y) {return arguments;} f_arg(1,2,3)[3] === undefined. Actual: ' + (f_arg(1,2,3)[3])); +} + +//CHECK#6 +if (f_arg.length !== 2) { + $ERROR('#6: f_arg = function(x,y) {return arguments;} f_arg.length === 2. Actual: ' + (f_arg.length)); +} + diff --git a/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.3_T1.js b/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.3_T1.js new file mode 100644 index 000000000..e54238ea1 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.3_T1.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Arguments : (ArgumentList : ArgumentList,, AssignmentExpression) is a bad syntax + * + * @path ch11/11.2/11.2.4/S11.2.4_A1.3_T1.js + * @description incorrect syntax + * @negative + */ + +function f_arg() { +} + +f_arg(1,,2); + diff --git a/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.4_T1.js b/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.4_T1.js new file mode 100644 index 000000000..a2eb7989b --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.4_T1.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Arguments : (ArgumentList : ArgumentList, AssignmentExpression) + * + * @path ch11/11.2/11.2.4/S11.2.4_A1.4_T1.js + * @description Return an internal list whose length is one greater than the + * length of ArgumentList and whose items are the items of ArgumentList, in order, + * followed at the end by GetValue(AssignmentExpression), which is the last item of + * the new list + */ + +function f_arg() { +} + +//CHECK#1 +f_arg(x=1,x); + diff --git a/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.4_T2.js b/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.4_T2.js new file mode 100644 index 000000000..0db853abd --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.4_T2.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Arguments : (ArgumentList : ArgumentList, AssignmentExpression) + * + * @path ch11/11.2/11.2.4/S11.2.4_A1.4_T2.js + * @description Return an internal list whose length is one greater than the + * length of ArgumentList and whose items are the items of ArgumentList, in order, + * followed at the end by GetValue(AssignmentExpression), which is the last item of + * the new list + */ + +function f_arg() { +} + +//CHECK#1 +try { + f_arg(x,x=1); + $ERROR('#1.1: function f_arg() {} f_arg(x,x=1) throw ReferenceError. Actual: ' + (f_arg(x,x=1))); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: function f_arg() {} f_arg(x,x=1) throw ReferenceError. Actual: ' + (e)); + } +} + diff --git a/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.4_T3.js b/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.4_T3.js new file mode 100644 index 000000000..7d8bd02c9 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.4_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Arguments : (ArgumentList : ArgumentList, AssignmentExpression) + * + * @path ch11/11.2/11.2.4/S11.2.4_A1.4_T3.js + * @description Return an internal list whose length is one greater than the + * length of ArgumentList and whose items are the items of ArgumentList, in order, + * followed at the end by GetValue(AssignmentExpression), which is the last item of + * the new list + */ + +function f_arg(x,y,z) { + return z; +} + +//CHECK#1 +if (f_arg(x=1,y=x,x+y) !== 2) { + $ERROR('#1: function f_arg(x,y,z) {return z;} f_arg(x=1,y=x,x+y) === 2. Actual: ' + (f_arg(x=1,y=x,x+y))); +} + diff --git a/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.4_T4.js b/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.4_T4.js new file mode 100644 index 000000000..83b228a88 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.4_T4.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Arguments : (ArgumentList : ArgumentList, AssignmentExpression) + * + * @path ch11/11.2/11.2.4/S11.2.4_A1.4_T4.js + * @description Return an internal list whose length is one greater than the + * length of ArgumentList and whose items are the items of ArgumentList, in order, + * followed at the end by GetValue(AssignmentExpression), which is the last item of + * the new list + */ + +var x = function () { throw "x"; }; +var y = function () { throw "y"; }; + +function f_arg() { +} + +//CHECK#1 +try { + f_arg(x(),y()); + $ERROR('#1.1: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; function f_arg() {} f_arg(x(),y()) throw "x". Actual: ' + (f_arg(x(),y()))); +} +catch (e) { + if (e === "y") { + $ERROR('#1.2: First argument is evaluated first, and then second argument'); + } else { + if (e !== "x") { + $ERROR('#1.3: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; function f_arg() {} f_arg(x(),y()) throw "x". Actual: ' + (e)); + } + } +} + diff --git a/js/src/tests/test262/ch11/11.2/11.2.4/browser.js b/js/src/tests/test262/ch11/11.2/11.2.4/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.4/browser.js diff --git a/js/src/tests/test262/ch11/11.2/11.2.4/shell.js b/js/src/tests/test262/ch11/11.2/11.2.4/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.4/shell.js |