diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /js/src/tests/test262/ch13/13.0 | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/tests/test262/ch13/13.0')
60 files changed, 1720 insertions, 0 deletions
diff --git a/js/src/tests/test262/ch13/13.0/13.0-1.js b/js/src/tests/test262/ch13/13.0/13.0-1.js new file mode 100644 index 000000000..0873465b5 --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/13.0-1.js @@ -0,0 +1,20 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * @path ch13/13.0/13.0-1.js
+ * @description 13.0 - multiple names in one function declaration is not allowed, two function names
+ */
+
+
+function testcase() {
+ try {
+ eval("function x, y() {}");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch13/13.0/13.0-10-s.js b/js/src/tests/test262/ch13/13.0/13.0-10-s.js new file mode 100644 index 000000000..71af1f4e4 --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/13.0-10-s.js @@ -0,0 +1,32 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 13;
+ * The production FunctionBody : SourceElementsopt is evaluated as follows:
+ *
+ * @path ch13/13.0/13.0-10-s.js
+ * @description Strict Mode - SourceElements is evaluated as strict mode code when the code of this FunctionBody with an inner function contains a Use Strict Directive
+ * @onlyStrict
+ */
+
+
+function testcase() {
+
+ function _13_0_10_fun() {
+ function _13_0_10_inner() {
+ "use strict";
+ eval("eval = 42;");
+ }
+ _13_0_10_inner();
+ };
+ try {
+ _13_0_10_fun();
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch13/13.0/13.0-11-s.js b/js/src/tests/test262/ch13/13.0/13.0-11-s.js new file mode 100644 index 000000000..5c623c054 --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/13.0-11-s.js @@ -0,0 +1,32 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 13;
+ * The production FunctionBody : SourceElementsopt is evaluated as follows:
+ *
+ * @path ch13/13.0/13.0-11-s.js
+ * @description Strict Mode - SourceElements is evaluated as strict mode code when the code of this FunctionBody with an inner function which is in strict mode
+ * @onlyStrict
+ */
+
+
+function testcase() {
+
+ function _13_0_11_fun() {
+ "use strict";
+ function _13_0_11_inner() {
+ eval("eval = 42;");
+ }
+ _13_0_11_inner();
+ };
+ try {
+ _13_0_11_fun();
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch13/13.0/13.0-12-s.js b/js/src/tests/test262/ch13/13.0/13.0-12-s.js new file mode 100644 index 000000000..17d593f1e --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/13.0-12-s.js @@ -0,0 +1,24 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 13;
+ * The production FunctionBody : SourceElementsopt is evaluated as follows:
+ *
+ * @path ch13/13.0/13.0-12-s.js
+ * @description Strict Mode - SourceElements is not evaluated as strict mode code when a Function constructor is contained in strict mode code and the function constructor body is not strict
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+
+ var _13_0_12_fun = new Function(" ","eval = 42;");
+ _13_0_12_fun();
+ return true;
+
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch13/13.0/13.0-13-s.js b/js/src/tests/test262/ch13/13.0/13.0-13-s.js new file mode 100644 index 000000000..1e231e4aa --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/13.0-13-s.js @@ -0,0 +1,25 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 13;
+ * The production FunctionBody : SourceElementsopt is evaluated as follows:
+ *
+ * @path ch13/13.0/13.0-13-s.js
+ * @description Strict Mode - SourceElements is evaluated as strict mode code when the function body of a Function constructor begins with a Strict Directive
+ * @onlyStrict
+ */
+
+
+function testcase() {
+
+ try {
+ eval("var _13_0_13_fun = new Function(\" \", \"'use strict'; eval = 42;\"); _13_0_13_fun();");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch13/13.0/13.0-14-s.js b/js/src/tests/test262/ch13/13.0/13.0-14-s.js new file mode 100644 index 000000000..86ec4534d --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/13.0-14-s.js @@ -0,0 +1,26 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 13;
+ * The production FunctionBody : SourceElementsopt is evaluated as follows:
+ *
+ * @path ch13/13.0/13.0-14-s.js
+ * @description Strict Mode - SourceElements is evaluated as strict mode code when the function body of a Function constructor contains a Strict Directive
+ * @onlyStrict
+ */
+
+
+function testcase() {
+
+ try {
+ var _13_0_14_fun = new Function(" ", "'use strict'; eval = 42; ");
+ _13_0_14_fun();
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch13/13.0/13.0-15-s.js b/js/src/tests/test262/ch13/13.0/13.0-15-s.js new file mode 100644 index 000000000..7f86492f7 --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/13.0-15-s.js @@ -0,0 +1,26 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 13;
+ * The production FunctionBody : SourceElementsopt is evaluated as follows:
+ *
+ * @path ch13/13.0/13.0-15-s.js
+ * @description Strict Mode - SourceElements is evaluated as strict mode code when a FunctionDeclaration is contained in strict mode code within eval code
+ * @onlyStrict
+ */
+
+
+function testcase() {
+
+ try {
+ eval("'use strict'; function _13_0_15_fun() {eval = 42;};");
+ _13_0_15_fun();
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch13/13.0/13.0-16-s.js b/js/src/tests/test262/ch13/13.0/13.0-16-s.js new file mode 100644 index 000000000..93c01c323 --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/13.0-16-s.js @@ -0,0 +1,26 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 13;
+ * The production FunctionBody : SourceElementsopt is evaluated as follows:
+ *
+ * @path ch13/13.0/13.0-16-s.js
+ * @description Strict Mode - SourceElements is evaluated as strict mode code when a FunctionExpression is contained in strict mode code within eval code
+ * @onlyStrict
+ */
+
+
+function testcase() {
+
+ try {
+ eval("'use strict'; var _13_0_16_fun = function () {eval = 42;};");
+ _13_0_16_fun();
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch13/13.0/13.0-17-s.js b/js/src/tests/test262/ch13/13.0/13.0-17-s.js new file mode 100644 index 000000000..283b3f7c3 --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/13.0-17-s.js @@ -0,0 +1,21 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 13;
+ * The production FunctionBody : SourceElementsopt is evaluated as follows:
+ *
+ * @path ch13/13.0/13.0-17-s.js
+ * @description Strict Mode - SourceElements is not evaluated as strict mode code when a Function constructor is contained in strict mode code within eval code
+ * @onlyStrict
+ */
+
+
+function testcase() {
+
+ eval("'use strict'; var _13_0_17_fun = new Function('eval = 42;'); _13_0_17_fun();");
+ return true;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch13/13.0/13.0-2.js b/js/src/tests/test262/ch13/13.0/13.0-2.js new file mode 100644 index 000000000..d30becfbf --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/13.0-2.js @@ -0,0 +1,20 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * @path ch13/13.0/13.0-2.js
+ * @description 13.0 - multiple names in one function declaration is not allowed, three function names
+ */
+
+
+function testcase() {
+ try {
+ eval("function x,y,z(){}");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch13/13.0/13.0-3.js b/js/src/tests/test262/ch13/13.0/13.0-3.js new file mode 100644 index 000000000..780c2d2b9 --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/13.0-3.js @@ -0,0 +1,21 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * @path ch13/13.0/13.0-3.js
+ * @description 13.0 - property names in function definition is not allowed, add a new property into object
+ */
+
+
+function testcase() {
+ var obj = {};
+ try {
+ eval("function obj.tt() {};");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch13/13.0/13.0-4.js b/js/src/tests/test262/ch13/13.0/13.0-4.js new file mode 100644 index 000000000..ce881f319 --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/13.0-4.js @@ -0,0 +1,22 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * @path ch13/13.0/13.0-4.js
+ * @description 13.0 - multiple names in one function declaration is not allowed, add a new property into a property which is a object
+ */
+
+
+function testcase() {
+ var obj = {};
+ obj.tt = { len: 10 };
+ try {
+ eval("function obj.tt.ss() {};");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch13/13.0/13.0-7-s.js b/js/src/tests/test262/ch13/13.0/13.0-7-s.js new file mode 100644 index 000000000..e73ed6548 --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/13.0-7-s.js @@ -0,0 +1,26 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 13;
+ * The production FunctionBody : SourceElementsopt is evaluated as follows:
+ *
+ * @path ch13/13.0/13.0-7-s.js
+ * @description Strict Mode - SourceElements is evaluated as strict mode code when the code of this FunctionDeclaration is contained in non-strict mode but the call to eval is a direct call in strict mode code
+ * @onlyStrict
+ */
+
+
+function testcase() {
+
+ try {
+ eval("'use strict'; function _13_0_7_fun() {eval = 42;};");
+ _13_0_7_fun();
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch13/13.0/13.0-8-s.js b/js/src/tests/test262/ch13/13.0/13.0-8-s.js new file mode 100644 index 000000000..a1b6e22a3 --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/13.0-8-s.js @@ -0,0 +1,27 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 13;
+ * The production FunctionBody : SourceElementsopt is evaluated as follows:
+ *
+ * @path ch13/13.0/13.0-8-s.js
+ * @description Strict Mode - SourceElements is evaluated as strict mode code when the code of this FunctionExpression is contained in non-strict mode but the call to eval is a direct call in strict mode code
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+
+ try {
+ eval("var _13_0_8_fun = function () {eval = 42;};");
+ _13_0_8_fun();
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch13/13.0/13.0-9-s.js b/js/src/tests/test262/ch13/13.0/13.0-9-s.js new file mode 100644 index 000000000..a7f12ca4f --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/13.0-9-s.js @@ -0,0 +1,30 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 13;
+ * The production FunctionBody : SourceElementsopt is evaluated as follows:
+ *
+ * @path ch13/13.0/13.0-9-s.js
+ * @description Strict Mode - SourceElements is evaluated as strict mode code when a FunctionDeclaration that is contained in strict mode code has an inner function
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+
+ var _13_0_9_fun = function () {
+ function _13_0_9_inner() { eval("eval = 42;"); }
+ _13_0_9_inner();
+ };
+ try {
+ _13_0_9_fun();
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch13/13.0/13.0_4-17gs.js b/js/src/tests/test262/ch13/13.0/13.0_4-17gs.js new file mode 100644 index 000000000..c5eb74302 --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/13.0_4-17gs.js @@ -0,0 +1,16 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+
+/**
+ * @path ch13/13.0/13.0_4-17gs.js
+ * @description Strict Mode - SourceElements is not evaluated as strict mode code when a Function constructor is contained in strict mode code
+ * @onlyStrict
+ * @negative NotEarlyError
+ */
+
+"use strict";
+var _13_0_4_17_fun = new Function('eval = 42;');
+throw NotEarlyError;
diff --git a/js/src/tests/test262/ch13/13.0/13.0_4-5gs.js b/js/src/tests/test262/ch13/13.0/13.0_4-5gs.js new file mode 100644 index 000000000..4f9c01325 --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/13.0_4-5gs.js @@ -0,0 +1,16 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+
+/**
+ * @path ch13/13.0/13.0_4-5gs.js
+ * @description Strict Mode - SourceElements is evaluated as strict mode code when a FunctionDeclaration is contained in strict mode code
+ * @onlyStrict
+ * @negative ^((?!NotEarlyError).)*$
+ */
+
+"use strict";
+throw NotEarlyError;
+function _13_0_4_5_fun() { eval = 42; };
diff --git a/js/src/tests/test262/ch13/13.0/S13_A1.js b/js/src/tests/test262/ch13/13.0/S13_A1.js new file mode 100644 index 000000000..8d0a905af --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/S13_A1.js @@ -0,0 +1,31 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * "x=function y(){}" statement does not store a reference to the new function in the varaible y(Identifier) + * + * @path ch13/13.0/S13_A1.js + * @description Checking the type of y + */ + +var __func = function __exp__func(){return 0;}; + +//////////////////////////////////////////////// +// ////////////////////////////// +//CHECK#1 +if (typeof __func !== "function") { + $ERROR('#1: typeof __func === "function". Actual: typeof __func ==='+typeof __func); +} +// +////////////////////////////////////////////////////////////////////////////// + + + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (typeof __exp__func !== "undefined"){ + $ERROR('#2: typeof __exp__func === "undefined". Actual: typeof __exp__func ==='+typeof __exp__func); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch13/13.0/S13_A10.js b/js/src/tests/test262/ch13/13.0/S13_A10.js new file mode 100644 index 000000000..dd85f242b --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/S13_A10.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Function is a data + * + * @path ch13/13.0/S13_A10.js + * @description Using function as a property of an object + */ + +function __ziggy__func(){return "ziggy stardust"} + +var __music_box={}; + +__music_box.ziggy = __ziggy__func; + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +if (typeof __music_box.ziggy !== "function") { + $ERROR('#1: typeof __music_box.ziggy === "function". Actual: typeof __music_box.ziggy ==='+typeof __music_box.ziggy); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__music_box.ziggy() !== "ziggy stardust") { + $ERROR('#2: __music_box.ziggy() === "ziggy stardust". Actual: __music_box.ziggy() ==='+__music_box.ziggy()); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch13/13.0/S13_A11_T1.js b/js/src/tests/test262/ch13/13.0/S13_A11_T1.js new file mode 100644 index 000000000..e9dc0e39a --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/S13_A11_T1.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Since arguments property has attribute { DontDelete }, only its elements can be deleted + * + * @path ch13/13.0/S13_A11_T1.js + * @description Returning result of "delete arguments" + */ + +function __func(){ return delete arguments;} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__func("A","B",1,2)) { + $ERROR('#1: arguments property has attribute { DontDelete }'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch13/13.0/S13_A11_T2.js b/js/src/tests/test262/ch13/13.0/S13_A11_T2.js new file mode 100644 index 000000000..18886a307 --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/S13_A11_T2.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Since arguments property has attribute { DontDelete }, only its elements can be deleted + * + * @path ch13/13.0/S13_A11_T2.js + * @description Checking if deleting the arguments property fails and then returning it + */ + +function __func(){ + delete arguments; + return arguments; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof __func("A","B",1,2) !== "object") { + $ERROR('#1: arguments property has attribute { DontDelete }'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch13/13.0/S13_A11_T3.js b/js/src/tests/test262/ch13/13.0/S13_A11_T3.js new file mode 100644 index 000000000..94345da8f --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/S13_A11_T3.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Since arguments property has attribute { DontDelete }, only its elements can be deleted + * + * @path ch13/13.0/S13_A11_T3.js + * @description Deleting arguments[i] and returning result of the operation + */ + +function __func(){ + was_del=false; + for (i=0; i < arguments.length; i++) + was_del= was_del || delete arguments[i]; + return was_del; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!__func("A","B",1,2)) { + $ERROR('#1: Since arguments property has attribute { DontDelete } elements of arguments can be deleted'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch13/13.0/S13_A11_T4.js b/js/src/tests/test262/ch13/13.0/S13_A11_T4.js new file mode 100644 index 000000000..c107879cd --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/S13_A11_T4.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Since arguments property has attribute { DontDelete }, only its elements can be deleted + * + * @path ch13/13.0/S13_A11_T4.js + * @description Deleting arguments[i] and checking the type of arguments[i] + */ + +function __func(){ + is_undef=true; + for (i=0; i < arguments.length; i++) + { + delete arguments[i]; + is_undef= is_undef && (typeof arguments[i] === "undefined"); + }; + return is_undef; +}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!__func("A","B",1,2)) { + $ERROR('#1: Since arguments property has attribute { DontDelete }, but elements of arguments can be deleted'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch13/13.0/S13_A12_T1.js b/js/src/tests/test262/ch13/13.0/S13_A12_T1.js new file mode 100644 index 000000000..278a46ac6 --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/S13_A12_T1.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Function declarations in global or function scope are {DontDelete} + * + * @path ch13/13.0/S13_A12_T1.js + * @description Checking if deleting a function that is declared in global scope fails + */ + +ALIVE="Letov is alive" + +function __func(){ + return ALIVE; +}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (delete __func) { + $ERROR('#1: delete __func returning false'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__func() !== ALIVE) { + $ERROR('#2: __func() === ALIVE. Actual: __func() ==='+__func()); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch13/13.0/S13_A12_T2.js b/js/src/tests/test262/ch13/13.0/S13_A12_T2.js new file mode 100644 index 000000000..08ea18247 --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/S13_A12_T2.js @@ -0,0 +1,37 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Function declarations in global or function scope are {DontDelete} + * + * @path ch13/13.0/S13_A12_T2.js + * @description Checking if deleting a function that is declared in function scope fails + */ + +ALIVE="Letov is alive" + +function __cont(){ + + function __func(){ + return ALIVE; + }; + + ////////////////////////////////////////////////////////////////////////////// + //CHECK#1 + if (delete __func) { + $ERROR('#1: delete __func returning false'); + } + // + ////////////////////////////////////////////////////////////////////////////// + + ////////////////////////////////////////////////////////////////////////////// + //CHECK#2 + if (__func() !== ALIVE) { + $ERROR('#2: __func() === ALIVE. Actual: __func() ==='+__func()); + } + // + ////////////////////////////////////////////////////////////////////////////// +}; + +__cont(); + diff --git a/js/src/tests/test262/ch13/13.0/S13_A13_T1.js b/js/src/tests/test262/ch13/13.0/S13_A13_T1.js new file mode 100644 index 000000000..072966196 --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/S13_A13_T1.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Deleting arguments[i] leads to breaking the connection to local reference + * + * @path ch13/13.0/S13_A13_T1.js + * @description Deleting arguments[i] + */ + +function __func(__arg){ + delete arguments[0]; + if (arguments[0] !== undefined) { + $ERROR('#1.1: arguments[0] === undefined'); + } + return __arg; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__func(1) !== 1) { + $ERROR('#1.2: __func(1) === 1. Actual: __func(1) ==='+__func(1)); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch13/13.0/S13_A13_T2.js b/js/src/tests/test262/ch13/13.0/S13_A13_T2.js new file mode 100644 index 000000000..49ba62ada --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/S13_A13_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. + +/** + * Deleting arguments[i] leads to breaking the connection to local reference + * + * @path ch13/13.0/S13_A13_T2.js + * @description Changing arguments value and then deleting the argument + */ + +function __func(__arg){ + __arg = 2; + delete arguments[0]; + if (arguments[0] !== undefined) { + $ERROR('#1.1: arguments[0] === undefined'); + } + return __arg; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__func(1) !== 2) { + $ERROR('#1.2: __func(1) === 2. Actual: __func(1) ==='+__func(1)); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch13/13.0/S13_A13_T3.js b/js/src/tests/test262/ch13/13.0/S13_A13_T3.js new file mode 100644 index 000000000..715150018 --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/S13_A13_T3.js @@ -0,0 +1,31 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Deleting arguments[i] leads to breaking the connection to local reference + * + * @path ch13/13.0/S13_A13_T3.js + * @description Changing argument value, deleting the argument and then defining a new value for arguments[i] + */ + +function __func(__arg){ + __arg = 2; + delete arguments[0]; + if (arguments[0] !== undefined) { + $ERROR('#1.1: arguments[0] === undefined'); + } + arguments[0] = "A"; + if (arguments[0] !== "A") { + $ERROR('#1.2: arguments[0] === "A"'); + } + return __arg; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__func(1) !== 2) { + $ERROR('#1.3: __func(1) === 2. Actual: __func(1) ==='+__func(1)); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch13/13.0/S13_A14.js b/js/src/tests/test262/ch13/13.0/S13_A14.js new file mode 100644 index 000000000..7d5bc732f --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/S13_A14.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Unicode symbols in function name are allowed + * + * @path ch13/13.0/S13_A14.js + * @description Defining function name with unicode symbols + */ + +eval("function __func\u0041(__arg){return __arg;};"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof __funcA !== "function") { + $ERROR('#1: unicode symbols in function name are allowed'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch13/13.0/S13_A15_T1.js b/js/src/tests/test262/ch13/13.0/S13_A15_T1.js new file mode 100644 index 000000000..74531f8c5 --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/S13_A15_T1.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'' variable overrides ActivationObject.arguments + * + * @path ch13/13.0/S13_A15_T1.js + * @description Declaring a function with "__func(arguments)" + */ + +function __func(arguments){ + return arguments; +}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__func(42) !== 42) { + $ERROR('#1: "arguments" variable overrides ActivationObject.arguments'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch13/13.0/S13_A15_T2.js b/js/src/tests/test262/ch13/13.0/S13_A15_T2.js new file mode 100644 index 000000000..77e7c847b --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/S13_A15_T2.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * ''arguments'' variable overrides ActivationObject.arguments + * + * @path ch13/13.0/S13_A15_T2.js + * @description Overriding arguments within functions body + */ + +THE_ANSWER="Answer to Life, the Universe, and Everything"; + +function __func(){ + var arguments = THE_ANSWER; + return arguments; +}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__func(42,42,42) !== THE_ANSWER) { + $ERROR('#1: "arguments" variable overrides ActivationObject.arguments'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch13/13.0/S13_A15_T3.js b/js/src/tests/test262/ch13/13.0/S13_A15_T3.js new file mode 100644 index 000000000..4ba50e717 --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/S13_A15_T3.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * ''arguments'' variable overrides ActivationObject.arguments + * + * @path ch13/13.0/S13_A15_T3.js + * @description Declaring a variable named with "arguments" without a function + */ + +THE_ANSWER="Answer to Life, the Universe, and Everything"; + +var arguments = THE_ANSWER; + +function __func(arguments){ + return arguments; + +}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof __func() !== "undefined") { + $ERROR('#1: typeof __func() === "undefined". Actual: typeof __func() ==='+typeof __func()); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__func("The Ultimate Question") !== "The Ultimate Question") { + $ERROR('#2: __func("The Ultimate Question") === "The Ultimate Question". Actual: __func("The Ultimate Question")==='+__func("The Ultimate Question")); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch13/13.0/S13_A15_T4.js b/js/src/tests/test262/ch13/13.0/S13_A15_T4.js new file mode 100644 index 000000000..a71b34833 --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/S13_A15_T4.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * ''arguments'' variable overrides ActivationObject.arguments + * + * @path ch13/13.0/S13_A15_T4.js + * @description Declaring a variable named with "arguments" and following a "return" statement within a function body + */ + +THE_ANSWER="Answer to Life, the Universe, and Everything"; + +function __func(){ + return typeof arguments; + var arguments = THE_ANSWER; +}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__func(42,42,42) !== "object") { + $ERROR('#1: __func(42,42,42) === "object". Actual: __func(42,42,42)==='+__func(42,42,42)); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch13/13.0/S13_A15_T5.js b/js/src/tests/test262/ch13/13.0/S13_A15_T5.js new file mode 100644 index 000000000..4896a19c2 --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/S13_A15_T5.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'' variable overrides ActivationObject.arguments + * + * @path ch13/13.0/S13_A15_T5.js + * @description Creating a variable named with "arguments" without a function + */ + +THE_ANSWER="Answer to Life, the Universe, and Everything"; + +var arguments = THE_ANSWER; + +function __func(){ + return arguments; +}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if ( __func() === THE_ANSWER) { + $ERROR('#1: __func() !== THE_ANSWER'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__func("The Ultimate Question") === "The Ultimate Question") { + $ERROR('#2: __func("The Ultimate Question") !== "The Ultimate Question"'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch13/13.0/S13_A16.js b/js/src/tests/test262/ch13/13.0/S13_A16.js new file mode 100644 index 000000000..8b8ee7080 --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/S13_A16.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. + +/** + * Any separators are admitted between declaration chunks + * + * @path ch13/13.0/S13_A16.js + * @description Inserting separators between declaration chunks + */ + +function +x +( +) +{ +} +; + +x(); + +function y ( ) {}; + +y(); + +function + +z + +( + +) + +{ + +} + +; + +z(); + +eval("function\u0009\u2029w(\u000C)\u00A0{\u000D};"); + +w(); + diff --git a/js/src/tests/test262/ch13/13.0/S13_A17_T1.js b/js/src/tests/test262/ch13/13.0/S13_A17_T1.js new file mode 100644 index 000000000..1ea6c287a --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/S13_A17_T1.js @@ -0,0 +1,45 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Function call cannot appear in the program before the FunctionExpression appears + * + * @path ch13/13.0/S13_A17_T1.js + * @description Trying to call a function before the FunctionExpression appears + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try{ + var __result = __func(); + $FAIL("#1.1: var __result = __func() lead to throwing exception"); +} catch(e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#1.2: func should throw a TypeError Actual: ' + (e)); + } +} +// +////////////////////////////////////////////////////////////////////////////// + +var __func = function (){return "ONE";}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +var __result = __func(); +if (__result !== "ONE") { + $ERROR('#2: __result === "ONE". Actual: __result ==='+__result); +} +// +////////////////////////////////////////////////////////////////////////////// + +__func = function (){return "TWO";}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +var __result = __func(); +if (__result !== "TWO") { + $ERROR('#3: __result === "TWO". Actual: __result ==='+__result); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch13/13.0/S13_A17_T2.js b/js/src/tests/test262/ch13/13.0/S13_A17_T2.js new file mode 100644 index 000000000..d502d3b46 --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/S13_A17_T2.js @@ -0,0 +1,46 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Function call cannot appear in the program before the FunctionExpression appears + * + * @path ch13/13.0/S13_A17_T2.js + * @description Trying to call a function before the FunctionExpression appears and then using the FunctionExpression one more time + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try{ + var __result = __func(); + $ERROR("#1: var __result = __func() lead to throwing exception"); +} catch(e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#1.2: func should throw a TypeError Actual: ' + (e)); + } +} +// +////////////////////////////////////////////////////////////////////////////// + +// now we reach the __func overwriting by new expression +var __func = function __func(){return "ONE";}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +var __result = __func(); +if (__result !== "ONE") { + $ERROR('#2: __result === "ONE". Actual: __result ==='+__result); +} +// +////////////////////////////////////////////////////////////////////////////// + +__func = function __func(){return "TWO";}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +var __result = __func(); +if (__result !== "TWO") { + $ERROR('#3: __result === "TWO". Actual: __result ==='+__result); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch13/13.0/S13_A18.js b/js/src/tests/test262/ch13/13.0/S13_A18.js new file mode 100644 index 000000000..827db7547 --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/S13_A18.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Closures are admitted + * + * @path ch13/13.0/S13_A18.js + * @description Using a function declaration as a function parameter + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof sinx !== 'undefined') { + $ERROR('#1: typeof sinx === \'undefined\'. Actual: typeof sinx ==='+typeof sinx); +} +// +////////////////////////////////////////////////////////////////////////////// + +var __val = function derivative(f, dx) { + return function(x) { + return (f(x + dx) - f(x)) / dx; + }; +}(function sinx(x){return Math.sin(x);},.0001)(0.5); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (typeof sinx !== 'undefined') { + $ERROR('#2: typeof sinx === \'undefined\'. Actual: typeof sinx ==='+typeof sinx); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch13/13.0/S13_A19_T1.js b/js/src/tests/test262/ch13/13.0/S13_A19_T1.js new file mode 100644 index 000000000..9bcf1921f --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/S13_A19_T1.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * "var" does not override function declaration + * + * @path ch13/13.0/S13_A19_T1.js + * @description Creating a function and a variable with identical Identifiers in global scope + */ + +// since "var" does not override function declaration __decl is set to function +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof __decl !== "function") { + $ERROR('#1: typeof __decl === "function". Actual: typeof __decl ==='+typeof __decl); +} +// +////////////////////////////////////////////////////////////////////////////// + +var __decl = 1; + +//since statement was evaluted __decl turns to 1 from function +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__decl !== 1) { + $ERROR('#2: __decl === 1. Actual: __decl ==='+__decl); +} +// +////////////////////////////////////////////////////////////////////////////// + +function __decl(){return 1;} + diff --git a/js/src/tests/test262/ch13/13.0/S13_A19_T2.js b/js/src/tests/test262/ch13/13.0/S13_A19_T2.js new file mode 100644 index 000000000..7757d8be6 --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/S13_A19_T2.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * "var" does not override function declaration + * + * @path ch13/13.0/S13_A19_T2.js + * @description Creating a function and a variable with identical Identifiers within function scope + */ + +(function (){ + + // since "var" does not override function declaration __decl is set to function + ////////////////////////////////////////////////////////////////////////////// + //CHECK#1 + if (typeof __decl !== "function") { + $ERROR('#1: typeof __decl === "function". Actual: typeof __decl ==='+typeof __decl); + } + // + ////////////////////////////////////////////////////////////////////////////// + + var __decl = 1; + + //since statement was evaluted __decl turns to 1 from function + ////////////////////////////////////////////////////////////////////////////// + //CHECK#2 + if (__decl !== 1) { + $ERROR('#2: __decl === 1. Actual: __decl ==='+__decl); + } + // + ////////////////////////////////////////////////////////////////////////////// + + function __decl(){return 1;} +})(); + diff --git a/js/src/tests/test262/ch13/13.0/S13_A2_T1.js b/js/src/tests/test262/ch13/13.0/S13_A2_T1.js new file mode 100644 index 000000000..b9307ac70 --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/S13_A2_T1.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. + +/** + * function must be evaluated inside the expression + * + * @path ch13/13.0/S13_A2_T1.js + * @description Defining function body with "return arg" + */ + +var x = (function __func(arg){return arg})(1); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (x !== 1) { + $ERROR('#1: x === 1. Actual: x ==='+x); +} + +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (typeof __func !== 'undefined') { + $ERROR('#2: typeof __func === \'undefined\'. Actual: typeof __func ==='+typeof __func); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch13/13.0/S13_A2_T2.js b/js/src/tests/test262/ch13/13.0/S13_A2_T2.js new file mode 100644 index 000000000..c43c58e79 --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/S13_A2_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. + +/** + * function must be evaluated inside the expression + * + * @path ch13/13.0/S13_A2_T2.js + * @description Defining function body with "return arg + arguments[1]" + */ + +var x = (function __func(arg){return arg + arguments[1]})(1,"1"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (x !== "11") { + $ERROR('#1: x === "11". Actual: x ==='+x); +} + +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (typeof __func !== 'undefined') { + $ERROR('#2: typeof __func === \'undefined\'. Actual: typeof __func ==='+typeof __func); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch13/13.0/S13_A2_T3.js b/js/src/tests/test262/ch13/13.0/S13_A2_T3.js new file mode 100644 index 000000000..83d3f2463 --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/S13_A2_T3.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. + +/** + * function must be evaluated inside the expression + * + * @path ch13/13.0/S13_A2_T3.js + * @description Defining function body with "return arguments[0] +"-"+ arguments[1]" + */ + +var x = (function __func(){return arguments[0] +"-"+ arguments[1]})("Obi","Wan"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (x !== "Obi-Wan") { + $ERROR('#1: x === "Obi-Wan". Actual: x ==='+x); +} + +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (typeof __func !== 'undefined') { + $ERROR('#2: typeof __func === \'undefined\'. Actual: typeof __func ==='+typeof __func); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch13/13.0/S13_A3_T1.js b/js/src/tests/test262/ch13/13.0/S13_A3_T1.js new file mode 100644 index 000000000..cac7e243d --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/S13_A3_T1.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. + +/** + * The Identifier in a FunctionExpression can be referenced from inside the FunctionExpression's FunctionBody to allow the function calling itself recursively + * + * @path ch13/13.0/S13_A3_T1.js + * @description Creating a recursive function that calculates factorial, as a variable. + * Function call itself by it`s name + */ + +var __func = function __exp__func(arg){ + if (arg === 1) { + return arg; + } else { + return __exp__func(arg-1)*arg; + } +}; + +var fact_of_3 = __func(3); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (fact_of_3 !== 6) { + $ERROR("#1: fact_of_3 === 6. Actual: fact_of_3 ==="+fact_of_3); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch13/13.0/S13_A3_T2.js b/js/src/tests/test262/ch13/13.0/S13_A3_T2.js new file mode 100644 index 000000000..2137666a7 --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/S13_A3_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. + +/** + * The Identifier in a FunctionExpression can be referenced from inside the FunctionExpression's FunctionBody to allow the function calling itself recursively + * + * @path ch13/13.0/S13_A3_T2.js + * @description Creating a recursive function that calculates factorial, as a variable. + * Function calls itself by the name of the variable + */ + +var __func = function (arg){ + if (arg === 1) { + return arg; + } else { + return __func(arg-1)*arg; + } +}; + +var fact_of_3 = __func(3); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (fact_of_3 !== 6) { + $ERROR("#1: fact_of_3 === 6. Actual: fact_of_3 ==="+fact_of_3); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch13/13.0/S13_A3_T3.js b/js/src/tests/test262/ch13/13.0/S13_A3_T3.js new file mode 100644 index 000000000..467f3fea5 --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/S13_A3_T3.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The Identifier in a FunctionExpression can be referenced from inside the FunctionExpression's FunctionBody to allow the function calling itself recursively + * + * @path ch13/13.0/S13_A3_T3.js + * @description Creating simple recursive function that calculates factorial + */ + +function __func(arg){ + if (arg === 1) { + return arg; + } else { + return __func(arg-1)*arg; + } +}; + +var fact_of_3 = __func(3); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (fact_of_3 !== 6) { + $ERROR("#1: fact_of_3 === 6. Actual: fact_of_3 ==="+fact_of_3); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch13/13.0/S13_A4_T1.js b/js/src/tests/test262/ch13/13.0/S13_A4_T1.js new file mode 100644 index 000000000..453207158 --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/S13_A4_T1.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The production FunctionDeclaration: "function Identifier ( FormalParameterList_opt ) { FunctionBody }" is processed by function declarations + * + * @path ch13/13.0/S13_A4_T1.js + * @description Declaring a function that returns string + */ + +function __func(){return "zig-zig-sputnik";}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof __func !== "function") { + $ERROR('#1: typeof __func === "function". Actual: typeof __func ==='+typeof __func); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__func() !== "zig-zig-sputnik") { + $ERROR('#2: __func() === "zig-zig-sputnik". Actual: __func() ==='+__func()); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch13/13.0/S13_A4_T2.js b/js/src/tests/test262/ch13/13.0/S13_A4_T2.js new file mode 100644 index 000000000..d7b4a2788 --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/S13_A4_T2.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The production FunctionDeclaration: "function Identifier ( FormalParameterList_opt ) { FunctionBody }" is processed by function declarations + * + * @path ch13/13.0/S13_A4_T2.js + * @description Declaring a function that uses prefix increment operator within its "return" Expression + */ + +function __func(arg){return ++arg;}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof __func !== "function") { + $ERROR('#1: typeof __func === "function". Actual: typeof __func ==='+typeof __func); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__func(1) !== 2) { + $ERROR('#2: __func(1) === 2. Actual: __func(1) ==='+__func(1)); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch13/13.0/S13_A4_T3.js b/js/src/tests/test262/ch13/13.0/S13_A4_T3.js new file mode 100644 index 000000000..6595f4f77 --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/S13_A4_T3.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The production FunctionDeclaration: "function Identifier ( FormalParameterList_opt ) { FunctionBody }" is processed by function declarations + * + * @path ch13/13.0/S13_A4_T3.js + * @description Declaring a function that uses arithmetical operators within its "return" Expression + */ + +function __func(arg1, arg2, arg3){return arg1+=(arg2+=arg3);}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof __func !== "function") { + $ERROR('#1: typeof __func === "function". Actual: typeof __func ==='+typeof __func); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__func(10, 20, 30) !== 60) { + $ERROR('#2: __func(10, 20, 30) === 60. Actual: __func(10,20,30) ==='+__func(10,20,30)); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch13/13.0/S13_A4_T4.js b/js/src/tests/test262/ch13/13.0/S13_A4_T4.js new file mode 100644 index 000000000..7330bd80f --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/S13_A4_T4.js @@ -0,0 +1,46 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The production FunctionDeclaration: "function Identifier ( FormalParameterList_opt ) { FunctionBody }" is processed by function declarations + * + * @path ch13/13.0/S13_A4_T4.js + * @description Declaring a function that uses strings concatenaion opeator within its "return" Expression + */ + +function __func(){return arguments[0].name + " " + arguments[0].surname;}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof __func !== "function") { + $ERROR('#1: typeof __func === "function". Actual: typeof __func ==='+typeof __func); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__func({name:'fox', surname:'malder'}) !== "fox malder") { + $ERROR('#2: __func({name:\'fox\', surname:\'malder\'}) === "fox malder". Actual: __func({name:\'fox\', surname:\'malder\'}) ==='+__func({name:'fox', surname:'malder'})); +} +// +////////////////////////////////////////////////////////////////////////////// + +function func__(arg){return arg.name + " " + arg.surname;}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (typeof func__ !== "function") { + $ERROR('#3: typeof func__ === "function". Actual: typeof __func ==='+typeof __func); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if (func__({name:'john', surname:'lennon'}) !== "john lennon") { + $ERROR('#4: func__({name:\'john\', surname:\'lennon\'}) === "john lennon". Actual: __func({name:\'john\', surname:\'lennon\'}) ==='+__func({name:'john', surname:'lennon'})); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch13/13.0/S13_A6_T1.js b/js/src/tests/test262/ch13/13.0/S13_A6_T1.js new file mode 100644 index 000000000..2cdd53709 --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/S13_A6_T1.js @@ -0,0 +1,36 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * FunctionDeclaration can be overrided by other FunctionDeclaration with the same Identifier + * + * @path ch13/13.0/S13_A6_T1.js + * @description Duplicating function declaration + */ + +function __func(){return 1}; + +var __store__func = __func; + +var __1 = __func(); + + function __func(){return 'A'}; + +var __A = __func(); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__store__func !== __func) { + $ERROR('#1: __store__func === __func. Actual: __store__func ==='+__store__func); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__1 !== __A) { + $ERROR('#2: __1 === __A. Actual: __1 ==='+__1); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch13/13.0/S13_A6_T2.js b/js/src/tests/test262/ch13/13.0/S13_A6_T2.js new file mode 100644 index 000000000..6268e06e2 --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/S13_A6_T2.js @@ -0,0 +1,36 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * FunctionDeclaration can be overrided by other FunctionDeclaration with the same Identifier + * + * @path ch13/13.0/S13_A6_T2.js + * @description Calling a function before it is declared one more time + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try{ + var __result = __func(); +} catch(e) { + $FAIL("#1: Function call can appears in the program before the FunctionDeclaration appears"); +} +if (__result !== "SECOND") { + $ERROR('#1.1: __result === "SECOND". Actual: __result ==='+__result); +} +// +////////////////////////////////////////////////////////////////////////////// + +function __func(){return "FIRST";}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +__result = __func(); +if (__result !== "SECOND") { + $ERROR('#2: __result === "SECOND". Actual: __result ==='+__result); +} +// +////////////////////////////////////////////////////////////////////////////// + +function __func(){return "SECOND";}; + diff --git a/js/src/tests/test262/ch13/13.0/S13_A7_T1.js b/js/src/tests/test262/ch13/13.0/S13_A7_T1.js new file mode 100644 index 000000000..b83e6e140 --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/S13_A7_T1.js @@ -0,0 +1,73 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The FunctionBody must be SourceElements + * + * @path ch13/13.0/S13_A7_T1.js + * @description Using only SourceElements within the FunctionBody + */ + +function __func(){'ground control to major tom'}; +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof __func !== "function") { + $ERROR('#1: typeof __func === "function". Actual: typeof __func ==='+typeof __func); +} +// +////////////////////////////////////////////////////////////////////////////// + +function __func__2(){b}; +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (typeof __func__2 !== "function") { + $ERROR('#2: typeof __func__2 === "function". Actual: typeof __func__2 ==='+typeof __func__2); +} +// +////////////////////////////////////////////////////////////////////////////// + +function __func__3(){1}; +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (typeof __func__3 !== "function") { + $ERROR('#3: typeof __func__3 === "function". Actual: typeof __func__3 ==='+typeof __func__3); +} +// +////////////////////////////////////////////////////////////////////////////// + +function __func__4(){1+c}; +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if (typeof __func__4 !== "function") { + $ERROR('#4: typeof __func__4 === "function". Actual: typeof __func__4 ==='+typeof __func__4); +} +// +////////////////////////////////////////////////////////////////////////////// + +function __func__5(){inc(d)}; +////////////////////////////////////////////////////////////////////////////// +//CHECK#5 +if (typeof __func__5 !== "function") { + $ERROR('#5: typeof __func__5 === "function". Actual: typeof __func__5 ==='+typeof __func__5); +} +// +////////////////////////////////////////////////////////////////////////////// + +function __func__6(){var \u0042 = 1;}; +////////////////////////////////////////////////////////////////////////////// +//CHECK#6 +if (typeof __func__6 !== "function") { + $ERROR('#6: typeof __func__6 === "function". Actual: typeof __func__6 ==='+typeof __func__6); +} +// +////////////////////////////////////////////////////////////////////////////// + +//function __func__7(){var \u003d = 1;}; +//////////////////////////////////////////////////////////////////////////////// +////CHECK#7 +//if (typeof __func__7 !== "function") { +// $ERROR('#7: The FunctionBody must be SourceElements'); +//} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch13/13.0/S13_A7_T2.js b/js/src/tests/test262/ch13/13.0/S13_A7_T2.js new file mode 100644 index 000000000..6b381b794 --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/S13_A7_T2.js @@ -0,0 +1,49 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The FunctionBody must be SourceElements + * + * @path ch13/13.0/S13_A7_T2.js + * @description Inserting elements that is different from SourceElements into the FunctionBody + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try{ + eval("function __func(){/ ABC}"); + $ERROR('#1: eval("function __func(){/ ABC}") lead to throwing exception'); +} catch(e){ + if(!(e instanceof SyntaxError)){ + $ERROR('#1.1: eval("function __func(){/ ABC}") lead to throwing exception of SyntaxError. Actual: exception is '+e); + } +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +try{ + eval("function __func(){&1}"); + $ERROR('#3: eval("function __func(){&1}") lead to throwing exception'); +} catch(e){ + if(!(e instanceof SyntaxError)){ + $ERROR('#3.1: eval("function __func(){&1}") lead to throwing exception of SyntaxError. Actual: exception is '+e); + } +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +try{ + eval("function __func(){# ABC}"); + $ERROR('#4: eval("function __func(){# ABC}") lead to throwing exception'); +} catch(e){ + if(!(e instanceof SyntaxError)){ + $ERROR('#4.1: eval("function __func(){# ABC}") lead to throwing exception of SyntaxError. Actual: exception is '+e); + } +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch13/13.0/S13_A7_T3.js b/js/src/tests/test262/ch13/13.0/S13_A7_T3.js new file mode 100644 index 000000000..e2b893b65 --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/S13_A7_T3.js @@ -0,0 +1,13 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The FunctionBody must be SourceElements + * + * @path ch13/13.0/S13_A7_T3.js + * @description Checking if execution of "function __func(){\A\B\C}" fails + * @negative + */ + +function __func(){\A\B\C}; + diff --git a/js/src/tests/test262/ch13/13.0/S13_A8_T1.js b/js/src/tests/test262/ch13/13.0/S13_A8_T1.js new file mode 100644 index 000000000..d147259ce --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/S13_A8_T1.js @@ -0,0 +1,33 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Arguments property of activation object contains real params to be passed + * + * @path ch13/13.0/S13_A8_T1.js + * @description Creating a function declared with "function __func(param1, param2, param3)" and using arguments.length property in order to perform the test + */ + + function __func(param1, param2, param3) { + return arguments.length; + } + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__func('A') !== 1) { + $ERROR('#1: __func(\'A\') === 1. Actual: __func(\'A\') ==='+__func('A')); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__func('A', 'B', 1, 2,__func) !== 5) { + $ERROR('#2: __func(\'A\', \'B\', 1, 2,__func) === 5. Actual: __func(\'A\', \'B\', 1, 2,__func) ==='+__func('A', 'B', 1, 2,__func)); +} +// +////////////////////////////////////////////////////////////////////////////// + + + + diff --git a/js/src/tests/test262/ch13/13.0/S13_A8_T2.js b/js/src/tests/test262/ch13/13.0/S13_A8_T2.js new file mode 100644 index 000000000..6e4b3f05c --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/S13_A8_T2.js @@ -0,0 +1,38 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Arguments property of activation object contains real params to be passed + * + * @path ch13/13.0/S13_A8_T2.js + * @description Creating a function with no parameters and using arguments.length property in order to perform the test + */ + + function __func() { + return arguments.length; + } + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__func('A') !== 1) { + $ERROR('#1: __func(\'A\') === 1. Actual: __func(\'A\') ==='+__func('A')); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__func('A', 'B', 1, 2,__func) !== 5) { + $ERROR('#2: __func(\'A\', \'B\', 1, 2,__func) === 5. Actual: __func(\'A\', \'B\', 1, 2,__func) ==='+__func('A', 'B', 1, 2,__func)); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (__func() !== 0) { + $ERROR('#3: __func() === 0. Actual: __func() ==='+__func()); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch13/13.0/S13_A9.js b/js/src/tests/test262/ch13/13.0/S13_A9.js new file mode 100644 index 000000000..c13119af9 --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/S13_A9.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. + +/** + * Function can be passed as argument + * + * @path ch13/13.0/S13_A9.js + * @description Using function as argument of another function + */ + +function __func__INC(arg){return arg + 1;}; +function __func__MULT(incrementator, arg, mult){ return incrementator(arg)*mult; }; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__func__MULT(__func__INC, 2, 2) !== 6) { + $ERROR('#1: function can be passed as argument'); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/js/src/tests/test262/ch13/13.0/browser.js b/js/src/tests/test262/ch13/13.0/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/browser.js diff --git a/js/src/tests/test262/ch13/13.0/shell.js b/js/src/tests/test262/ch13/13.0/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch13/13.0/shell.js |