diff options
Diffstat (limited to 'js/src/tests/test262/ch12/12.2')
64 files changed, 1482 insertions, 0 deletions
diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-1-s.js b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-1-s.js new file mode 100644 index 000000000..102f9fdb0 --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-1-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.
+/**
+ * @path ch12/12.2/12.2.1/12.2.1-1-s.js
+ * @description eval - a function declaring a var named 'eval' throws SyntaxError in strict mode
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ 'use strict';
+
+ try {
+ eval('function foo() { var eval; }');
+ return false;
+ }
+ catch (e) {
+ return (e instanceof SyntaxError);
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-10-s.js b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-10-s.js new file mode 100644 index 000000000..8f442fc90 --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-10-s.js @@ -0,0 +1,19 @@ +/// 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 ch12/12.2/12.2.1/12.2.1-10-s.js
+ * @description Strict Mode: an indirect eval assigning into 'eval' does not throw
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ 'use strict';
+ var s = eval;
+ s('eval = 42;');
+ return true;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-11.js b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-11.js new file mode 100644 index 000000000..650835ee1 --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-11.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 ch12/12.2/12.2.1/12.2.1-11.js
+ * @description arguments as var identifier in eval code is allowed
+ */
+
+
+function testcase() {
+ eval("var arguments;");
+ return true;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-12-s.js b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-12-s.js new file mode 100644 index 000000000..7d96f25fe --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-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.
+/**
+ * @path ch12/12.2/12.2.1/12.2.1-12-s.js
+ * @description arguments as local var identifier throws SyntaxError in strict mode
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ 'use strict';
+
+ try {
+ eval('function foo() { var arguments;}');
+ return false;
+ }
+ catch (e) {
+ return (e instanceof SyntaxError);
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-12.js b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-12.js new file mode 100644 index 000000000..f5ba2925d --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-12.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 ch12/12.2/12.2.1/12.2.1-12.js
+ * @description arguments as local var identifier is allowed
+ */
+
+
+function testcase() {
+ eval("(function (){var arguments;})");
+ return true;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-13-s.js b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-13-s.js new file mode 100644 index 000000000..d34ab90d1 --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-13-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.
+/**
+ * @path ch12/12.2/12.2.1/12.2.1-13-s.js
+ * @description arguments assignment throws SyntaxError in strict mode
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ 'use strict';
+
+ try {
+ eval('function foo() { arguments = 42; }; foo()');
+ return false;
+ }
+ catch (e) {
+ return (e instanceof SyntaxError);
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-14-s.js b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-14-s.js new file mode 100644 index 000000000..252688c96 --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-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.
+/**
+ * @path ch12/12.2/12.2.1/12.2.1-14-s.js
+ * @description arguments - a function expr declaring a var named 'arguments' throws SyntaxError in strict mode
+ * @onlyStrict
+ */
+
+
+
+
+function testcase() {
+ 'use strict';
+
+ try {
+ eval('(function (){var arguments;});');
+ return false;
+ }
+ catch (e) {
+ return (e instanceof SyntaxError);
+ }
+}
+runTestCase(testcase);
\ No newline at end of file diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-15-s.js b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-15-s.js new file mode 100644 index 000000000..185ba5156 --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-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.
+/**
+ * @path ch12/12.2/12.2.1/12.2.1-15-s.js
+ * @description arguments - a function expr assigning into 'arguments' throws a SyntaxError in strict mode
+ * @onlyStrict
+ */
+
+
+
+
+function testcase() {
+ 'use strict';
+
+ try {
+ eval('(function () {arguments = 42;})()');
+ return false;
+ }
+ catch (e) {
+ return (e instanceof SyntaxError);
+ }
+}
+runTestCase(testcase);
\ No newline at end of file diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-16-s.js b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-16-s.js new file mode 100644 index 000000000..d39963bc7 --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-16-s.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 ch12/12.2/12.2.1/12.2.1-16-s.js
+ * @description A Function constructor (called as a function) declaring a var named 'arguments' does not throw a SyntaxError in strict mode
+ * @onlyStrict
+ */
+
+
+
+
+function testcase() {
+ 'use strict';
+ Function('var arguments;');
+ return true;
+}
+runTestCase(testcase);
\ No newline at end of file diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-17-s.js b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-17-s.js new file mode 100644 index 000000000..c53dce258 --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-17-s.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 ch12/12.2/12.2.1/12.2.1-17-s.js
+ * @description A Function constructor (called as a function) assigning into 'arguments' will not throw any error if contained within strict mode and its body does not start with strict mode
+ * @onlyStrict
+ */
+
+
+
+
+function testcase() {
+ 'use strict';
+
+ var f = Function('arguments = 42;');
+ f();
+ return true;
+}
+runTestCase(testcase);
\ No newline at end of file diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-18-s.js b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-18-s.js new file mode 100644 index 000000000..fb4afd3c2 --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-18-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.
+/**
+ * @path ch12/12.2/12.2.1/12.2.1-18-s.js
+ * @description A direct eval declaring a var named 'arguments' throws SyntaxError in strict mode
+ * @onlyStrict
+ */
+
+
+
+
+function testcase() {
+ 'use strict';
+
+ try {
+ eval('var arguments;');
+ return false;
+ }
+ catch (e) {
+ return (e instanceof SyntaxError);
+ }
+}
+runTestCase(testcase);
\ No newline at end of file diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-19-s.js b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-19-s.js new file mode 100644 index 000000000..18fcc5d18 --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-19-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.
+/**
+ * @path ch12/12.2/12.2.1/12.2.1-19-s.js
+ * @description A direct eval assigning into 'arguments' throws SyntaxError in strict mode
+ * @onlyStrict
+ */
+
+
+
+
+function testcase() {
+ 'use strict';
+
+ try {
+ eval('arguments = 42;');
+ return false;
+ }
+ catch (e) {
+ return (e instanceof SyntaxError) ;
+ }
+}
+runTestCase(testcase);
\ No newline at end of file diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-1gs.js b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-1gs.js new file mode 100644 index 000000000..a93b2aae7 --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-1gs.js @@ -0,0 +1,14 @@ +/// 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 ch12/12.2/12.2.1/12.2.1-1gs.js
+ * @description Strict Mode - SyntaxError is thrown if a VariableDeclaration occurs within strict code and its Identifier is eval
+ * @onlyStrict
+ * @negative ^((?!NotEarlyError).)*$
+ */
+"use strict";
+throw NotEarlyError;
+for (var eval in arrObj) { }
\ No newline at end of file diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-2-s.js b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-2-s.js new file mode 100644 index 000000000..8b9848c54 --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-2-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.
+/**
+ * @path ch12/12.2/12.2.1/12.2.1-2-s.js
+ * @description eval - a function assigning into 'eval' throws SyntaxError in strict mode
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ 'use strict';
+
+ try {
+ eval('function foo() { eval = 42; }; foo()');
+ return false;
+ }
+ catch (e) {
+ return (e instanceof SyntaxError);
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-20-s.js b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-20-s.js new file mode 100644 index 000000000..230340fda --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-20-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.
+/**
+ * @path ch12/12.2/12.2.1/12.2.1-20-s.js
+ * @description Strict Mode: an indirect eval declaring a var named 'arguments' does not throw
+ * @onlyStrict
+ */
+
+
+
+
+function testcase() {
+ 'use strict';
+ var s = eval;
+ s('var arguments;');
+ return true;
+}
+runTestCase(testcase);
\ No newline at end of file diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-21-s.js b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-21-s.js new file mode 100644 index 000000000..2d1907b01 --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-21-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.
+/**
+ * @path ch12/12.2/12.2.1/12.2.1-21-s.js
+ * @description Strict Mode: an indirect eval assigning into 'arguments' does not throw
+ * @onlyStrict
+ */
+
+
+
+
+function testcase() {
+ 'use strict';
+ var s = eval;
+ s('arguments = 42;');
+ return true;
+}
+runTestCase(testcase);
\ No newline at end of file diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-22-s.js b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-22-s.js new file mode 100644 index 000000000..943360cda --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-22-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.
+/**
+ * @path ch12/12.2/12.2.1/12.2.1-22-s.js
+ * @description arguments as global var identifier throws SyntaxError in strict mode
+ * @onlyStrict
+ */
+
+
+
+
+function testcase() {
+
+ var indirectEval = eval;
+
+ try {
+ indirectEval("'use strict'; var arguments;");
+ return false;
+ }
+ catch (e) {
+ return (e instanceof SyntaxError);
+ }
+}
+runTestCase(testcase);
\ No newline at end of file diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-23-s.js b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-23-s.js new file mode 100644 index 000000000..29d667897 --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-23-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.
+/**
+ * @path ch12/12.2/12.2.1/12.2.1-23-s.js
+ * @description arguments as local var identifier assigned to throws SyntaxError in strict mode
+ * @onlyStrict
+ */
+
+
+
+
+function testcase() {
+ 'use strict';
+
+ try {
+ eval('function foo() { var arguments = 42;}');
+ return false;
+ }
+ catch (e) {
+ return (e instanceof SyntaxError);
+ }
+}
+runTestCase(testcase);
\ No newline at end of file diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-24-s.js b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-24-s.js new file mode 100644 index 000000000..bd9cc069d --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-24-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.
+/**
+ * @path ch12/12.2/12.2.1/12.2.1-24-s.js
+ * @description eval as local var identifier assigned to throws SyntaxError in strict mode
+ * @onlyStrict
+ */
+
+
+
+
+function testcase() {
+ 'use strict';
+
+ try {
+ eval('function foo() { var eval = 42;}');
+ return false;
+ }
+ catch (e) {
+ return (e instanceof SyntaxError);
+ }
+}
+runTestCase(testcase);
\ No newline at end of file diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-25-s.js b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-25-s.js new file mode 100644 index 000000000..f28397959 --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-25-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.
+/**
+ * @path ch12/12.2/12.2.1/12.2.1-25-s.js
+ * @description arguments as local var identifier throws SyntaxError in strict mode
+ * @onlyStrict
+ */
+
+
+
+
+function testcase() {
+ 'use strict';
+
+ try {
+ eval('function foo() { var arguments, a;}');
+ return false;
+ }
+ catch (e) {
+ return (e instanceof SyntaxError);
+ }
+}
+runTestCase(testcase);
\ No newline at end of file diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-26-s.js b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-26-s.js new file mode 100644 index 000000000..b4e24356f --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-26-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.
+/**
+ * @path ch12/12.2/12.2.1/12.2.1-26-s.js
+ * @description eval as local var identifier throws SyntaxError in strict mode
+ * @onlyStrict
+ */
+
+
+
+
+function testcase() {
+ 'use strict';
+
+ try {
+ eval('function foo() { var a, eval;}');
+ return false;
+ }
+ catch (e) {
+ return (e instanceof SyntaxError);
+ }
+}
+runTestCase(testcase);
\ No newline at end of file diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-27-s.js b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-27-s.js new file mode 100644 index 000000000..8f08b1b2a --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-27-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.
+/**
+ * @path ch12/12.2/12.2.1/12.2.1-27-s.js
+ * @description eval as local var identifier assigned to throws SyntaxError in strict mode
+ * @onlyStrict
+ */
+
+
+
+
+function testcase() {
+ 'use strict';
+
+ try {
+ eval('function foo() { var eval = 42, a;}');
+ return false;
+ }
+ catch (e) {
+ return (e instanceof SyntaxError);
+ }
+}
+runTestCase(testcase);
\ No newline at end of file diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-28-s.js b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-28-s.js new file mode 100644 index 000000000..ea6d73a0c --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-28-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.
+/**
+ * @path ch12/12.2/12.2.1/12.2.1-28-s.js
+ * @description arguments as local var identifier assigned to throws SyntaxError in strict mode
+ * @onlyStrict
+ */
+
+
+
+
+function testcase() {
+ 'use strict';
+
+ try {
+ eval('function foo() { var a, arguments = 42;}');
+ return false;
+ }
+ catch (e) {
+ return (e instanceof SyntaxError);
+ }
+}
+runTestCase(testcase);
\ No newline at end of file diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-29-s.js b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-29-s.js new file mode 100644 index 000000000..4b389d966 --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-29-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.
+/**
+ * @path ch12/12.2/12.2.1/12.2.1-29-s.js
+ * @description eval as local var identifier throws SyntaxError in strict mode
+ * @onlyStrict
+ */
+
+
+
+
+function testcase() {
+ 'use strict';
+
+ try {
+ eval('function foo() { var eval, a = 42;}');
+ return false;
+ }
+ catch (e) {
+ return (e instanceof SyntaxError);
+ }
+}
+runTestCase(testcase);
\ No newline at end of file diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-3-s.js b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-3-s.js new file mode 100644 index 000000000..6f207527e --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-3-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.
+/**
+ * @path ch12/12.2/12.2.1/12.2.1-3-s.js
+ * @description eval - a function expr declaring a var named 'eval' throws SyntaxError in strict mode
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ 'use strict';
+
+ try {
+ eval('(function () { var eval; })');
+ return false;
+ }
+ catch (e) {
+ return (e instanceof SyntaxError);
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-30-s.js b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-30-s.js new file mode 100644 index 000000000..8998405d0 --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-30-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.
+/**
+ * @path ch12/12.2/12.2.1/12.2.1-30-s.js
+ * @description arguments as local var identifier throws SyntaxError in strict mode
+ * @onlyStrict
+ */
+
+
+
+
+function testcase() {
+ 'use strict';
+
+ try {
+ eval('function foo() { var a = 42, arguments;}');
+ return false;
+ }
+ catch (e) {
+ return (e instanceof SyntaxError);
+ }
+}
+runTestCase(testcase);
\ No newline at end of file diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-31-s.js b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-31-s.js new file mode 100644 index 000000000..305af43d2 --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-31-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.
+/**
+ * @path ch12/12.2/12.2.1/12.2.1-31-s.js
+ * @description eval as local var identifier defined twice throws SyntaxError in strict mode
+ * @onlyStrict
+ */
+
+
+
+
+function testcase() {
+ 'use strict';
+
+ try {
+ eval('function foo() { var eval, eval;}');
+ return false;
+ }
+ catch (e) {
+ return (e instanceof SyntaxError);
+ }
+}
+runTestCase(testcase);
\ No newline at end of file diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-32-s.js b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-32-s.js new file mode 100644 index 000000000..b68ecb63d --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-32-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.
+/**
+ * @path ch12/12.2/12.2.1/12.2.1-32-s.js
+ * @description arguments as local var identifier defined twice and assigned once throws SyntaxError in strict mode
+ * @onlyStrict
+ */
+
+
+
+
+function testcase() {
+ 'use strict';
+
+ try {
+ eval('function foo() { var arguments, arguments = 42;}');
+ return false;
+ }
+ catch (e) {
+ return (e instanceof SyntaxError);
+ }
+}
+runTestCase(testcase);
\ No newline at end of file diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-33-s.js b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-33-s.js new file mode 100644 index 000000000..1a54c5e5b --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-33-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.
+/**
+ * @path ch12/12.2/12.2.1/12.2.1-33-s.js
+ * @description arguments as local var identifier throws SyntaxError in strict mode
+ * @onlyStrict
+ */
+
+
+
+
+function testcase() {
+ 'use strict';
+
+ try {
+ eval('function foo() { var a, arguments, b;}');
+ return false;
+ }
+ catch (e) {
+ return (e instanceof SyntaxError);
+ }
+}
+runTestCase(testcase);
\ No newline at end of file diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-34-s.js b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-34-s.js new file mode 100644 index 000000000..c41cb67a6 --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-34-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.
+/**
+ * @path ch12/12.2/12.2.1/12.2.1-34-s.js
+ * @description 'for(var eval in ...) {...}' throws SyntaxError in strict mode
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ 'use strict';
+
+ try {
+ eval('for (var eval in null) {};');
+ return false;
+ }
+ catch (e) {
+ return (e instanceof SyntaxError);
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-35-s.js b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-35-s.js new file mode 100644 index 000000000..41eaacabf --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-35-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.
+/**
+ * @path ch12/12.2/12.2.1/12.2.1-35-s.js
+ * @description 'for(var eval = 42 in ...) {...}' throws SyntaxError in strict mode
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ 'use strict';
+
+ try {
+ eval('for (var eval = 42 in null) {};');
+ return false;
+ }
+ catch (e) {
+ return (e instanceof SyntaxError);
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-36-s.js b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-36-s.js new file mode 100644 index 000000000..f33169483 --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-36-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.
+/**
+ * @path ch12/12.2/12.2.1/12.2.1-36-s.js
+ * @description 'for(var arguments in ...) {...}' throws SyntaxError in strict mode
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ 'use strict';
+
+ try {
+ eval('for (var arguments in null) {};');
+ return false;
+ }
+ catch (e) {
+ return (e instanceof SyntaxError);
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-37-s.js b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-37-s.js new file mode 100644 index 000000000..2a134a665 --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-37-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.
+/**
+ * @path ch12/12.2/12.2.1/12.2.1-37-s.js
+ * @description 'for(var arguments = 42 in ...) {...}' throws SyntaxError in strict mode
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ 'use strict';
+
+ try {
+ eval('for (var arguments = 42 in null) {};');
+ return false;
+ }
+ catch (e) {
+ return (e instanceof SyntaxError);
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-4-s.js b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-4-s.js new file mode 100644 index 000000000..2eef4faaa --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-4-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.
+/**
+ * @path ch12/12.2/12.2.1/12.2.1-4-s.js
+ * @description eval - a function expr assigning into 'eval' throws a SyntaxError in strict mode
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ 'use strict';
+
+ try {
+ eval('(function () { eval = 42; })()');
+ return false;
+ }
+ catch (e) {
+ return (e instanceof SyntaxError);
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-4gs.js b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-4gs.js new file mode 100644 index 000000000..add5e144d --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-4gs.js @@ -0,0 +1,14 @@ +/// 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 ch12/12.2/12.2.1/12.2.1-4gs.js
+ * @description Strict Mode - SyntaxError is thrown if a VariableDeclarationNoIn occurs within strict code and its Identifier is arguments
+ * @onlyStrict
+ * @negative ^((?!NotEarlyError).)*$
+ */
+"use strict";
+throw NotEarlyError;
+var arguments;
\ No newline at end of file diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-5-s.js b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-5-s.js new file mode 100644 index 000000000..8644c4a20 --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-5-s.js @@ -0,0 +1,18 @@ +/// 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 ch12/12.2/12.2.1/12.2.1-5-s.js
+ * @description Strict Mode - a Function declaring var named 'eval' does not throw SyntaxError
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ 'use strict';
+ Function('var eval;');
+ return true;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-6-s.js b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-6-s.js new file mode 100644 index 000000000..2db1c2bf8 --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-6-s.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 ch12/12.2/12.2.1/12.2.1-6-s.js
+ * @description eval - a Function assigning into 'eval' will not throw any error if contained within strict mode and its body does not start with strict mode
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ 'use strict';
+
+ var f = Function('eval = 42;');
+ f();
+ return true;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-7-s.js b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-7-s.js new file mode 100644 index 000000000..fec5ae659 --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-7-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.
+/**
+ * @path ch12/12.2/12.2.1/12.2.1-7-s.js
+ * @description eval - a direct eval declaring a var named 'eval' throws SyntaxError in strict mode
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ 'use strict';
+
+ try {
+ eval('var eval;');
+ return false;
+ }
+ catch (e) {
+ return (e instanceof SyntaxError);
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-8-s.js b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-8-s.js new file mode 100644 index 000000000..385808d44 --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-8-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.
+/**
+ * @path ch12/12.2/12.2.1/12.2.1-8-s.js
+ * @description eval - a direct eval assigning into 'eval' throws SyntaxError in strict mode
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ 'use strict';
+
+ try {
+ eval('eval = 42;');
+ return false;
+ }
+ catch (e) {
+ return (e instanceof SyntaxError) ;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-9-s.js b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-9-s.js new file mode 100644 index 000000000..6479cc174 --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/12.2.1-9-s.js @@ -0,0 +1,19 @@ +/// 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 ch12/12.2/12.2.1/12.2.1-9-s.js
+ * @description Strict Mode: an indirect eval declaring a var named 'eval' does not throw
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ 'use strict';
+ var s = eval;
+ s('var eval;');
+ return true;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/browser.js b/js/src/tests/test262/ch12/12.2/12.2.1/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/browser.js diff --git a/js/src/tests/test262/ch12/12.2/12.2.1/shell.js b/js/src/tests/test262/ch12/12.2/12.2.1/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/12.2.1/shell.js diff --git a/js/src/tests/test262/ch12/12.2/S12.2_A1.js b/js/src/tests/test262/ch12/12.2/S12.2_A1.js new file mode 100644 index 000000000..520daebf5 --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/S12.2_A1.js @@ -0,0 +1,53 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Variables are created when the program is entered. Variables are initialised to "undefined" + * when created. A variable with an Initialiser is assigned the value of its AssignmentExpression when the + * VariableStatement is executed, not when the variable is created + * + * @path ch12/12.2/S12.2_A1.js + * @description Creating variables after entering the execution scope + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + __x = __x; + __y = __x ? "good fellow" : "liar"; // __y assigned to "liar" since __x undefined + __z = __z === __x ? 1 : 0; // __z assigned to 1 since both __x and __z are undefined +} catch (e) { + $ERROR('#1: Using declarated variable before it declaration is admitted'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +try{ + __something__undefined = __something__undefined; + $ERROR('#2: "__something__undefined = __something__undefined" lead to throwing exception'); +} catch(e){ + $PRINT(e.message); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if ((__y !== "liar")&(__z !== 1)) { + $ERROR('#3: (__y === "liar") and (__z === 1). Actual: __y ==='+__y+' and __z ==='+__z ); +} +// +////////////////////////////////////////////////////////////////////////////// + +var __x, __y = true, __z = __y ? "smeagol" : "golum"; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if (!__y&!(__z = "smeagol")) { + $ERROR('#4: A variable with an Initialiser is assigned the value of its AssignmentExpression when the VariableStatement is executed'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.2/S12.2_A10.js b/js/src/tests/test262/ch12/12.2/S12.2_A10.js new file mode 100644 index 000000000..b85f957b2 --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/S12.2_A10.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. + +/** + * "var" statement within "for" statement is allowed + * + * @path ch12/12.2/S12.2_A10.js + * @description Declaring variable within a "for" IterationStatement + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + __ind=__ind; +} catch (e) { + $ERROR('#1: var inside "for" is admitted '+e.message); +} +// +////////////////////////////////////////////////////////////////////////////// + +for (var __ind;;){ + break; +} + diff --git a/js/src/tests/test262/ch12/12.2/S12.2_A11.js b/js/src/tests/test262/ch12/12.2/S12.2_A11.js new file mode 100644 index 000000000..392d4e74b --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/S12.2_A11.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. + +/** + * When using property attributes, {ReadOnly} is not used + * + * @path ch12/12.2/S12.2_A11.js + * @description Changing variable value using property attributes + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +this['__declared__var'] = "baloon"; +if (this['__declared__var'] !== "baloon") { + $ERROR('#1: this[\'__declared__var\'] === "baloon". Actual: this[\'__declared__var\'] ==='+ this['__declared__var'] ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__declared__var !== "baloon") { + $ERROR('#2: __declared__var === "baloon". Actual: __declared__var ==='+ __declared__var ); +} +// +////////////////////////////////////////////////////////////////////////////// + +var __declared__var; + diff --git a/js/src/tests/test262/ch12/12.2/S12.2_A12.js b/js/src/tests/test262/ch12/12.2/S12.2_A12.js new file mode 100644 index 000000000..d69e27539 --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/S12.2_A12.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. + +/** + * VariableDeclaration within "do-while" loop is allowed + * + * @path ch12/12.2/S12.2_A12.js + * @description Declaring variable within "do-while" statement + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + x=x; +} catch (e) { + $ERROR('#1: Declaration variable inside "do-while" statement is admitted'); +} +// +////////////////////////////////////////////////////////////////////////////// + +do var x; while (false); + diff --git a/js/src/tests/test262/ch12/12.2/S12.2_A2.js b/js/src/tests/test262/ch12/12.2/S12.2_A2.js new file mode 100644 index 000000000..5f7de5abc --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/S12.2_A2.js @@ -0,0 +1,47 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Variables are defined with global scope (that is, they are created as members of the global object, as described in 10.1.3) using property attributes { DontDelete} + * + * @path ch12/12.2/S12.2_A2.js + * @description Checking if deleting global variables that have the attributes {DontDelete} fails + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (delete(__variable)) { + $ERROR('#1: delete(__variable)===false'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (delete(this["__variable"])) { + $ERROR('#2: delete(this["__variable"])===false'); +} +// +////////////////////////////////////////////////////////////////////////////// + + +var __variable; +var __variable = "defined"; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (delete(__variable) | delete(this["__variable"])) { + $ERROR('#3: (delete(__variable) | delete(this["__variable"]))===false' ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if ((__variable !== "defined")|(this["__variable"] !=="defined")) { + $ERROR('#4: __variable === "defined" and this["__variable"] ==="defined"'); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/js/src/tests/test262/ch12/12.2/S12.2_A3.js b/js/src/tests/test262/ch12/12.2/S12.2_A3.js new file mode 100644 index 000000000..5c0845ad2 --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/S12.2_A3.js @@ -0,0 +1,55 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * FunctionDeclaration produces a new scope + * + * @path ch12/12.2/S12.2_A3.js + * @description Using Global scope and Function scope together + */ + +var __var = "OUT"; + +(function(){ + var __var ="IN"; + (function(){__var = "INNER_SPACE";})(); + (function(){var __var = "INNER_SUN";})(); + ////////////////////////////////////////////////////////////////////////////// + //CHECK#1 + if (__var !== "INNER_SPACE") { + $ERROR('#1: __var === "INNER_SPACE". Actual: __var ==='+ __var ); + } + // + ////////////////////////////////////////////////////////////////////////////// +})(); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__var !== "OUT") { + $ERROR('#2: __var === "OUT". Actual: __var ==='+ __var ); +} +// +////////////////////////////////////////////////////////////////////////////// + + +(function(){ + __var ="IN"; + (function(){__var = "INNERED"})(); + (function(){var __var = "INNAGER"})(); + ////////////////////////////////////////////////////////////////////////////// + //CHECK#3 + if (__var!=="INNERED") { + $ERROR('#3: __var==="INNERED". Actual: __var==='+ __var ); + } + // + ////////////////////////////////////////////////////////////////////////////// +})(); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if (__var!=="INNERED") { + $ERROR('#4: __var==="INNERED". Actual: __var==='+ __var ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.2/S12.2_A4.js b/js/src/tests/test262/ch12/12.2/S12.2_A4.js new file mode 100644 index 000000000..17f5c6a87 --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/S12.2_A4.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Unicode characters in variable Identifier are allowed + * + * @path ch12/12.2/S12.2_A4.js + * @description Create and use unicode characters in variable Identifier + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + __var=__var; +} catch (e) { + $ERROR('#1: Unicode characters in variable Identifier allowed'); +} +// +////////////////////////////////////////////////////////////////////////////// + +var \u005f\u005f\u0076\u0061\u0072 = 1; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__var !== 1) { + $ERROR('#2: __var === 1. Actual: __var ==='+ __var ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.2/S12.2_A5.js b/js/src/tests/test262/ch12/12.2/S12.2_A5.js new file mode 100644 index 000000000..c168bfd2b --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/S12.2_A5.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. + +/** + * VariableDeclaration within Eval statement is initialized as the program reaches the eval statement + * + * @path ch12/12.2/S12.2_A5.js + * @description Executing eval("var x") + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try{ + x=x; + $ERROR('#1: "x=x" lead to throwing exception'); +}catch(e){ + $PRINT(e.message); +}; +// +////////////////////////////////////////////////////////////////////////////// + +eval("var x"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +try{ + x=x; +}catch(e){ + $ERROR('#2: VariableDeclaration inside Eval statement is initialized when program reaches the eval statement '+e.message); +}; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.2/S12.2_A6_T1.js b/js/src/tests/test262/ch12/12.2/S12.2_A6_T1.js new file mode 100644 index 000000000..34e7f0e7a --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/S12.2_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. + +/** + * VariableDeclaration within "try-catch" statement is allowed + * + * @path ch12/12.2/S12.2_A6_T1.js + * @description Declaring variable within "try-catch" statement + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try{ + intry__var=intry__var; +}catch(e){ + $ERROR('#1: Variable declaration inside "try" block is admitted'); +}; +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +try{ + incatch__var=incatch__var; +}catch(e){ + $ERROR('#2: Variable declaration inside "catch" block is admitted'); +}; +// +////////////////////////////////////////////////////////////////////////////// + +try{ + var intry__var; +}catch(e){ + var incatch__var; +}; + diff --git a/js/src/tests/test262/ch12/12.2/S12.2_A6_T2.js b/js/src/tests/test262/ch12/12.2/S12.2_A6_T2.js new file mode 100644 index 000000000..4b586e0ab --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/S12.2_A6_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. + +/** + * VariableDeclaration within "try-catch" statement is allowed + * + * @path ch12/12.2/S12.2_A6_T2.js + * @description Declaring variables within "try-catch" statement + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try{ + intry__intry__var=intry__intry__var; + intry__incatch__var=intry__incatch__var; + incatch__intry__var=incatch__intry__var; + incatch__incatch__var=incatch__incatch__var; +}catch(e){ + $ERROR('#1: Variable declaration inside "try-catch" block is admitted'); +}; +// +////////////////////////////////////////////////////////////////////////////// + +try{ + try { + var intry__intry__var; + } catch (e) { + var intry__incatch__var; + } +}catch(e){ + try { + var incatch__intry__var; + } catch (e) { + var incatch__incatch__var; + } + +}; + diff --git a/js/src/tests/test262/ch12/12.2/S12.2_A7.js b/js/src/tests/test262/ch12/12.2/S12.2_A7.js new file mode 100644 index 000000000..167355a9f --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/S12.2_A7.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. + +/** + * VariableDeclaration within "for" statement is allowed + * + * @path ch12/12.2/S12.2_A7.js + * @description Declaring variable within "for" statement + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try{ + infor_var = infor_var; +}catch(e){ + $ERROR('#1: Variable declaration inside "for" loop is admitted'); +}; +// +////////////////////////////////////////////////////////////////////////////// + +for (;;){ + break; + var infor_var; +} + diff --git a/js/src/tests/test262/ch12/12.2/S12.2_A8_T1.js b/js/src/tests/test262/ch12/12.2/S12.2_A8_T1.js new file mode 100644 index 000000000..c9466b665 --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/S12.2_A8_T1.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Only AssignmentExpression is admitted when variable is initialized + * + * @path ch12/12.2/S12.2_A8_T1.js + * @description Checking if execution of "var x += 1" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +var x += 1; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.2/S12.2_A8_T2.js b/js/src/tests/test262/ch12/12.2/S12.2_A8_T2.js new file mode 100644 index 000000000..f5b9edc5f --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/S12.2_A8_T2.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Only AssignmentExpression is admitted when variable is initialized + * + * @path ch12/12.2/S12.2_A8_T2.js + * @description Checking if execution of "var x | true" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +var x | true; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.2/S12.2_A8_T3.js b/js/src/tests/test262/ch12/12.2/S12.2_A8_T3.js new file mode 100644 index 000000000..4272e5c1b --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/S12.2_A8_T3.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Only AssignmentExpression is admitted when variable is initialized + * + * @path ch12/12.2/S12.2_A8_T3.js + * @description Checking if execution of "var x && 1" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +var x && 1; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.2/S12.2_A8_T4.js b/js/src/tests/test262/ch12/12.2/S12.2_A8_T4.js new file mode 100644 index 000000000..1f4641770 --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/S12.2_A8_T4.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Only AssignmentExpression is admitted when variable is initialized + * + * @path ch12/12.2/S12.2_A8_T4.js + * @description Checking if execution of "var x++" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +var x++; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.2/S12.2_A8_T5.js b/js/src/tests/test262/ch12/12.2/S12.2_A8_T5.js new file mode 100644 index 000000000..1c414f6dd --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/S12.2_A8_T5.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Only AssignmentExpression is admitted when variable is initialized + * + * @path ch12/12.2/S12.2_A8_T5.js + * @description Checking if execution of "var --x" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +var --x; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.2/S12.2_A8_T6.js b/js/src/tests/test262/ch12/12.2/S12.2_A8_T6.js new file mode 100644 index 000000000..c763f07aa --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/S12.2_A8_T6.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Only AssignmentExpression is admitted when variable is initialized + * + * @path ch12/12.2/S12.2_A8_T6.js + * @description Checking if execution of "var x*1" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +var x*1; +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/js/src/tests/test262/ch12/12.2/S12.2_A8_T7.js b/js/src/tests/test262/ch12/12.2/S12.2_A8_T7.js new file mode 100644 index 000000000..86d1c3398 --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/S12.2_A8_T7.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Only AssignmentExpression is admitted when variable is initialized + * + * @path ch12/12.2/S12.2_A8_T7.js + * @description Checking if execution of "var x>>1" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +var x>>1; +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/js/src/tests/test262/ch12/12.2/S12.2_A8_T8.js b/js/src/tests/test262/ch12/12.2/S12.2_A8_T8.js new file mode 100644 index 000000000..d798757d6 --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/S12.2_A8_T8.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. + +/** + * Only AssignmentExpression is admitted when variable is initialized + * + * @path ch12/12.2/S12.2_A8_T8.js + * @description Checking if execution of "var x in __arr" fails + * @negative + */ + +__arr = []; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +var x in __arr; +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/js/src/tests/test262/ch12/12.2/S12.2_A9.js b/js/src/tests/test262/ch12/12.2/S12.2_A9.js new file mode 100644 index 000000000..261599a65 --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/S12.2_A9.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. + +/** + * When using property attributes, {DontEnum} is not used + * + * @path ch12/12.2/S12.2_A9.js + * @description Enumerating property attributes of "this" and then searching for the declared variable + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +for (__prop in this){ + if (__prop === "__declared__var") + enumed=true; +} +if (!(enumed)) { + $ERROR('#1: When using property attributes, {DontEnum} not used'); +} +// +////////////////////////////////////////////////////////////////////////////// + +var __declared__var; + diff --git a/js/src/tests/test262/ch12/12.2/browser.js b/js/src/tests/test262/ch12/12.2/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/browser.js diff --git a/js/src/tests/test262/ch12/12.2/shell.js b/js/src/tests/test262/ch12/12.2/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.2/shell.js |