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/ch12 | |
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/ch12')
565 files changed, 25062 insertions, 0 deletions
diff --git a/js/src/tests/test262/ch12/12.1/12.1-1.js b/js/src/tests/test262/ch12/12.1/12.1-1.js new file mode 100644 index 000000000..e5311368f --- /dev/null +++ b/js/src/tests/test262/ch12/12.1/12.1-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 ch12/12.1/12.1-1.js
+ * @description 12.1 - block '{ StatementListopt };' is not allowed: try-catch
+ */
+
+
+function testcase() {
+ try {
+ eval("try{};catch(){}");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.1/12.1-2.js b/js/src/tests/test262/ch12/12.1/12.1-2.js new file mode 100644 index 000000000..ab1d4668e --- /dev/null +++ b/js/src/tests/test262/ch12/12.1/12.1-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 ch12/12.1/12.1-2.js
+ * @description 12.1 - block '{ StatementListopt };' is not allowed: try-catch-finally
+ */
+
+
+function testcase() {
+ try {
+ eval("try{};catch{};finally{}");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.1/12.1-3.js b/js/src/tests/test262/ch12/12.1/12.1-3.js new file mode 100644 index 000000000..e0ccd4f58 --- /dev/null +++ b/js/src/tests/test262/ch12/12.1/12.1-3.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.1/12.1-3.js
+ * @description 12.1 - block '{ StatementListopt };' is not allowed: try-finally
+ */
+
+
+function testcase() {
+ try {
+ eval("try{};finally{}");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.1/12.1-4.js b/js/src/tests/test262/ch12/12.1/12.1-4.js new file mode 100644 index 000000000..4df0c5604 --- /dev/null +++ b/js/src/tests/test262/ch12/12.1/12.1-4.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.1/12.1-4.js
+ * @description 12.1 - block '{ StatementListopt };' is not allowed: if-else
+ */
+
+
+function testcase() {
+ try {
+ eval("if{};else{}");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.1/12.1-5.js b/js/src/tests/test262/ch12/12.1/12.1-5.js new file mode 100644 index 000000000..4d2238962 --- /dev/null +++ b/js/src/tests/test262/ch12/12.1/12.1-5.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.1/12.1-5.js
+ * @description 12.1 - block '{ StatementListopt };' is not allowed: if-else-if
+ */
+
+
+function testcase() {
+ try {
+ eval("if{};else if{}");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.1/12.1-6.js b/js/src/tests/test262/ch12/12.1/12.1-6.js new file mode 100644 index 000000000..d6907d9c6 --- /dev/null +++ b/js/src/tests/test262/ch12/12.1/12.1-6.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.1/12.1-6.js
+ * @description 12.1 - block '{ StatementListopt };' is not allowed: if-else-if-else
+ */
+
+
+function testcase() {
+ try {
+ eval("if{};else if{};else{}");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.1/12.1-7.js b/js/src/tests/test262/ch12/12.1/12.1-7.js new file mode 100644 index 000000000..ab89adc8b --- /dev/null +++ b/js/src/tests/test262/ch12/12.1/12.1-7.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.1/12.1-7.js
+ * @description 12.1 - block '{ StatementListopt };' is not allowed: do-while
+ */
+
+
+function testcase() {
+ try {
+ eval("do{};while()");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.1/S12.1_A2.js b/js/src/tests/test262/ch12/12.1/S12.1_A2.js new file mode 100644 index 000000000..eed2e89d4 --- /dev/null +++ b/js/src/tests/test262/ch12/12.1/S12.1_A2.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. + +/** + * The production StatementList Statement is evaluated as follows + * 1. Evaluate Statement. + * 2. If an exception was thrown, return (throw, V, empty) where V is the exception + * + * @path ch12/12.1/S12.1_A2.js + * @description Throwing exception within a Block + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + x(); + $ERROR('#1: "x()" lead to throwing exception'); +} catch (e) { + $PRINT(e.message); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +try { + throw "catchme"; + $ERROR('#2: throw "catchme" lead to throwing exception'); +} catch (e) { + if (e!=="catchme") { + $ERROR('#2.1: Exception === "catchme". Actual: Exception ==='+ e ); + } +} + +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.1/S12.1_A4_T1.js b/js/src/tests/test262/ch12/12.1/S12.1_A4_T1.js new file mode 100644 index 000000000..8acad6f1c --- /dev/null +++ b/js/src/tests/test262/ch12/12.1/S12.1_A4_T1.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The production Block can't be inside of expression + * + * @path ch12/12.1/S12.1_A4_T1.js + * @description Checking if execution of "y={__func}()" fails + * @negative + */ + +function __func(){}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +y={__func}(); +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.1/S12.1_A4_T2.js b/js/src/tests/test262/ch12/12.1/S12.1_A4_T2.js new file mode 100644 index 000000000..510d6f7b0 --- /dev/null +++ b/js/src/tests/test262/ch12/12.1/S12.1_A4_T2.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The production Block can't be inside of expression + * + * @path ch12/12.1/S12.1_A4_T2.js + * @description Checking if execution of "y={x}" fails + * @negative + */ + +x=1; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +y={x}; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.1/S12.1_A5.js b/js/src/tests/test262/ch12/12.1/S12.1_A5.js new file mode 100644 index 000000000..00356061f --- /dev/null +++ b/js/src/tests/test262/ch12/12.1/S12.1_A5.js @@ -0,0 +1,57 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * StatementList: StatementList Statement inside the Block is evaluated from left to right + * + * @path ch12/12.1/S12.1_A5.js + * @description Throwing exceptions within embedded/sequence Blocks + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + throw 1; + throw 2; + throw 3; + $ERROR('1.1: throw 1 lead to throwing exception'); +} catch (e) { + if (e!==1) { + $ERROR('#1.2: Exception === 1. Actual: Exception ==='+ e); + } +} +//////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +try { + { + throw 1; + throw 2; + } + throw 3; + $ERROR('#2.1: throw 1 lead to throwing exception'); +} catch (e) { + if (e!==1) { + $ERROR('#2.2: Exception === 1. Actual: Exception ==='+ e); + } +} +//////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +try { + throw 1; + { + throw 2; + throw 3; + } + $ERROR('#3.1: throw 1 lead to throwing exception'); +} catch (e) { + if (e!==1) { + $ERROR('#3.2: Exception === 1. Actual: Exception ==='+ e); + } +} +//////////////////////////////////////////////////////////////////////////////// + + diff --git a/js/src/tests/test262/ch12/12.1/browser.js b/js/src/tests/test262/ch12/12.1/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.1/browser.js diff --git a/js/src/tests/test262/ch12/12.1/shell.js b/js/src/tests/test262/ch12/12.1/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.1/shell.js diff --git a/js/src/tests/test262/ch12/12.10/12.10-0-1.js b/js/src/tests/test262/ch12/12.10/12.10-0-1.js new file mode 100644 index 000000000..b1da0a5b7 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/12.10-0-1.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.10/12.10-0-1.js
+ * @description with does not change declaration scope - vars in with are visible outside
+ */
+
+
+function testcase() {
+ var o = {};
+ var f = function () {
+ /* capture foo binding before executing with */
+ return foo;
+ }
+
+ with (o) {
+ var foo = "12.10-0-1";
+ }
+
+ return f()==="12.10-0-1"
+
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.10/12.10-0-10.js b/js/src/tests/test262/ch12/12.10/12.10-0-10.js new file mode 100644 index 000000000..60e67f5aa --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/12.10-0-10.js @@ -0,0 +1,28 @@ +/// 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.10/12.10-0-10.js
+ * @description with introduces scope - name lookup finds function parameter
+ */
+
+
+function testcase() {
+ function f(o) {
+
+ function innerf(o, x) {
+ with (o) {
+ return x;
+ }
+ }
+
+ return innerf(o, 42);
+ }
+
+ if (f({}) === 42) {
+ return true;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.10/12.10-0-11.js b/js/src/tests/test262/ch12/12.10/12.10-0-11.js new file mode 100644 index 000000000..183ee45f7 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/12.10-0-11.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.
+/**
+ * @path ch12/12.10/12.10-0-11.js
+ * @description with introduces scope - name lookup finds inner variable
+ */
+
+
+function testcase() {
+ function f(o) {
+
+ function innerf(o) {
+ var x = 42;
+
+ with (o) {
+ return x;
+ }
+ }
+
+ return innerf(o);
+ }
+
+ if (f({}) === 42) {
+ return true;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.10/12.10-0-12.js b/js/src/tests/test262/ch12/12.10/12.10-0-12.js new file mode 100644 index 000000000..a2a22518b --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/12.10-0-12.js @@ -0,0 +1,28 @@ +/// 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.10/12.10-0-12.js
+ * @description with introduces scope - name lookup finds property
+ */
+
+
+function testcase() {
+ function f(o) {
+
+ function innerf(o) {
+ with (o) {
+ return x;
+ }
+ }
+
+ return innerf(o);
+ }
+
+ if (f({x:42}) === 42) {
+ return true;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.10/12.10-0-3.js b/js/src/tests/test262/ch12/12.10/12.10-0-3.js new file mode 100644 index 000000000..22d67781e --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/12.10-0-3.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.10/12.10-0-3.js
+ * @description with introduces scope - that is captured by function expression
+ */
+
+
+function testcase() {
+ var o = {prop: "12.10-0-3 before"};
+ var f;
+
+ with (o) {
+ f = function () { return prop; }
+ }
+ o.prop = "12.10-0-3 after";
+ return f()==="12.10-0-3 after"
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.10/12.10-0-7.js b/js/src/tests/test262/ch12/12.10/12.10-0-7.js new file mode 100644 index 000000000..0f780d59e --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/12.10-0-7.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.10/12.10-0-7.js
+ * @description with introduces scope - scope removed when exiting with statement
+ */
+
+
+function testcase() {
+ var o = {foo: 1};
+
+ with (o) {
+ foo = 42;
+ }
+
+ try {
+ foo;
+ }
+ catch (e) {
+ return true;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.10/12.10-0-8.js b/js/src/tests/test262/ch12/12.10/12.10-0-8.js new file mode 100644 index 000000000..613734890 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/12.10-0-8.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.10/12.10-0-8.js
+ * @description with introduces scope - var initializer sets like named property
+ */
+
+
+function testcase() {
+ var o = {foo: 42};
+
+ with (o) {
+ var foo = "set in with";
+ }
+
+ return o.foo === "set in with";
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.10/12.10-0-9.js b/js/src/tests/test262/ch12/12.10/12.10-0-9.js new file mode 100644 index 000000000..746542ffa --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/12.10-0-9.js @@ -0,0 +1,29 @@ +/// 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.10/12.10-0-9.js
+ * @description with introduces scope - name lookup finds outer variable
+ */
+
+
+function testcase() {
+ function f(o) {
+ var x = 42;
+
+ function innerf(o) {
+ with (o) {
+ return x;
+ }
+ }
+
+ return innerf(o);
+ }
+
+ if (f({}) === 42) {
+ return true;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.10/12.10-2-1.js b/js/src/tests/test262/ch12/12.10/12.10-2-1.js new file mode 100644 index 000000000..3ba1eb1eb --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/12.10-2-1.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.10/12.10-2-1.js
+ * @description with - expression being Number
+ */
+
+
+function testcase() {
+ var o = 2;
+ var foo = 1;
+ try
+ {
+ with (o) {
+ foo = 42;
+ }
+ }
+ catch(e)
+ {
+ }
+ return true;
+
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.10/12.10-2-2.js b/js/src/tests/test262/ch12/12.10/12.10-2-2.js new file mode 100644 index 000000000..a4de02221 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/12.10-2-2.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.10/12.10-2-2.js
+ * @description with - expression being Boolean
+ */
+
+
+function testcase() {
+ var o = true;
+ var foo = 1;
+ try
+ {
+ with (o) {
+ foo = 42;
+ }
+ }
+ catch(e)
+ {
+ }
+ return true;
+
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.10/12.10-2-3.js b/js/src/tests/test262/ch12/12.10/12.10-2-3.js new file mode 100644 index 000000000..07003092c --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/12.10-2-3.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.10/12.10-2-3.js
+ * @description with - expression being string
+ */
+
+
+function testcase() {
+ var o = "str";
+ var foo = 1;
+ try
+ {
+ with (o) {
+ foo = 42;
+ }
+ }
+ catch(e)
+ {
+ }
+ return true;
+
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.10/12.10-7-1.js b/js/src/tests/test262/ch12/12.10/12.10-7-1.js new file mode 100644 index 000000000..6292efd97 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/12.10-7-1.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.
+/**
+ * @path ch12/12.10/12.10-7-1.js
+ * @description with introduces scope - restores the earlier environment on exit
+ */
+
+
+function testcase() {
+ var a = 1;
+
+ var o = {a : 2};
+ try
+ {
+ with (o) {
+ a = 3;
+ throw 1;
+ a = 4;
+ }
+ }
+ catch(e)
+ {}
+
+ if (a === 1 && o.a === 3) {
+ return true;
+ }
+
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-1-s.js b/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-1-s.js new file mode 100644 index 000000000..3c042e412 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-1-s.js @@ -0,0 +1,31 @@ +/// 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.10/12.10.1/12.10.1-1-s.js
+ * @description with statement in strict mode throws SyntaxError (strict function)
+ * @onlyStrict
+ */
+
+
+function testcase() {
+
+ try {
+ // wrapping it in eval since this needs to be a syntax error. The
+ // exception thrown must be a SyntaxError exception.
+ eval("\
+ function f() {\
+ \'use strict\';\
+ var o = {}; \
+ with (o) {};\
+ }\
+ ");
+ return false;
+ }
+ catch (e) {
+ return(e instanceof SyntaxError);
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-10-s.js b/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-10-s.js new file mode 100644 index 000000000..4e470b517 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-10-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.
+/**
+ * @path ch12/12.10/12.10.1/12.10.1-10-s.js
+ * @description with statement in strict mode throws SyntaxError (eval, where the container function is strict)
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ 'use strict';
+
+ // wrapping it in eval since this needs to be a syntax error. The
+ // exception thrown must be a SyntaxError exception. Note that eval
+ // inherits the strictness of its calling context.
+ try {
+ eval("\
+ var o = {};\
+ with (o) {}\
+ ");
+ return false;
+ }
+ catch (e) {
+ return (e instanceof SyntaxError);
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-11-s.js b/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-11-s.js new file mode 100644 index 000000000..3c4e81daa --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-11-s.js @@ -0,0 +1,23 @@ +/// 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.10/12.10.1/12.10.1-11-s.js
+ * @description Strict Mode - SyntaxError is thrown when using WithStatement in strict mode code
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ try {
+ eval("with ({}) { throw new Error();}");
+
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-11gs.js b/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-11gs.js new file mode 100644 index 000000000..b40b37236 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-11gs.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.10/12.10.1/12.10.1-11gs.js
+ * @description Strict Mode - SyntaxError is thrown when using with statement
+ * @onlyStrict
+ * @negative ^((?!NotEarlyError).)*$
+ */
+
+"use strict";
+throw NotEarlyError;
+with ({}) { }
diff --git a/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-12-s.js b/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-12-s.js new file mode 100644 index 000000000..0f327297d --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-12-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.10/12.10.1/12.10.1-12-s.js
+ * @description with statement in strict mode throws SyntaxError (strict eval)
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ try {
+ eval("\
+ 'use strict'; \
+ var o = {}; \
+ with (o) {}\
+ ");
+ return false;
+ }
+ catch (e) {
+ return (e instanceof SyntaxError) ;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-13-s.js b/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-13-s.js new file mode 100644 index 000000000..39d56659e --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-13-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.10/12.10.1/12.10.1-13-s.js
+ * @description Strict Mode - SyntaxError isn't thrown when WithStatement body is in strict mode code
+ * @noStrict
+ */
+
+
+function testcase() {
+ with ({}) {
+ "use strict";
+ }
+ return true;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-14-s.js b/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-14-s.js new file mode 100644 index 000000000..0e7e685b7 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-14-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.10/12.10.1/12.10.1-14-s.js
+ * @description Strict Mode - SyntaxError is thrown when the getter of a literal object utilizes WithStatement
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+
+ try {
+ eval("var obj = { get: function (a) { with(a){} } }; ");
+
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-15-s.js b/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-15-s.js new file mode 100644 index 000000000..8621631f6 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-15-s.js @@ -0,0 +1,23 @@ +/// 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.10/12.10.1/12.10.1-15-s.js
+ * @description Strict Mode - SyntaxError is thrown when the RHS of a dot property assignment utilizes WithStatement
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+
+ try {
+ eval("var obj = {}; obj.get = function (a) { with(a){} }; ");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-16-s.js b/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-16-s.js new file mode 100644 index 000000000..e798b5715 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-16-s.js @@ -0,0 +1,23 @@ +/// 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.10/12.10.1/12.10.1-16-s.js
+ * @description Strict Mode - SyntaxError is thrown when the RHS of an object indexer assignment utilizes WithStatement
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+
+ try {
+ eval("var obj = {}; obj['get'] = function (a) { with(a){} }; ");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-2-s.js b/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-2-s.js new file mode 100644 index 000000000..211a1386e --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-2-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.
+/**
+ * @path ch12/12.10/12.10.1/12.10.1-2-s.js
+ * @description with statement in strict mode throws SyntaxError (nested function where container is strict)
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ try {
+ // wrapping it in eval since this needs to be a syntax error. The
+ // exception thrown must be a SyntaxError exception.
+ eval("\
+ function foo() {\
+ \'use strict\'; \
+ function f() {\
+ var o = {}; \
+ with (o) {};\
+ }\
+ }\
+ ");
+ return false;
+ }
+ catch (e) {
+ return (e instanceof SyntaxError);
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-3-s.js b/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-3-s.js new file mode 100644 index 000000000..8b0d2961b --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-3-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.
+/**
+ * @path ch12/12.10/12.10.1/12.10.1-3-s.js
+ * @description with statement in strict mode throws SyntaxError (nested strict function)
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ try {
+ // wrapping it in eval since this needs to be a syntax error. The
+ // exception thrown must be a SyntaxError exception.
+ eval("\
+ function foo() {\
+ function f() {\
+ \'use strict\'; \
+ var o = {}; \
+ with (o) {};\
+ }\
+ }\
+ ");
+ return false;
+ }
+ catch (e) {
+ return (e instanceof SyntaxError);
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-4-s.js b/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-4-s.js new file mode 100644 index 000000000..adb09673b --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-4-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.10/12.10.1/12.10.1-4-s.js
+ * @description with statement in strict mode throws SyntaxError (strict Function)
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ try {
+ var f = Function("\
+ \'use strict\'; \
+ var o = {}; \
+ with (o) {};\
+ ");
+ return false;
+ }
+ catch (e) {
+ return (e instanceof SyntaxError);
+
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-5-s.js b/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-5-s.js new file mode 100644 index 000000000..3a1ea1ad8 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-5-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.10/12.10.1/12.10.1-5-s.js
+ * @description with statement allowed in nested Function even if its container Function is strict)
+ * @onlyStrict
+ */
+
+
+function testcase() {
+
+ Function("\'use strict\'; var f1 = Function( \"var o = {}; with (o) {};\")");
+ return true;
+
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-7-s.js b/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-7-s.js new file mode 100644 index 000000000..0ceb2097e --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-7-s.js @@ -0,0 +1,28 @@ +/// 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.10/12.10.1/12.10.1-7-s.js
+ * @description with statement in strict mode throws SyntaxError (function expression, where the container function is directly evaled from strict code)
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ 'use strict';
+
+ try {
+ eval("var f = function () {\
+ var o = {}; \
+ with (o) {}; \
+ }\
+ ");
+ return false;
+ }
+ catch (e) {
+ return (e instanceof SyntaxError);
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-8-s.js b/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-8-s.js new file mode 100644 index 000000000..55cfa8e4e --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-8-s.js @@ -0,0 +1,28 @@ +/// 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.10/12.10.1/12.10.1-8-s.js
+ * @description with statement in strict mode throws SyntaxError (function expression, where the container Function is strict)
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ try {
+ Function("\
+ \'use strict\'; \
+ var f1 = function () {\
+ var o = {}; \
+ with (o) {}; \
+ }\
+ ");
+ return false;
+ }
+ catch (e) {
+ return (e instanceof SyntaxError);
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-9-s.js b/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-9-s.js new file mode 100644 index 000000000..b0e29e256 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/12.10.1/12.10.1-9-s.js @@ -0,0 +1,28 @@ +/// 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.10/12.10.1/12.10.1-9-s.js
+ * @description with statement in strict mode throws SyntaxError (strict function expression)
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ try {
+ eval("\
+ var f = function () {\
+ \'use strict\';\
+ var o = {}; \
+ with (o) {}; \
+ }\
+ ");
+ return false;
+ }
+ catch (e) {
+ return (e instanceof SyntaxError) ;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.10/12.10.1/browser.js b/js/src/tests/test262/ch12/12.10/12.10.1/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/12.10.1/browser.js diff --git a/js/src/tests/test262/ch12/12.10/12.10.1/shell.js b/js/src/tests/test262/ch12/12.10/12.10.1/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/12.10.1/shell.js diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.10_T1.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.10_T1.js new file mode 100644 index 000000000..2256e66b7 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.10_T1.js @@ -0,0 +1,139 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.10_T1.js + * @description Using interation statement within "with" statement leading to normal completion + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +with(myObj){ + do{ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } + while(false); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + $ERROR('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.10_T2.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.10_T2.js new file mode 100644 index 000000000..35978c0d3 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.10_T2.js @@ -0,0 +1,148 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.10_T2.js + * @description Using iteration statement within "with" statement leading to completion by exception + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + with(myObj){ + do{ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + throw value; + } + while(false); + } +} catch(e){ + result = e; +} + +if(!(result === "value")){ + $ERROR('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + $ERROR('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.10_T3.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.10_T3.js new file mode 100644 index 000000000..b7f67f521 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.10_T3.js @@ -0,0 +1,151 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.10_T3.js + * @description Using iteration statment withing "with" statement leading to completion by exception + * iteration statement inside with statement - exception completion + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + with(myObj){ + do{ + throw value; + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } + while(false); + } +} catch(e){ + result = e; +} + +if(!(result === "myObj_value")){ + $ERROR('#0: result === "myObj_value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === undefined)){ + $ERROR('#4: p4 === undefined. Actual: p4 ==='+ p4 ); +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.10_T4.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.10_T4.js new file mode 100644 index 000000000..87ba7f654 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.10_T4.js @@ -0,0 +1,141 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.10_T4.js + * @description Using iteration statement witthin "with" staement leading to completion by break + * iteration statement inside with statement - break completion + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +with(myObj){ + do{ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + break; + } + while(false); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + $ERROR('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.10_T5.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.10_T5.js new file mode 100644 index 000000000..05d7d8d04 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.10_T5.js @@ -0,0 +1,142 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.10_T5.js + * @description Using iteration statement within "with" statement leading to completion by break + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +with(myObj){ + do{ + break; + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } + while(false); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === undefined)){ + $ERROR('#4: p4 === undefined. Actual: p4 ==='+ p4 ); +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.11_T1.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.11_T1.js new file mode 100644 index 000000000..a939778d8 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.11_T1.js @@ -0,0 +1,147 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.11_T1.js + * @description Calling a function within "with" statement declared without the statement, leading to normal completion + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +var f = function(){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; +} + +with(myObj){ + f(); +} + +if(!(p1 === "x1")){ + $ERROR('#1: p1 === "x1". Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +try{ + p3; + $ERROR('#3: p3 is nod defined'); +} +catch(e){ +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === parseInt)){ + $ERROR('#11: st_parseInt === parseInt. Actual: st_parseInt ==='+ st_parseInt ); +} + +if(!isNaN(st_NaN)){ + $ERROR('#12: st_NaN === NaN. Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === Infinity)){ + $ERROR('#13: st_Infinity === Infinity. Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === eval)){ + $ERROR('#14: st_eval === eval. Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === parseFloat)){ + $ERROR('#15: st_parseFloat === parseFloat. Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === isNaN)){ + $ERROR('#16: st_isNaN === isNaN. Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === isFinite)){ + $ERROR('#17: st_isFinite === isFinite. Actual: st_isFinite ==='+ st_isFinite ); +} + +try { + value; + $ERROR('#18: value is not defined'); +} catch(e) { +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.11_T2.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.11_T2.js new file mode 100644 index 000000000..cfbefef48 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.11_T2.js @@ -0,0 +1,152 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.11_T2.js + * @description Calling a function within "with" statement declared without the statement, leading to normal completion by "return" + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +var f = function(){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + return value; +} + +with(myObj){ + result = f(); +} + +if(!(result === "value")){ + $ERROR('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === "x1")){ + $ERROR('#1: p1 === "x1". Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +try{ + p3; + $ERROR('#3: p3 is nod defined'); +} +catch(e){ +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === parseInt)){ + $ERROR('#11: st_parseInt === parseInt. Actual: st_parseInt ==='+ st_parseInt ); +} + +if(!isNaN(st_NaN)){ + $ERROR('#12: st_NaN === NaN. Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === Infinity)){ + $ERROR('#13: st_Infinity === Infinity. Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === eval)){ + $ERROR('#14: st_eval === eval. Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === parseFloat)){ + $ERROR('#15: st_parseFloat === parseFloat. Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === isNaN)){ + $ERROR('#16: st_isNaN === isNaN. Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === isFinite)){ + $ERROR('#17: st_isFinite === isFinite. Actual: st_isFinite ==='+ st_isFinite ); +} + +try { + value; + $ERROR('#18: value is not defined'); +} catch(e) { +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.11_T3.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.11_T3.js new file mode 100644 index 000000000..9d68c9c9d --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.11_T3.js @@ -0,0 +1,152 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.11_T3.js + * @description Calling a function within "with" statement declared without the statement, leading to normal completion by "return" + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +var f = function(){ + return value; + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; +} + +with(myObj){ + result = f(); +} + +if(!(result === undefined)){ + $ERROR('#0: result === undefined. Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try{ + p4; + $ERROR('#4: p4 doesn\'t exists'); +} +catch(e){ +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +try { + value; + $ERROR('#18: value is not defined'); +} catch(e) { +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.11_T4.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.11_T4.js new file mode 100644 index 000000000..d2fc84a75 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.11_T4.js @@ -0,0 +1,155 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.11_T4.js + * @description Calling a function within "with" statement declared without the statement, leading to completion by exception + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + var f = function(){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + throw value; + } + with(myObj){ + f(); + } +} catch(e){ + result = e; +} + +if(!(result === "value")){ + $ERROR('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === "x1")){ + $ERROR('#1: p1 === "x1". Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +try{ + p3; + $ERROR('#3: p3 is nod defined'); +} +catch(e){ +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === parseInt)){ + $ERROR('#11: st_parseInt === parseInt. Actual: st_parseInt ==='+ st_parseInt ); +} + +if(!isNaN(st_NaN)){ + $ERROR('#12: st_NaN === NaN. Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === Infinity)){ + $ERROR('#13: st_Infinity === Infinity. Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === eval)){ + $ERROR('#14: st_eval === eval. Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === parseFloat)){ + $ERROR('#15: st_parseFloat === parseFloat. Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === isNaN)){ + $ERROR('#16: st_isNaN === isNaN. Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === isFinite)){ + $ERROR('#17: st_isFinite === isFinite. Actual: st_isFinite ==='+ st_isFinite ); +} + +try { + value; + $ERROR('#18: value is not defined'); +} catch(e) { +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.11_T5.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.11_T5.js new file mode 100644 index 000000000..9dfc0e5dc --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.11_T5.js @@ -0,0 +1,155 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.11_T5.js + * @description Calling a function within "with" statement declared without the statement, leading to completion by exception + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + var f = function(){ + throw value; + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } + with(myObj){ + f(); + } +} catch(e){ + result = e; +} + +if(!(result === undefined)){ + $ERROR('#0: result === undefined. Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try{ + p4; + $ERROR('#4: p4 doesn\'t exists'); +} +catch(e){ +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +try { + value; + $ERROR('#18: value is not defined'); +} catch(e) { +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.12_T1.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.12_T1.js new file mode 100644 index 000000000..6ccbf0ca7 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.12_T1.js @@ -0,0 +1,144 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.12_T1.js + * @description Calling a function without "with" statement declared within the statement, leading to normal completion + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +with(myObj){ + var f = function(){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } +} +f(); + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try{ + p4; + $ERROR('#4: p4 doesn\'t exists'); +} +catch(e){ +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +try { + value; + $ERROR('#18: value is not defined'); +} catch(e) { +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.12_T2.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.12_T2.js new file mode 100644 index 000000000..bd0cbe0f8 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.12_T2.js @@ -0,0 +1,150 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.12_T2.js + * @description Calling a function without "with" statement declared within the statement, leading to normal completion by "return" + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +with(myObj){ + var f = function(){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + return value; + } +} +result = f(); + +if(!(result === "value")){ + $ERROR('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try{ + p4; + $ERROR('#4: p4 doesn\'t exists'); +} +catch(e){ +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.12_T3.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.12_T3.js new file mode 100644 index 000000000..39ab7d395 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.12_T3.js @@ -0,0 +1,152 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.12_T3.js + * @description Calling a function without "with" statement declared within the statement, leading to normal completion by "return" + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +with(myObj){ + var f = function(){ + return value; + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } +} +result = f(); + +if(!(result === undefined)){ + $ERROR('#0: result === undefined. Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.12_T4.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.12_T4.js new file mode 100644 index 000000000..49b58c6d5 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.12_T4.js @@ -0,0 +1,152 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.12_T4.js + * @description Calling a function without "with" statement declared within the statement, leading to completion by exception + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + with(myObj){ + var f = function(){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + throw value; + } + } + f(); +} catch(e){ + result = e; +} + +if(!(result === "value")){ + $ERROR('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +try { + value; + $ERROR('#18: value is not defined'); +} catch(e) { +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.12_T5.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.12_T5.js new file mode 100644 index 000000000..2e3534367 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.12_T5.js @@ -0,0 +1,156 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.12_T5.js + * @description Calling a function without "with" statement declared within the statement, leading to completion by exception + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + with(myObj){ + var f = function(){ + throw value; + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } + } + f(); +} catch(e){ + result = e; +} + +if(!(result === undefined)){ + $ERROR('#0: result === undefined. Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.1_T1.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.1_T1.js new file mode 100644 index 000000000..a749c9c20 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.1_T1.js @@ -0,0 +1,136 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.1_T1.js + * @description Using "with" inside of global context leading to normal completion + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +with(myObj){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + $ERROR('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.1_T2.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.1_T2.js new file mode 100644 index 000000000..d07cb0e69 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.1_T2.js @@ -0,0 +1,145 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.1_T2.js + * @description Using "with" inside of global context leading to completion by exception + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + with(myObj){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + throw value; + } +} catch(e){ + result = e; +} + +if(!(result === "value")){ + $ERROR('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + $ERROR('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.1_T3.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.1_T3.js new file mode 100644 index 000000000..200209019 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.1_T3.js @@ -0,0 +1,147 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.1_T3.js + * @description Using "with" inside of global context leading to completion by exception + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + with(myObj){ + throw value; + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } +} catch(e){ + result = e; +} + +if(!(result === "myObj_value")){ + $ERROR('#0: result === "myObj_value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === undefined)){ + $ERROR('#4: p4 === undefined. Actual: p4 ==='+ p4 ); +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.2_T1.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.2_T1.js new file mode 100644 index 000000000..20a344d48 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.2_T1.js @@ -0,0 +1,144 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.2_T1.js + * @description Calling a function without "with" statement when the statement itself is declared within the function declaration, leading to normal completion + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +var f = function(){ + with(myObj){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } +} +f(); + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.2_T2.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.2_T2.js new file mode 100644 index 000000000..39312c70a --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.2_T2.js @@ -0,0 +1,149 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.2_T2.js + * @description Calling a function without "with" statement when the statement itself is declared within the function declaration, leading to normal completion by "return" + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +var f = function(){ + with(myObj){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + return value; + } +} +result = f(); + +if(!(result === "value")){ + $ERROR('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.2_T3.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.2_T3.js new file mode 100644 index 000000000..f34c7cb94 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.2_T3.js @@ -0,0 +1,152 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.2_T3.js + * @description Calling a function without "with" statement when the statement itself is declared within the function declaration, leading to normal completion by "return" + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +var f = function(){ + with(myObj){ + return value; + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } +} +result = f(); + +if(!(result === "myObj_value")){ + $ERROR('#0: result === "myObj_value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.2_T4.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.2_T4.js new file mode 100644 index 000000000..f8bff8e20 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.2_T4.js @@ -0,0 +1,153 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.2_T4.js + * @description Calling a function without "with" statement when the statement itself is declared within the function declaration, leading to completion by exception + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + var f = function(){ + with(myObj){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + throw value; + } + } + f(); +} catch(e){ + result = e; +} + +if(!(result === "value")){ + $ERROR('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.2_T5.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.2_T5.js new file mode 100644 index 000000000..d67f69d6d --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.2_T5.js @@ -0,0 +1,151 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.2_T5.js + * @description Calling a function without "with" statement when the statement itself is declared within the function declaration, leading to completion by exception + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + var f = function(){ + with(myObj){ + throw value; + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } + } + f(); +} catch(e){ + result = e; +} + +if(!(result === "myObj_value")){ + $ERROR('#0: result === "myObj_value". Actual: result ==='+ result ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.3_T1.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.3_T1.js new file mode 100644 index 000000000..3e453847b --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.3_T1.js @@ -0,0 +1,144 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.3_T1.js + * @description Using "with" statement within function constructor, leading to normal completition + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +var f = function(){ + with(myObj){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } +} +var obj = new f(); + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.3_T2.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.3_T2.js new file mode 100644 index 000000000..183d0dabf --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.3_T2.js @@ -0,0 +1,145 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.3_T2.js + * @description Using "with" statement within function constructor, leading to normal completition by "return" + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +var f = function(){ + with(myObj){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + return value; + } +} +var obj = new f(); + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.3_T3.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.3_T3.js new file mode 100644 index 000000000..e413f3918 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.3_T3.js @@ -0,0 +1,148 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.3_T3.js + * @description Using "with" statement within function constructor, leading to normal completition by "return" + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +var f = function(){ + with(myObj){ + return value; + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } +} +var obj = new f(); + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.3_T4.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.3_T4.js new file mode 100644 index 000000000..7ac5823f7 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.3_T4.js @@ -0,0 +1,149 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.3_T4.js + * @description Using "with" statement within function constructor, leading to completition by exception + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + var f = function(){ + with(myObj){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + throw value; + } + } + var obj = new f(); +} catch(e){ + result = e; +} + +if(!(result === "value")){ + $ERROR('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.3_T5.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.3_T5.js new file mode 100644 index 000000000..41b85c6dc --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.3_T5.js @@ -0,0 +1,156 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.3_T5.js + * @description Using "with" statement within function constructor, leading to completition by exception + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + var f = function(){ + with(myObj){ + throw value; + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } + } + var obj = new f(); +} catch(e){ + result = e; +} + +if(!(result === "myObj_value")){ + $ERROR('#0: result === "myObj_value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.4_T1.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.4_T1.js new file mode 100644 index 000000000..2bbec00ec --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.4_T1.js @@ -0,0 +1,139 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.4_T1.js + * @description Using "with" statement within iteration statement, leading to normal completion + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +do{ + with(myObj){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } +} +while(false); + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + $ERROR('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.4_T2.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.4_T2.js new file mode 100644 index 000000000..9bafbb075 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.4_T2.js @@ -0,0 +1,148 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.4_T2.js + * @description Using "with" statement within iteration statement, leading to completion by exception + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + do{ + with(myObj){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + throw value; + } + } + while(false); +} catch(e){ + result = e; +} + +if(!(result === "value")){ + $ERROR('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + $ERROR('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.4_T3.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.4_T3.js new file mode 100644 index 000000000..3b3e72f8a --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.4_T3.js @@ -0,0 +1,150 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.4_T3.js + * @description Using "with" statement within iteration statement, leading to completion by exception + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + do{ + with(myObj){ + throw value; + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } + } + while(false); +} catch(e){ + result = e; +} + +if(!(result === "myObj_value")){ + $ERROR('#0: result === "myObj_value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === undefined)){ + $ERROR('#4: p4 === undefined. Actual: p4 ==='+ p4 ); +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.4_T4.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.4_T4.js new file mode 100644 index 000000000..b9209bb67 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.4_T4.js @@ -0,0 +1,140 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.4_T4.js + * @description Using "with" statement within iteration statement, leading to completion by break + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +do{ + with(myObj){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + break; + } +} +while(false); + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + $ERROR('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.4_T5.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.4_T5.js new file mode 100644 index 000000000..b942e2b41 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.4_T5.js @@ -0,0 +1,142 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.4_T5.js + * @description Using "with" statement within iteration statement, leading to completion by break + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +do{ + with(myObj){ + break; + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } +} +while(false); + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === undefined)){ + $ERROR('#4: p4 ===undefined. Actual: p4 ==='+ p4 ); +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.5_T1.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.5_T1.js new file mode 100644 index 000000000..a45cd5df1 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.5_T1.js @@ -0,0 +1,144 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.5_T1.js + * @description Using "with" statement within "for-in" statement, leading to normal completion + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +for(var prop in myObj){ + with(myObj){ + if(prop === 'p1') { + st_p1 = p1; + p1 = 'x1'; + } + if(prop === 'p2') { + st_p2 = p2; + this.p2 = 'x2'; + } + if(prop === 'p3') { + st_p3 = p3; + del = delete p3; + } + if(prop === 'parseInt') st_parseInt = parseInt; + if(prop === 'NaN') st_NaN = NaN; + if(prop === 'Infinity') st_Infinity = Infinity; + if(prop === 'eval') st_eval = eval; + if(prop === 'parseFloat') st_parseFloat = parseFloat; + if(prop === 'isNaN') st_isNaN = isNaN; + if(prop === 'isFinite') st_isFinite = isFinite; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + $ERROR('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.5_T2.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.5_T2.js new file mode 100644 index 000000000..4efa5a216 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.5_T2.js @@ -0,0 +1,147 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.5_T2.js + * @description Using "with" statement within "for-in" statement, leading to completion by exception + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + for(var prop in myObj){ + with(myObj){ + st_p1 = p1; + p1 = 'x1'; + st_p2 = p2; + this.p2 = 'x2'; + st_p3 = p3; + del = delete p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + throw value; + } + } +} catch(e){ + result = e; +} + +if(!(result === "value")){ + $ERROR('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + $ERROR('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.5_T3.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.5_T3.js new file mode 100644 index 000000000..e4cace7e1 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.5_T3.js @@ -0,0 +1,155 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.5_T3.js + * @description Using "with" statement within "for-in" statement, leading to completion by exception + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + for(var prop in myObj){ + with(myObj){ + throw value; + if(prop === 'p1') { + st_p1 = p1; + p1 = 'x1'; + } + if(prop === 'p2') { + st_p2 = p2; + this.p2 = 'x2'; + } + if(prop === 'p3') { + st_p3 = p3; + del = delete p3; + } + if(prop === 'parseInt') st_parseInt = parseInt; + if(prop === 'NaN') st_NaN = NaN; + if(prop === 'Infinity') st_Infinity = Infinity; + if(prop === 'eval') st_eval = eval; + if(prop === 'parseFloat') st_parseFloat = parseFloat; + if(prop === 'isNaN') st_isNaN = isNaN; + if(prop === 'isFinite') st_isFinite = isFinite; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } + } +} catch(e){ + result = e; +} + +if(!(result === "myObj_value")){ + $ERROR('#0: result === "myObj_value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === undefined)){ + $ERROR('#4: p4 === undefined. Actual: p4 ==='+ p4 ); +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.5_T4.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.5_T4.js new file mode 100644 index 000000000..6655901d6 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.5_T4.js @@ -0,0 +1,139 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.5_T4.js + * @description Using "with" statement within "for-in" statement, leading to completion by break + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +for(var prop in myObj){ + with(myObj){ + st_p1 = p1; + p1 = 'x1'; + st_p2 = p2; + this.p2 = 'x2'; + st_p3 = p3; + del = delete p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + break; + } +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + $ERROR('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.5_T5.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.5_T5.js new file mode 100644 index 000000000..1273f5166 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.5_T5.js @@ -0,0 +1,147 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.5_T5.js + * @description Using "with" statement within "for-in" statement, leading to completion by break + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +for(var prop in myObj){ + with(myObj){ + break; + if(prop === 'p1') { + st_p1 = p1; + p1 = 'x1'; + } + if(prop === 'p2') { + st_p2 = p2; + this.p2 = 'x2'; + } + if(prop === 'p3') { + st_p3 = p3; + del = delete p3; + } + if(prop === 'parseInt') st_parseInt = parseInt; + if(prop === 'NaN') st_NaN = NaN; + if(prop === 'Infinity') st_Infinity = Infinity; + if(prop === 'eval') st_eval = eval; + if(prop === 'parseFloat') st_parseFloat = parseFloat; + if(prop === 'isNaN') st_isNaN = isNaN; + if(prop === 'isFinite') st_isFinite = isFinite; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === undefined)){ + $ERROR('#4: p4 === undefined. Actual: p4 ==='+ p4 ); +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.6_T1.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.6_T1.js new file mode 100644 index 000000000..608ceef9f --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.6_T1.js @@ -0,0 +1,138 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.6_T1.js + * @description Using "with" statement within another "with" statement, leading to normal completion + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +with(myObj){ + with(myObj){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + $ERROR('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.6_T2.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.6_T2.js new file mode 100644 index 000000000..8cfae1a8b --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.6_T2.js @@ -0,0 +1,147 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.6_T2.js + * @description Using "with" statement within another "with" statement, leading to completion by exception + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + with(myObj){ + with(myObj){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + throw value; + } + } +} catch(e){ + result = e; +} + +if(!(result === "value")){ + $ERROR('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + $ERROR('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.6_T3.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.6_T3.js new file mode 100644 index 000000000..4774eb44d --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.6_T3.js @@ -0,0 +1,149 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.6_T3.js + * @description Using "with" statement within another "with" statement, leading to completion by exception + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + with(myObj){ + with(myObj){ + throw value; + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } + } +} catch(e){ + result = e; +} + +if(!(result === "myObj_value")){ + $ERROR('#0: result === "myObj_value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === undefined)){ + $ERROR('#4: p4 === undefined. Actual: p4 ==='+ p4 ); +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.7_T1.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.7_T1.js new file mode 100644 index 000000000..134af702c --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.7_T1.js @@ -0,0 +1,144 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.7_T1.js + * @description Calling a function within "with" statement declared within the statement, leading to normal completion + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +with(myObj){ + var f = function(){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } + f(); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.7_T2.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.7_T2.js new file mode 100644 index 000000000..3efde0328 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.7_T2.js @@ -0,0 +1,149 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.7_T2.js + * @description Calling a function within "with" statement declared within the statement, leading to normal completion by "return" + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +with(myObj){ + var f = function(){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + return value; + } + result = f(); +} + +if(!(result === "value")){ + $ERROR('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.7_T3.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.7_T3.js new file mode 100644 index 000000000..d43395763 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.7_T3.js @@ -0,0 +1,151 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.7_T3.js + * @description Calling a function within "with" statement declared within the statement, leading to normal completion by "return" + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +with(myObj){ + var f = function(){ + return value; + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } + result = f(); +} + +if(!(result === undefined)){ + $ERROR('#0: result === undefined. Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.7_T4.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.7_T4.js new file mode 100644 index 000000000..9ca70ef1c --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.7_T4.js @@ -0,0 +1,153 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.7_T4.js + * @description Calling a function within "with" statement declared within the statement, leading to completion by exception + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + with(myObj){ + var f = function(){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + throw value; + } + f(); + } +} catch(e){ + result = e; +} + +if(!(result === "value")){ + $ERROR('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.7_T5.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.7_T5.js new file mode 100644 index 000000000..d7070388b --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.7_T5.js @@ -0,0 +1,155 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.7_T5.js + * @description Calling a function within "with" statement declared within the statement, leading to completion by exception + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + with(myObj){ + var f = function(){ + throw value; + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } + f(); + } +} catch(e){ + result = e; +} + +if(!(result === undefined)){ + $ERROR('#0: result === undefined. Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.8_T1.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.8_T1.js new file mode 100644 index 000000000..73519377b --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.8_T1.js @@ -0,0 +1,144 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.8_T1.js + * @description Declaring function constructor within "with" statement, leading to normal completion + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +with(myObj){ + var f = function(){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } + var obj = new f(); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.8_T2.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.8_T2.js new file mode 100644 index 000000000..fd81d2bfc --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.8_T2.js @@ -0,0 +1,144 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.8_T2.js + * @description Declaring function constructor within "with" statement, leading to normal completion by "return" + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +with(myObj){ + var f = function(){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + return value; + } + var obj = new f(); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.8_T3.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.8_T3.js new file mode 100644 index 000000000..39a648266 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.8_T3.js @@ -0,0 +1,147 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.8_T3.js + * @description Declaring function constructor within "with" statement, leading to normal completion by "return" + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +with(myObj){ + var f = function(){ + return value; + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } + var obj = new f(); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.8_T4.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.8_T4.js new file mode 100644 index 000000000..f6eed2043 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.8_T4.js @@ -0,0 +1,152 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.8_T4.js + * @description Declaring function constructor within "with" statement, leading to completion by exception + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + with(myObj){ + var f = function(){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + throw value; + } + var obj = new f(); + } +} catch(e){ + result = e; +} + +if(!(result === "value")){ + $ERROR('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.8_T5.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.8_T5.js new file mode 100644 index 000000000..c2425b1f1 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.8_T5.js @@ -0,0 +1,155 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.8_T5.js + * @description Declaring function constructor within "with" statement, leading to completion by exception + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + with(myObj){ + var f = function(){ + throw value; + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } + var obj = new f(); + } +} catch(e){ + result = e; +} + +if(!(result === undefined)){ + $ERROR('#0: result === undefined. Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.9_T1.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.9_T1.js new file mode 100644 index 000000000..629b517b4 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.9_T1.js @@ -0,0 +1,144 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.9_T1.js + * @description Using "for-in" statement within "with" statement, leading to normal completion + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +with(myObj){ + for(var prop in myObj){ + if(prop === 'p1') { + st_p1 = p1; + p1 = 'x1'; + } + if(prop === 'p2') { + st_p2 = p2; + this.p2 = 'x2'; + } + if(prop === 'p3') { + st_p3 = p3; + del = delete p3; + } + if(prop === 'parseInt') st_parseInt = parseInt; + if(prop === 'NaN') st_NaN = NaN; + if(prop === 'Infinity') st_Infinity = Infinity; + if(prop === 'eval') st_eval = eval; + if(prop === 'parseFloat') st_parseFloat = parseFloat; + if(prop === 'isNaN') st_isNaN = isNaN; + if(prop === 'isFinite') st_isFinite = isFinite; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + $ERROR('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.9_T2.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.9_T2.js new file mode 100644 index 000000000..8e82e60eb --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.9_T2.js @@ -0,0 +1,139 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.9_T2.js + * @description Using "for-in" statement within "with" statement, leading to completion by break + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +with(myObj){ + for(var prop in myObj){ + st_p1 = p1; + p1 = 'x1'; + st_p2 = p2; + this.p2 = 'x2'; + st_p3 = p3; + del = delete p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + break; + } +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + $ERROR('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A1.9_T3.js b/js/src/tests/test262/ch12/12.10/S12.10_A1.9_T3.js new file mode 100644 index 000000000..52ba815fc --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A1.9_T3.js @@ -0,0 +1,147 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The with statement adds a computed object to the front of the + * scope chain of the current execution context + * + * @path ch12/12.10/S12.10_A1.9_T3.js + * @description Using "for-in" statement within "with" statement, leading to completion by break + * @noStrict + */ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +with(myObj){ + for(var prop in myObj){ + break; + if(prop === 'p1') { + st_p1 = p1; + p1 = 'x1'; + } + if(prop === 'p2') { + st_p2 = p2; + this.p2 = 'x2'; + } + if(prop === 'p3') { + st_p3 = p3; + del = delete p3; + } + if(prop === 'parseInt') st_parseInt = parseInt; + if(prop === 'NaN') st_NaN = NaN; + if(prop === 'Infinity') st_Infinity = Infinity; + if(prop === 'eval') st_eval = eval; + if(prop === 'parseFloat') st_parseFloat = parseFloat; + if(prop === 'isNaN') st_isNaN = isNaN; + if(prop === 'isFinite') st_isFinite = isFinite; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === undefined)){ + $ERROR('#4: p4 === undefined. Actual: p4 ==='+ p4 ); +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.10_T1.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.10_T1.js new file mode 100644 index 000000000..17fd49b0a --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.10_T1.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. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.10_T1.js + * @description Using iteration statement within "with" statement, leading to normal completion + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +with(myObj){ + do{ + p1 = 'x1'; + } while(false); +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + $ERROR('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + + + + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.10_T2.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.10_T2.js new file mode 100644 index 000000000..12c26bd86 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.10_T2.js @@ -0,0 +1,57 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.10_T2.js + * @description Using iteration statement within "with" statement, leading completion by exception + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +try { + with(myObj){ + do{ + p1 = 'x1'; + throw value; + } while(false); + } +} catch(e){ + result = p1; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(result !== 1){ + $ERROR('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(p1 !== 1){ + $ERROR('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "x1"){ + $ERROR('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.10_T3.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.10_T3.js new file mode 100644 index 000000000..32c27cce4 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.10_T3.js @@ -0,0 +1,57 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.10_T3.js + * @description Using iteration statement within "with" statement, leading completion by exception + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +try { + with(myObj){ + do{ + throw value; + p1 = 'x1'; + } while(false); + } +} catch(e){ + result = p1; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(result !== 1){ + $ERROR('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(p1 !== 1){ + $ERROR('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "a"){ + $ERROR('#3: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.10_T4.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.10_T4.js new file mode 100644 index 000000000..5f55777e2 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.10_T4.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. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.10_T4.js + * @description Using iteration statement within "with" statement, leading completion be break + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +with(myObj){ + do{ + p1 = 'x1'; + break; + } while(false); +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + $ERROR('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + + + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.10_T5.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.10_T5.js new file mode 100644 index 000000000..b26cd9d43 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.10_T5.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. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.10_T5.js + * @description Using iteration statement within "with" statement, leading completion be break + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +with(myObj){ + do{ + break; + p1 = 'x1'; + } while(false); +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "a"){ + $ERROR('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.11_T1.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.11_T1.js new file mode 100644 index 000000000..8d15c1486 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.11_T1.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. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.11_T1.js + * @description Calling a function within "with" statement declared without the statement, leading to normal completion + * @noStrict + */ + +this.p1 = 1; +var result = "result"; +var myObj = {p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +var f = function(){ + p1 = 'x1'; +} + +with(myObj){ + f(); +} + +if(!(p1 === "x1")){ + $ERROR('#1: p1 === "x1". Actual: p1 ==='+ p1 ); +} + +if(!(myObj.p1 === "a")){ + $ERROR('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.11_T2.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.11_T2.js new file mode 100644 index 000000000..81cdcc6af --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.11_T2.js @@ -0,0 +1,41 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.11_T2.js + * @description Calling a function within "with" statement declared without the statement, leading to normal completion by "return" + * @noStrict + */ + +this.p1 = 1; +var result = "result"; +var value = "value"; +var myObj = {p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +var f = function(){ + p1 = 'x1'; + return value; +} + +with(myObj){ + result = f(); +} + +if(!(p1 === "x1")){ + $ERROR('#1: p1 === "x1". Actual: p1 ==='+ p1 ); +} + +if(!(myObj.p1 === "a")){ + $ERROR('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(result === "value")){ + $ERROR('#3: result === "value". Actual: result ==='+ result ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.11_T3.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.11_T3.js new file mode 100644 index 000000000..35e24fee0 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.11_T3.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.11_T3.js + * @description Calling a function within "with" statement declared without the statement, leading to normal completion by "return" + * @noStrict + */ + +this.p1 = 1; +var result = "result"; +var value = "value"; +var myObj = {p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +var f = function(){ + return value; + p1 = 'x1'; +} + +with(myObj){ + result = f(); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(myObj.p1 === "a")){ + $ERROR('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(result === "value")){ + $ERROR('#3: result === "value". Actual: result ==='+ result ); +} + + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.11_T4.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.11_T4.js new file mode 100644 index 000000000..7056d6181 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.11_T4.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. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.11_T4.js + * @description Calling a function within "with" statement declared without the statement, leading to completion by exception + * @noStrict + */ + +this.p1 = 1; +var result = "result"; +var value = "value"; +var myObj = {p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +try { + var f = function(){ + p1 = 'x1'; + throw value; + } + + with(myObj){ + f(); + } +} catch(e){ + result = e; +} + +if(!(p1 === "x1")){ + $ERROR('#1: p1 === "x1". Actual: p1 ==='+ p1 ); +} + +if(!(myObj.p1 === "a")){ + $ERROR('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(result === "value")){ + $ERROR('#3: result === "value". Actual: result ==='+ result ); +} + + + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.11_T5.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.11_T5.js new file mode 100644 index 000000000..ebce27c9f --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.11_T5.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. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.11_T5.js + * @description Calling a function within "with" statement declared without the statement, leading to completion by exception + * @noStrict + */ + +this.p1 = 1; +var result = "result"; +var value = "value"; +var myObj = {p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +try { + var f = function(){ + throw value; + p1 = 'x1'; + } + with(myObj){ + f(); + } +} catch(e){ + result = e; +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(myObj.p1 === "a")){ + $ERROR('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(result === "value")){ + $ERROR('#3: result === "value". Actual: result ==='+ result ); +} + + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.12_T1.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.12_T1.js new file mode 100644 index 000000000..1ec9f7607 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.12_T1.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. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.12_T1.js + * @description Calling a function without "with" statement declared within the statement, leading to normal completion + * @noStrict + */ + +this.p1 = 1; +var result = "result"; +var myObj = {p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +with(myObj){ + var f = function(){ + p1 = 'x1'; + } +} + +f(); + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.12_T2.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.12_T2.js new file mode 100644 index 000000000..171ef5808 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.12_T2.js @@ -0,0 +1,41 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.12_T2.js + * @description Calling a function without "with" statement declared within the statement, leading to normal completion by "return" + * @noStrict + */ + +this.p1 = 1; +var result = "result"; +var value = "value"; +var myObj = {p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +with(myObj){ + var f = function(){ + p1 = 'x1' + return value; + } +} + +result = f(); + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(result === "myObj_value")){ + $ERROR('#3: result === "myObj_value". Actual: result ==='+ result ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.12_T3.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.12_T3.js new file mode 100644 index 000000000..3cea6bc58 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.12_T3.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.12_T3.js + * @description Calling a function without "with" statement declared within the statement, leading to normal completion by "return" + * @noStrict + */ + +this.p1 = 1; +var result = "result"; +var value = "value"; +var myObj = {p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +with(myObj){ + var f = function(){ + return value; + p1 = 'x1'; + } +} +result = f(); + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(myObj.p1 === "a")){ + $ERROR('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(result === "myObj_value")){ + $ERROR('#3: result === "myObj_value". Actual: result ==='+ result ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.12_T4.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.12_T4.js new file mode 100644 index 000000000..1049d25fe --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.12_T4.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. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.12_T4.js + * @description Calling a function without "with" statement declared within the statement, leading to completion by exception + * @noStrict + */ + +this.p1 = 1; +var result = "result"; +var value = "value"; +var myObj = {p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +try { + with(myObj){ + var f = function(){ + p1 = 'x1'; + throw value; + } + } + f(); +} catch(e){ + result = e; +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(result === "myObj_value")){ + $ERROR('#3: result === "myObj_value". Actual: result ==='+ result ); +} + + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.12_T5.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.12_T5.js new file mode 100644 index 000000000..9d3c9fed9 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.12_T5.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. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.12_T5.js + * @description Calling a function without "with" statement declared within the statement, leading to completion by exception + * @noStrict + */ + +this.p1 = 1; +var result = "result"; +var value = "value"; +var myObj = {p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +try { + with(myObj){ + var f = function(){ + throw value; + p1 = 'x1'; + } + } + f(); +} catch(e){ + result = e; +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(myObj.p1 === "a")){ + $ERROR('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(result === "myObj_value")){ + $ERROR('#3: result === "myObj_value". Actual: result ==='+ result ); +} + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.1_T1.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.1_T1.js new file mode 100644 index 000000000..58ee15b9c --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.1_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. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.1_T1.js + * @description Using "with" statement within global context - normal completion + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + + +with(myObj){ + p1 = 'x1'; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + $ERROR('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + + + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.1_T2.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.1_T2.js new file mode 100644 index 000000000..12b72b2c2 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.1_T2.js @@ -0,0 +1,59 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.1_T2.js + * @description Using "with" statement within global context, leading to completion by exception + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +try { + + with(myObj){ + + p1 = 'x1' + throw value; + + } +} catch(e){ + result = p1; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(result !== 1){ + $ERROR('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(p1 !== 1){ + $ERROR('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (myObj.p1 !== "x1") { + $ERROR('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.1_T3.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.1_T3.js new file mode 100644 index 000000000..f78052019 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.1_T3.js @@ -0,0 +1,58 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.1_T3.js + * @description Using "with" statement within global context, leading to completion by exception + * @noStrict + */ + +this.p1 = 1; +var result = "result"; +var myObj = {p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +try { + + with(myObj){ + + throw value; + p1 = 'x1' + } +} catch(e){ + result = p1; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(!(result === 1)){ + $ERROR('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(!(p1 === 1)){ + $ERROR('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(!(myObj.p1 === "a")){ + $ERROR('#3: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + + + + + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.2_T1.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.2_T1.js new file mode 100644 index 000000000..0d3e11beb --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.2_T1.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. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.2_T1.js + * @description Declaring "with" statement within a function body, leading to normal completion + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +var f = function(){ + with(myObj){ + p1 = 'x1'; + } +} + +f(); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + $ERROR('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.2_T2.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.2_T2.js new file mode 100644 index 000000000..2ef4889d4 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.2_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. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.2_T2.js + * @description Declaring "with" statement within a function body, leading to normal completion by "return" + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +var f = function(){ + with(myObj){ + p1 = 'x1'; + return value; + } +}; + +f(); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(myObj.p1 !== "x1"){ + $ERROR('#1: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + + + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.2_T3.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.2_T3.js new file mode 100644 index 000000000..8f46552e7 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.2_T3.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. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.2_T3.js + * @description Declaring "with" statement within a function body, leading to normal completion by "return" + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +var f = function(){ + with(myObj){ + return value; + p1 = 'x1'; + } +}; + +f(); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "a"){ + $ERROR('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.2_T4.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.2_T4.js new file mode 100644 index 000000000..3c5598088 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.2_T4.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.2_T4.js + * @description Declaring "with" statement within a function body, leading to completion by exception + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +try { + var f = function(){ + with(myObj){ + p1 = 'x1'; + throw value; + } + }; + + f(); +} catch(e){ + result = p1; +} + + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(result !== 1){ + $ERROR('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(p1 !== 1){ + $ERROR('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "x1"){ + $ERROR('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.2_T5.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.2_T5.js new file mode 100644 index 000000000..61d86905a --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.2_T5.js @@ -0,0 +1,63 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.2_T5.js + * @description Declaring "with" statement within a function body, leading to completion by exception + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +}; + +try { + var f = function(){ + with(myObj){ + throw value; + p1 = 'x1'; + } + }; + f(); +} catch(e){ + result = p1; +} + + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(result !== 1){ + $ERROR('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(p1 !== 1){ + $ERROR('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "a"){ + $ERROR('#3: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + + + + + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.3_T1.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.3_T1.js new file mode 100644 index 000000000..27a310837 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.3_T1.js @@ -0,0 +1,48 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.3_T1.js + * @description Declaring "with" statement within a function constructor, leading to normal completion + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +function __FACTORY(){ + with(myObj){ + p1 = 'x1'; + } +} + +var obj = new __FACTORY(); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + $ERROR('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + + + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.3_T2.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.3_T2.js new file mode 100644 index 000000000..de6faab31 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.3_T2.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. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.3_T2.js + * @description Declaring "with" statement within a function constructor, leading to normal completion by "return" + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +function __FACTORY(){ + with(myObj){ + p1 = 'x1'; + return value; + } +} + +var obj = new __FACTORY; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + $ERROR('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.3_T3.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.3_T3.js new file mode 100644 index 000000000..4a981756a --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.3_T3.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. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.3_T3.js + * @description Declaring "with" statement within a function constructor, leading to normal completion by "return" + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +function __FACTORY(){ + with(myObj){ + return value; + p1 = 'x1'; + } +} + +var obj = new __FACTORY; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "a"){ + $ERROR('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + + + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.3_T4.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.3_T4.js new file mode 100644 index 000000000..3eeb2ed5e --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.3_T4.js @@ -0,0 +1,58 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * No matter how control leaves the embedded 'Statement', the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.3_T4.js + * @description Declaring "with" statement within a function constructor, leading to completion by exception + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +}; + +function __FACTORY(){ + with(myObj){ + var p1 = 'x1'; + throw value; + } +} + +try { + var obj = new __FACTORY(); +} catch(e){ + result = p1; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (result !== 1) { + $ERROR('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (p1 !== 1) { + $ERROR('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (myObj.p1 !== "x1") { + $ERROR('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.4_T1.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.4_T1.js new file mode 100644 index 000000000..1ef21667b --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.4_T1.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. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.4_T1.js + * @description Using "with" statement within iteration statement, leading to normal completion + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +do { + with(myObj){ + p1 = 'x1'; + } +} while(false); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + $ERROR('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + + + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.4_T2.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.4_T2.js new file mode 100644 index 000000000..801c592aa --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.4_T2.js @@ -0,0 +1,57 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.4_T2.js + * @description Using "with" statement within iteration statement, leading to completion by exception + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +try { + do{ + with(myObj){ + p1 = 'x1'; + throw value; + } + } while(false); +} catch(e){ + result = p1; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(result !== 1){ + $ERROR('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(p1 !== 1){ + $ERROR('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "x1"){ + $ERROR('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.4_T3.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.4_T3.js new file mode 100644 index 000000000..56698024e --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.4_T3.js @@ -0,0 +1,57 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.4_T3.js + * @description Using "with" statement within iteration statement, leading to completion by exception + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +try { + do{ + with(myObj){ + throw value; + p1 = 'x1'; + } + } while(false); +} catch(e){ + result = p1; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(result !== 1){ + $ERROR('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(p1 !== 1){ + $ERROR('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "a"){ + $ERROR('#3: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.4_T4.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.4_T4.js new file mode 100644 index 000000000..557666a9c --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.4_T4.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. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.4_T4.js + * @description Using "with" statement within iteration statement, leading to completion by break + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +do { + with(myObj){ + p1 = 'x1'; + break; + } +} while(false); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + $ERROR('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + + + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.4_T5.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.4_T5.js new file mode 100644 index 000000000..06816be05 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.4_T5.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. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.4_T5.js + * @description Using "with" statement within iteration statement, leading to completion by break + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +do { + with(myObj){ + break; + p1 = 'x1'; + } +} while(false); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "a"){ + $ERROR('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + + + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.5_T1.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.5_T1.js new file mode 100644 index 000000000..b49962dc1 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.5_T1.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. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.5_T1.js + * @description Using "with" statement within "for-in" statement, leading to normal completion + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +for(var prop in myObj){ + with(myObj){ + p1 = 'x1'; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + $ERROR('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.5_T2.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.5_T2.js new file mode 100644 index 000000000..e1ec1d611 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.5_T2.js @@ -0,0 +1,57 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.5_T2.js + * @description Using "with" statement within "for-in" statement, leading to completion by exception + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +try { + for(var prop in myObj){ + with(myObj){ + p1 = 'x1'; + throw value; + } + } +} catch(e){ + result = p1; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(result !== 1){ + $ERROR('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(p1 !== 1){ + $ERROR('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "x1"){ + $ERROR('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.5_T3.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.5_T3.js new file mode 100644 index 000000000..d85bca3bf --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.5_T3.js @@ -0,0 +1,57 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.5_T3.js + * @description Using "with" statement within "for-in" statement, leading to completion by exception + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +try { + for(var prop in myObj){ + with(myObj){ + throw value; + p1 = 'x1'; + } + } +} catch(e){ + result = p1; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(result !== 1){ + $ERROR('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(p1 !== 1){ + $ERROR('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "a"){ + $ERROR('#3: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.5_T4.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.5_T4.js new file mode 100644 index 000000000..f85657a82 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.5_T4.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. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.5_T4.js + * @description Using "with" statement within "for-in" statement, leading to completion by break + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +for(var prop in myObj){ + with(myObj){ + p1 = 'x1'; + break; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + $ERROR('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.5_T5.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.5_T5.js new file mode 100644 index 000000000..78b526fc3 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.5_T5.js @@ -0,0 +1,48 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.5_T5.js + * @description Using "with" statement within "for-in" statement, leading to completion by break + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +for(var prop in myObj){ + with(myObj){ + break; + p1 = 'x1'; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(myObj.p1 !== "a"){ + $ERROR('#1: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + + + + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.6_T1.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.6_T1.js new file mode 100644 index 000000000..4042e9b71 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.6_T1.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.6_T1.js + * @description Using "with" statement within another "with" statement, leading to normal completion + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +var theirObj = { + p1: true, + value: 'theirObj_value', + valueOf : function(){return 'thr_valueOf';} +} + +with(myObj){ + with(theirObj){ + p1 = 'x1'; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "a"){ + $ERROR('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(theirObj.p1 !== "x1"){ + $ERROR('#3: theirObj.p1 === "x1". Actual: theirObj.p1 ==='+ theirObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + + + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.6_T2.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.6_T2.js new file mode 100644 index 000000000..db1d04dfb --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.6_T2.js @@ -0,0 +1,65 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.6_T2.js + * @description Using "with" statement within another "with" statement, leading to completion by exception + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +var theirObj = { + p1: true, + value: 'theirObj_value', + valueOf : function(){return 'thr_valueOf';} +} + + +try { + with(myObj){ + with(theirObj){ + p1 = 'x1'; + throw value; + } + } +} catch(e){ + result = p1; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "a"){ + $ERROR('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(theirObj.p1 !== "x1"){ + $ERROR('#3: theirObj.p1 === "x1". Actual: theirObj.p1 ==='+ theirObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.6_T3.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.6_T3.js new file mode 100644 index 000000000..ade4cdc5f --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.6_T3.js @@ -0,0 +1,66 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.6_T3.js + * @description Using "with" statement within another "with" statement, leading to completion by exception + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +var theirObj = { + p1: true, + value: 'theirObj_value', + valueOf : function(){return 'thr_valueOf';} +} + + +try { + with(myObj){ + with(theirObj){ + throw value; + p1 = 'x1'; + + } + } +} catch(e){ + result = p1; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "a"){ + $ERROR('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(theirObj.p1 !== true){ + $ERROR('#3: theirObj.p1 === true. Actual: theirObj.p1 ==='+ theirObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.7_T1.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.7_T1.js new file mode 100644 index 000000000..b24f131a4 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.7_T1.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. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.7_T1.js + * @description Declaring and calling a function within "with" statement, leading to normal completion + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +with(myObj){ + (function(){ + p1 = 'x1'; + })(); +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + $ERROR('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + + + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.7_T2.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.7_T2.js new file mode 100644 index 000000000..7494fa7f3 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.7_T2.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. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.7_T2.js + * @description Declaring and calling a function within "with" statement, leading to normal completion by "return" + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +with(myObj){ + result=(function(){ + p1 = 'x1'; + return value; + })(); +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(result !== "myObj_value"){ + $ERROR('#2: result === "myObj_value". Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "x1"){ + $ERROR('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + + + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.7_T3.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.7_T3.js new file mode 100644 index 000000000..d3b72e03d --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.7_T3.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. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.7_T3.js + * @description Declaring and calling a function within "with" statement, leading to normal completion by "return" + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +with(myObj){ + result=(function(){ + return value; + p1 = 'x1'; + })(); +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(result !== 'myObj_value'){ + $ERROR('#2: result === \'myObj_value\'. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "a"){ + $ERROR('#3: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.7_T4.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.7_T4.js new file mode 100644 index 000000000..cd97c3c1b --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.7_T4.js @@ -0,0 +1,57 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.7_T4.js + * @description Declaring and calling a function within "with" statement, leading to completion by exception + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +try { + with(myObj){ + (function (){ + p1 = 'x1'; + throw value; + })(); + } +} catch(e){ + result = p1; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(result !== 1){ + $ERROR('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(p1 !== 1){ + $ERROR('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "x1"){ + $ERROR('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.7_T5.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.7_T5.js new file mode 100644 index 000000000..c0d9d84a2 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.7_T5.js @@ -0,0 +1,57 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.7_T5.js + * @description Declaring and calling a function within "with" statement, leading to completion by exception + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +try { + with(myObj){ + (function f(){ + throw value; + p1 = 'x1'; + })(); + } +} catch(e){ + result = p1; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(result !== 1){ + $ERROR('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(p1 !== 1){ + $ERROR('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "a"){ + $ERROR('#3: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.8_T1.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.8_T1.js new file mode 100644 index 000000000..efe008e85 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.8_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. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.8_T1.js + * @description Declaring function constructor within "with" statement, leading to normal completion + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +with(myObj){ + var __FACTORY = function(){ + p1 = 'x1'; + } + var obj = new __FACTORY; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + $ERROR('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.8_T2.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.8_T2.js new file mode 100644 index 000000000..948270d0f --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.8_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. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.8_T2.js + * @description Declaring function constructor within "with" statement, leading to normal completion by "return" + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +with(myObj){ + var __FACTORY = function(){ + p1 = 'x1'; + return value; + } + var obj = new __FACTORY; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + $ERROR('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.8_T3.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.8_T3.js new file mode 100644 index 000000000..f104c10f3 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.8_T3.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. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.8_T3.js + * @description Declaring function constructor within "with" statement, leading to normal completion by "return" + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +with(myObj){ + var __FACTORY = function(){ + return value; + p1 = 'x1'; + } + var obj = new __FACTORY; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "a"){ + $ERROR('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.8_T4.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.8_T4.js new file mode 100644 index 000000000..2f034a106 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.8_T4.js @@ -0,0 +1,58 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.8_T4.js + * @description Declaring function constructor within "with" statement, leading to completion by exception + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +try { + with(myObj){ + var __FACTORY = function(){ + p1 = 'x1'; + throw value; + } + var obj = new __FACTORY; + } +} catch(e){ + result = p1; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(result !== 1){ + $ERROR('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(p1 !== 1){ + $ERROR('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "x1"){ + $ERROR('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.8_T5.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.8_T5.js new file mode 100644 index 000000000..7484ca06a --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.8_T5.js @@ -0,0 +1,58 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.8_T5.js + * @description Declaring function constructor within "with" statement, leading to completion by exception + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +try { + with(myObj){ + var __FACTORY = function(){ + throw value; + p1 = 'x1'; + } + var obj = new __FACTORY; + } +} catch(e){ + result = p1; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(result !== 1){ + $ERROR('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(p1 !== 1){ + $ERROR('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "a"){ + $ERROR('#3: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.9_T1.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.9_T1.js new file mode 100644 index 000000000..f54c2087b --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.9_T1.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. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.9_T1.js + * @description Using "for-in" statement within "with" statement, leading to normal completion + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +with(myObj){ + for(var prop in myObj){ + p1 = 'x1'; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + $ERROR('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + + + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.9_T2.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.9_T2.js new file mode 100644 index 000000000..a1bb6dfe9 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.9_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. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.9_T2.js + * @description Using "for-in" statement within "with" statement, leading to completion by break + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +with(myObj){ + for(var prop in myObj){ + p1 = 'x1'; + break; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + $ERROR('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A3.9_T3.js b/js/src/tests/test262/ch12/12.10/S12.10_A3.9_T3.js new file mode 100644 index 000000000..c00200340 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.9_T3.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. + +/** + * No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state + * + * @path ch12/12.10/S12.10_A3.9_T3.js + * @description Using "for-in" statement within "with" statement, leading to completion by break + * @noStrict + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +with(myObj){ + for(var prop in myObj){ + break; + p1 = 'x1'; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "a"){ + $ERROR('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A4_T1.js b/js/src/tests/test262/ch12/12.10/S12.10_A4_T1.js new file mode 100644 index 000000000..6deef5b1a --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A4_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. + +/** + * Changing property using "eval" statement containing "with" statement + * + * @path ch12/12.10/S12.10_A4_T1.js + * @description Changing string property + * @noStrict + */ + +this.p1 = 1; +var myObj = { + p1: 'a', +} +eval("with(myObj){p1='b'}"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(myObj.p1 !== 'b'){ + $ERROR('#1: myObj.p1 === "b". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 === 1){ + $ERROR('#2: myObj.p1 !== 1'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A4_T2.js b/js/src/tests/test262/ch12/12.10/S12.10_A4_T2.js new file mode 100644 index 000000000..e31f52b84 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A4_T2.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. + +/** + * Changing property using "eval" statement containing "with" statement + * + * @path ch12/12.10/S12.10_A4_T2.js + * @description Changing number property + * @noStrict + */ + +this.p1 = 'a'; +var myObj = { + p1: 1, +} +eval("with(myObj){p1=2}"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(myObj.p1 !== 2){ + $ERROR('#1: myObj.p1 === 2. Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 === 'a'){ + $ERROR('#2: myObj.p1 !== \'a\''); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A4_T3.js b/js/src/tests/test262/ch12/12.10/S12.10_A4_T3.js new file mode 100644 index 000000000..94c58701c --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A4_T3.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. + +/** + * Changing property using "eval" statement containing "with" statement + * + * @path ch12/12.10/S12.10_A4_T3.js + * @description Changing boolean property + * @noStrict + */ + +this.p1 = 'a'; +var myObj = { + p1: true, +} +eval("with(myObj){p1=false}"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(myObj.p1 !== false){ + $ERROR('#1: myObj.p1 === false. Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 === 'a'){ + $ERROR('#2: myObj.p1 !== \'a\''); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A4_T4.js b/js/src/tests/test262/ch12/12.10/S12.10_A4_T4.js new file mode 100644 index 000000000..042d0dfc5 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A4_T4.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Changing property using "eval" statement containing "with" statement + * + * @path ch12/12.10/S12.10_A4_T4.js + * @description Changing object property + * @noStrict + */ + +this.p1 = 'a'; +var myObj = { + p1: {a:"hello"}, +} +eval("with(myObj){p1={b:'hi'}}"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(myObj.p1.a === "hello"){ + $ERROR('#1: myObj.p1.a !== "hello"'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1.b !== "hi"){ + $ERROR('#2: myObj.p1.b === "hi". Actual: myObj.p1.b ==='+ myObj.p1.b ); +} +// +////////////////////////////////////////////////////////////////////////////// + + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 === 'a'){ + $ERROR('#3: myObj.p1 !== \'a\''); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A4_T5.js b/js/src/tests/test262/ch12/12.10/S12.10_A4_T5.js new file mode 100644 index 000000000..38a743b03 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A4_T5.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. + +/** + * Changing property using "eval" statement containing "with" statement + * + * @path ch12/12.10/S12.10_A4_T5.js + * @description Changing array property + * @noStrict + */ + +this.p1 = 'a'; +var myObj = { + p1: [1,2,3], +} +eval("with(myObj){p1=[3,2,1]}"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(myObj.p1[2] !== 1){ + $ERROR('#1: myObj.p1[2] === 1. Actual: myObj.p1[2] ==='+ myObj.p1[2] ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 === 'a'){ + $ERROR('#2: myObj.p1 !== \'a\''); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A4_T6.js b/js/src/tests/test262/ch12/12.10/S12.10_A4_T6.js new file mode 100644 index 000000000..fce451118 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A4_T6.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. + +/** + * Changing property using "eval" statement containing "with" statement + * + * @path ch12/12.10/S12.10_A4_T6.js + * @description Changing function property + * @noStrict + */ + +this.p1 = 'a'; +var myObj = { + p1: function(){return 0;}, +} +eval("with(myObj){p1=function(){return 1;}}"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(myObj.p1() !== 1){ + $ERROR('#1: myObj.p1 === 1. Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 === 'a'){ + $ERROR('#2: myObj.p1 !== \'a\''); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A5_T1.js b/js/src/tests/test262/ch12/12.10/S12.10_A5_T1.js new file mode 100644 index 000000000..351e4bb9d --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A5_T1.js @@ -0,0 +1,50 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Deleting property using "eval" statement containing "with" statement + * + * @path ch12/12.10/S12.10_A5_T1.js + * @description Deleting string property + * @noStrict + */ + +this.p1 = 1; +var myObj = { + p1: 'a', + del:false +} +eval("with(myObj){del = delete p1}"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(myObj.p1 === 'a'){ + $ERROR('#1: myObj.p1 !== "a"'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== undefined){ + $ERROR('#2: myObj.p1 === undefined. Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.del !== true){ + $ERROR('#3: myObj.del === true. Actual: myObj.del ==='+ myObj.del ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if(myObj.p1 === 1){ + $ERROR('#4: myObj.p1 !== 1'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A5_T2.js b/js/src/tests/test262/ch12/12.10/S12.10_A5_T2.js new file mode 100644 index 000000000..909d79d03 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A5_T2.js @@ -0,0 +1,50 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Deleting property using "eval" statement containing "with" statement + * + * @path ch12/12.10/S12.10_A5_T2.js + * @description Deleting number property + * @noStrict + */ + +this.p1 = 'a'; +var myObj = { + p1: 1, + del:false +} +eval("with(myObj){del = delete p1}"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(myObj.p1 === 1){ + $ERROR('#1: myObj.p1 !== 1'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== undefined){ + $ERROR('#2: myObj.p1 === undefined . Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.del !== true){ + $ERROR('#3: myObj.del === true. Actual: myObj.del ===. Actual: myObj.del ==='+ myObj.del +myObj.del); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if(myObj.p1 === 'a'){ + $ERROR('#4: myObj.p1 !== \'a\''); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A5_T3.js b/js/src/tests/test262/ch12/12.10/S12.10_A5_T3.js new file mode 100644 index 000000000..cd2ec3487 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A5_T3.js @@ -0,0 +1,51 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Deleting property using "eval" statement containing "with" statement + * + * @path ch12/12.10/S12.10_A5_T3.js + * @description Deleting boolean property + * @noStrict + */ + +this.p1 = 'a'; +var myObj = { + p1: true, + del:false +} + +eval("with(myObj){del = delete p1}"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(myObj.p1 === true){ + $ERROR('#1: myObj.p1 !== true '); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== undefined){ + $ERROR('#2: myObj.p1 === undefined . Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.del !== true){ + $ERROR('#3: myObj.del === true . Actual: myObj.del ==='+ myObj.del ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if(myObj.p1 === 'a'){ + $ERROR('#4: myObj.p1 !== \'a\''); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A5_T4.js b/js/src/tests/test262/ch12/12.10/S12.10_A5_T4.js new file mode 100644 index 000000000..96f2ded29 --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A5_T4.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. + +/** + * Deleting property using "eval" statement containing "with" statement + * + * @path ch12/12.10/S12.10_A5_T4.js + * @description Deleting object property + * @noStrict + */ + +this.p1 = 'a'; +var myObj = { + p1: {a:"hello"}, + del:false +} +eval("with(myObj){del = delete p1}"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try{ +if(myObj.p1.a === "hello"){ + $ERROR('#1: myObj.p1.a !== "hello" '); +} +}catch(e){var x=1}; +if(x !== 1){ + $ERROR('#1: x === 1. Actual: x ==='+ x ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== undefined){ + $ERROR('#2: myObj.p1 === undefined . Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.del !== true){ + $ERROR('#3: myObj.del === true . Actual: myObj.del ==='+ myObj.del ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if(myObj.p1 === 'a'){ + $ERROR('#4: myObj.p1 !== \'a\''); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A5_T5.js b/js/src/tests/test262/ch12/12.10/S12.10_A5_T5.js new file mode 100644 index 000000000..f0b52d07a --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A5_T5.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. + +/** + * Deleting property using "eval" statement containing "with" statement + * + * @path ch12/12.10/S12.10_A5_T5.js + * @description Deleting array property + * @noStrict + */ + +this.p1 = 'a'; +var myObj = { + p1: [1,2,3], + del:false +} +eval("with(myObj){del = delete p1}"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try{ +if(myObj.p1[2] === 3){ + $ERROR('#1: myObj.p1[2] !== 3 '); +} +}catch(e){var x=1}; +if(x !== 1){ + $ERROR('#1: x === 1. Actual: x ==='+ x ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== undefined){ + $ERROR('#2: myObj.p1 === undefined . Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.del !== true){ + $ERROR('#3: myObj.del === true . Actual: myObj.del ==='+ myObj.del ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if(myObj.p1 === 'a'){ + $ERROR('#4: myObj.p1 !== \'a\''); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.10/S12.10_A5_T6.js b/js/src/tests/test262/ch12/12.10/S12.10_A5_T6.js new file mode 100644 index 000000000..67c79398a --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/S12.10_A5_T6.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. + +/** + * Deleting property using "eval" statement containing "with" statement + * + * @path ch12/12.10/S12.10_A5_T6.js + * @description Deleting function property + * @noStrict + */ + +this.p1 = 'a'; +var myObj = { + p1: function(){return 0;}, + del:false +} +eval("with(myObj){del = delete p1}"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try{ +if(myObj.p1() === 0){ + $ERROR('#1: myObj.p1() !== 0 '); +} +}catch(e){var x=1}; +if(x !== 1){ + $ERROR('#1: x === 1. Actual: x ==='+ x ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== undefined){ + $ERROR('#2: myObj.p1 === undefined . Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.del !== true){ + $ERROR('#3: myObj.del === true . Actual: myObj.del ==='+ myObj.del ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if(myObj.p1 === 'a'){ + $ERROR('#4: myObj.p1 !== \'a\''); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.10/browser.js b/js/src/tests/test262/ch12/12.10/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/browser.js diff --git a/js/src/tests/test262/ch12/12.10/shell.js b/js/src/tests/test262/ch12/12.10/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.10/shell.js diff --git a/js/src/tests/test262/ch12/12.11/S12.11_A1_T1.js b/js/src/tests/test262/ch12/12.11/S12.11_A1_T1.js new file mode 100644 index 000000000..0d637da55 --- /dev/null +++ b/js/src/tests/test262/ch12/12.11/S12.11_A1_T1.js @@ -0,0 +1,74 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If Result.type is break and Result.target is in the current + * label set, return (normal, Result.value, empty) + * + * @path ch12/12.11/S12.11_A1_T1.js + * @description Simple test using switch statement + */ + +function SwitchTest(value){ + var result = 0; + + switch(value) { + case 0: + result += 2; + case 1: + result += 4; + break; + case 2: + result += 8; + case 3: + result += 16; + default: + result += 32; + break; + case 4: + result += 64; + } + + return result; +} + +if(!(SwitchTest(0) === 6)){ + $ERROR("#1: SwitchTest(0) === 6. Actual: SwitchTest(0) ==="+ SwitchTest(0) ); +} + +if(!(SwitchTest(1) === 4)){ + $ERROR("#2: SwitchTest(1) === 4. Actual: SwitchTest(1) ==="+ SwitchTest(1) ); +} + +if(!(SwitchTest(2) === 56)){ + $ERROR("#3: SwitchTest(2) === 56. Actual: SwitchTest(2) ==="+ SwitchTest(2) ); +} + +if(!(SwitchTest(3) === 48)){ + $ERROR("#4: SwitchTest(3) === 48. Actual: SwitchTest(3) ==="+ SwitchTest(3) ); +} + +if(!(SwitchTest(4) === 64)){ + $ERROR("#5: SwitchTest(4) === 64. Actual: SwitchTest(4) ==="+ SwitchTest(4) ); +} + +if(!(SwitchTest(true) === 32)){ + $ERROR("#6: SwitchTest(true) === 32. Actual: SwitchTest(true) ==="+ SwitchTest(true) ); +} + +if(!(SwitchTest(false) === 32)){ + $ERROR("#7: SwitchTest(false) === 32. Actual: SwitchTest(false) ==="+ SwitchTest(false) ); +} + +if(!(SwitchTest(null) === 32)){ + $ERROR("#8: SwitchTest(null) === 32. Actual: SwitchTest(null) ==="+ SwitchTest(null) ); +} + +if(!(SwitchTest(void 0) === 32)){ + $ERROR("#9: SwitchTest(void 0) === 32. Actual: SwitchTest(void 0) ==="+ SwitchTest(void 0) ); +} + +if(!(SwitchTest('0') === 32)){ + $ERROR("#10: SwitchTest('0') === 32. Actual: SwitchTest('0') ==="+ SwitchTest('0') ); +} + diff --git a/js/src/tests/test262/ch12/12.11/S12.11_A1_T2.js b/js/src/tests/test262/ch12/12.11/S12.11_A1_T2.js new file mode 100644 index 000000000..a7b4abc59 --- /dev/null +++ b/js/src/tests/test262/ch12/12.11/S12.11_A1_T2.js @@ -0,0 +1,88 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If Result.type is break and Result.target is in the current + * label set, return (normal, Result.value, empty) + * + * @path ch12/12.11/S12.11_A1_T2.js + * @description Switch with different types of variables + */ + +var x = new Number(2); + +function SwitchTest(value){ + var result = 0; + + switch(value) { + case 0: + result += 2; + case '1': + result += 4; + break; + case new Number(2): + result += 8; + case 3: + result += 16; + default: + result += 32; + break; + case 4: + result += 64; + break; + case x: + result += 128; + break; + case 0: + result += 256; + case 1: + result += 512; + } + + return result; +} + +if(!(SwitchTest(0) === 6)){ + $ERROR("#1: SwitchTest(0) === 6. Actual: SwitchTest(0) ==="+ SwitchTest(0) ); +} + +if(!(SwitchTest(1) === 512)){ + $ERROR("#2: SwitchTest(1) === 512. Actual: SwitchTest(1) ==="+ SwitchTest(1) ); +} + +if(!(SwitchTest(2) === 32)){ + $ERROR("#3: SwitchTest(2) === 32. Actual: SwitchTest(2) ==="+ SwitchTest(2) ); +} + +if(!(SwitchTest(3) === 48)){ + $ERROR("#4: SwitchTest(3) === 48. Actual: SwitchTest(3) ==="+ SwitchTest(3) ); +} + +if(!(SwitchTest(4) === 64)){ + $ERROR("#5: SwitchTest(4) === 64. Actual: SwitchTest(4) ==="+ SwitchTest(4) ); +} + +if(!(SwitchTest(true) === 32)){ + $ERROR("#6: SwitchTest(true) === 32. Actual: SwitchTest(true) ==="+ SwitchTest(true) ); +} + +if(!(SwitchTest(false) === 32)){ + $ERROR("#7: SwitchTest(false) === 32. Actual: SwitchTest(false) ==="+ SwitchTest(false) ); +} + +if(!(SwitchTest(null) === 32)){ + $ERROR("#8: SwitchTest(null) === 32. Actual: SwitchTest(null) ==="+ SwitchTest(null) ); +} + +if(!(SwitchTest(void 0) === 32)){ + $ERROR("#9: SwitchTest(void 0) === 32. Actual: SwitchTest(void 0) ==="+ SwitchTest(void 0) ); +} + +if(!(SwitchTest('0') === 32)){ + $ERROR("#10: SwitchTest('0') === 32. Actual: SwitchTest('0') ==="+ SwitchTest('0') ); +} + +if(!(SwitchTest(x) === 128)){ + $ERROR("#10: SwitchTest(x) === 128. Actual: SwitchTest(x) ==="+ SwitchTest(x) ); +} + diff --git a/js/src/tests/test262/ch12/12.11/S12.11_A1_T3.js b/js/src/tests/test262/ch12/12.11/S12.11_A1_T3.js new file mode 100644 index 000000000..3171a6661 --- /dev/null +++ b/js/src/tests/test262/ch12/12.11/S12.11_A1_T3.js @@ -0,0 +1,92 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If Result.type is break and Result.target is in the current + * label set, return (normal, Result.value, empty) + * + * @path ch12/12.11/S12.11_A1_T3.js + * @description Using case with null, NaN, Infinity + */ + +function SwitchTest(value){ + var result = 0; + + switch(value) { + case 0: + result += 2; + case 1: + result += 4; + break; + case 2: + result += 8; + case 3: + result += 16; + default: + result += 32; + break; + case null: + result += 64; + case NaN: + result += 128; + break; + case Infinity: + result += 256; + case 2+3: + result += 512; + break; + case undefined: + result += 1024; + } + + return result; +} + +if(!(SwitchTest(0) === 6)){ + $ERROR("#1: SwitchTest(0) === 6. Actual: SwitchTest(0) ==="+ SwitchTest(0) ); +} + +if(!(SwitchTest(1) === 4)){ + $ERROR("#2: SwitchTest(1) === 4. Actual: SwitchTest(1) ==="+ SwitchTest(1) ); +} + +if(!(SwitchTest(2) === 56)){ + $ERROR("#3: SwitchTest(2) === 56. Actual: SwitchTest(2) ==="+ SwitchTest(2) ); +} + +if(!(SwitchTest(3) === 48)){ + $ERROR("#4: SwitchTest(3) === 48. Actual: SwitchTest(3) ==="+ SwitchTest(3) ); +} + +if(!(SwitchTest(4) === 32)){ + $ERROR("#5: SwitchTest(4) === 32. Actual: SwitchTest(4) ==="+ SwitchTest(4) ); +} + +if(!(SwitchTest(5) === 512)){ + $ERROR("#5: SwitchTest(5) === 512. Actual: SwitchTest(5) ==="+ SwitchTest(5) ); +} + +if(!(SwitchTest(true) === 32)){ + $ERROR("#6: SwitchTest(true) === 32. Actual: SwitchTest(true) ==="+ SwitchTest(true) ); +} + +if(!(SwitchTest(false) === 32)){ + $ERROR("#7: SwitchTest(false) === 32. Actual: SwitchTest(false) ==="+ SwitchTest(false) ); +} + +if(!(SwitchTest(null) === 192)){ + $ERROR("#8: SwitchTest(null) === 192. Actual: SwitchTest(null) ==="+ SwitchTest(null) ); +} + +if(!(SwitchTest(void 0) === 1024)){ + $ERROR("#9: SwitchTest(void 0) === 1024. Actual: SwitchTest(void 0) ==="+ SwitchTest(void 0) ); +} + +if(!(SwitchTest(NaN) === 32)){ + $ERROR("#10: SwitchTest(NaN) === 32. Actual: SwitchTest(NaN) ==="+ SwitchTest(NaN) ); +} + +if(!(SwitchTest(Infinity) === 768)){ + $ERROR("#10: SwitchTest(NaN) === 768. Actual: SwitchTest(NaN) ==="+ SwitchTest(NaN) ); +} + diff --git a/js/src/tests/test262/ch12/12.11/S12.11_A1_T4.js b/js/src/tests/test262/ch12/12.11/S12.11_A1_T4.js new file mode 100644 index 000000000..0182397fe --- /dev/null +++ b/js/src/tests/test262/ch12/12.11/S12.11_A1_T4.js @@ -0,0 +1,80 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If Result.type is break and Result.target is in the current + * label set, return (normal, Result.value, empty) + * + * @path ch12/12.11/S12.11_A1_T4.js + * @description Using case with isNaN and isNaN(value) + */ + +function SwitchTest(value){ + var result = 0; + + switch(value) { + case 0: + result += 2; + case 1: + result += 4; + break; + case 2: + result += 8; + case isNaN(value): + result += 16; + default: + result += 32; + break; + case null: + result += 64; + case isNaN: + result += 128; + break; + case Infinity: + result += 256; + case 2+3: + result += 512; + break; + case undefined: + result += 1024; + } + + return result; +} + +if(!(SwitchTest(eval('Number(false)')) === 6)){ + $ERROR("#1: SwitchTest(0) === 6. Actual: SwitchTest(0) ==="+ SwitchTest(0) ); +} + +if(!(SwitchTest(parseInt) === 32)){ + $ERROR("#2: SwitchTest(parseInt) === 32. Actual: SwitchTest(parseInt) ==="+ SwitchTest(parseInt) ); +} + +if(!(SwitchTest(isNaN) === 128)){ + $ERROR("#3: SwitchTest(isNaN) === 128. Actual: SwitchTest(isNaN) ==="+ SwitchTest(isNaN) ); +} + +if(!(SwitchTest(true) === 32)){ + $ERROR("#6: SwitchTest(true) === 32. Actual: SwitchTest(true) ==="+ SwitchTest(true) ); +} + +if(!(SwitchTest(false) === 48)){ + $ERROR("#7: SwitchTest(false) === 48. Actual: SwitchTest(false) ==="+ SwitchTest(false) ); +} + +if(!(SwitchTest(null) === 192)){ + $ERROR("#8: SwitchTest(null) === 192. Actual: SwitchTest(null) ==="+ SwitchTest(null) ); +} + +if(!(SwitchTest(void 0) === 1024)){ + $ERROR("#9: SwitchTest(void 0) === 1024. Actual: SwitchTest(void 0) ==="+ SwitchTest(void 0) ); +} + +if(!(SwitchTest(NaN) === 32)){ + $ERROR("#10: SwitchTest(NaN) === 32. Actual: SwitchTest(NaN) ==="+ SwitchTest(NaN) ); +} + +if(!(SwitchTest(Infinity) === 768)){ + $ERROR("#10: SwitchTest(NaN) === 768. Actual: SwitchTest(NaN) ==="+ SwitchTest(NaN) ); +} + diff --git a/js/src/tests/test262/ch12/12.11/S12.11_A2_T1.js b/js/src/tests/test262/ch12/12.11/S12.11_A2_T1.js new file mode 100644 index 000000000..247437638 --- /dev/null +++ b/js/src/tests/test262/ch12/12.11/S12.11_A2_T1.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. + +/** + * There can be only one DefaultClause + * + * @path ch12/12.11/S12.11_A2_T1.js + * @description Duplicate DefaultClause + * @negative + */ + +function SwitchTest(value){ + var result = 0; + + switch(value) { + case 0: + result += 2; + default: + result += 32; + break; + default: + result += 32; + break; + } + + return result; +} + +var x = SwitchTest(0); + diff --git a/js/src/tests/test262/ch12/12.11/S12.11_A3_T1.js b/js/src/tests/test262/ch12/12.11/S12.11_A3_T1.js new file mode 100644 index 000000000..feab32852 --- /dev/null +++ b/js/src/tests/test262/ch12/12.11/S12.11_A3_T1.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. + +/** + * Syntax constructions of switch statement + * + * @path ch12/12.11/S12.11_A3_T1.js + * @description Checking if execution of "switch() {}" fails + * @negative + */ + +function SwitchTest(value){ + var result = 0; + + switch() { + case 0: + result += 2; + default: + result += 32; + break; + } + + return result; +} + +var x = SwitchTest(0); + diff --git a/js/src/tests/test262/ch12/12.11/S12.11_A3_T2.js b/js/src/tests/test262/ch12/12.11/S12.11_A3_T2.js new file mode 100644 index 000000000..d879d6028 --- /dev/null +++ b/js/src/tests/test262/ch12/12.11/S12.11_A3_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. + +/** + * Syntax constructions of switch statement + * + * @path ch12/12.11/S12.11_A3_T2.js + * @description Checking if execution of "switch {}" fails + * @negative + */ + +function SwitchTest(value){ + var result = 0; + + switch { + case 0: + result += 2; + default: + result += 32; + break; + } + + return result; +} + +var x = SwitchTest(0); + diff --git a/js/src/tests/test262/ch12/12.11/S12.11_A3_T3.js b/js/src/tests/test262/ch12/12.11/S12.11_A3_T3.js new file mode 100644 index 000000000..03d3898dc --- /dev/null +++ b/js/src/tests/test262/ch12/12.11/S12.11_A3_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. + +/** + * Syntax constructions of switch statement + * + * @path ch12/12.11/S12.11_A3_T3.js + * @description Checking if execution of "switch(value)" fails + * @negative + */ + +switch(value); + diff --git a/js/src/tests/test262/ch12/12.11/S12.11_A3_T4.js b/js/src/tests/test262/ch12/12.11/S12.11_A3_T4.js new file mode 100644 index 000000000..00def2926 --- /dev/null +++ b/js/src/tests/test262/ch12/12.11/S12.11_A3_T4.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. + +/** + * Syntax constructions of switch statement + * + * @path ch12/12.11/S12.11_A3_T4.js + * @description Using "case" that has no Expresson after it. "CaseClause: case Expression : [StatementList]" + * @negative + */ + +function SwitchTest(value){ + var result = 0; + + switch(value) { + case: + result += 2; + default: + result += 32; + break; + } + + return result; +} + +var x = SwitchTest(0); + diff --git a/js/src/tests/test262/ch12/12.11/S12.11_A3_T5.js b/js/src/tests/test262/ch12/12.11/S12.11_A3_T5.js new file mode 100644 index 000000000..02cd94bd9 --- /dev/null +++ b/js/src/tests/test262/ch12/12.11/S12.11_A3_T5.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. + +/** + * Syntax constructions of switch statement + * + * @path ch12/12.11/S12.11_A3_T5.js + * @description Introducing statement not followed by "case" keyword + * @negative + */ + +function SwitchTest(value){ + var result = 0; + + switch(value) { + result =2; + case 0: + result += 2; + default: + result += 32; + break; + } + + return result; +} + +var x = SwitchTest(0); + diff --git a/js/src/tests/test262/ch12/12.11/S12.11_A4_T1.js b/js/src/tests/test262/ch12/12.11/S12.11_A4_T1.js new file mode 100644 index 000000000..8fbafbc81 --- /dev/null +++ b/js/src/tests/test262/ch12/12.11/S12.11_A4_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. + +/** + * Embedded syntax constructions of switch statement + * + * @path ch12/12.11/S12.11_A4_T1.js + * @description Nesting one "switch" statement into StatementList of the other's + */ + +function SwitchTest(value){ + var result = 0; + + switch(value) { + case 0: + switch(value) { + case 0: + result += 3; + break; + default: + result += 32; + break; + } + result *= 2; + break; + result=3; + default: + result += 32; + break; + } + return result; +} + +var x = SwitchTest(0); +if(x!==6) $ERROR("#1: SwitchTest(0) === 6. Actual: SwitchTest(0) ==="+ SwitchTest(0) ); + diff --git a/js/src/tests/test262/ch12/12.11/browser.js b/js/src/tests/test262/ch12/12.11/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.11/browser.js diff --git a/js/src/tests/test262/ch12/12.11/shell.js b/js/src/tests/test262/ch12/12.11/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.11/shell.js diff --git a/js/src/tests/test262/ch12/12.12/S12.12_A1_T1.js b/js/src/tests/test262/ch12/12.12/S12.12_A1_T1.js new file mode 100644 index 000000000..c88e0650a --- /dev/null +++ b/js/src/tests/test262/ch12/12.12/S12.12_A1_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. + +/** + * Labelled statements are only used in conjunction with labelled + * break and continue statements + * + * @path ch12/12.12/S12.12_A1_T1.js + * @description Checking if labelled break works. See continue and break sections + */ + +var object = {p1: 1, p2: 1}; +var result = 0; +lbl: for(var i in object){ + result += object[i]; + break lbl; +} + +if(!(result === 1)){ + $ERROR("'break label' should break execution of labelled iteration statement"); +} + diff --git a/js/src/tests/test262/ch12/12.12/browser.js b/js/src/tests/test262/ch12/12.12/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.12/browser.js diff --git a/js/src/tests/test262/ch12/12.12/shell.js b/js/src/tests/test262/ch12/12.12/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.12/shell.js diff --git a/js/src/tests/test262/ch12/12.13/S12.13_A1.js b/js/src/tests/test262/ch12/12.13/S12.13_A1.js new file mode 100644 index 000000000..bc2463577 --- /dev/null +++ b/js/src/tests/test262/ch12/12.13/S12.13_A1.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. + +/** + * Sanity test for throw statement + * + * @path ch12/12.13/S12.13_A1.js + * @description Trying to throw exception with "throw" + * @negative + */ + +throw "error"; + diff --git a/js/src/tests/test262/ch12/12.13/S12.13_A2_T1.js b/js/src/tests/test262/ch12/12.13/S12.13_A2_T1.js new file mode 100644 index 000000000..bca31ea80 --- /dev/null +++ b/js/src/tests/test262/ch12/12.13/S12.13_A2_T1.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. + +/** + * "throw Expression" returns (throw, GetValue(Result(1)), empty), where 1 evaluates Expression + * + * @path ch12/12.13/S12.13_A2_T1.js + * @description Throwing undefined + */ + +// CHECK#1 +try{ + throw undefined; +} +catch(e){ + if (e!==undefined) $ERROR('#1: Exception === undefined. Actual: Exception ==='+ e ); +} + diff --git a/js/src/tests/test262/ch12/12.13/S12.13_A2_T2.js b/js/src/tests/test262/ch12/12.13/S12.13_A2_T2.js new file mode 100644 index 000000000..e068f39f6 --- /dev/null +++ b/js/src/tests/test262/ch12/12.13/S12.13_A2_T2.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. + +/** + * "throw Expression" returns (throw, GetValue(Result(1)), empty), where 1 evaluates Expression + * + * @path ch12/12.13/S12.13_A2_T2.js + * @description Throwing null + */ + +// CHECK#1 +try{ + throw null; +} +catch(e){ + if (e!==null) $ERROR('#1: Exception === null. Actual: Exception ==='+ e ); +} + diff --git a/js/src/tests/test262/ch12/12.13/S12.13_A2_T3.js b/js/src/tests/test262/ch12/12.13/S12.13_A2_T3.js new file mode 100644 index 000000000..37592ac19 --- /dev/null +++ b/js/src/tests/test262/ch12/12.13/S12.13_A2_T3.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. + +/** + * "throw Expression" returns (throw, GetValue(Result(1)), empty), where 1 evaluates Expression + * + * @path ch12/12.13/S12.13_A2_T3.js + * @description Throwing boolean + */ + +// CHECK#1 +try{ + throw true; +} +catch(e){ + if (e!==true) $ERROR('#1: Exception ===true. Actual: Exception ==='+ e ); +} + +// CHECK#2 +try{ + throw false; +} +catch(e){ + if (e!==false) $ERROR('#2: Exception ===false. Actual: Exception ==='+ e ); +} + +// CHECK#3 +var b=false; +try{ + throw b; +} +catch(e){ + if (e!==false) $ERROR('#3: Exception ===false. Actual: Exception ==='+ e ); +} + +// CHECK#4 +var b=true; +try{ + throw b; +} +catch(e){ + if (e!==true) $ERROR('#4: Exception ===true. Actual: Exception ==='+ e ); +} + diff --git a/js/src/tests/test262/ch12/12.13/S12.13_A2_T4.js b/js/src/tests/test262/ch12/12.13/S12.13_A2_T4.js new file mode 100644 index 000000000..bddf2dac3 --- /dev/null +++ b/js/src/tests/test262/ch12/12.13/S12.13_A2_T4.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. + +/** + * "throw Expression" returns (throw, GetValue(Result(1)), empty), where 1 evaluates Expression + * + * @path ch12/12.13/S12.13_A2_T4.js + * @description Throwing string + */ + +// CHECK#1 +try{ + throw "exception #1"; +} +catch(e){ + if (e!=="exception #1") $ERROR('#1: Exception ==="exception #1". Actual: Exception ==='+ e ); +} + +// CHECK#2 +var b="exception #1"; +try{ + throw b; +} +catch(e){ + if (e!=="exception #1") $ERROR('#2: Exception ==="exception #1". Actual: Exception ==='+ e ); +} + diff --git a/js/src/tests/test262/ch12/12.13/S12.13_A2_T5.js b/js/src/tests/test262/ch12/12.13/S12.13_A2_T5.js new file mode 100644 index 000000000..8d8084849 --- /dev/null +++ b/js/src/tests/test262/ch12/12.13/S12.13_A2_T5.js @@ -0,0 +1,75 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * "throw Expression" returns (throw, GetValue(Result(1)), empty), where 1 evaluates Expression + * + * @path ch12/12.13/S12.13_A2_T5.js + * @description Throwing number + */ + +// CHECK#1 +try{ + throw 13; +} +catch(e){ + if (e!==13) $ERROR('#1: Exception ===13. Actual: Exception ==='+ e ); +} + +// CHECK#2 +var b=13; +try{ + throw b; +} +catch(e){ + if (e!==13) $ERROR('#2: Exception ===13. Actual: Exception ==='+ e ); +} + +// CHECK#3 +try{ + throw 2.13; +} +catch(e){ + if (e!==2.13) $ERROR('#3: Exception ===2.13. Actual: Exception ==='+ e ); +} + +// CHECK#4 +try{ + throw NaN; +} +catch(e){ + if (!isNaN(e)) $ERROR('#4: Exception is NaN'); +} + +// CHECK#5 +try{ + throw +Infinity; +} +catch(e){ + if (e!==+Infinity) $ERROR('#5: Exception ===+Infinity. Actual: Exception ==='+ e ); +} + +// CHECK#6 +try{ + throw -Infinity; +} +catch(e){ + if (e!==-Infinity) $ERROR('#6: Exception ===-Infinity. Actual: Exception ==='+ e ); +} + +// CHECK#7 +try{ + throw +0; +} +catch(e){ + if (e!==+0) $ERROR('#7: Exception ===+0. Actual: Exception ==='+ e ); +} + +// CHECK#8 +try{ + throw -0; +} +catch(e){ + if (e!==-0) $ERROR('#8: Exception ===-0. Actual: Exception ==='+ e ); +} + diff --git a/js/src/tests/test262/ch12/12.13/S12.13_A2_T6.js b/js/src/tests/test262/ch12/12.13/S12.13_A2_T6.js new file mode 100644 index 000000000..39e799852 --- /dev/null +++ b/js/src/tests/test262/ch12/12.13/S12.13_A2_T6.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. + +/** + * "throw Expression" returns (throw, GetValue(Result(1)), empty), where 1 evaluates Expression + * + * @path ch12/12.13/S12.13_A2_T6.js + * @description Throwing object + */ + +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';}, + i:7 +} + +try{ + throw myObj; +} +catch(e){ +// CHECK#1 + if (e.p1!=="a") $ERROR('#1: e.p1 === "a". Actual: e.p1 ==='+ e.p1 ); +// CHECK#2 + if (e.value!=='myObj_value') $ERROR('#2: e.p1 === \'myObj_value\'. Actual: e.p1 ==='+ e.p1 ); +// CHECK#3 + if (e.eval()!=='obj_eval') $ERROR('#3: e.p1 === \'obj_eval\'. Actual: e.p1 ==='+ e.p1 ); +} + +// CHECK#4 +myObj.i=6 +try{ + throw myObj; +} +catch(e){} +if (myObj.i!==6) $ERROR('#4: Handling of catch must be correct'); + diff --git a/js/src/tests/test262/ch12/12.13/S12.13_A2_T7.js b/js/src/tests/test262/ch12/12.13/S12.13_A2_T7.js new file mode 100644 index 000000000..bf633f868 --- /dev/null +++ b/js/src/tests/test262/ch12/12.13/S12.13_A2_T7.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. + +/** + * "throw Expression" returns (throw, GetValue(Result(1)), empty), where 1 evaluates Expression + * + * @path ch12/12.13/S12.13_A2_T7.js + * @description Throwing Array + */ + +var mycars = new Array(); +mycars[0] = "Saab"; +mycars[1] = "Volvo"; +mycars[2] = "BMW"; + +var mycars2 = new Array(); +mycars2[0] = "Mercedes"; +mycars2[1] = "Jeep"; +mycars2[2] = "Suzuki"; + +// CHECK#1 +try{ + throw mycars; +} +catch(e){ + for (var i=0;i<3;i++){ + if (e[i]!==mycars[i]) $ERROR('#1.'+i+': Exception['+i+'] === mycars['+i+']. Actual: Exception['+i+'] ==='+ e[i] ); + } +} + diff --git a/js/src/tests/test262/ch12/12.13/S12.13_A3_T1.js b/js/src/tests/test262/ch12/12.13/S12.13_A3_T1.js new file mode 100644 index 000000000..7843a6459 --- /dev/null +++ b/js/src/tests/test262/ch12/12.13/S12.13_A3_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. + +/** + * 1. Evaluate Expression + * + * @path ch12/12.13/S12.13_A3_T1.js + * @description Evaluating boolean expression + */ + +// CHECK#1 +var b=true; +try{ + throw b&&false; +} +catch(e){ + if (e!==false) $ERROR('#1: Exception === false(operaton &&). Actual: Exception ==='+ e ); +} + +// CHECK#2 +var b=true; +try{ + throw b||false; +} +catch(e){ + if (e!==true) $ERROR('#2: Exception === true(operaton ||). Actual: Exception ==='+ e ); +} + +// CHECK#3 +try{ + throw !false; +} +catch(e){ + if (e!==true) $ERROR('#3: Exception === true(operaton !). Actual: Exception ==='+ e ); +} + +// CHECK#4 +var b=true; +try{ + throw !(b&&false); +} +catch(e){ + if (e!==true) $ERROR('#4: Exception === true(operaton &&). Actual: Exception ==='+ e ); +} + diff --git a/js/src/tests/test262/ch12/12.13/S12.13_A3_T2.js b/js/src/tests/test262/ch12/12.13/S12.13_A3_T2.js new file mode 100644 index 000000000..f8cb92203 --- /dev/null +++ b/js/src/tests/test262/ch12/12.13/S12.13_A3_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. + +/** + * 1. Evaluate Expression + * + * @path ch12/12.13/S12.13_A3_T2.js + * @description Evaluating string expression + */ + +// CHECK#1 +try{ + throw "exception"+" #1"; +} +catch(e){ + if (e!=="exception #1") $ERROR('#1: Exception === "exception #1"(operaton +). Actual: Exception ==='+ e ); +} + +// CHECK#2 +var b="exception" +var a=" #1"; +try{ + throw b+a; +} +catch(e){ + if (e!=="exception #1") $ERROR('#2: Exception === "exception #1"(operaton +). Actual: Exception ==='+ e ); +} + diff --git a/js/src/tests/test262/ch12/12.13/S12.13_A3_T3.js b/js/src/tests/test262/ch12/12.13/S12.13_A3_T3.js new file mode 100644 index 000000000..44c9d075c --- /dev/null +++ b/js/src/tests/test262/ch12/12.13/S12.13_A3_T3.js @@ -0,0 +1,92 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * 1. Evaluate Expression + * + * @path ch12/12.13/S12.13_A3_T3.js + * @description Evaluating number expression + */ + +// CHECK#1 +try{ + throw 10+3; +} +catch(e){ + if (e!==13) $ERROR('#1: Exception ===13(operaton +). Actual: Exception ==='+ e); +} + +// CHECK#2 +var b=10; +var a=3; +try{ + throw a+b; +} +catch(e){ + if (e!==13) $ERROR('#2: Exception ===13(operaton +). Actual: Exception ==='+ e); +} + +// CHECK#3 +try{ + throw 3.15-1.02; +} +catch(e){ + if (e!==2.13) $ERROR('#3: Exception ===2.13(operaton -). Actual: Exception ==='+ e); +} + +// CHECK#4 +try{ + throw 2*2; +} +catch(e){ + if (e!==4) $ERROR('#4: Exception ===4(operaton *). Actual: Exception ==='+ e); +} + +// CHECK#5 +try{ + throw 1+Infinity; +} +catch(e){ + if (e!==+Infinity) $ERROR('#5: Exception ===+Infinity(operaton +). Actual: Exception ==='+ e); +} + +// CHECK#6 +try{ + throw 1-Infinity; +} +catch(e){ + if (e!==-Infinity) $ERROR('#6: Exception ===-Infinity(operaton -). Actual: Exception ==='+ e); +} + +// CHECK#7 +try{ + throw 10/5; +} +catch(e){ + if (e!==2) $ERROR('#7: Exception ===2(operaton /). Actual: Exception ==='+ e); +} + +// CHECK#8 +try{ + throw 8>>2; +} +catch(e){ + if (e!==2) $ERROR('#8: Exception ===2(operaton >>). Actual: Exception ==='+ e); +} + +// CHECK#9 +try{ + throw 2<<2; +} +catch(e){ + if (e!==8) $ERROR('#9: Exception ===8(operaton <<). Actual: Exception ==='+ e); +} + +// CHECK#10 +try{ + throw 123%100; +} +catch(e){ + if (e!==23) $ERROR('#10: Exception ===23(operaton %). Actual: Exception ==='+ e); +} + diff --git a/js/src/tests/test262/ch12/12.13/S12.13_A3_T4.js b/js/src/tests/test262/ch12/12.13/S12.13_A3_T4.js new file mode 100644 index 000000000..9a6e010f0 --- /dev/null +++ b/js/src/tests/test262/ch12/12.13/S12.13_A3_T4.js @@ -0,0 +1,56 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * 1. Evaluate Expression + * + * @path ch12/12.13/S12.13_A3_T4.js + * @description Evaluating array expression + */ + +var mycars = new Array(); +mycars[0] = "Saab"; +mycars[1] = "Volvo"; +mycars[2] = "BMW"; + +var mycars2 = new Array(); +mycars2[0] = "Mercedes"; +mycars2[1] = "Jeep"; +mycars2[2] = "Suzuki"; + +// CHECK#1 +try{ + throw mycars.concat(mycars2); +} +catch(e){ + for (var i=0;i<3;i++){ + if (e[i]!==mycars[i]) $ERROR('#1.'+i+': Exception['+i+']===mycars['+i+'](operation .concat). Actual: Exception['+i+']==='+ e[i] ); + } + for (var i=3;i<6;i++){ + if (e[i]!==mycars2[i-3]) $ERROR('#1.'+i+': Exception['+i+']===mycars2['+(i-3)+'](operation .concat). Actual: Exception['+i+']==='+ e[i] ); + } +} + +// CHECK#2 +try{ + throw new Array("Mercedes","Jeep","Suzuki"); +} +catch(e){ + for (var i=0;i<3;i++){ + if (e[i]!==mycars2[i]) $ERROR('#2.'+i+': Exception['+i+']===mycars2['+i+'](operation new). Actual: Exception['+i+']==='+ e[i] ); + } +} + +// CHECK#3 +try{ + throw mycars.concat(new Array("Mercedes","Jeep","Suzuki")); +} +catch(e){ + for (var i=0;i<3;i++){ + if (e[i]!==mycars[i]) $ERROR('#3.'+i+': Exception['+i+']===mycars['+i+'](operation .concat(new)). Actual: Exception['+i+']==='+ e[i] ); + } + for (var i=3;i<6;i++){ + if (e[i]!==mycars2[i-3]) $ERROR('#3.'+i+': Exception['+i+']===mycars2['+(i-3)+'](operation .concat(new)). Actual: Exception['+i+']==='+ e[i] ); + } +} + diff --git a/js/src/tests/test262/ch12/12.13/S12.13_A3_T5.js b/js/src/tests/test262/ch12/12.13/S12.13_A3_T5.js new file mode 100644 index 000000000..69fb016d5 --- /dev/null +++ b/js/src/tests/test262/ch12/12.13/S12.13_A3_T5.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. + +/** + * 1. Evaluate Expression + * + * @path ch12/12.13/S12.13_A3_T5.js + * @description Evaluating equation expression + */ + +// CHECK#1 +var a=true; +var b=false; +try{ + throw ((a&&(!b))?"exception":" #1"); +} +catch(e){ + if (e!=="exception") $ERROR('#1: Exception ==="exception"(operaton ? , ). Actual: Exception ==='+e ); +} + diff --git a/js/src/tests/test262/ch12/12.13/S12.13_A3_T6.js b/js/src/tests/test262/ch12/12.13/S12.13_A3_T6.js new file mode 100644 index 000000000..7191c6bd6 --- /dev/null +++ b/js/src/tests/test262/ch12/12.13/S12.13_A3_T6.js @@ -0,0 +1,58 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * 1. Evaluate Expression + * + * @path ch12/12.13/S12.13_A3_T6.js + * @description Evaluating functions + */ + +// CHECK#1 +var i=0; +function adding1(){ + i++; + return 1; +} +try{ + throw (adding1()); +} +catch(e){ + if (e!==1) $ERROR('#1: Exception ===1. Actual: Exception ==='+ e); +} + +// CHECK#2 +var i=0; +function adding2(){ + i++; + return i; +} +try{ + throw adding2(); +} +catch(e){} +if (i!==1) $ERROR('#2: i===1. Actual: i==='+ i); + +// CHECK#3 +var i=0; +function adding3(){ + i++; +} +try{ + throw adding3(); +} +catch(e){} +if (i!==1) $ERROR('#3: i===1. Actual: i==='+i); + +// CHECK#4 +function adding4(i){ + i++; + return i; +} +try{ + throw (adding4(1)); +} +catch(e){ + if (e!==2) $ERROR('#4: Exception ===2. Actual: Exception ==='+ e); +} + diff --git a/js/src/tests/test262/ch12/12.13/browser.js b/js/src/tests/test262/ch12/12.13/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.13/browser.js diff --git a/js/src/tests/test262/ch12/12.13/shell.js b/js/src/tests/test262/ch12/12.13/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.13/shell.js diff --git a/js/src/tests/test262/ch12/12.14/12.14-1.js b/js/src/tests/test262/ch12/12.14/12.14-1.js new file mode 100644 index 000000000..47bff810b --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/12.14-1.js @@ -0,0 +1,23 @@ +/// 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.14/12.14-1.js
+ * @description catch doesn't change declaration scope - var initializer in catch with same name as catch parameter changes parameter
+ */
+
+
+function testcase() {
+ foo = "prior to throw";
+ try {
+ throw new Error();
+ }
+ catch (foo) {
+ var foo = "initializer in catch";
+ }
+ return foo === "prior to throw";
+
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.14/12.14-10.js b/js/src/tests/test262/ch12/12.14/12.14-10.js new file mode 100644 index 000000000..1bdf8273d --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/12.14-10.js @@ -0,0 +1,31 @@ +/// 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.14/12.14-10.js
+ * @description catch introduces scope - name lookup finds function parameter
+ */
+
+
+function testcase() {
+ function f(o) {
+
+ function innerf(o, x) {
+ try {
+ throw o;
+ }
+ catch (e) {
+ return x;
+ }
+ }
+
+ return innerf(o, 42);
+ }
+
+ if (f({}) === 42) {
+ return true;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.14/12.14-11.js b/js/src/tests/test262/ch12/12.14/12.14-11.js new file mode 100644 index 000000000..6fded5bee --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/12.14-11.js @@ -0,0 +1,33 @@ +/// 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.14/12.14-11.js
+ * @description catch introduces scope - name lookup finds inner variable
+ */
+
+
+function testcase() {
+ function f(o) {
+
+ function innerf(o) {
+ var x = 42;
+
+ try {
+ throw o;
+ }
+ catch (e) {
+ return x;
+ }
+ }
+
+ return innerf(o);
+ }
+
+ if (f({}) === 42) {
+ return true;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.14/12.14-12.js b/js/src/tests/test262/ch12/12.14/12.14-12.js new file mode 100644 index 000000000..c92580cfe --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/12.14-12.js @@ -0,0 +1,31 @@ +/// 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.14/12.14-12.js
+ * @description catch introduces scope - name lookup finds property
+ */
+
+
+function testcase() {
+ function f(o) {
+
+ function innerf(o) {
+ try {
+ throw o;
+ }
+ catch (e) {
+ return e.x;
+ }
+ }
+
+ return innerf(o);
+ }
+
+ if (f({x:42}) === 42) {
+ return true;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.14/12.14-13.js b/js/src/tests/test262/ch12/12.14/12.14-13.js new file mode 100644 index 000000000..3efb98913 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/12.14-13.js @@ -0,0 +1,42 @@ +/// 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.14/12.14-13.js
+ * @description catch introduces scope - updates are based on scope
+ */
+
+
+function testcase() {
+ var res1 = false;
+ var res2 = false;
+ var res3 = false;
+
+ var x_12_14_13 = 'local';
+ try {
+ function foo() {
+ this.x_12_14_13 = 'instance';
+ }
+
+ try {
+ throw foo;
+ }
+ catch (e) {
+ res1 = (x_12_14_13 === 'local');
+ e();
+ res2 = (x_12_14_13 === 'local');
+ }
+ res3 = (x_12_14_13 === 'local');
+
+ if (res1 === true &&
+ res2 === true &&
+ res3 === true) {
+ return true;
+ }
+ } finally {
+ delete this.x_12_14_13;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.14/12.14-14.js b/js/src/tests/test262/ch12/12.14/12.14-14.js new file mode 100644 index 000000000..40b2c82c8 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/12.14-14.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.14/12.14-14.js
+ * @description Exception object is a function, when an exception parameter is called as a function in catch block, global object is passed as the this value
+ */
+
+
+function testcase() {
+ try {
+ throw function () {
+ this._12_14_14_foo = "test";
+ };
+ return false;
+ } catch (e) {
+ e();
+ return fnGlobalObject()._12_14_14_foo === "test";
+ }
+ finally {
+ delete fnGlobalObject()._12_14_14_foo;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.14/12.14-15.js b/js/src/tests/test262/ch12/12.14/12.14-15.js new file mode 100644 index 000000000..e4397c17c --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/12.14-15.js @@ -0,0 +1,28 @@ +/// 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.14/12.14-15.js
+ * @description Exception object is a function which is a property of an object, when an exception parameter is called as a function in catch block, global object is passed as the this value
+ */
+
+
+function testcase() {
+ var obj = {};
+ obj.test = function () {
+ this._12_14_15_foo = "test";
+ };
+ try {
+ throw obj.test;
+ return false;
+ } catch (e) {
+ e();
+ return fnGlobalObject()._12_14_15_foo === "test";
+ }
+ finally {
+ delete fnGlobalObject()._12_14_15_foo;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.14/12.14-16.js b/js/src/tests/test262/ch12/12.14/12.14-16.js new file mode 100644 index 000000000..e160e3d37 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/12.14-16.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.
+/**
+ * @path ch12/12.14/12.14-16.js
+ * @description Exception object is a function which update in catch block, when an exception parameter is called as a function in catch block, global object is passed as the this value
+ */
+
+
+function testcase() {
+ try {
+ throw function () {
+ this._12_14_16_foo = "test";
+ };
+ return false;
+ } catch (e) {
+ var obj = {};
+ obj.test = function () {
+ this._12_14_16_foo = "test1";
+ };
+ e = obj.test;
+ e();
+ return fnGlobalObject()._12_14_16_foo === "test1";
+ }
+ finally {
+ delete fnGlobalObject()._12_14_16_foo;
+ }
+
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.14/12.14-2.js b/js/src/tests/test262/ch12/12.14/12.14-2.js new file mode 100644 index 000000000..16d08d34c --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/12.14-2.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.14/12.14-2.js
+ * @description catch doesn't change declaration scope - var initializer in catch with same name as catch parameter changes parameter
+ */
+
+
+function testcase() {
+ function capturedFoo() {return foo};
+ foo = "prior to throw";
+ try {
+ throw new Error();
+ }
+ catch (foo) {
+ var foo = "initializer in catch";
+ return capturedFoo() !== "initializer in catch";
+ }
+
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.14/12.14-3.js b/js/src/tests/test262/ch12/12.14/12.14-3.js new file mode 100644 index 000000000..6cd541061 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/12.14-3.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.
+/**
+ * local vars must not be visible outside with block
+ * local functions must not be visible outside with block
+ * local function expresssions should not be visible outside with block
+ * local vars must shadow outer vars
+ * local functions must shadow outer functions
+ * local function expresssions must shadow outer function expressions
+ * eval should use the appended object to the scope chain
+ *
+ * @path ch12/12.14/12.14-3.js
+ * @description catch doesn't change declaration scope - var declaration are visible outside when name different from catch parameter
+ */
+
+
+function testcase() {
+ try {
+ throw new Error();
+ }
+ catch (e) {
+ var foo = "declaration in catch";
+ }
+
+ return foo === "declaration in catch";
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.14/12.14-4.js b/js/src/tests/test262/ch12/12.14/12.14-4.js new file mode 100644 index 000000000..1d3cb1b16 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/12.14-4.js @@ -0,0 +1,34 @@ +/// 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.
+/**
+ * local vars must not be visible outside with block
+ * local functions must not be visible outside with block
+ * local function expresssions should not be visible outside with block
+ * local vars must shadow outer vars
+ * local functions must shadow outer functions
+ * local function expresssions must shadow outer function expressions
+ * eval should use the appended object to the scope chain
+ *
+ * @path ch12/12.14/12.14-4.js
+ * @description catch introduces scope - block-local vars must shadow outer vars
+ */
+
+
+function testcase() {
+ var o = { foo : 42};
+
+ try {
+ throw o;
+ }
+ catch (e) {
+ var foo;
+
+ if (foo === undefined) {
+ return true;
+ }
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.14/12.14-6.js b/js/src/tests/test262/ch12/12.14/12.14-6.js new file mode 100644 index 000000000..ae31f846e --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/12.14-6.js @@ -0,0 +1,33 @@ +/// 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.
+/**
+ * local vars must not be visible outside with block
+ * local functions must not be visible outside with block
+ * local function expresssions should not be visible outside with block
+ * local vars must shadow outer vars
+ * local functions must shadow outer functions
+ * local function expresssions must shadow outer function expressions
+ * eval should use the appended object to the scope chain
+ *
+ * @path ch12/12.14/12.14-6.js
+ * @description catch introduces scope - block-local function expression must shadow outer function expression
+ */
+
+
+function testcase() {
+ var o = {foo : function () { return 42;}};
+
+ try {
+ throw o;
+ }
+ catch (e) {
+ var foo = function () {};
+ if (foo() === undefined) {
+ return true;
+ }
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.14/12.14-7.js b/js/src/tests/test262/ch12/12.14/12.14-7.js new file mode 100644 index 000000000..b7f8dbc36 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/12.14-7.js @@ -0,0 +1,39 @@ +/// 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.
+/**
+ * local vars must not be visible outside with block
+ * local functions must not be visible outside with block
+ * local function expresssions should not be visible outside with block
+ * local vars must shadow outer vars
+ * local functions must shadow outer functions
+ * local function expresssions must shadow outer function expressions
+ * eval should use the appended object to the scope chain
+ *
+ * @path ch12/12.14/12.14-7.js
+ * @description catch introduces scope - scope removed when exiting catch block
+ */
+
+
+function testcase() {
+ var o = {foo: 1};
+ var catchAccessed = false;
+
+ try {
+ throw o;
+ }
+ catch (expObj) {
+ catchAccessed = (expObj.foo == 1);
+ }
+
+ try {
+ expObj;
+ }
+ catch (e) {
+ return catchAccessed && e instanceof ReferenceError
+ }
+ return false;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.14/12.14-8.js b/js/src/tests/test262/ch12/12.14/12.14-8.js new file mode 100644 index 000000000..d2e059cd9 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/12.14-8.js @@ -0,0 +1,34 @@ +/// 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.
+/**
+ * local vars must not be visible outside with block
+ * local functions must not be visible outside with block
+ * local function expresssions should not be visible outside with block
+ * local vars must shadow outer vars
+ * local functions must shadow outer functions
+ * local function expresssions must shadow outer function expressions
+ * eval should use the appended object to the scope chain
+ *
+ * @path ch12/12.14/12.14-8.js
+ * @description catch introduces scope - scope removed when exiting catch block (properties)
+ */
+
+
+function testcase() {
+ var o = {foo: 42};
+
+ try {
+ throw o;
+ }
+ catch (e) {
+ var foo = 1;
+ }
+
+ if (o.foo === 42) {
+ return true;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.14/12.14-9.js b/js/src/tests/test262/ch12/12.14/12.14-9.js new file mode 100644 index 000000000..2236dd169 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/12.14-9.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.
+/**
+ * @path ch12/12.14/12.14-9.js
+ * @description catch introduces scope - name lookup finds outer variable
+ */
+
+
+function testcase() {
+ function f(o) {
+ var x = 42;
+
+ function innerf(o) {
+ try {
+ throw o;
+ }
+ catch (e) {
+ return x;
+ }
+ }
+
+ return innerf(o);
+ }
+
+ if (f({}) === 42) {
+ return true;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.14/12.14.1/12.14.1-1-s.js b/js/src/tests/test262/ch12/12.14/12.14.1/12.14.1-1-s.js new file mode 100644 index 000000000..894a13501 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/12.14.1/12.14.1-1-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.
+/**
+ * @path ch12/12.14/12.14.1/12.14.1-1-s.js
+ * @description Strict Mode - SyntaxError is thrown if a TryStatement with a Catch occurs within strict code and the Identifier of the Catch production is eval
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+
+ try {
+ eval("\
+ try {} catch (eval) { }\
+ ");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.14/12.14.1/12.14.1-1gs.js b/js/src/tests/test262/ch12/12.14/12.14.1/12.14.1-1gs.js new file mode 100644 index 000000000..04708c31e --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/12.14.1/12.14.1-1gs.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.14/12.14.1/12.14.1-1gs.js
+ * @description Strict Mode - SyntaxError is thrown if a TryStatement with a Catch occurs within strict code and the Identifier of the Catch production is eval
+ * @onlyStrict
+ * @negative ^((?!NotEarlyError).)*$
+ */
+
+"use strict";
+throw NotEarlyError;
+try { } catch (eval) { }
diff --git a/js/src/tests/test262/ch12/12.14/12.14.1/12.14.1-2-s.js b/js/src/tests/test262/ch12/12.14/12.14.1/12.14.1-2-s.js new file mode 100644 index 000000000..b0e660bd0 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/12.14.1/12.14.1-2-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.
+/**
+ * @path ch12/12.14/12.14.1/12.14.1-2-s.js
+ * @description Strict Mode - SyntaxError is thrown if a TryStatement with a Catch occurs within strict code and the Identifier of the Catch production is arguments
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+
+ try {
+ eval("\
+ try {} catch (arguments) { }\
+ ");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.14/12.14.1/12.14.1-3-s.js b/js/src/tests/test262/ch12/12.14/12.14.1/12.14.1-3-s.js new file mode 100644 index 000000000..3c477785b --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/12.14.1/12.14.1-3-s.js @@ -0,0 +1,33 @@ +/// 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.14/12.14.1/12.14.1-3-s.js
+ * @description Strict Mode - SyntaxError isn't thrown if a TryStatement with a Catch occurs within strict code and the Identifier of the Catch production is EVAL but throws SyntaxError if it is eval
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+
+ try{ eval(" try { \
+ throw new Error(\"...\");\
+ return false;\
+ } catch (EVAL) {\
+ try\
+ {\
+ throw new Error(\"...\");\
+ }catch(eval)\
+ {\
+ return EVAL instanceof Error;\
+ }\
+ }");
+ return false;
+ } catch(e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.14/12.14.1/12.14.1-4-s.js b/js/src/tests/test262/ch12/12.14/12.14.1/12.14.1-4-s.js new file mode 100644 index 000000000..58f372cba --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/12.14.1/12.14.1-4-s.js @@ -0,0 +1,23 @@ +/// 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.14/12.14.1/12.14.1-4-s.js
+ * @description Strict Mode - SyntaxError isn't thrown if a TryStatement with a Catch occurs within strict code and the Identifier of the Catch production is EVAL
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+
+ try {
+ throw new Error("...");
+ return false;
+ } catch (EVAL) {
+ return EVAL instanceof Error;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.14/12.14.1/12.14.1-5-s.js b/js/src/tests/test262/ch12/12.14/12.14.1/12.14.1-5-s.js new file mode 100644 index 000000000..84e85593a --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/12.14.1/12.14.1-5-s.js @@ -0,0 +1,23 @@ +/// 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.14/12.14.1/12.14.1-5-s.js
+ * @description Strict Mode - SyntaxError isn't thrown if a TryStatement with a Catch occurs within strict code and the Identifier of the Catch production is Arguments
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+
+ try {
+ throw new Error("...");
+ return false;
+ } catch (Arguments) {
+ return Arguments instanceof Error;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.14/12.14.1/12.14.1-6-s.js b/js/src/tests/test262/ch12/12.14/12.14.1/12.14.1-6-s.js new file mode 100644 index 000000000..edd8bb558 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/12.14.1/12.14.1-6-s.js @@ -0,0 +1,23 @@ +/// 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.14/12.14.1/12.14.1-6-s.js
+ * @description Strict Mode - SyntaxError isn't thrown if a TryStatement with a Catch occurs within strict code and the Identifier of the Catch production is ARGUMENTS
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+
+ try {
+ throw new Error("...");
+ return false;
+ } catch (ARGUMENTS) {
+ return ARGUMENTS instanceof Error;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.14/12.14.1/browser.js b/js/src/tests/test262/ch12/12.14/12.14.1/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/12.14.1/browser.js diff --git a/js/src/tests/test262/ch12/12.14/12.14.1/shell.js b/js/src/tests/test262/ch12/12.14/12.14.1/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/12.14.1/shell.js diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A1.js b/js/src/tests/test262/ch12/12.14/S12.14_A1.js new file mode 100644 index 000000000..894376009 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A1.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The production TryStatement : try Block Catch is evaluated as follows: 2. If Result(1).type is not throw, return Result(1) + * + * @path ch12/12.14/S12.14_A1.js + * @description Executing TryStatement : try Block Catch. The statements doesn't cause actual exceptions + */ + +// CHECK#1 +try { + var x=0; +} +catch (e) { + $ERROR('#1: If Result(1).type is not throw, return Result(1). Actual: 4 Return(Result(3))'); +} + +// CHECK#2 +var c1=0; +try{ + var x1=1; +} +finally +{ + c1=1; +} +if(x1!==1){ + $ERROR('#2.1: "try" block must be evaluated. Actual: try Block has not been evaluated'); +} +if (c1!==1){ + $ERROR('#2.2: "finally" block must be evaluated. Actual: finally Block has not been evaluated'); +} + +// CHECK#3 +var c2=0; +try{ + var x2=1; +} +catch(e){ + $ERROR('#3.1: If Result(1).type is not throw, return Result(1). Actual: 4 Return(Result(3))'); +} +finally{ + c2=1; +} +if(x2!==1){ + $ERROR('#3.2: "try" block must be evaluated. Actual: try Block has not been evaluated'); +} +if (c2!==1){ + $ERROR('#3.3: "finally" block must be evaluated. Actual: finally Block has not been evaluated'); +} + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A10_T1.js b/js/src/tests/test262/ch12/12.14/S12.14_A10_T1.js new file mode 100644 index 000000000..c7a7c4651 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A10_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. + +/** + * Using "try" with "catch" or "finally" statement within/without a "while" statement + * + * @path ch12/12.14/S12.14_A10_T1.js + * @description Throwing exception while executing iteration statement placed into try Block + */ + +// CHECK#1 +var i=0; +try{ +while(i<10){ + if(i===5) throw i; + i++; +} +} +catch(e){ + if(e!==5)$ERROR('#1: Exception === 5. Actual: Exception ==='+ e ); +} + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A10_T2.js b/js/src/tests/test262/ch12/12.14/S12.14_A10_T2.js new file mode 100644 index 000000000..1826b48a8 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A10_T2.js @@ -0,0 +1,116 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Using "try" with "catch" or "finally" statement within/without a "while" statement + * + * @path ch12/12.14/S12.14_A10_T2.js + * @description Try statement inside loop, where use continue loop + */ + +// CHECK#1 +var c1=0,fin=0; +while(c1<2){ + try{ + c1+=1; + continue; + } + catch(er1){} + finally{ + fin=1; + } + fin=-1; +}; +if(fin!==1){ + $ERROR('#1: "finally" block must be evaluated at "try{continue} catch finally" construction'); +} + +// CHECK#2 +var c2=0,fin2=0; +while(c2<2){ + try{ + throw "ex1"; + } + catch(er1){ + c2+=1; + continue; + } + finally{ + fin2=1; + } + fin2=-1; +} +if(fin2!==1){ + $ERROR('#2: "finally" block must be evaluated at "try catch{continue} finally" construction'); +} + +// CHECK#3 +var c3=0,fin3=0; +while(c3<2){ + try{ + throw "ex1"; + } + catch(er1){ + c3+=1; + } + finally{ + fin3=1; + continue; + } + fin3=0; +} +if(fin3!==1){ + $ERROR('#3: "finally" block must be evaluated at "try catch finally{continue}" construction'); +} + +// CHECK#4 +var c4=0,fin4=0; +while(c4<2){ + try{ + c4+=1; + continue; + } + finally{ + fin4=1; + } + fin4=-1; +}; +if(fin4!==1){ + $ERROR('#4: "finally" block must be evaluated at "try{continue} finally" construction'); +} + +// CHECK#5 +var c5=0; +while(c5<2){ + try{ + throw "ex1"; + } + catch(er1){ + c5+=1; + continue; + } +} +if(c5!==2){ + $ERROR('#5: "try catch{continue}" must work correctly'); +} + +// CHECK#6 +var c6=0,fin6=0; +while(c6<2){ + try{ + c6+=1; + throw "ex1" + } + finally{ + fin6=1; + continue; + } + fin6=-1; +} +if(fin6!==1){ + $ERROR('#6.1: "finally" block must be evaluated'); +} +if(c6!==2){ + $ERROR('#6.2: "try finally{continue}" must work correctly'); +} + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A10_T3.js b/js/src/tests/test262/ch12/12.14/S12.14_A10_T3.js new file mode 100644 index 000000000..88e56168a --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A10_T3.js @@ -0,0 +1,151 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Using "try" with "catch" or "finally" statement within/without a "while" statement + * + * @path ch12/12.14/S12.14_A10_T3.js + * @description Try statement inside loop, where use break + */ + +// CHECK#1 +var c1=0,fin=0; +while(c1<2){ + try{ + c1+=1; + break; + } + catch(er1){} + finally{ + fin=1; + } + fin=-1; + c1+=2; +} +if(fin!==1){ + $ERROR('#1.1: "finally" block must be evaluated'); +} +if(c1!==1){ + $ERROR('#1.2: "try{break}catch finally" must work correctly'); +} + +// CHECK#2 +var c2=0,fin2=0; +while(c2<2){ + try{ + throw "ex1"; + } + catch(er1){ + c2+=1; + break; + } + finally{ + fin2=1; + } + c2+=2; + fin2=-1; +} +if(fin2!==1){ + $ERROR('#2.1: "finally" block must be evaluated'); +} +if(c2!==1){ + $ERROR('#2.2: "try catch{break} finally" must work correctly'); +} + +// CHECK#3 +var c3=0,fin3=0; +while(c3<2){ + try{ + throw "ex1"; + } + catch(er1){ + c3+=1; + } + finally{ + fin3=1; + break; + } + c3+=2; + fin3=0; +} +if(fin3!==1){ + $ERROR('#3.1: "finally" block must be evaluated'); +} +if(c3!==1){ + $ERROR('#3.2: "try catch finally{break}" must work correctly'); +} + +// CHECK#4 +var c4=0,fin4=0; +while(c4<2){ + try{ + c4+=1; + break; + } + finally{ + fin4=1; + } + fin4=-1; + c4+=2; +} +if(fin4!==1){ + $ERROR('#4.1: "finally" block must be evaluated'); +} +if(c4!==1){ + $ERROR('#4.2: "try{break} finally" must work correctly'); +} + +// CHECK#5 +var c5=0; +while(c5<2){ + try{ + throw "ex1"; + } + catch(er1){ + break; + } +} +if(c5!==0){ + $ERROR('#5: "try catch{break}" must work correctly'); +} + +// CHECK#6 +var c6=0; +while(c6<2){ + try{ + c6+=1; + break; + } + catch(er1){} + c6+=2; +} +if(c6!==1){ + $ERROR('#6: "try{break} catch" must work correctly'); +} + +// CHECK#7 +var c7=0,fin7=0; +try{ + while(c7<2){ + try{ + c7+=1; + throw "ex1"; + } + finally{ + fin7=1; + break; + } + fin7=-1; + c7+=2; + } +} +catch(ex1){ + c7=10; +} +if(fin7!==1){ + $ERROR('#7.1: "finally" block must be evaluated'); +} +if(c7!==1){ + $ERROR('#7.2: "try finally{break}" must work correctly'); +} + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A10_T4.js b/js/src/tests/test262/ch12/12.14/S12.14_A10_T4.js new file mode 100644 index 000000000..926e564d3 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A10_T4.js @@ -0,0 +1,56 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Using "try" with "catch" or "finally" statement within/without a "while" statement + * + * @path ch12/12.14/S12.14_A10_T4.js + * @description Try statement inside loop, where combinate using break and continue + */ + +// CHECK#1 +var c1=0,fin=0; +while(c1<2){ + try{ + c1+=1; + break; + } + catch(er1){} + finally{ + fin=1; + continue; + } + fin=-1; + c1+=2; +} +if(fin!==1){ + $ERROR('#1.1: "finally" block must be evaluated'); +} +if(c1!==2){ + $ERROR('#1.2: "try{break} catch finally{continue}" must work correctly'); +} + +// CHECK#2 +var c2=0,fin2=0; +while(c2<2){ + try{ + throw "ex1"; + } + catch(er1){ + c2+=1; + break; + } + finally{ + fin2=1; + continue; + } + c2+=2; + fin2=-1; +} +if(fin2!==1){ + $ERROR('#2.1: "finally" block must be evaluated'); +} +if(c2!==2){ + $ERROR('#2.2: "try catch{break} finally{continue} must work correctly'); +} + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A10_T5.js b/js/src/tests/test262/ch12/12.14/S12.14_A10_T5.js new file mode 100644 index 000000000..e840e9395 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A10_T5.js @@ -0,0 +1,39 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Using "try" with "catch" or "finally" statement within/without a "while" statement + * + * @path ch12/12.14/S12.14_A10_T5.js + * @description Throw some exceptions from different place of loop body + */ + +// CHECK#1 +var c=0, i=0; +var fin=0; +while(i<10){ + i+=1; + try{ + if(c===0){ + throw "ex1"; + $ERROR('#1.1: throw "ex1" lead to throwing exception'); + } + c+=2; + if(c===1){ + throw "ex2"; + $ERROR('#1.2: throw "ex2" lead to throwing exception'); + } + } + catch(er1){ + c-=1; + continue; + $ERROR('#1.3: "try catch{continue} finally" must work correctly'); + } + finally{ + fin+=1; + } +} +if(fin!==10){ + $ERROR('#1.4: "finally" block must be evaluated'); +} + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A11_T1.js b/js/src/tests/test262/ch12/12.14/S12.14_A11_T1.js new file mode 100644 index 000000000..41cfdb0a5 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_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. + +/** + * Using "try" with "catch" or "finally" statement within/without a "for" statement + * + * @path ch12/12.14/S12.14_A11_T1.js + * @description Loop inside try Block, where throw exception + */ + +// CHECK#1 +try{ + for(var i=0;i<10;i++){ + if(i===5) throw i; + } +} +catch(e){ + if(e!==5)$ERROR('#1: Exception === 5. Actual: Exception ==='+ e ); +} + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A11_T2.js b/js/src/tests/test262/ch12/12.14/S12.14_A11_T2.js new file mode 100644 index 000000000..7453936fd --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A11_T2.js @@ -0,0 +1,123 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Using "try" with "catch" or "finally" statement within/without a "for" statement + * + * @path ch12/12.14/S12.14_A11_T2.js + * @description Try statement inside loop, where use continue loop + */ + +// CHECK#1 +var fin=0; +for(var i=0;i<5;i++){ + try{ + i+=1; + continue; + } + catch(er1){} + finally{ + fin=1; + } + fin=-1; +} +if(fin!==1){ + $ERROR('#1: "finally" block must be evaluated at "try{continue} catch finally" construction'); +} + +// CHECK#2 +var c2=0,fin2=0; +for(var i=0;i<5;i++){ + try{ + throw "ex1"; + } + catch(er1){ + c2+=1; + continue; + } + finally{ + fin2=1; + } + fin2=-1; +} +if(fin2!==1){ + $ERROR('#2.1: "finally" block must be evaluated'); +} +if(c2!==5){ + $ERROR('#2.1: "try catch{continue} finally" must work correctly'); +} + +// CHECK#3 +var c3=0,fin3=0; +for(var i=0;i<5;i++){ + try{ + throw "ex1"; + } + catch(er1){ + c3+=1; + } + finally{ + fin3=1; + continue; + } + fin3=0; +} +if(fin3!==1){ + $ERROR('#3.1: "finally" block must be evaluated'); +} +if(c3!==5){ + $ERROR('#3.2: "try catch finally{continue}" must work correctly'); +} + +// CHECK#4 +var fin=0; +for(var i=0;i<5;i++){ + try{ + i+=1; + continue; + } + finally{ + fin=1; + } + fin=-1; +}; +if(fin!==1){ + $ERROR('#4: "finally" block must be evaluated at "try{continue} finally" construction'); +} + +// CHECK#5 +var c5=0; +for(var c5=0;c5<10;){ + try{ + throw "ex1"; + } + catch(er1){ + c5+=1; + continue; + } + c5+=12; +}; +if(c5!==10){ + $ERROR('#5: "try catch{continue} must work correctly'); +} + +// CHECK#6 +var c6=0,fin6=0; +for(var c6=0;c6<10;){ + try{ + c6+=1; + throw "ex1" + } + finally{ + fin6=1; + continue; + } + fin6=-1; +}; +if(fin6!==1){ + $ERROR('#6.1: "finally" block must be evaluated'); +} +if(c6!==10){ + $ERROR('#6.2: "try finally{continue}" must work correctly'); +} + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A11_T3.js b/js/src/tests/test262/ch12/12.14/S12.14_A11_T3.js new file mode 100644 index 000000000..af9976a2d --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A11_T3.js @@ -0,0 +1,150 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Using "try" with "catch" or "finally" statement within/without a "for" statement + * + * @path ch12/12.14/S12.14_A11_T3.js + * @description Try statement inside loop, where use break + */ + +// CHECK#1 +var c1=0,fin=0; +for(var i=0;i<5;i++){ + try{ + c1+=1; + break; + } + catch(er1){} + finally{ + fin=1; + } + fin=-1; + c1+=2; +}; +if(fin!==1){ + $ERROR('#1.1: "finally" block must be evaluated'); +} +if(c1!==1){ + $ERROR('#1.2: "try{break}catch finally" must work correctly'); +} + +// CHECK#2 +var c2=0,fin2=0; +for(var i=0;i<5;i++){ + try{ + throw "ex1"; + } + catch(er1){ + c2+=1; + break; + } + finally{ + fin2=1; + } + c2+=2; + fin2=-1; +}; +if(fin2!==1){ + $ERROR('#2.1: "finally" block must be evaluated'); +} +if(c2!==1){ + $ERROR('#2.2: "try catch{break} finally" must work correctly'); +} + +// CHECK#3 +var c3=0,fin3=0; +for(var i=0;i<5;i++){ + try{ + throw "ex1"; + } + catch(er1){ + c3+=1; + } + finally{ + fin3=1; + break; + } + c3+=2; + fin3=0; +}; +if(fin3!==1){ + $ERROR('#3.1: "finally" block must be evaluated'); +} +if(c3!==1){ + $ERROR('#3.2: "try catch finally{break}" must work correctly'); +} + +// CHECK#4 +var c4=0,fin4=0; +for(var i=0;i<5;i++){ + try{ + c4+=1; + break; + } + finally{ + fin4=1; + } + fin4=-1; + c4+=2; +}; +if(fin4!==1){ + $ERROR('#4.1: "finally" block must be evaluated'); +} +if(c4!==1){ + $ERROR('#4.2: "try{break} finally" must work correctly'); +} + +// CHECK#5 +for(var i=0;i<5;i++){ + try{ + throw "ex1"; + } + catch(er1){ + break; + } +}; +if(i!==0){ + $ERROR('#5: "try catch{break}" must work correctly'); +} + +// CHECK#6 +var c6=0; +for(var c6=0;c6<5;){ + try{ + c6+=1; + break; + } + catch(er1){} + c6+=2; +}; +if(c6!==1){ + $ERROR('#6: "try{break} catch" must work correctly'); +} + +// CHECK#7 +var c7=0,fin7=0; +try{ + for(var c7=0;c7<5;){ + try{ + c7+=1; + throw "ex1"; + } + finally{ + fin7=1; + break; + } + fin7=-1; + c7+=2; + } +} +catch(ex1){ + c7=10; +} +if(fin7!==1){ + $ERROR('#7.1: "finally" block must be evaluated'); +} +if(c7!==1){ + $ERROR('#7.2: "try finally{break}" must work correctly'); +} + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A11_T4.js b/js/src/tests/test262/ch12/12.14/S12.14_A11_T4.js new file mode 100644 index 000000000..6f4762beb --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A11_T4.js @@ -0,0 +1,56 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Using "try" with "catch" or "finally" statement within/without a "for" statement + * + * @path ch12/12.14/S12.14_A11_T4.js + * @description Try statement inside loop, where combinate using break and continue + */ + +// CHECK#1 +var c1=0,fin=0; +for(var i=0;i<5;i++){ + try{ + c1+=1; + break; + } + catch(er1){} + finally{ + fin=1; + continue; + } + fin=-1; + c1+=2; +} +if(fin!==1){ + $ERROR('#1.1: "finally" block must be evaluated'); +} +if(c1!==5){ + $ERROR('#1.2: "try{break} catch finally{continue}" must work correctly'); +} + +// CHECK#2 +var c2=0,fin2=0; +for(var i=0;i<5;i++){ + try{ + throw "ex1"; + } + catch(er1){ + c2+=1; + break; + } + finally{ + fin2=1; + continue; + } + c2+=2; + fin2=-1; +} +if(fin2!==1){ + $ERROR('#2.1: "finally" block must be evaluated'); +} +if(c2!==5){ + $ERROR('#2.2: "try catch{break} finally{continue}" must work correctly'); +} + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A12_T1.js b/js/src/tests/test262/ch12/12.14/S12.14_A12_T1.js new file mode 100644 index 000000000..b6906b1b8 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A12_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. + +/** + * Using "try" with "catch" or "finally" statement within/without a "for-in" statement + * + * @path ch12/12.14/S12.14_A12_T1.js + * @description Loop inside try Block, where throw exception + */ + +var x; +var mycars = new Array(); +mycars[0] = "Saab"; +mycars[1] = "Volvo"; +mycars[2] = "BMW"; + +// CHECK#1 +try{ + for (x in mycars){ + if (mycars[x]==="BMW") throw "ex"; + } +} +catch(e){ + if(e!=="ex")$ERROR('#1: Exception ==="ex". Actual: Exception ==='+ e ); +} + + + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A12_T2.js b/js/src/tests/test262/ch12/12.14/S12.14_A12_T2.js new file mode 100644 index 000000000..6a6729962 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A12_T2.js @@ -0,0 +1,132 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Using "try" with "catch" or "finally" statement within/without a "for-in" statement + * + * @path ch12/12.14/S12.14_A12_T2.js + * @description Try statement inside loop, where use continue loop + */ + +var x; +var mycars = new Array(); +mycars[0] = "Saab"; +mycars[1] = "Volvo"; +mycars[2] = "BMW"; + +// CHECK#1 +var fin=0; +var i=0; +for (x in mycars){ + try{ + i+=1; + continue; + } + catch(er1){} + finally{ + fin=1; + } + fin=-1; +} +if(fin!==1){ + $ERROR('#1.1: "finally" block must be evaluated'); +} +if(i!==3){ + $ERROR('#1.2: "try{continue} catch finally" must work correctly'); +} + +// CHECK#2 +var c2=0,fin2=0; +for (x in mycars){ + try{ + throw "ex1"; + } + catch(er1){ + c2+=1; + continue; + } + finally{ + fin2=1; + } + fin2=-1; +} +if(fin2!==1){ + $ERROR('#2.1: "finally" block must be evaluated'); +} +if(c2!==3){ + $ERROR('#2.1: "try catch{continue} finally" must work correctly'); +} + +// CHECK#3 +var c3=0,fin3=0; +for (x in mycars){ + try{ + throw "ex1"; + } + catch(er1){ + c3+=1; + } + finally{ + fin3=1; + continue; + } + fin3=0; +} +if(c3!==3){ + $ERROR('#3.1: "finally" block must be evaluated'); +} +if(fin3!==1){ + $ERROR('#3.2: "try catch finally{continue}" must work correctly'); +} + +// CHECK#4 +var fin=0; +for (x in mycars){ + try{ + continue; + } + finally{ + fin=1; + } + fin=-1; +} +if(fin!==1){ + $ERROR('#4: "finally" block must be evaluated at "try{continue} finally" construction'); +} + +// CHECK#5 +var c5=0; +for (x in mycars){ + try{ + throw "ex1"; + } + catch(er1){ + c5+=1; + continue; + } + c5+=12; +} +if(c5!==3){ + $ERROR('#5: "try catch{continue}" must work correctly'); +} + +// CHECK#6 +var c6=0,fin6=0; +for (x in mycars){ + try{ + c6+=1; + throw "ex1"; + } + finally{ + fin6=1; + continue; + } + fin6=-1; +} +if(fin6!==1){ + $ERROR('#6.1: "finally" block must be evaluated'); +} +if(c6!==3){ + $ERROR('#6.2: "try finally{continue}" must work correctly'); +} + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A12_T3.js b/js/src/tests/test262/ch12/12.14/S12.14_A12_T3.js new file mode 100644 index 000000000..d3b4cea0c --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A12_T3.js @@ -0,0 +1,162 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Using "try" with "catch" or "finally" statement within/without a "for-in" statement + * + * @path ch12/12.14/S12.14_A12_T3.js + * @description Try statement inside loop, where use break + */ + +var x; +var mycars = new Array(); +mycars[0] = "Saab"; +mycars[1] = "Volvo"; +mycars[2] = "BMW"; + +// CHECK#1 +var c1=0,fin=0; +for (x in mycars){ + try{ + c1+=1; + break; + } + catch(er1){ + c1+=1; + } + finally{ + fin=1; + } + fin=-1; + c1+=2; +}; +if(fin!==1){ + $ERROR('#1.1: "finally" block must be evaluated'); +} +if(c1!==1){ + $ERROR('#1.2: "try{break}catch finally" must work correctly'); +} + +// CHECK#2 +var c2=0,fin2=0; +for (x in mycars){ + try{ + throw "ex1"; + } + catch(er1){ + c2+=1; + break; + } + finally{ + fin2=1; + } + c2+=2; + fin2=-1; +} +if(fin2!==1){ + $ERROR('#2.1: "finally" block must be evaluated'); +} +if(c2!==1){ + $ERROR('#2.2: "try catch{break} finally" must work correctly'); +} + +// CHECK#3 +var c3=0,fin3=0; +for (x in mycars){ + try{ + throw "ex1"; + } + catch(er1){ + c3+=1; + } + finally{ + fin3=1; + break; + } + c3+=2; + fin3=0; +} +if(fin3!==1){ + $ERROR('#3.1: "finally" block must be evaluated'); +} +if(c3!==1){ + $ERROR('#3.2: "try catch finally{break}" must work correctly'); +} + +// CHECK#4 +var c4=0,fin4=0; +for (x in mycars){ + try{ + c4+=1; + break; + } + finally{ + fin4=1; + } + fin4=-1; + c4+=2; +} +if(fin4!==1){ + $ERROR('#4.1: "finally" block must be evaluated'); +} +if(c4!==1){ + $ERROR('#4.2: "try{break} finally" must work correctly'); +} + +// CHECK#5 +var c5=0; +for (x in mycars){ + try{ + throw "ex1"; + c5++; + } + catch(er1){ + break; + c5++; + } + c5++; +} +if(c5!==0){ + $ERROR('#5: "try catch{break}" must work correctly'); +} + +// CHECK#6 +var c6=0; +for (x in mycars){ + try{ + c6+=1; + break; + } + catch(er1){} + c6+=2; +} +if(c6!==1){ + $ERROR('#6: "try{break} catch" must work correctly'); +} + +// CHECK#7 +var c7=0,fin7=0; +try{ + for (x in mycars){ + try{ + c7+=1; + throw "ex1"; + } + finally{ + fin7=1; + break; + } + fin7=-1; + c7+=2; + } +} +catch(ex1){ + c7=10; +} +if(fin7!==1){ + $ERROR('#7.1: "finally" block must be evaluated'); +} +if(c7!==1){ + $ERROR('#7.2: "try finally{break}" must work correctly'); +} + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A12_T4.js b/js/src/tests/test262/ch12/12.14/S12.14_A12_T4.js new file mode 100644 index 000000000..c09b4e2e7 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A12_T4.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Using "try" with "catch" or "finally" statement within/without a "for-in" statement + * + * @path ch12/12.14/S12.14_A12_T4.js + * @description Try statement inside loop, where combinate using break and continue + */ + +var x; +var mycars = new Array(); +mycars[0] = "Saab"; +mycars[1] = "Volvo"; +mycars[2] = "BMW"; + +// CHECK#1 +var c1=0,fin=0; +for (x in mycars){ + try{ + c1+=1; + break; + } + catch(er1){} + finally{ + fin=1; + continue; + } + fin=-1; + c1+=2; +} +if(fin!==1){ + $ERROR('#1.1: "finally" block must be evaluated'); +} +if(c1!==3){ + $ERROR('#1.2: "try{break} catch finally{continue}" must work correctly'); +} + +// CHECK#2 +var c2=0,fin2=0; +for (x in mycars){ + try{ + throw "ex1"; + } + catch(er1){ + c2+=1; + break; + } + finally{ + fin2=1; + continue; + } + c2+=2; + fin2=-1; +} +if(fin2!==1){ + $ERROR('#2.1: "finally" block must be evaluated'); +} +if(c2!==3){ + $ERROR('#2.2: "try catch{break} finally{continue}" must work correctly'); +} + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A13_T1.js b/js/src/tests/test262/ch12/12.14/S12.14_A13_T1.js new file mode 100644 index 000000000..ab3b79d4d --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A13_T1.js @@ -0,0 +1,79 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Using "try" with "catch" or "finally" statement with a "return" statement + * + * @path ch12/12.14/S12.14_A13_T1.js + * @description Using try/catch syntax construction + */ + +// CHECK#1 +function myFunction1(){ + try{ + return 1; + } + catch(err){ + $ERROR('#1.1: "return 1" inside function does not lead to throwing exception'); + return 0; + } + return 2; +} +var x1=myFunction1(); +if(x1!==1){ + $ERROR('#1.2: x1===1. Actual: x1==='+x1); +} + +// CHECK#2 +function myFunction2(){ + try{ + throw "exc"; + return 1; + }catch(err){ + return 2; + } + return 3; +} +var x2=myFunction2(); +if (x2!==2){ + $ERROR('#2: x2===2. Actual: x2==='+x2); +} + +// CHECK#3 +function myFunction3(){ + try{ + return someValue; + }catch(err){ + return 1; + } + return 2; +} +var x3=myFunction3(); +if (x3!==1){ + $ERROR('#3: x3===1. Actual: x3==='+x3); +} + +// CHECK#4 +function myFunction4(){ + try{ + throw "ex1"; + return 1; + }catch(err){ + throw "ex2" + return 0; + } + return 2; +} +try{ + var x4=myFunction4(); + $ERROR('#4.1: Throwing exception inside function lead to throwing exception outside this function'); +} +catch(e){ + if(e==="ex1"){ + $ERROR('#4.2: Exception !=="ex1". Actual: catch previous exception'); + } + if(e!=="ex2"){ + $ERROR('#4.3: Exception ==="ex2". Actual: Exception ==='+ e ); + } +} + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A13_T2.js b/js/src/tests/test262/ch12/12.14/S12.14_A13_T2.js new file mode 100644 index 000000000..947926476 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A13_T2.js @@ -0,0 +1,182 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Using "try" with "catch" or "finally" statement with a "return" statement + * + * @path ch12/12.14/S12.14_A13_T2.js + * @description Using try/finally syntax construction + */ + +// CHECK#1 +var c1=0; +function myFunction1(){ + try{ + return 1; + }finally{ + c1=1; + } + return 2; +} +var x1=myFunction1(); +if(x1!==1){ + $ERROR('#1.1: x1===1. Actual: x1==='+x1); +} +if (c1!==1){ + $ERROR('#1.2: "finally" block must be evaluated'); +} + +// CHECK#2 +var c2=0; +function myFunction2(){ + try{ + throw "exc"; + return 1; + }finally{ + c2=1; + } + return 2; +} +try{ + var x2=myFunction2(); + $ERROR('#2.1: Throwing exception inside function lead to throwing exception outside this function'); +} +catch(e){ + if (c2!==1){ + $ERROR('#2.2: "finally" block must be evaluated'); + } +} + +// CHECK#3 +var c3=0; +function myFunction3(){ + try{ + return someValue; + }finally{ + c3=1; + } + return 2; +} +try{ + var x3=myFunction3(); + $ERROR('#3.1: Throwing exception inside function lead to throwing exception outside this function'); +} +catch(e){ + if (c3!==1){ + $ERROR('#3.2: "finally" block must be evaluated'); + } +} + +// CHECK#4 +var c4=0; +function myFunction4(){ + try{ + return 1; + }finally{ + c4=1; + throw "exc"; + return 0; + } + return 2; +} +try{ + var x4=myFunction4(); + $ERROR('#4.2: Throwing exception inside function lead to throwing exception outside this function'); +} +catch(e){ + if (c4!==1){ + $ERROR('#4.3: "finally" block must be evaluated'); + } +} + +// CHECK#5 +var c5=0; +function myFunction5(){ + try{ + return 1; + }finally{ + c5=1; + return someValue; + return 0; + } + return 2; +} +try{ + var x5=myFunction5(); + $ERROR('#5.2: Throwing exception inside function lead to throwing exception outside this function'); +} +catch(e){ + if (c5!==1){ + $ERROR('#5.3: "finally" block must be evaluated'); + } +} + +// CHECK#6 +var c6=0; +function myFunction6(){ + try{ + throw "ex1"; + return 1; + }finally{ + c6=1; + throw "ex2"; + return 2; + } + return 3; +} +try{ + var x6=myFunction6(); + $ERROR('#6.1: Throwing exception inside function lead to throwing exception outside this function'); +} +catch(e){ + if(e==="ex1"){ + $ERROR('#6.2: Exception !=="ex1". Actual: catch previous exception'); + } + if(e!=="ex2"){ + $ERROR('#6.3: Exception !=="ex1". Actual: '+e); + } + if (c6!==1){ + $ERROR('#6.4: "finally" block must be evaluated'); + } +} + +// CHECK#7 +var c7=0; +function myFunction7(){ + try{ + return 1; + }finally{ + c7=1; + return 2; + } + return 3; +} +var x7=myFunction7(); +if(x7!==2){ + $ERROR('#7.1: "catch" block must be evaluated'); +} +if (c7!==1){ + $ERROR('#7.2: "finally" block must be evaluated'); +} + +// CHECK#8 +var c8=0; +function myFunction8(){ + try{ + throw "ex1"; + }finally{ + c8=1; + return 2; + } + return 3; +} +try{ + var x8=myFunction8(); +} +catch(ex1){ + c8=10; +} +if (c8!==1){ + $ERROR('#8: "finally" block must be evaluated'); +} + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A13_T3.js b/js/src/tests/test262/ch12/12.14/S12.14_A13_T3.js new file mode 100644 index 000000000..9b3e4a3e9 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A13_T3.js @@ -0,0 +1,186 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Using "try" with "catch" or "finally" statement with a "return" statement + * + * @path ch12/12.14/S12.14_A13_T3.js + * @description Using try/catch/finally syntax construction + */ + +// CHECK#1 +var c1=0; +function myFunction1(){ + try{ + return 1; + }catch(err){ + $ERROR('#1.1: "return 1" inside function does not lead to throwing exception'); + return 0; + }finally{ + c1=1; + } + return 2; +} +var x1=myFunction1(); +if(x1!==1){ + $ERROR('#1.3: x1===1. Actual: x1==='+x1); +} +if (c1!==1){ + $ERROR('#1.4: "finally" block must be evaluated'); +} + +// CHECK#2 +var c2=0; +function myFunction2(){ + try{ + throw "exc"; + return 1; + }catch(err){ + return 0; + }finally{ + c2=1; + } + return 2; +} +var x2=myFunction2(); +if (c2!==1){ + $ERROR('#2.1: "finally" block must be evaluated'); +} +if (x2!==0){ + $ERROR('#2.2: x2===0. Actual: x2==='+x2); +} + +// CHECK#3 +var c3=0; +function myFunction3(){ + try{ + return someValue; + }catch(err){ + return 1; + }finally{ + c3=1; + } + return 2; +} +var x3=myFunction3(); +if (c3!==1){ + $ERROR('#3.1: "finally" block must be evaluated'); +} +if (x3!==1){ + $ERROR('#3.2: x3===1. Actual: x3==='+x3); +} + +// CHECK#4 +var c4=0; +function myFunction4(){ + try{ + throw "ex1"; + return 1; + }catch(err){ + throw "ex2" + return 0; + }finally{ + c4=1; + } + return 2; +} +try{ + var x4=myFunction4(); + $ERROR('#4.1: Throwing exception inside function lead to throwing exception outside this function'); +} +catch(e){ + if(e==="ex1"){ + $ERROR('#4.2: Exception !== "ex1". Actual: catch previous exception'); + } + if(e!=="ex2"){ + $ERROR('#4.3: Exception === "ex2". Actual: Exception ==='+ e ); + } + if (c4!==1){ + $ERROR('#4.4: "finally" block must be evaluated'); + } +} + +// CHECK#5 +var c5=0; +function myFunction5(){ + try{ + throw "ex1"; + return 1; + }catch(err){ + return 0; + }finally{ + c5=1; + throw "ex2"; + } + return 2; +} +try{ + var x5=myFunction5(); + $ERROR('#5.1: Throwing exception inside function lead to throwing exception outside this function'); +} +catch(e){ + if(e==="ex1"){ + $ERROR('#5.2: Exception !== "ex1". Actual: catch previous exception'); + } + if(e!=="ex2"){ + $ERROR('#5.3: Exception === "ex2". Actual: Exception ==='+ e ); + } + if (c5!==1){ + $ERROR('#5.4: "finally" block must be evaluated'); + } +} + +// CHECK#6 +var c6=0; +function myFunction6(){ + try{ + throw "ex1"; + return 1; + }catch(err){ + throw "ex2"; + return 0; + }finally{ + c6=1; + throw "ex3"; + } + return 2; +} +try{ + var x6=myFunction6(); + $ERROR('#6.1: Throwing exception inside function lead to throwing exception outside this function'); +} +catch(e){ + if(e==="ex1"){ + $ERROR('#6.2: Exception !== "ex1". Actual: catch previous exception'); + } + if(e==="ex2"){ + $ERROR('#6.3: Exception !== "ex2". Actual: catch previous exception'); + } + if(e!=="ex3"){ + $ERROR('#6.4: Exception === "ex3". Actual: Exception ==='+ e ); + } + if(c6!==1) $ERROR('#6.5: "finally" block must be evaluated'); +} + +// CHECK#7 +var c7=0; +function myFunction7(){ + try{ + throw "ex1"; + return 1; + }catch(err){ + throw "ex2"; + return 0; + }finally{ + c7=1; + return 2; + } + return 3; +} +try{ + var x7=myFunction7(); + if(x7!==2) $ERROR('#7.1: x7===2. Actual: x7==='+x7); +} +catch(e){} +if(c7!==1) $ERROR('#7.2: "finally" block must be evaluated'); + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A14.js b/js/src/tests/test262/ch12/12.14/S12.14_A14.js new file mode 100644 index 000000000..af2177a05 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A14.js @@ -0,0 +1,79 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Using "try" with "catch" or "finally" statement within/without a "with" statement + * + * @path ch12/12.14/S12.14_A14.js + * @description Using try/catch/finally in With and With in try/catch/finally + * @noStrict + */ + +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} + +// CHECK#1 +try{ + with(myObj){ + throw "ex"; + } +} +catch(e){ + if (e!=="ex") $ERROR('#1: Exception ==="ex". Actual: Exception ==='+ e ); +} + +// CHECK#2 +with(myObj){ + try{ + throw p1; + } + catch(e){ + if (e!=="a") $ERROR('#2.1: Exception ==="a". Actual: Exception ==='+ e ); + p1='pass'; + } +} +if(myObj.p1!=='pass') $ERROR('#2.2: "throw p1" lead to throwing exception'); + +// CHECK#3 +with(myObj){ + try{ + p1='fail'; + throw p2; + } + catch(e){ + if (e!=="b") $ERROR('#3.1: Exception ==="b". Actual: Exception ==='+ e ); + p1='pass'; + } + finally{ + p2='pass'; + } +} +if(myObj.p1!=='pass') $ERROR('#3.2: "throw p2" lead to throwing exception'); +if(myObj.p2!=='pass') $ERROR('#3.3: "finally" block must be evaluated'); + +// CHECK#4 +myObj.p1='fail'; +try{ + with(myObj){ + try{ + throw p3; + } + finally{ + p1='pass'; + } + } +} +catch(e){} +if(myObj.p1!=='pass') $ERROR('#4: "finally" block must be evaluated'); + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A15.js b/js/src/tests/test262/ch12/12.14/S12.14_A15.js new file mode 100644 index 000000000..abd6a63a7 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A15.js @@ -0,0 +1,92 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Using "try" with "catch" or "finally" statement within/without a "switch" statement + * + * @path ch12/12.14/S12.14_A15.js + * @description Insert try/catch/finally to switch statement + */ + +// CHECK#1 +function SwitchTest1(value){ + var result = 0; + try{ + switch(value) { + case 1: + result += 4; + throw result; + break; + default: + result += 32; + break; + case 4: + result += 64; + throw "ex"; + } + return result; + } + catch(e){ + if ((value===1)&&(e!==4)) $ERROR('#1.1: Exception ===4. Actual: Exception ==='+ e ); + if ((value===4)&&(e!=="ex")) $ERROR('#1.2: Exception ==="ex". Actual: Exception ==='+ e ); + } + finally{ + return result; + } +} +if (SwitchTest1(1)!==4) $ERROR('#1.3: SwitchTest1(1)===4. Actual: SwitchTest1(1)==='+ SwitchTest1(1) ); +if (SwitchTest1(4)!==64) $ERROR('#1.4: SwitchTest1(4)===64. Actual: SwitchTest1(4)==='+ SwitchTest1(4) ); + +// CHECK#2 +var c2=0; +function SwitchTest2(value){ + var result = 0; + switch(value) { + case 0: + try{ + result += 2; + break; + } + finally{ + c2=1; + } + case 1: + result += 4; + break; + default: + result += 32; + break; + } + return result; +} +if (SwitchTest2(1)!==4) $ERROR('#2.1: SwitchTest1(1)===4. Actual: SwitchTest1(1)==='+ SwitchTest1(1) ); +if (c2===1) $ERROR('#2.2: Evaluate finally block'); +if (SwitchTest2(0)!==2) $ERROR('#2.3: SwitchTest1(0)===2. Actual: SwitchTest1(0)==='+ SwitchTest1(0) ); +if (c2!==1) $ERROR('#2.4: "finally" block must be evaluated'); + +// CHECK#3 +function SwitchTest3(value){ + var result = 0; + switch(value) { + case 0: + try{ + result += 2; + throw "ex"; + } + finally{ + break; + } + default: + result += 32; + break; + } + return result; +} +try{ + var x3=SwitchTest3(0); + if (x3!==2) $ERROR('#3.1: x3===2. Actual: x3==='+x3); +} +catch(e){ + $ERROR('#3.2: Catching exception inside function does not lead to throwing exception outside this function'); +} + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A16_T1.js b/js/src/tests/test262/ch12/12.14/S12.14_A16_T1.js new file mode 100644 index 000000000..b6e39191b --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A16_T1.js @@ -0,0 +1,14 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally" + * + * @path ch12/12.14/S12.14_A16_T1.js + * @description Checking if pure "try" syntax construction passes + * @negative + */ + +// CHECK#1 +try + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A16_T10.js b/js/src/tests/test262/ch12/12.14/S12.14_A16_T10.js new file mode 100644 index 000000000..2baef30d0 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A16_T10.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. + +/** + * TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally" + * + * @path ch12/12.14/S12.14_A16_T10.js + * @description Catch: "catch (Identifier ) Block" + * @negative + */ + +// CHECK#1 +try{} +catch(){} +finally{} + + + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A16_T11.js b/js/src/tests/test262/ch12/12.14/S12.14_A16_T11.js new file mode 100644 index 000000000..8d8699e6b --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A16_T11.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. + +/** + * TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally" + * + * @path ch12/12.14/S12.14_A16_T11.js + * @description Catch and Finally are placed into the Block of "try" (whitle expected outside) + * @negative + */ + +// CHECK#1 +try{ + { + } + catch(e){} + finally{} +} + + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A16_T12.js b/js/src/tests/test262/ch12/12.14/S12.14_A16_T12.js new file mode 100644 index 000000000..dacc1a6a6 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A16_T12.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. + +/** + * TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally" + * + * @path ch12/12.14/S12.14_A16_T12.js + * @description Embedded "try" statements followed by two "catch" statements + * @negative + */ + +// CHECK#1 +try +{ + try + { + } +} +catch(e1){} +catch(e2){} + + + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A16_T13.js b/js/src/tests/test262/ch12/12.14/S12.14_A16_T13.js new file mode 100644 index 000000000..20b475499 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A16_T13.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. + +/** + * TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally" + * + * @path ch12/12.14/S12.14_A16_T13.js + * @description Catch: "catch (Identifier ) Block". Checking if execution of "22" passes at the place of Identifier of "catch" + * @negative + */ + +// CHECK#1 +try +{ +} +catch("22") +{ +} + + + + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A16_T14.js b/js/src/tests/test262/ch12/12.14/S12.14_A16_T14.js new file mode 100644 index 000000000..dfcbc2c65 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A16_T14.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally" + * + * @path ch12/12.14/S12.14_A16_T14.js + * @description Checking if passing argument to "try" statement fails + * @negative + */ + +// CHECK#1 +try(e1){ +} +catch(e){} + + + + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A16_T15.js b/js/src/tests/test262/ch12/12.14/S12.14_A16_T15.js new file mode 100644 index 000000000..720bf61dd --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A16_T15.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. + +/** + * TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally" + * + * @path ch12/12.14/S12.14_A16_T15.js + * @description Finally: "finally Block". Checking if passing argument to "try" statement fails + * @negative + */ + +// CHECK#1 +try{ +} +finally(e){} + + + + + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A16_T2.js b/js/src/tests/test262/ch12/12.14/S12.14_A16_T2.js new file mode 100644 index 000000000..a3e9421d5 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A16_T2.js @@ -0,0 +1,14 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally" + * + * @path ch12/12.14/S12.14_A16_T2.js + * @description Checking if execution of "catch" with no "try" fails + * @negative + */ + +// CHECK#1 +catch + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A16_T3.js b/js/src/tests/test262/ch12/12.14/S12.14_A16_T3.js new file mode 100644 index 000000000..237580b02 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A16_T3.js @@ -0,0 +1,14 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally" + * + * @path ch12/12.14/S12.14_A16_T3.js + * @description Checking if execution of "finally" with no "try" fails + * @negative + */ + +// CHECK#1 +finally + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A16_T4.js b/js/src/tests/test262/ch12/12.14/S12.14_A16_T4.js new file mode 100644 index 000000000..ae3e45bba --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A16_T4.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally" + * + * @path ch12/12.14/S12.14_A16_T4.js + * @description Catch: "catch (Identifier ) Block". Checking if execution of "catch" that takes no arguments fails + * @negative + */ + +// CHECK#1 +try{} +catch{} + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A16_T5.js b/js/src/tests/test262/ch12/12.14/S12.14_A16_T5.js new file mode 100644 index 000000000..a825e889a --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A16_T5.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally" + * + * @path ch12/12.14/S12.14_A16_T5.js + * @description Catch: "catch (Identifier ) Block". Checking if execution of "catch" with no Block fails + * @negative + */ + +// CHECK#1 +try{} +catch() + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A16_T6.js b/js/src/tests/test262/ch12/12.14/S12.14_A16_T6.js new file mode 100644 index 000000000..8210671c4 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A16_T6.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally" + * + * @path ch12/12.14/S12.14_A16_T6.js + * @description Block: "{ StatementList }". Checking if execution of "try{ catch{}{}" fails + * @negative + */ + +// CHECK#1 +try{ +catch(){} + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A16_T7.js b/js/src/tests/test262/ch12/12.14/S12.14_A16_T7.js new file mode 100644 index 000000000..76990243d --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A16_T7.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally" + * + * @path ch12/12.14/S12.14_A16_T7.js + * @description Block: "{ StatementList }". Checking if execution of "try{} catch(){" fails + * @negative + */ + +// CHECK#1 +try{} +catch(){ + + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A16_T8.js b/js/src/tests/test262/ch12/12.14/S12.14_A16_T8.js new file mode 100644 index 000000000..93774a7b6 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A16_T8.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. + +/** + * TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally" + * + * @path ch12/12.14/S12.14_A16_T8.js + * @description Block: "{ StatementList }". Catch: "catch (Identifier ) Block". Checking if execution of "try{} catch(){finally{}" fails + * @negative + */ + +// CHECK#1 +try{} +catch(){ +finally{} + + + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A16_T9.js b/js/src/tests/test262/ch12/12.14/S12.14_A16_T9.js new file mode 100644 index 000000000..d7fb3308e --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A16_T9.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. + +/** + * TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally" + * + * @path ch12/12.14/S12.14_A16_T9.js + * @description Checking if execution of "catch(){} finally{}" fails + * @negative + */ + +// CHECK#1 +catch(){} +finally{} + + + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A17.js b/js/src/tests/test262/ch12/12.14/S12.14_A17.js new file mode 100644 index 000000000..6878502e6 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A17.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. + +/** + * Using "try" with "catch" or "finally" statement in a constructor + * + * @path ch12/12.14/S12.14_A17.js + * @description Creating exceptions within constructor + */ + +var i=1; +function Integer( value, exception ) { + try{ + this.value = checkValue( value ); + if(exception) $ERROR('#'+i+'.1: Must be exception'); + } + catch(e){ + this.value = e.toString(); + if(!exception) $ERROR('#'+i+'.2: Don`t must be exception'); + } + i++; +} + +function checkValue(value){ + if(Math.floor(value)!=value||isNaN(value)){ + throw (INVALID_INTEGER_VALUE +": " + value); + } + else{ + return value; + } +} + +// CHECK#1 +new Integer(13, false); +// CHECK#2 +new Integer(NaN, true); +// CHECK#3 +new Integer(0, false); +// CHECK#4 +new Integer(Infinity, false); +// CHECK#5 +new Integer(-1.23, true); +// CHECK#6 +new Integer(Math.LN2, true); + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A18_T1.js b/js/src/tests/test262/ch12/12.14/S12.14_A18_T1.js new file mode 100644 index 000000000..635c235d0 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A18_T1.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. + +/** + * Catching objects with try/catch/finally statement + * + * @path ch12/12.14/S12.14_A18_T1.js + * @description Catching undefined + */ + +// CHECK#1 +try{ + throw undefined; +} +catch(e){ + if (e!==undefined) $ERROR('#1: Exception === undefined. Actual: '+e); +} + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A18_T2.js b/js/src/tests/test262/ch12/12.14/S12.14_A18_T2.js new file mode 100644 index 000000000..f6499be27 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A18_T2.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. + +/** + * Catching objects with try/catch/finally statement + * + * @path ch12/12.14/S12.14_A18_T2.js + * @description Catching null + */ + +// CHECK#1 +try{ + throw null; +} +catch(e){ + if (e!==null) $ERROR('#1: Exception ===null. Actual: '+e); +} + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A18_T3.js b/js/src/tests/test262/ch12/12.14/S12.14_A18_T3.js new file mode 100644 index 000000000..1ee0644d1 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A18_T3.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Catching objects with try/catch/finally statement + * + * @path ch12/12.14/S12.14_A18_T3.js + * @description Catching boolean + */ + +// CHECK#1 +try{ + throw true; +} +catch(e){ + if (e!==true) $ERROR('#1: Exception ===true. Actual: Exception ==='+ e ); +} + +// CHECK#2 +try{ + throw false; +} +catch(e){ + if (e!==false) $ERROR('#2: Exception ===false. Actual: Exception ==='+ e ); +} + +// CHECK#3 +var b=false; +try{ + throw b; +} +catch(e){ + if (e!==false) $ERROR('#3: Exception ===false. Actual: Exception ==='+ e ); +} + +// CHECK#4 +var b=true; +try{ + throw b; +} +catch(e){ + if (e!==true) $ERROR('#4: Exception ===true. Actual: Exception ==='+ e ); +} + +// CHECK#5 +var b=true; +try{ + throw b&&false; +} +catch(e){ + if (e!==false) $ERROR('#5: Exception ===false. Actual: Exception ==='+ e ); +} + +// CHECK#5 +var b=true; +try{ + throw b||false; +} +catch(e){ + if (e!==true) $ERROR('#6: Exception ===true. Actual: Exception ==='+ e ); +} + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A18_T4.js b/js/src/tests/test262/ch12/12.14/S12.14_A18_T4.js new file mode 100644 index 000000000..3cd7d9064 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A18_T4.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. + +/** + * Catching objects with try/catch/finally statement + * + * @path ch12/12.14/S12.14_A18_T4.js + * @description Catching string + */ + +// CHECK#1 +try{ + throw "exception #1"; +} +catch(e){ + if (e!=="exception #1") $ERROR('#1: Exception ==="exception #1". Actual: Exception ==='+ e ); +} + +// CHECK#2 +try{ + throw "exception"+" #1"; +} +catch(e){ + if (e!=="exception #1") $ERROR('#2: Exception ==="exception #1". Actual: Exception ==='+ e ); +} + +// CHECK#3 +var b="exception #1"; +try{ + throw b; +} +catch(e){ + if (e!=="exception #1") $ERROR('#3: Exception ==="exception #1". Actual: Exception ==='+ e ); +} + +// CHECK#4 +var a="exception"; +var b=" #1"; +try{ + throw a+b; +} +catch(e){ + if (e!=="exception #1") $ERROR('#4: Exception ==="exception #1". Actual: Exception ==='+ e ); +} + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A18_T5.js b/js/src/tests/test262/ch12/12.14/S12.14_A18_T5.js new file mode 100644 index 000000000..c46c421be --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A18_T5.js @@ -0,0 +1,102 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Catching objects with try/catch/finally statement + * + * @path ch12/12.14/S12.14_A18_T5.js + * @description Catching Number + */ + +// CHECK#1 +try{ + throw 13; +} +catch(e){ + if (e!==13) $ERROR('#1: Exception ===13. Actual: Exception ==='+ e ); +} + +// CHECK#2 +try{ + throw 10+3; +} +catch(e){ + if (e!==13) $ERROR('#2: Exception ===13. Actual: Exception ==='+ e ); +} + +// CHECK#3 +var b=13; +try{ + throw b; +} +catch(e){ + if (e!==13) $ERROR('#3: Exception ===13. Actual: Exception ==='+ e ); +} + +// CHECK#4 +var a=3; +var b=10; +try{ + throw a+b; +} +catch(e){ + if (e!==13) $ERROR('#4: Exception ===13. Actual: Exception ==='+ e ); +} + +// CHECK#5 +try{ + throw 2.13; +} +catch(e){ + if (e!==2.13) $ERROR('#5: Exception ===2.13. Actual: Exception ==='+ e ); +} + +// CHECK#6 +var ex=2/3; +try{ + throw 2/3; +} +catch(e){ + if (e!==ex) $ERROR('#6: Exception ===2/3. Actual: Exception ==='+ e ); +} + +// CHECK#7 +try{ + throw NaN; +} +catch(e){ + if (!isNaN(e)) $ERROR('#7: Exception is NaN'); +} + +// CHECK#8 +try{ + throw +Infinity; +} +catch(e){ + if (e!==+Infinity) $ERROR('#8: Exception ===+Infinity. Actual: Exception ==='+ e ); +} + +// CHECK#9 +try{ + throw -Infinity; +} +catch(e){ + if (e!==-Infinity) $ERROR('#9: Exception ===-Infinity. Actual: Exception ==='+ e ); +} + +// CHECK#10 +try{ + throw +0; +} +catch(e){ + if (e!==+0) $ERROR('#10: Exception ===+0. Actual: Exception ==='+ e ); +} + +// CHECK#11 +try{ + throw -0; +} +catch(e){ + if (e!==-0) $ERROR('#11: Exception ===-0. Actual: Exception ==='+ e ); +} + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A18_T6.js b/js/src/tests/test262/ch12/12.14/S12.14_A18_T6.js new file mode 100644 index 000000000..ca17450b3 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A18_T6.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. + +/** + * Catching objects with try/catch/finally statement + * + * @path ch12/12.14/S12.14_A18_T6.js + * @description Catching Object + */ + +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';}, + i:7, +} + +try{ + throw myObj; +} +catch(e){ +// CHECK#1 + if (e.p1!=="a") $ERROR('#1: e.p1==="a". Actual: e.p1==='+ e.p1 ); +// CHECK#2 + if (e.value!=='myObj_value') $ERROR('#2: e.value===\'myObj_value\'. Actual: e.value==='+ e.value ); +// CHECK#3 + if (e.eval()!=='obj_eval') $ERROR('#3: e.eval()===\'obj_eval\'. Actual: e.eval()==='+ e.eval() ); +} + +// CHECK#4 +myObj.i=6; +try{ + throw myObj; +} +catch(e){} +if (myObj.i!==6) $ERROR('#4: Handling of catch must be correct'); + +// CHECK#5 +myObj.i=6; +try{ + throw myObj; +} +catch(e){ + e.i=10; +} +if (myObj.i!==10) $ERROR('#5: Handling of catch must be correct'); + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A18_T7.js b/js/src/tests/test262/ch12/12.14/S12.14_A18_T7.js new file mode 100644 index 000000000..905cfa0bc --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A18_T7.js @@ -0,0 +1,66 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Catching objects with try/catch/finally statement + * + * @path ch12/12.14/S12.14_A18_T7.js + * @description Catching Array + */ + +var mycars = new Array(); +mycars[0] = "Saab"; +mycars[1] = "Volvo"; +mycars[2] = "BMW"; + +var mycars2 = new Array(); +mycars2[0] = "Mercedes"; +mycars2[1] = "Jeep"; +mycars2[2] = "Suzuki"; + +// CHECK#1 +try{ + throw mycars; +} +catch(e){ + for (var i=0;i<3;i++){ + if (e[i]!==mycars[i]) $ERROR('#1.'+i+': Exception['+i+']===mycars['+i+']. Actual: Exception['+i+']==='+ e[i] ); + } +} + +// CHECK#2 +try{ + throw mycars.concat(mycars2); +} +catch(e){ + for (var i=0;i<3;i++){ + if (e[i]!==mycars[i]) $ERROR('#2.'+i+': Exception['+i+']===mycars['+i+']. Actual: Exception['+i+']==='+ e[i] ); + } + for (var i=3;i<6;i++){ + if (e[i]!==mycars2[i-3]) $ERROR('#2.'+i+': Exception['+i+']===mycars2['+i+']. Actual: Exception['+i+']==='+ e[i] ); + } +} + +// CHECK#3 +try{ + throw new Array("Mercedes","Jeep","Suzuki"); +} +catch(e){ + for (var i=0;i<3;i++){ + if (e[i]!==mycars2[i]) $ERROR('#3.'+i+': Exception['+i+']===mycars2['+i+']. Actual: Exception['+i+']==='+ e[i]); + } +} + +// CHECK#4 +try{ + throw mycars.concat(new Array("Mercedes","Jeep","Suzuki")); +} +catch(e){ + for (var i=0;i<3;i++){ + if (e[i]!==mycars[i]) $ERROR('#4.'+i+': Exception['+i+']===mycars['+i+']. Actual: Exception['+i+']==='+ e[i] ); + } + for (var i=3;i<6;i++){ + if (e[i]!==mycars2[i-3]) $ERROR('#4.'+i+': Exception['+i+']===mycars2['+(i-3)+']. Actual: Exception['+i+']==='+ e[i]); + } +} + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A19_T1.js b/js/src/tests/test262/ch12/12.14/S12.14_A19_T1.js new file mode 100644 index 000000000..c2e8d27a4 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A19_T1.js @@ -0,0 +1,68 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Catching system exceptions of different types with try statement + * + * @path ch12/12.14/S12.14_A19_T1.js + * @description Testing try/catch syntax construction + */ + +// CHECK#1 +try{ + throw (Error("hello")); +} +catch(e){ + if (e.toString()!=="Error: hello") $ERROR('#1: Exception.toString()==="Error: hello". Actual: Exception is '+e); +} + +// CHECK#2 +try{ + throw (new Error("hello")); +} +catch(e){ + if (e.toString()!=="Error: hello") $ERROR('#2: Exception.toString()==="Error: hello". Actual: Exception is '+e); +} + +// CHECK#3 +var c3=0; +try{ + throw EvalError(1); +} +catch(e){ + if (e.toString()!=="EvalError: 1") $ERROR('#3: Exception.toString()==="EvalError: 1". Actual: Exception is '+e); +} + +// CHECK#4 +try{ + throw RangeError(1); +} +catch(e){ + if (e.toString()!=="RangeError: 1") $ERROR('#4: Exception.toString()==="RangeError: 1". Actual: Exception is '+e); +} + +// CHECK#5 +try{ + throw ReferenceError(1); +} +catch(e){ + if (e.toString()!=="ReferenceError: 1") $ERROR('#5: Exception.toString()==="ReferenceError: 1". Actual: Exception is '+e); +} + +// CHECK#6 +var c6=0; +try{ + throw TypeError(1); +} +catch(e){ + if (e.toString()!=="TypeError: 1") $ERROR('#6: Exception.toString()==="TypeError: 1". Actual: Exception is '+e); +} + +// CHECK#7 +try{ + throw URIError("message", "fileName", "1"); +} +catch(e){ + if (e.toString()!=="URIError: message") $ERROR('#7: Exception.toString()==="URIError: message". Actual: Exception is '+e); +} + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A19_T2.js b/js/src/tests/test262/ch12/12.14/S12.14_A19_T2.js new file mode 100644 index 000000000..acc465ea1 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A19_T2.js @@ -0,0 +1,102 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Catching system exceptions of different types with try statement + * + * @path ch12/12.14/S12.14_A19_T2.js + * @description Testing try/catch/finally syntax construction + */ + +var fin=0; +// CHECK#1 +try{ + throw (Error("hello")); +} +catch(e){ + if (e.toString()!=="Error: hello") $ERROR('#1.1: Exception.toString()==="Error: hello". Actual: Exception is '+e); +} +finally{ + fin=1; +} +if (fin!==1) $ERROR('#1.2: "finally" block must be evaluated'); + +// CHECK#2 +fin=0; +try{ + throw (new Error("hello")); +} +catch(e){ + if (e.toString()!=="Error: hello") $ERROR('#2.1: Exception.toString()==="Error: hello". Actual: Exception is '+e); +} +finally{ + fin=1; +} +if (fin!==1) $ERROR('#2.2: "finally" block must be evaluated'); + +// CHECK#3 +fin=0; +var c3=0; +try{ + throw EvalError(1); +} +catch(e){ + if (e.toString()!=="EvalError: 1") $ERROR('#3.1: Exception.toString()==="EvalError: 1". Actual: Exception is '+e); +} +finally{ + fin=1; +} +if (fin!==1) $ERROR('#3.2: "finally" block must be evaluated'); + +// CHECK#4 +fin=0; +try{ + throw RangeError(1); +} +catch(e){ + if (e.toString()!=="RangeError: 1") $ERROR('#4.1: Exception.toString()==="RangeError: 1". Actual: Exception is '+e); +} +finally{ + fin=1; +} +if (fin!==1) $ERROR('#4.2: "finally" block must be evaluated'); + +// CHECK#5 +fin=0; +try{ + throw ReferenceError(1); +} +catch(e){ + if (e.toString()!=="ReferenceError: 1") $ERROR('#5.1: Exception.toString()==="ReferenceError: 1". Actual: Exception is '+e); +} +finally{ + fin=1; +} +if (fin!==1) $ERROR('#5.2: "finally" block must be evaluated'); + +// CHECK#6 +fin=0; +try{ + throw TypeError(1); +} +catch(e){ + if (e.toString()!=="TypeError: 1") $ERROR('#6.1: Exception.toString()==="TypeError: 1". Actual: Exception is '+e); +} +finally{ + fin=1; +} +if (fin!==1) $ERROR('#6.2: "finally" block must be evaluated'); + +// CHECK#7 +fin=0; +try{ + throw URIError("message", "fileName", "1"); +} +catch(e){ + if (e.toString()!=="URIError: message") $ERROR('#7.1: Exception.toString()==="URIError: message". Actual: Exception is '+e); +} +finally{ + fin=1; +} +if (fin!==1) $ERROR('#7.2: "finally" block must be evaluated'); + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A2.js b/js/src/tests/test262/ch12/12.14/S12.14_A2.js new file mode 100644 index 000000000..4185b346f --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A2.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Throwing exception with "throw" and catching it with "try" statement + * + * @path ch12/12.14/S12.14_A2.js + * @description Checking if execution of "catch" catches an exception thrown with "throw" + */ + +// CHECK#1 +try { + throw "catchme"; + $ERROR('#1: throw "catchme" lead to throwing exception'); +} +catch(e){} + +// CHECK#2 +var c2=0; +try{ + try{ + throw "exc"; + $ERROR('#2.1: throw "exc" lead to throwing exception'); + }finally{ + c2=1; + } +} +catch(e){ + if (c2!==1){ + $ERROR('#2.2: "finally" block must be evaluated'); + } +} + +// CHECK#3 +var c3=0; +try{ + throw "exc"; + $ERROR('#3.1: throw "exc" lead to throwing exception'); +} +catch(err){ + var x3=1; +} +finally{ + c3=1; +} +if (x3!==1){ + $ERROR('#3.2: "catch" block must be evaluated'); +} +if (c3!==1){ + $ERROR('#3.3: "finally" block must be evaluated'); +} + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A3.js b/js/src/tests/test262/ch12/12.14/S12.14_A3.js new file mode 100644 index 000000000..b87f6d57c --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A3.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. + +/** + * Catching system exception with "try" statement + * + * @path ch12/12.14/S12.14_A3.js + * @description Checking if execution of "catch" catches system exceptions + */ + +// CHECK#1 +try{ + y; + $ERROR('#1: "y" lead to throwing exception'); +} +catch(e){} + +// CHECK#2 +var c2=0; +try{ + try{ + someValue; + $ERROR('#3.1: "someValues" lead to throwing exception'); + } + finally{ + c2=1; + } +} +catch(e){ + if (c2!==1){ + $ERROR('#3.2: "finally" block must be evaluated'); + } +} + +// CHECK#3 +var c3=0,x3=0; +try{ + x3=someValue; + $ERROR('#3.1: "x3=someValues" lead to throwing exception'); +} +catch(err){ + x3=1; +} +finally{ + c3=1; +} +if (x3!==1){ + $ERROR('#3.2: "catch" block must be evaluated'); +} +if (c3!==1){ + $ERROR('#3.3: "finally" block must be evaluated'); +} + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A4.js b/js/src/tests/test262/ch12/12.14/S12.14_A4.js new file mode 100644 index 000000000..e904f5c9e --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A4.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. + +/** + * Sanity test for "catch(Indetifier) statement" + * + * @path ch12/12.14/S12.14_A4.js + * @description Checking if deleting an exception fails + * @noStrict + */ + +// CHECK#1 +try { + throw "catchme"; + $ERROR('#1.1: throw "catchme" lead to throwing exception'); +} +catch (e) { + if (delete e){ + $ERROR('#1.2: Exception has DontDelete property'); + } + if (e!=="catchme") { + $ERROR('#1.3: Exception === "catchme". Actual: Exception ==='+ e ); + } +} + +// CHECK#2 +try { + throw "catchme"; + $ERROR('#2.1: throw "catchme" lead to throwing exception'); +} +catch(e){} +try{ + e; + $ERROR('#2.2: Deleting catching exception after ending "catch" block'); +} +catch(err){} + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A5.js b/js/src/tests/test262/ch12/12.14/S12.14_A5.js new file mode 100644 index 000000000..f7620908b --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A5.js @@ -0,0 +1,51 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The production TryStatement: "try Block Finally" and the production TryStatement: "try Block Catch Finally" + * + * @path ch12/12.14/S12.14_A5.js + * @description Checking "catch" catches the Identifier in appropriate way + */ + +// CHECK#1 +try { + throw "catchme"; + throw "dontcatchme"; + $ERROR('#1.1: throw "catchme" lead to throwing exception'); +} +catch (e) { + if(e==="dontcatchme"){ + $ERROR('#1.2: Exception !== "dontcatchme"'); + } + if (e!=="catchme") { + $ERROR('#1.3: Exception === "catchme". Actual: Exception ==='+ e ); + } +} + +// CHECK#2 +function SwitchTest1(value){ + var result = 0; + try{ + switch(value) { + case 1: + result += 4; + throw result; + break; + case 4: + result += 64; + throw "ex"; + } + return result; + } + catch(e){ + if ((value===1)&&(e!==4)) $ERROR('#2.1: Exception === 4. Actual: '+e); + if ((value===4)&&(e!=="ex"))$ERROR('#2.2: Exception === "ex". Actual: '+e); + } + finally{ + return result; + } +} +if (SwitchTest1(1)!==4) $ERROR('#2.3: "finally" block must be evaluated'); +if (SwitchTest1(4)!==64)$ERROR('#2.4: "finally" block must be evaluated'); + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A6.js b/js/src/tests/test262/ch12/12.14/S12.14_A6.js new file mode 100644 index 000000000..96b30dbc0 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A6.js @@ -0,0 +1,67 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The production TryStatement: "try Block Catch Finally" + * + * @path ch12/12.14/S12.14_A6.js + * @description Executing sequence of "try" statements, using counters with varying values within + */ + +// CHECK#1 +var c1=0; +try { + c1+=1; + y; + $ERROR('#1.1: "y" lead to throwing exception'); +} +catch (e) { + c1*=2; +} +if (c1!==2){ + $ERROR('#1.2: Sequence evaluation of commands try/catch is 1. try, 2. catch'); +} + +// CHECK#2 +var c2=0; +try{ + c2+=1; +} +finally{ + c2*=2; +} +if (c2!==2){ + $ERROR('#2: Sequence evaluation of commands try/finally is 1. try, 2. finally'); +} + +// CHECK#3 +var c3=0; +try{ + c3=1; + z; +} +catch(err){ + c3*=2; +} +finally{ + c3+=1; +} +if (c3!==3){ + $ERROR('#3: Sequence evaluation of commands try/catch/finally(with exception) is 1. try, 2. catch, 3. finally'); +} + +// CHECK#4 +var c4=0; +try{ + c4=1; +} +catch(err){ + c4*=3; +} +finally{ + c4+=1; +} +if (c4!==2){ + $ERROR('#4: Sequence evaluation of commands try/catch/finally(without exception) is 1. try, 2. finally'); +} + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A7_T1.js b/js/src/tests/test262/ch12/12.14/S12.14_A7_T1.js new file mode 100644 index 000000000..86efa4fad --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A7_T1.js @@ -0,0 +1,138 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Evaluating the nested productions TryStatement + * + * @path ch12/12.14/S12.14_A7_T1.js + * @description Checking if the production of nested TryStatement statements evaluates correct + */ + +// CHECK#1 +try{ + try{ + throw "ex2"; + } + catch(er2){ + if (er2!=="ex2") + $ERROR('#1.1: Exception === "ex2". Actual: Exception ==='+ e ); + throw "ex1"; + } + } + catch(er1){ + if (er1!=="ex1") $ERROR('#1.2: Exception === "ex1". Actual: '+er1); + if (er1==="ex2") $ERROR('#1.3: Exception !== "ex2". Actual: catch previous embedded exception'); +} + +// CHECK#2 +try{ + throw "ex1"; +} +catch(er1){ + try{ + throw "ex2"; + } + catch(er1){ + if (er1==="ex1") $ERROR('#2.1: Exception !== "ex1". Actual: catch previous catching exception'); + if (er1!=="ex2") $ERROR('#2.2: Exception === "ex2". Actual: Exception ==='+ er1 ); + } + if (er1!=="ex1") $ERROR('#2.3: Exception === "ex1". Actual: Exception ==='+ er1 ); + if (er1==="ex2") $ERROR('#2.4: Exception !== "ex2". Actual: catch previous catching exception'); +} + +// CHECK#3 +try{ + throw "ex1"; +} +catch(er1){ + if (er1!=="ex1") $ERROR('#3.1: Exception ==="ex1". Actual: Exception ==='+ er1 ); +} +finally{ + try{ + throw "ex2"; + } + catch(er1){ + if (er1==="ex1") $ERROR('#3.2: Exception !=="ex1". Actual: catch previous embedded exception'); + if (er1!=="ex2") $ERROR('#3.3: Exception ==="ex2". Actual: Exception ==='+ er1 ); + } +} + +// CHECK#4 +var c4=0; +try{ + throw "ex1"; +} +catch(er1){ + try{ + throw "ex2"; + } + catch(er1){ + if (er1==="ex1") $ERROR('#4.1: Exception !=="ex1". Actual: catch previous catching exception'); + if (er1!=="ex2") $ERROR('#4.2: Exception ==="ex2". Actual: Exception ==='+ er1 ); + } + if (er1!=="ex1") $ERROR('#4.3: Exception ==="ex1". Actual: Exception ==='+ er1 ); + if (er1==="ex2") $ERROR('#4.4: Exception !=="ex2". Actual: Catch previous embedded exception'); +} +finally{ + c4=1; +} +if (c4!==1) $ERROR('#4.5: "finally" block must be evaluated'); + +// CHECK#5 +var c5=0; +try{ + try{ + throw "ex2"; + } + catch(er1){ + if (er1!=="ex2") $ERROR('#5.1: Exception ==="ex2". Actual: Exception ==='+ er1 ); + } + throw "ex1"; +} +catch(er1){ + if (er1!=="ex1") $ERROR('#5.2: Exception ==="ex1". Actual: Exception ==='+ er1 ); + if (er1==="ex2") $ERROR('#5.3: Exception !=="ex2". Actual: catch previous embedded exception'); +} +finally{ + c5=1; +} +if (c5!==1) $ERROR('#5.4: "finally" block must be evaluated'); + +// CHECK#6 +var c6=0; +try{ + try{ + throw "ex1"; + } + catch(er1){ + if (er1!=="ex1") $ERROR('#6.1: Exception ==="ex1". Actual: Exception ==='+ er1 ); + } +} +finally{ + c6=1; +} +if (c6!==1) $ERROR('#6.2: "finally" block must be evaluated'); + +// CHECK#7 +var c7=0; +try{ + try{ + throw "ex1"; + } + finally{ + try{ + c7=1; + throw "ex2"; + } + catch(er1){ + if (er1!=="ex2") $ERROR('#7.1: Exception ==="ex2". Actual: Exception ==='+ er1 ); + if (er1==="ex1") $ERROR('#7.2: Exception !=="ex1". Actual: catch previous embedded exception'); + c7++; + } + } +} +catch(er1){ + if (er1!=="ex1") $ERROR('#7.3: Exception ==="ex1". Actual: Exception ==='+ er1 ); +} +if (c7!==2) $ERROR('#7.4: "finally" block must be evaluated'); + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A7_T2.js b/js/src/tests/test262/ch12/12.14/S12.14_A7_T2.js new file mode 100644 index 000000000..94a8c343d --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A7_T2.js @@ -0,0 +1,152 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Evaluating the nested productions TryStatement + * + * @path ch12/12.14/S12.14_A7_T2.js + * @description Checking if the production of nested TryStatement statements evaluates correct + */ + +// CHECK#1 +try{ + try{ + throw "ex2"; + } + finally{ + throw "ex1"; + } +} +catch(er1){ + if (er1!=="ex1") $ERROR('#1.2: Exception === "ex1". Actual: Exception ==='+er1 ); + if (er1==="ex2") $ERROR('#1.3: Exception !== "ex2". Actual: catch previous embedded exception'); +} + +// CHECK#2 +try{ + try{ + throw "ex1"; + } + catch(er1){ + if (er1!=="ex1") $ERROR('#2.1: Exception === "ex1". Actual: Exception ==='+er1 ); + try{ + throw "ex2"; + } + finally{ + throw "ex3"; + } + $ERROR('#2.2: throw "ex1" lead to throwing exception'); + } +} +catch(er1){ + if (er1!=="ex3") $ERROR('#2.3: Exception === "ex3". Actual: Exception ==='+er1 ); +} + +// CHECK#3 +try{ + try{ + throw "ex1"; + } + catch(er1){ + if (er1!=="ex1") $ERROR('#3.1: Exception === "ex1". Actual: Exception ==='+er1 ); + } + finally{ + try{ + throw "ex2"; + } + finally{ + throw "ex3"; + } + } +} +catch(er1){ + if (er1!=="ex3") $ERROR('#3.2: Exception === "ex3". Actual: Exception ==='+er1 ); +} + +// CHECK#4 +var c4=0; +try{ + try{ + throw "ex1"; + } + catch(er1){ + if (er1!=="ex1") $ERROR('#4.1: Exception === "ex1". Actual: Exception ==='+er1 ); + try{ + throw "ex2"; + } + finally{ + throw "ex3"; + } + } + finally{ + c4=1; + } +} +catch(er1){ + if (er1!=="ex3") $ERROR('#4.2: Exception === "ex3". Actual: Exception ==='+er1 ); +} +if (c4!==1) $ERROR('#4.3: "finally" block must be evaluated'); + +// CHECK#5 +var c5=0; +try{ + try{ + throw "ex2"; + } + finally{ + throw "ex3"; + } + throw "ex1"; +} +catch(er1){ + if (er1!=="ex3") $ERROR('#5.1: Exception === "ex3". Actual: Exception ==='+er1 ); + if (er1==="ex2") $ERROR('#5.2: Exception !== "ex2". Actual: catch previous embedded exception'); + if (er1==="ex1") $ERROR('#5.3: Exception !=="ex1". Actual: catch previous embedded exception'); +} +finally{ + c5=1; +} +if (c5!==1) $ERROR('#5.4: "finally" block must be evaluated'); + +// CHECK#6 +var c6=0; +try{ + try{ + try{ + throw "ex1"; + } + finally{ + throw "ex2"; + } + } + finally{ + c6=1; + } +} +catch(er1){ + if (er1!=="ex2") $ERROR('#6.1: Exception === "ex2". Actual: Exception ==='+er1 ); +} +if (c6!==1) $ERROR('#6.2: "finally" block must be evaluated'); + +// CHECK#7 +var c7=0; +try{ + try{ + throw "ex1"; + } + finally{ + try{ + c7=1; + throw "ex2"; + } + finally{ + c7++; + throw "ex3"; + } + } +} +catch(er1){ + if (er1!=="ex3") $ERROR('#7.1: Exception === "ex3". Actual: Exception ==='+er1 ); +} +if (c7!==2) $ERROR('#7.2: Embedded "try/finally" blocks must be evaluated'); + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A7_T3.js b/js/src/tests/test262/ch12/12.14/S12.14_A7_T3.js new file mode 100644 index 000000000..183ab7d22 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A7_T3.js @@ -0,0 +1,169 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Evaluating the nested productions TryStatement + * + * @path ch12/12.14/S12.14_A7_T3.js + * @description Checking if the production of nested TryStatement statements evaluates correct + */ + +// CHECK#1 +try{ + try{ + throw "ex2"; + } + catch(er2){ + if (er2!=="ex2") $ERROR('#1.1: Exception === "ex2". Actual: Exception ==='+er2); + throw "ex1"; + } + finally{ + throw "ex3"; + } +} +catch(er1){ + if (er1!=="ex3") $ERROR('#1.2: Exception === "ex3". Actual: Exception ==='+er1); + if (er1==="ex2") $ERROR('#1.3: Exception !=="ex2". Actual: catch previous catched exception'); + if (er1==="ex1") $ERROR('#1.4: Exception !=="ex1". Actual: catch previous embedded exception'); +} + +// CHECK#2 +var c2=0; +try{ + throw "ex1"; +} +catch(er1){ + try{ + throw "ex2"; + } + catch(er1){ + if (er1==="ex1") $ERROR('#2.1: Exception !=="ex1". Actual: catch previous catched exception'); + if (er1!=="ex2") $ERROR('#2.2: Exception === "ex2". Actual: Exception ==='+er1); + } + finally{ + c2=1; + } + if (er1!=="ex1") $ERROR('#2.3: Exception === "ex1". Actual: Exception ==='+er1); + if (er1==="ex2") $ERROR('#2.4: Exception !== "ex2". Actual: catch previous embedded exception'); +} +if (c2!==1) $ERROR('#2.5: "finally" block must be evaluated'); + +// CHECK#3 +var c3=0; +try{ + throw "ex1"; +} +catch(er1){ + if (er1!=="ex1") $ERROR('#3.1: Exception === "ex1". Actual: Exception ==='+er1); +} +finally{ + try{ + throw "ex2"; + } + catch(er1){ + if (er1==="ex1") $ERROR('#3.2: Exception !=="ex1". Actual: catch previous catched exception'); + if (er1!=="ex2") $ERROR('#3.3: Exception === "ex2". Actual: Exception ==='+er1); + } + finally{ + c3=1; + } +} +if (c3!==1) $ERROR('#3.4: "finally" block must be evaluated'); + +// CHECK#4 +var c4=0; +try{ + try{ + throw "ex1"; + } + catch(er1){ + try{ + throw "ex2"; + } + catch(er1){ + if (er1==="ex1") $ERROR('#4.1: Exception !=="ex2". Actual: catch previous catched exception'); + if (er1!=="ex2") $ERROR('#4.2: Exception === "ex2". Actual: Exception ==='+er1); + } + finally{ + c4=2; + throw "ex3"; + } + if (er1!=="ex1") $ERROR('#4.3: Exception === "ex2". Actual: Exception ==='+er1); + if (er1==="ex2") $ERROR('#4.4: Exception !=="ex2". Actual: catch previous catched exception'); + if (er1==="ex3") $ERROR('#4.5: Exception !=="ex3". Actual: Catch previous embedded exception'); + } + finally{ + c4*=2; + } +} +catch(er1){} +if (c4!==4) $ERROR('#4.6: "finally" block must be evaluated'); + +// CHECK#5 +var c5=0; +try{ + try{ + throw "ex2"; + } + catch(er1){ + if (er1!=="ex2") $ERROR('#5.1: Exception === "ex2". Actual: Exception ==='+er1); + } + finally{ + throw "ex3"; + } + throw "ex1"; +} +catch(er1){ + if (er1!=="ex3") $ERROR('#5.2: Exception === "ex3". Actual: Exception ==='+er1); + if (er1==="ex2") $ERROR('#5.3: Exception !=="ex2". Actual: catch previous catched exception'); + if (er1==="ex1") $ERROR('#5.4: Exception !=="ex1". Actual: catch previous embedded exception'); +} +finally{ + c5=1; +} +if (c5!==1) $ERROR('#5.5: "finally" block must be evaluated'); + +// CHECK#6 +var c6=0; +try{ + try{ + throw "ex1"; + } + catch(er1){ + if (er1!=="ex1") $ERROR('#6.1: Exception === "ex1". Actual: Exception ==='+er1); + } + finally{ + c6=2; + } +} +finally{ + c6*=2; +} +if (c6!==4) $ERROR('#6.2: "finally" block must be evaluated'); + +// CHECK#7 +var c7=0; +try{ + try{ + throw "ex1"; + } + finally{ + try{ + c7=1; + throw "ex2"; + } + catch(er1){ + if (er1!=="ex2") $ERROR('#7.1: Exception === "ex2". Actual: Exception ==='+er1); + if (er1==="ex1") $ERROR('#7.2: Exception !=="ex2". Actual: catch previous catched exception'); + c7++; + } + finally{ + c7*=2; + } + } +} +catch(er1){ + if (er1!=="ex1") $ERROR('#7.3: Exception === "ex1". Actual: Exception ==='+er1); +} +if (c7!==4) $ERROR('#7.4: "finally" block must be evaluated'); + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A8.js b/js/src/tests/test262/ch12/12.14/S12.14_A8.js new file mode 100644 index 000000000..4ac0574a2 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A8.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. + +/** + * "try" with "catch" or "finally" statement within/without an "if" statement + * + * @path ch12/12.14/S12.14_A8.js + * @description Throwing exception within an "if" statement + */ + +// CHECK#1 +var c1=1; +try{ + if(c1===1){ + throw "ex1"; + $ERROR('#1.1: throw "ex1" lead to throwing exception'); + } + $ERROR('#1.2: throw "ex1" inside the "if" statement lead to throwing exception'); +} +catch(er1){ + if (er1!=="ex1") $ERROR('#1.3: Exception ==="ex1". Actual: Exception ==='+er1); +} + +// CHECK#2 +var c2=1; +if(c2===1){ + try{ + throw "ex1"; + $ERROR('#2.1: throw "ex1" lead to throwing exception'); + } + catch(er1){ + if(er1!="ex1") $ERROR('#2.2: Exception ==="ex1". Actual: Exception ==='+er1); + } +} + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A9_T1.js b/js/src/tests/test262/ch12/12.14/S12.14_A9_T1.js new file mode 100644 index 000000000..974b9e725 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A9_T1.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. + +/** + * "try" with "catch" or "finally" statement within/without an "do while" statement + * + * @path ch12/12.14/S12.14_A9_T1.js + * @description Loop within a "try" Block, from where exception is thrown + */ + +// CHECK#1 +var i=0; +try{ + do{ + if(i===5) throw i; + i++; + } + while(i<10); +} +catch(e){ + if(e!==5)$ERROR('#1: Exception ===5. Actual: Exception ==='+ e ); +} + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A9_T2.js b/js/src/tests/test262/ch12/12.14/S12.14_A9_T2.js new file mode 100644 index 000000000..9b36f31fb --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A9_T2.js @@ -0,0 +1,122 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * "try" with "catch" or "finally" statement within/without an "do while" statement + * + * @path ch12/12.14/S12.14_A9_T2.js + * @description "try" statement within a loop, the statement contains "continue" statement + */ + +// CHECK#1 +var c1=0,fin=0; +do{ + try{ + c1+=1; + continue; + } + catch(er1){} + finally{ + fin=1; + } + fin=-1; +} +while(c1<2); +if(fin!==1){ + $ERROR('#1: "finally" block must be evaluated at "try{continue} catch finally" construction'); +} + +// CHECK#2 +var c2=0,fin2=0; +do{ + try{ + throw "ex1"; + } + catch(er1){ + c2+=1; + continue; + } + finally{ + fin2=1; + } + fin2=-1; +} +while(c2<2); +if(fin2!==1){ + $ERROR('#2: "finally" block must be evaluated at "try catch{continue} finally" construction'); +} + +// CHECK#3 +var c3=0,fin3=0; +do{ + try{ + throw "ex1"; + } + catch(er1){ + c3+=1; + } + finally{ + fin3=1; + continue; + } + fin3=0; +} +while(c3<2); +if(fin3!==1){ + $ERROR('#3: "finally" block must be evaluated at "try catch finally{continue}" construction'); +} + +// CHECK#4 +var c4=0,fin4=0; +do{ + try{ + c4+=1; + continue; + } + finally{ + fin4=1; + } + fin4=-1; +} +while(c4<2); +if(fin4!==1){ + $ERROR('#4: "finally" block must be evaluated at "try{continue} finally" construction'); +} + +// CHECK#5 +var c5=0; +do{ + try{ + throw "ex1"; + } + catch(er1){ + c5+=1; + continue; + } +} +while(c5<2); +if(c5!==2){ + $ERROR('#5: "try catch{continue}" must work correctly'); +} + +// CHECK#6 +var c6=0,fin6=0; +do{ + try{ + c6+=1; + throw "ex1" + } + finally{ + fin6=1; + continue; + } + fin6=-1; +} +while(c6<2); +if(fin6!==1){ + $ERROR('#6.1: "finally" block must be evaluated'); +} +if(c6!==2){ + $ERROR('#6.2: "try finally{continue}" must work correctly'); +} + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A9_T3.js b/js/src/tests/test262/ch12/12.14/S12.14_A9_T3.js new file mode 100644 index 000000000..60bdd4b30 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A9_T3.js @@ -0,0 +1,158 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * "try" with "catch" or "finally" statement within/without an "do while" statement + * + * @path ch12/12.14/S12.14_A9_T3.js + * @description "try" statement within a loop, the statement contains "break" statement + */ + +// CHECK#1 +var c1=0,fin=0; +do{ + try{ + c1+=1; + break; + } + catch(er1){} + finally{ + fin=1; + } + fin=-1; + c1+=2; +} +while(c1<2); +if(fin!==1){ + $ERROR('#1.1: "finally" block must be evaluated'); +} +if(c1!==1){ + $ERROR('#1.2: "try{break}catch finally" must work correctly'); +} + +// CHECK#2 +var c2=0,fin2=0; +do{ + try{ + throw "ex1"; + } + catch(er1){ + c2+=1; + break; + } + finally{ + fin2=1; + } + c2+=2; + fin2=-1; +} +while(c2<2); +if(fin2!==1){ + $ERROR('#2.1: "finally" block must be evaluated'); +} +if(c2!==1){ + $ERROR('#2.2: "try catch{break} finally" must work correctly'); +} + +// CHECK#3 +var c3=0,fin3=0; +do{ + try{ + throw "ex1"; + } + catch(er1){ + c3+=1; + } + finally{ + fin3=1; + break; + } + c3+=2; + fin3=0; +} +while(c3<2); +if(fin3!==1){ + $ERROR('#3.1: "finally" block must be evaluated'); +} +if(c3!==1){ + $ERROR('#3.2: "try catch finally{break}" must work correctly'); +} + +// CHECK#4 +var c4=0,fin4=0; +do{ + try{ + c4+=1; + break; + } + finally{ + fin4=1; + } + fin4=-1; + c4+=2; +} +while(c4<2); +if(fin4!==1){ + $ERROR('#4.1: "finally" block must be evaluated'); +} +if(c4!==1){ + $ERROR('#4.2: "try{break} finally" must work correctly'); +} + +// CHECK#5 +var c5=0; +do{ + try{ + throw "ex1"; + } + catch(er1){ + break; + } +} +while(c5<2); +if(c5!==0){ + $ERROR('#5: "try catch{break}" must work correctly'); +} + +// CHECK#6 +var c6=0; +do{ + try{ + c6+=1; + break; + } + catch(er1){} + c6+=2; +} +while(c6<2); +if(c6!==1){ + $ERROR('#6: "try{break} catch" must work correctly'); +} + +// CHECK#7 +var c7=0,fin7=0; +try{ + do{ + try{ + c7+=1; + throw "ex1"; + } + finally{ + fin7=1; + break; + } + fin7=-1; + c7+=2; + } + while(c7<2); +} +catch(ex1){ + c7=10; +} +if(fin7!==1){ + $ERROR('#7.1: "finally" block must be evaluated'); +} +if(c7!==1){ + $ERROR('#7.2: try finally{break} error'); +} + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A9_T4.js b/js/src/tests/test262/ch12/12.14/S12.14_A9_T4.js new file mode 100644 index 000000000..06542b1d1 --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A9_T4.js @@ -0,0 +1,58 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * "try" with "catch" or "finally" statement within/without an "do while" statement + * + * @path ch12/12.14/S12.14_A9_T4.js + * @description "try" statement within a loop, the statement contains "continue" and "break" statements + */ + +// CHECK#1 +var c1=0,fin=0; +do{ + try{ + c1+=1; + break; + } + catch(er1){} + finally{ + fin=1; + continue; + } + fin=-1; + c1+=2; +} +while(c1<2); +if(fin!==1){ + $ERROR('#1.1: "finally" block must be evaluated'); +} +if(c1!==2){ + $ERROR('#1.2: "try{break} catch finally{continue}" must work correctly'); +} + +// CHECK#2 +var c2=0,fin2=0; +do{ + try{ + throw "ex1"; + } + catch(er1){ + c2+=1; + break; + } + finally{ + fin2=1; + continue; + } + c2+=2; + fin2=-1; +} +while(c2<2); +if(fin2!==1){ + $ERROR('#2.1: "finally" block must be evaluated'); +} +if(c2!==2){ + $ERROR('#2.2: "try catch{break} finally{continue}" must work correctly'); +} + diff --git a/js/src/tests/test262/ch12/12.14/S12.14_A9_T5.js b/js/src/tests/test262/ch12/12.14/S12.14_A9_T5.js new file mode 100644 index 000000000..dd16dfe2d --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/S12.14_A9_T5.js @@ -0,0 +1,41 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * "try" with "catch" or "finally" statement within/without an "do while" statement + * + * @path ch12/12.14/S12.14_A9_T5.js + * @description Checking if exceptions are thrown correctly from wherever of loop body + */ + +// CHECK#1 +var c=0, i=0; +var fin=0; +do{ + i+=1; + try{ + if(c===0){ + throw "ex1"; + $ERROR('#1.1: throw "ex1" lead to throwing exception'); + } + c+=2; + if(c===1){ + throw "ex2"; + $ERROR('#1.2: throw "ex2" lead to throwing exception'); + } + } + catch(er1){ + c-=1; + continue; + $ERROR('#1.3: "try catch{continue} finally" must work correctly'); + } + finally{ + fin+=1; + } +} +while(i<10); +if(fin!==10){ + $ERROR('#1.4: "finally" block must be evaluated'); +} + + diff --git a/js/src/tests/test262/ch12/12.14/browser.js b/js/src/tests/test262/ch12/12.14/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/browser.js diff --git a/js/src/tests/test262/ch12/12.14/shell.js b/js/src/tests/test262/ch12/12.14/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.14/shell.js 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 diff --git a/js/src/tests/test262/ch12/12.3/S12.3_A1.js b/js/src/tests/test262/ch12/12.3/S12.3_A1.js new file mode 100644 index 000000000..e314b179e --- /dev/null +++ b/js/src/tests/test262/ch12/12.3/S12.3_A1.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. + +/** + * The production EmptyStatement ; is evaluated as follows Return (normal, empty, empty) + * + * @path ch12/12.3/S12.3_A1.js + * @description Using EmptyStatement ; + */ + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;; ;;;;;; ;; ;; ;;;;;; ;;;;;;;; ;; ;; ;;;;; +;;;;; ;; ;;;; ;;;; ;; ;; ;; ;; ;; ;;;;; +;;;;; ;;;; ;; ;;;; ;; ;;;;;; ;; ;;;; ;;;;; +;;;;; ;; ;; ;; ;; ;; ;; ;; ;;;;; +;;;;; ;;;;;; ;; ;; ;; ;; ;; ;;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + diff --git a/js/src/tests/test262/ch12/12.3/browser.js b/js/src/tests/test262/ch12/12.3/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.3/browser.js diff --git a/js/src/tests/test262/ch12/12.3/shell.js b/js/src/tests/test262/ch12/12.3/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.3/shell.js diff --git a/js/src/tests/test262/ch12/12.4/S12.4_A1.js b/js/src/tests/test262/ch12/12.4/S12.4_A1.js new file mode 100644 index 000000000..0754d791e --- /dev/null +++ b/js/src/tests/test262/ch12/12.4/S12.4_A1.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. + +/** + * An ExpressionStatement can not start with the function keyword because that might make it ambiguous with a FunctionDeclaration + * + * @path ch12/12.4/S12.4_A1.js + * @description Checking if execution of "function(){}()" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +function(){}(); +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.4/S12.4_A2_T1.js b/js/src/tests/test262/ch12/12.4/S12.4_A2_T1.js new file mode 100644 index 000000000..70d0aa62d --- /dev/null +++ b/js/src/tests/test262/ch12/12.4/S12.4_A2_T1.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. + +/** + * The production ExpressionStatement : [lookahead \notin {{, function}] Expression; is evaluated as follows: + * 1. Evaluate Expression. + * 2. Call GetValue(Result(1)). + * 3. Return (normal, Result(2), empty) + * + * @path ch12/12.4/S12.4_A2_T1.js + * @description Checking by using eval "(eval("x+1+x==1"))" + */ + +x=1; + +__evaluated = eval("x+1+x==1"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__evaluated !== false) { + $ERROR('#1: __evaluated === false. Actual: __evaluated ==='+ __evaluated ); +} +// +////////////////////////////////////////////////////////////////////////////// + +__evaluated = eval("1+1+1==1"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__evaluated !== false) { + $ERROR('#2: __evaluated === false. Actual: __evaluated ==='+ __evaluated ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.4/S12.4_A2_T2.js b/js/src/tests/test262/ch12/12.4/S12.4_A2_T2.js new file mode 100644 index 000000000..2fdadc008 --- /dev/null +++ b/js/src/tests/test262/ch12/12.4/S12.4_A2_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. + +/** + * The production ExpressionStatement : [lookahead \notin {{, function}] Expression; is evaluated as follows: + * 1. Evaluate Expression. + * 2. Call GetValue(Result(1)). + * 3. Return (normal, Result(2), empty) + * + * @path ch12/12.4/S12.4_A2_T2.js + * @description Checking by using eval(eval(x), where x is any string) + */ + +x="5+1|0===0"; + +__evaluated = eval(x); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__evaluated !== 7) { + $ERROR('#1: __evaluated === 7. Actual: __evaluated ==='+ __evaluated ); +} +// +////////////////////////////////////////////////////////////////////////////// + +__evaluated = eval("2*"+x+">-1"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__evaluated !== 11) { + $ERROR('#2: __evaluated === 11. Actual: __evaluated ==='+ __evaluated ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.4/browser.js b/js/src/tests/test262/ch12/12.4/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.4/browser.js diff --git a/js/src/tests/test262/ch12/12.4/shell.js b/js/src/tests/test262/ch12/12.4/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.4/shell.js diff --git a/js/src/tests/test262/ch12/12.5/S12.5_A1.1_T1.js b/js/src/tests/test262/ch12/12.5/S12.5_A1.1_T1.js new file mode 100644 index 000000000..ae2038c98 --- /dev/null +++ b/js/src/tests/test262/ch12/12.5/S12.5_A1.1_T1.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. + +/** + * 0, null, undefined, false, empty string, NaN in expression is evaluated to false + * + * @path ch12/12.5/S12.5_A1.1_T1.js + * @description Using "if" without "else" construction + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 + +if(0) + $ERROR('#1: 0 in expression is evaluated to false '); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(false) + $ERROR('#2: false in expression is evaluated to false '); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(null) + $ERROR('#3: null in expression is evaluated to false '); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if(undefined) + $ERROR('#4: undefined in expression is evaluated to false '); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#5 +if("") + $ERROR('#5: empty string in expression is evaluated to false '); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#6 +if(NaN) + $ERROR('#5: NaN in expression is evaluated to false '); +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.5/S12.5_A1.1_T2.js b/js/src/tests/test262/ch12/12.5/S12.5_A1.1_T2.js new file mode 100644 index 000000000..ba5d8e3cb --- /dev/null +++ b/js/src/tests/test262/ch12/12.5/S12.5_A1.1_T2.js @@ -0,0 +1,71 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * 0, null, undefined, false, empty string, NaN in expression is evaluated to false + * + * @path ch12/12.5/S12.5_A1.1_T2.js + * @description Using "if/else" construction + */ + +var c=0; +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(0) + $ERROR('#1.1: 0 in expression is evaluated to false '); +else + c++; +if (c!=1) $ERROR('#1.2: else branch don`t execute'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(false) + $ERROR('#2.1: false in expression is evaluated to false '); +else + c++; +if (c!=2) $ERROR('#2.2: else branch don`t execute'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(null) + $ERROR('#3.1: null in expression is evaluated to false '); +else + c++; +if (c!=3) $ERROR('#3.2: else branch don`t execute'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if(undefined) + $ERROR('#4.1: undefined in expression is evaluated to false '); +else + c++; +if (c!=4) $ERROR('#4.2: else branch don`t execute'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#5 +if("") + $ERROR('#5.1: empty string in expression is evaluated to false '); +else + c++; +if (c!=5) $ERROR('#5.2: else branch don`t execute'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#6 +if(NaN) + $ERROR('#6.1: NaN in expression is evaluated to false '); +else + c++; +if (c!=6) $ERROR('#6.2: else branch don`t execute'); +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.5/S12.5_A1.2_T1.js b/js/src/tests/test262/ch12/12.5/S12.5_A1.2_T1.js new file mode 100644 index 000000000..19ba4cdd1 --- /dev/null +++ b/js/src/tests/test262/ch12/12.5/S12.5_A1.2_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. + +/** + * 1, true, non-empty string and others in expression is evaluated to true when using operator "new" + * + * @path ch12/12.5/S12.5_A1.2_T1.js + * @description Using "if" without "else" construction + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(!(new Number(1))) + $ERROR('#1: new 1 in expression is evaluated to true'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(!(new Boolean(true))) + $ERROR('#2: new true in expression is evaluated to true'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(!(new String("1"))) + $ERROR('#3: new "1" in expression is evaluated to true'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if(!(new String("A"))) + $ERROR('#4: new "A" in expression is evaluated to true'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#5 +if(!(new Boolean(false))) + $ERROR('#2: new false in expression is evaluated to true '); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#6 +if(!(new Number(NaN))) + $ERROR('#6: new NaN in expression is evaluated to true '); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#7 +if(!(new Number(null))) + $ERROR('#7: new null in expression is evaluated to true '); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#8 +if(!(new String(undefined))) + $ERROR('#8: new undefined in expression is evaluated to true '); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#9 +if(!(new String(""))) + $ERROR('#9: new empty string in expression is evaluated to true '); +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.5/S12.5_A1.2_T2.js b/js/src/tests/test262/ch12/12.5/S12.5_A1.2_T2.js new file mode 100644 index 000000000..b384311f1 --- /dev/null +++ b/js/src/tests/test262/ch12/12.5/S12.5_A1.2_T2.js @@ -0,0 +1,101 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * 1, true, non-empty string and others in expression is evaluated to true when using operator "new" + * + * @path ch12/12.5/S12.5_A1.2_T2.js + * @description Using "if/else" construction + */ + +var c=0; +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(!(new Number(1))) + $ERROR('#1.1: new 1 in expression is evaluated to true'); +else + c++; +if (c!=1) $ERROR('#1.2: else branch don`t execute'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(!(new Boolean(true))) + $ERROR('#2.1: new true in expression is evaluated to true'); +else + c++; +if (c!=2) $ERROR('#2.2: else branch don`t execute'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(!(new String("1"))) + $ERROR('#3.1: new "1" in expression is evaluated to true'); +else + c++; +if (c!=3) $ERROR('#3.2: else branch don`t execute'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if(!(new String("A"))) + $ERROR('#4.1: new "A" in expression is evaluated to true'); +else + c++; +if (c!=4) $ERROR('#4.2: else branch don`t execute'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#5 +if(!(new Boolean(false))) + $ERROR('#5.1: new false in expression is evaluated to true '); +else + c++; +if (c!=5) $ERROR('#5.2: else branch don`t execute'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#6 +if(!(new Number(NaN))) + $ERROR('#6.1: new NaN in expression is evaluated to true '); +else + c++; +if (c!=6) $ERROR('#6.2: else branch don`t execute'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#7 +if(!(new Number(null))) + $ERROR('#7.1: new null in expression is evaluated to true '); +else + c++; +if (c!=7) $ERROR('#7.2: else branch don`t execute'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#8 +if(!(new String(undefined))) + $ERROR('#8.1: new undefined in expression is evaluated to true '); +else + c++; +if (c!=8) $ERROR('#8.2: else branch don`t execute'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#9 +if(!(new String(""))) + $ERROR('#9.1: new empty string in expression is evaluated to true '); +else + c++; +if (c!=9) $ERROR('#9.2: else branch don`t execute'); +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.5/S12.5_A10_T1.js b/js/src/tests/test262/ch12/12.5/S12.5_A10_T1.js new file mode 100644 index 000000000..4995fe1c2 --- /dev/null +++ b/js/src/tests/test262/ch12/12.5/S12.5_A10_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. + +/** + * Function expession inside the "if" expression is allowed + * + * @path ch12/12.5/S12.5_A10_T1.js + * @description Using function expession(function __func(){return 0;}) inside the "if" expression + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +if(function __func(){return 0;}){ + ; +}else { + $ERROR('#1: Function expession inside the "if" expression is allowed'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.5/S12.5_A10_T2.js b/js/src/tests/test262/ch12/12.5/S12.5_A10_T2.js new file mode 100644 index 000000000..bcb187b08 --- /dev/null +++ b/js/src/tests/test262/ch12/12.5/S12.5_A10_T2.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. + +/** + * Function expession inside the "if" expression is allowed + * + * @path ch12/12.5/S12.5_A10_T2.js + * @description Using function expession "function __func(){return 0;}()" within "if" expression + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +if(function __func(){return 0;}()){ + $ERROR('#1: Function expession inside the if expression is allowed'); +}else { + ; +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.5/S12.5_A11.js b/js/src/tests/test262/ch12/12.5/S12.5_A11.js new file mode 100644 index 000000000..250b29f50 --- /dev/null +++ b/js/src/tests/test262/ch12/12.5/S12.5_A11.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. + +/** + * {} within the "if" expression is not allowed + * + * @path ch12/12.5/S12.5_A11.js + * @description Checking if execution of "if({1})" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +if({1}) + { + ; + }else + { + ; + } +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.5/S12.5_A12_T1.js b/js/src/tests/test262/ch12/12.5/S12.5_A12_T1.js new file mode 100644 index 000000000..43f858b09 --- /dev/null +++ b/js/src/tests/test262/ch12/12.5/S12.5_A12_T1.js @@ -0,0 +1,58 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Embedded "if/else" constructions are allowed + * + * @path ch12/12.5/S12.5_A12_T1.js + * @description Using embedded "if/else" into "if/else" constructions + */ + +//CHECK# 1 +if(true) + if (false) + $ERROR('#1.1: At embedded "if/else" constructions engine must select right branches'); + else + ; +else + if (true) + $ERROR('#1.2: At embedded "if/else" constructions engine must select right branches'); + else + $ERROR('#1.3: At embedded "if/else" constructions engine must select right branches'); + +//CHECK# 2 +if(true) + if (true) + ; + else + $ERROR('#2.1: At embedded "if/else" constructions engine must select right branches'); +else + if (true) + $ERROR('#2.2: At embedded "if/else" constructions engine must select right branches'); + else + $ERROR('#2.3: At embedded "if/else" constructions engine must select right branches'); + +//CHECK# 3 +if(false) + if (true) + $ERROR('#3.1: At embedded "if/else" constructions engine must select right branches'); + else + $ERROR('#3.2: At embedded "if/else" constructions engine must select right branches'); +else + if (true) + ; + else + $ERROR('#3.3: At embedded "if/else" constructions engine must select right branches'); + +//CHECK# 4 +if(false) + if (true) + $ERROR('#4.1: At embedded "if/else" constructions engine must select right branches'); + else + $ERROR('#4.2: At embedded "if/else" constructions engine must select right branches'); +else + if (false) + $ERROR('#4.3: At embedded "if/else" constructions engine must select right branches'); + else + ; + diff --git a/js/src/tests/test262/ch12/12.5/S12.5_A12_T2.js b/js/src/tests/test262/ch12/12.5/S12.5_A12_T2.js new file mode 100644 index 000000000..c9115994b --- /dev/null +++ b/js/src/tests/test262/ch12/12.5/S12.5_A12_T2.js @@ -0,0 +1,50 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Embedded "if/else" constructions are allowed + * + * @path ch12/12.5/S12.5_A12_T2.js + * @description Using embedded "if" into "if/else" constructions + */ + +//CHECK# 1 +if(true){ + if (false) + $ERROR('#1.1: At embedded "if/else" constructions engine must select right branches'); +} +else{ + if (true) + $ERROR('#1.2: At embedded "if/else" constructions engine must select right branches'); +} + +//CHECK# 2 +if(true){ + if (true) + ; +} +else{ + if (true) + $ERROR('#2.2: At embedded "if/else" constructions engine must select right branches'); +} + +//CHECK# 3 +if(false){ + if (true) + $ERROR('#3.1: At embedded "if/else" constructions engine must select right branches'); +} +else{ + if (true) + ; +} + +//CHECK# 4 +if(false){ + if (true) + $ERROR('#4.1: At embedded "if/else" constructions engine must select right branches'); +} +else{ + if (false) + $ERROR('#4.3: At embedded "if/else" constructions engine must select right branches'); +} + diff --git a/js/src/tests/test262/ch12/12.5/S12.5_A12_T3.js b/js/src/tests/test262/ch12/12.5/S12.5_A12_T3.js new file mode 100644 index 000000000..a17cff21f --- /dev/null +++ b/js/src/tests/test262/ch12/12.5/S12.5_A12_T3.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. + +/** + * Embedded "if/else" constructions are allowed + * + * @path ch12/12.5/S12.5_A12_T3.js + * @description Using embedded "if/else" into "if" without "else" constructions + */ + +//CHECK# 1 +if(true) + if (false) + $ERROR('#1.1: At embedded "if/else" constructions engine must select right branches'); + else + ; + +//CHECK# 2 +if(true) + if (true) + ; + else + $ERROR('#2.1: At embedded "if/else" constructions engine must select right branches'); + +//CHECK# 3 +if(false) + if (true) + $ERROR('#3.1: At embedded "if/else" constructions engine must select right branches'); + else + $ERROR('#3.2: At embedded "if/else" constructions engine must select right branches'); + +//CHECK# 4 +if(false) + if (true) + $ERROR('#4.1: At embedded "if/else" constructions engine must select right branches'); + else + $ERROR('#4.2: At embedded "if/else" constructions engine must select right branches'); + diff --git a/js/src/tests/test262/ch12/12.5/S12.5_A12_T4.js b/js/src/tests/test262/ch12/12.5/S12.5_A12_T4.js new file mode 100644 index 000000000..03f643d62 --- /dev/null +++ b/js/src/tests/test262/ch12/12.5/S12.5_A12_T4.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. + +/** + * Embedded "if/else" constructions are allowed + * + * @path ch12/12.5/S12.5_A12_T4.js + * @description Using embedded "if" into "if" constructions + */ + +//CHECK# 1 +if(true) + if (false) + $ERROR('#1.1: At embedded "if/else" constructions engine must select right branches'); + +//CHECK# 2 +var c=0; +if(true) + if (true) + c=2; +if (c!==2) + $ERROR('#2: At embedded "if/else" constructions engine must select right branches'); + +//CHECK# 3 +if(false) + if (true) + $ERROR('#3.1: At embedded "if/else" constructions engine must select right branches'); + +//CHECK# 4 +if(false) + if (true) + $ERROR('#4.1: At embedded "if/else" constructions engine must select right branches'); + diff --git a/js/src/tests/test262/ch12/12.5/S12.5_A1_T1.js b/js/src/tests/test262/ch12/12.5/S12.5_A1_T1.js new file mode 100644 index 000000000..df6f327d4 --- /dev/null +++ b/js/src/tests/test262/ch12/12.5/S12.5_A1_T1.js @@ -0,0 +1,39 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * 1, true, non-empty string in expression is evaluated to true + * + * @path ch12/12.5/S12.5_A1_T1.js + * @description Using "if" without "else" construction + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(!(1)) + $ERROR('#1: 1 in expression is evaluated to true'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(!(true)) + $ERROR('#2: true in expression is evaluated to true'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(!("1")) + $ERROR('#3: "1" in expression is evaluated to true'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if(!("A")) + $ERROR('#4: "A" in expression is evaluated to true'); +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/js/src/tests/test262/ch12/12.5/S12.5_A1_T2.js b/js/src/tests/test262/ch12/12.5/S12.5_A1_T2.js new file mode 100644 index 000000000..ea952a930 --- /dev/null +++ b/js/src/tests/test262/ch12/12.5/S12.5_A1_T2.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * 1, true, non-empty string in expression is evaluated to true + * + * @path ch12/12.5/S12.5_A1_T2.js + * @description Using "if/else" construction + */ + +var c=0; +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(!(1)) + $ERROR('#1.1: 1 in expression is evaluated to true'); +else + c++; +if (c!=1) $ERROR('#1.2: else branch don`t execute'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(!(true)) + $ERROR('#2.1: true in expression is evaluated to true'); +else + c++; +if (c!=2) $ERROR('#2.2: else branch don`t execute'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(!("1")) + $ERROR('#3.1: "1" in expression is evaluated to true'); +else + c++; +if (c!=3) $ERROR('#3.2: else branch don`t execute'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if(!("A")) + $ERROR('#4.1: "A" in expression is evaluated to true'); +else + c++; +if (c!=4) $ERROR('#4.2: else branch don`t execute'); +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/js/src/tests/test262/ch12/12.5/S12.5_A2.js b/js/src/tests/test262/ch12/12.5/S12.5_A2.js new file mode 100644 index 000000000..c953c29cd --- /dev/null +++ b/js/src/tests/test262/ch12/12.5/S12.5_A2.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. + +/** + * In the "if" Statement eval in Expression is admitted + * + * @path ch12/12.5/S12.5_A2.js + * @description Checking by using eval "eval("true")" + * @negative + */ + +if (eval("true")) $FAIL('#1: In the "if" Statement eval as Expression is admitted'); + diff --git a/js/src/tests/test262/ch12/12.5/S12.5_A3.js b/js/src/tests/test262/ch12/12.5/S12.5_A3.js new file mode 100644 index 000000000..3eb41d59b --- /dev/null +++ b/js/src/tests/test262/ch12/12.5/S12.5_A3.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. + +/** + * When the production "IfStatement: if ( Expression ) Statement else Statement" is evaluated, Expression is evaluated first + * + * @path ch12/12.5/S12.5_A3.js + * @description The Expression is "(function(){throw 1})()" + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + if ((function(){throw 1})()) abracadabra +} catch (e) { + if (e !== 1) { + $ERROR('#1: Exception === 1. Actual: Exception ==='+ e); + } +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +try { + if ((function(){throw 1})()) abracadabra; else blablachat; +} catch (e) { + if (e !== 1) { + $ERROR('#2: Exception === 1. Actual: Exception ==='+ e); + } +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/js/src/tests/test262/ch12/12.5/S12.5_A4.js b/js/src/tests/test262/ch12/12.5/S12.5_A4.js new file mode 100644 index 000000000..73babcfea --- /dev/null +++ b/js/src/tests/test262/ch12/12.5/S12.5_A4.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. + +/** + * When the production "IfStatement: if ( Expression ) Statement else Statement" is evaluated, Statement(s) is(are) evaluated second + * + * @path ch12/12.5/S12.5_A4.js + * @description The first statement is "(function(){throw "instatement"})()" + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + if (true) (function(){throw "instatement"})(); + $FAIL("#1 failed") +} catch (e) { + if (e !== "instatement") { + $ERROR('#1: Exception === "instatement". Actual: Exception ==='+ e); + } +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +try { + if (false) (function(){throw "truebranch"})(); (function(){throw "missbranch"})(); + $FAIL("#2 failed") +} catch (e) { + if (e !== "missbranch") { + $ERROR('#2: Exception === "missbranch". Actual: Exception ==='+ e); + } +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/js/src/tests/test262/ch12/12.5/S12.5_A5.js b/js/src/tests/test262/ch12/12.5/S12.5_A5.js new file mode 100644 index 000000000..72c334a67 --- /dev/null +++ b/js/src/tests/test262/ch12/12.5/S12.5_A5.js @@ -0,0 +1,48 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * FunctionDeclaration inside the "if" Expression is evaluated as true and function will not be declarated + * + * @path ch12/12.5/S12.5_A5.js + * @description The "if" Expression is "function __func(){throw "FunctionExpression";}" + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + __func=__func; + $ERROR('#1: "__func=__func" lead to throwing exception'); +} catch (e) { + ; +} +// +////////////////////////////////////////////////////////////////////////////// + + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +try { + if(function __func(){throw "FunctionExpression";}) (function(){throw "TrueBranch"})(); else (function(){"MissBranch"})(); +} catch (e) { + if (e !== "TrueBranch") { + $ERROR('#2: Exception ==="TrueBranch". Actual: Exception ==='+ e); + } +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +try { + __func=__func; + $ERROR('#3: "__func=__func" lead to throwing exception'); +} catch (e) { + ; +} +// +////////////////////////////////////////////////////////////////////////////// + + + + diff --git a/js/src/tests/test262/ch12/12.5/S12.5_A6_T1.js b/js/src/tests/test262/ch12/12.5/S12.5_A6_T1.js new file mode 100644 index 000000000..76aabe63c --- /dev/null +++ b/js/src/tests/test262/ch12/12.5/S12.5_A6_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. + +/** + * In the If statement expression must be enclosed in braces + * + * @path ch12/12.5/S12.5_A6_T1.js + * @description Checking if execution of "if true" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if true; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.5/S12.5_A6_T2.js b/js/src/tests/test262/ch12/12.5/S12.5_A6_T2.js new file mode 100644 index 000000000..1b6f383ab --- /dev/null +++ b/js/src/tests/test262/ch12/12.5/S12.5_A6_T2.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. + +/** + * In the If statement expression must be enclosed in braces + * + * @path ch12/12.5/S12.5_A6_T2.js + * @description Checking if execution of "if false" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if false; +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/js/src/tests/test262/ch12/12.5/S12.5_A7.js b/js/src/tests/test262/ch12/12.5/S12.5_A7.js new file mode 100644 index 000000000..f450d6aea --- /dev/null +++ b/js/src/tests/test262/ch12/12.5/S12.5_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. + +/** + * In the "if" statement empty statement is allowed and is evaluated to "undefined" + * + * @path ch12/12.5/S12.5_A7.js + * @description Checking by using eval "eval("if(1);"))" + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + var __evaluated = eval("if(1);"); + if (__evaluated !== undefined) { + $ERROR('#1: __evaluated === undefined. Actual: __evaluated ==='+ __evaluated ); + } + +} catch (e) { + $ERROR('#1.1: "__evaluated = eval("if(1);")" does not lead to throwing exception'); + +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.5/S12.5_A8.js b/js/src/tests/test262/ch12/12.5/S12.5_A8.js new file mode 100644 index 000000000..7a2d4b9c6 --- /dev/null +++ b/js/src/tests/test262/ch12/12.5/S12.5_A8.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. + +/** + * In the "if" Statement empty expression is not allowed + * + * @path ch12/12.5/S12.5_A8.js + * @description Checking if execution of "if()" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(); +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.5/browser.js b/js/src/tests/test262/ch12/12.5/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.5/browser.js diff --git a/js/src/tests/test262/ch12/12.5/shell.js b/js/src/tests/test262/ch12/12.5/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.5/shell.js diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A1.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A1.js new file mode 100644 index 000000000..c95c6ff1e --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A1.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * When the production "do Statement while ( Expression )" is evaluated, Statement is evaluated first + * + * @path ch12/12.6/12.6.1/S12.6.1_A1.js + * @description Evaluating various Expressions + */ + +var __in__do; + +do __in__do=1; while ( false ); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__in__do!==1) { + $ERROR('#1: false evaluates to false'); +} +// +////////////////////////////////////////////////////////////////////////////// + +do __in__do=2; while ( 0 ); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__in__do!==2) { + $ERROR('#2: 0 evaluates to false'); +} +// +////////////////////////////////////////////////////////////////////////////// + +do __in__do=3; while ( "" ); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (__in__do!==3) { + $ERROR('#3: "" evaluates to false'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A10.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A10.js new file mode 100644 index 000000000..0c01a5e2e --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A10.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. + +/** + * FunctionExpression within a "do-while" statement is allowed, but no function with the given name will appear in the global context + * + * @path ch12/12.6/12.6.1/S12.6.1_A10.js + * @description Also this a test on FunctionExpression + */ + +var check = 0; +do { + if(typeof(f) === "function"){ + check = -1; + break; + } else { + check = 1; + break; + } +} while(function f(){}); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (check !== 1) { + $ERROR('#1: FunctionExpression within a "do-while" statement is allowed, but no function with the given name will appear in the global context'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A11.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A11.js new file mode 100644 index 000000000..60071bd6b --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A11.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. + +/** + * Block "{}" in a "do-while" Expression is evaluated to true + * + * @path ch12/12.6/12.6.1/S12.6.1_A11.js + * @description Checking if execution of "do {} while({})" passes + */ + +do { + var __in__do=1; + if(__in__do)break; +} while({}); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__in__do !== 1) { + $ERROR('#1: "{}" in do-while expression evaluates to true'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A12.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A12.js new file mode 100644 index 000000000..1e623bc43 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A12.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. + +/** + * Any statement within "do-while" construction must be a compound + * + * @path ch12/12.6/12.6.1/S12.6.1_A12.js + * @description Checking if execution of "do var x=1; var y =2; while (0)" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +do var x=1; var y =2; while (0); +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A14_T1.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A14_T1.js new file mode 100644 index 000000000..38bc21491 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A14_T1.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. + +/** + * FunctionExpression within a "do-while" Expression is allowed + * + * @path ch12/12.6/12.6.1/S12.6.1_A14_T1.js + * @description Using FunctionExpression "function __func(){return 0;}" as an Expression + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +do{ + var __reached = 1; + break; +}while(function __func(){return 0;}); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__reached !== 1) { + $ERROR('#2: function expession inside of do-while expression is allowed'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A14_T2.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A14_T2.js new file mode 100644 index 000000000..9ae3ad763 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A14_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. + +/** + * FunctionExpression within a "do-while" Expression is allowed + * + * @path ch12/12.6/12.6.1/S12.6.1_A14_T2.js + * @description Using FunctionExpression "function __func(){return 0;}()" as an Expression + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +do{ + var __reached = 1; + break; +}while(function __func(){return 0;}()); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__reached !== 1) { + $ERROR('#2: function expession inside of do-while expression is allowed'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A15.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A15.js new file mode 100644 index 000000000..65588750c --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A15.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Block within a "do-while" Expression is not allowed + * + * @path ch12/12.6/12.6.1/S12.6.1_A15.js + * @description Using "{0}" Block as an Expression + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +do{ + ; +}while({0}); +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A2.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A2.js new file mode 100644 index 000000000..023c7d4a2 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A2.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. + +/** + * While evaluating "do Statement while ( Expression )", Statement is evaluated first and only after it is done Expression is checked + * + * @path ch12/12.6/12.6.1/S12.6.1_A2.js + * @description Evaluating Statement with error Expression + */ + +try { + do __in__do = "reached"; while (abbracadabra); + $ERROR('#1: \'do __in__do = "reached"; while (abbracadabra)\' lead to throwing exception');
+} catch (e) {
+ if (e instanceof Test262Error) throw e; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__in__do !== "reached") { + $ERROR('#1.1: __in__do === "reached". Actual: __in__do ==='+ __in__do ); +} +// +////////////////////////////////////////////////////////////////////////////// + + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A3.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A3.js new file mode 100644 index 000000000..5f5f0ed69 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A3.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. + +/** + * When the production "do Statement while ( Expression )" is evaluated, then (normal, V, empty) is returned + * + * @path ch12/12.6/12.6.1/S12.6.1_A3.js + * @description Using eval "eval("do __in__do=1; while (false)")" + */ + +__evaluated = eval("do __in__do=1; while (false)"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +if (__in__do !== 1) { + $ERROR('#1: __in__do === 1. Actual: __in__do ==='+ __in__do ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__evaluated !== 1) { + $ERROR('#2: __evaluated === 1. Actual: __evaluated ==='+ __evaluated ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A4_T1.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A4_T1.js new file mode 100644 index 000000000..917afe329 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A4_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. + +/** + * "break" within a "do-while" Statement is allowed and performed as described in 12.8 + * + * @path ch12/12.6/12.6.1/S12.6.1_A4_T1.js + * @description Using "break" within a "do-while" loop + */ + +do { + __in__do__before__break="reached"; + break; + __in__do__after__break="where am i"; +} while(2===1); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__in__do__before__break !== "reached") { + $ERROR('#1: __in__do__before__break === "reached". Actual: __in__do__before__break ==='+ __in__do__before__break ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (typeof __in__do__after__break !== "undefined") { + $ERROR('#2: typeof __in__do__after__break === "undefined". Actual: typeof __in__do__after__break ==='+ typeof __in__do__after__break ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A4_T2.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A4_T2.js new file mode 100644 index 000000000..72e01a07d --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_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. + +/** + * "break" within a "do-while" Statement is allowed and performed as described in 12.8 + * + * @path ch12/12.6/12.6.1/S12.6.1_A4_T2.js + * @description "break" and VariableDeclaration within a "do-while" statement + */ + +do_out : do { + var __in__do__before__break="black"; + do_in : do { + var __in__do__IN__before__break="hole"; + break do_in; + var __in__do__IN__after__break="sun"; + } while (0); + var __in__do__after__break="won't you come"; +} while(2==1); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!(__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break)) { + $ERROR('#1: (__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break)===true. Actual: (__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break)==='+ (__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break) ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A4_T3.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A4_T3.js new file mode 100644 index 000000000..a6adc0836 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_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. + +/** + * "break" within a "do-while" Statement is allowed and performed as described in 12.8 + * + * @path ch12/12.6/12.6.1/S12.6.1_A4_T3.js + * @description "break" and VariableDeclaration within a "do-while" statement + */ + +do_out : do { + var __in__do__before__break="once"; + do_in : do { + var __in__do__IN__before__break="in"; + break do_out; + var __in__do__IN__after__break="the"; + } while (0); + var __in__do__after__break="lifetime"; +} while(2===1); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!(__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&!__in__do__after__break)) { + $ERROR('#1: (__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&!__in__do__after__break)===true. Actual: (__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&!__in__do__after__break)==='+ (__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&!__in__do__after__break) ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A4_T4.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A4_T4.js new file mode 100644 index 000000000..52cb23cc9 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A4_T4.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. + +/** + * "break" within a "do-while" Statement is allowed and performed as described in 12.8 + * + * @path ch12/12.6/12.6.1/S12.6.1_A4_T4.js + * @description "break" and VariableDeclaration within a "do-while" statement + */ + +do_out : do { + var __in__do__before__break="reached"; + do_in : do { + var __in__do__IN__before__break="reached"; + break; + var __in__do__IN__after__break="where am i"; + } while (0); + var __in__do__after__break="where am i"; +} while(2===1); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!(__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break)) { + $ERROR('#1: (__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break)===true. Actual: (__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break)==='+ (__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break) ); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A4_T5.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A4_T5.js new file mode 100644 index 000000000..97f65bf59 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A4_T5.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. + +/** + * "break" within a "do-while" Statement is allowed and performed as described in 12.8 + * + * @path ch12/12.6/12.6.1/S12.6.1_A4_T5.js + * @description Using labeled "break" in order to continue a loop + */ + +//CHECK#1 +var i=0; +woohoo:{ + do{ + i++; + if ( ! (i < 10) ) { + break woohoo; + $ERROR('#1.1: "break woohoo" must break loop'); + } + } while ( true ); + if (i!==10) $ERROR('#1.2: i===10. Actual: i==='+ i ); +} + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A5.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A5.js new file mode 100644 index 000000000..67bc20de2 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A5.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. + +/** + * After "do-while" is broken, (normal, V, empty) is returned + * + * @path ch12/12.6/12.6.1/S12.6.1_A5.js + * @description Using eval + */ + +__evaluated = eval("do {__in__do__before__break=1; break; __in__do__after__break=2;} while(0)"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__in__do__before__break !== 1) { + $ERROR('#1: __in__do__before__break === 1. Actual: __in__do__before__break ==='+ __in__do__before__break ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (typeof __in__do__after__break !== "undefined") { + $ERROR('#2: typeof __in__do__after__break === "undefined". Actual: typeof __in__do__after__break ==='+ typeof __in__do__after__break ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (__evaluated !== 1) { + $ERROR('#3: __evaluated === 1. Actual: __evaluated ==='+ __evaluated ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A6_T1.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A6_T1.js new file mode 100644 index 000000000..40af77c63 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A6_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. + +/** + * Expression in "do-while" IterationStatement is bracketed with braces + * + * @path ch12/12.6/12.6.1/S12.6.1_A6_T1.js + * @description Checking if execution of "do{} while 1" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +do break; while 1; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A6_T2.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A6_T2.js new file mode 100644 index 000000000..06fb063ca --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A6_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. + +/** + * Expression in "do-while" IterationStatement is bracketed with braces + * + * @path ch12/12.6/12.6.1/S12.6.1_A6_T2.js + * @description Checking if execution of "do{} while 0" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +do break; while 0; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A6_T3.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A6_T3.js new file mode 100644 index 000000000..b29c7c83f --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A6_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. + +/** + * Expression in "do-while" IterationStatement is bracketed with braces + * + * @path ch12/12.6/12.6.1/S12.6.1_A6_T3.js + * @description Checking if execution of "do{}while true" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +do break; while true; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A6_T4.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A6_T4.js new file mode 100644 index 000000000..55b670506 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A6_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. + +/** + * Expression in "do-while" IterationStatement is bracketed with braces + * + * @path ch12/12.6/12.6.1/S12.6.1_A6_T4.js + * @description Checking if execution of "do{}while false" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +do break; while false; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A6_T5.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A6_T5.js new file mode 100644 index 000000000..4b0b06202 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A6_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. + +/** + * Expression in "do-while" IterationStatement is bracketed with braces + * + * @path ch12/12.6/12.6.1/S12.6.1_A6_T5.js + * @description Checking if execution of "do{}while ''" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +do break; while ''; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A6_T6.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A6_T6.js new file mode 100644 index 000000000..35e96f41e --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A6_T6.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. + +/** + * Expression in "do-while" IterationStatement is bracketed with braces + * + * @path ch12/12.6/12.6.1/S12.6.1_A6_T6.js + * @description Checking if execution of "do{}while 'hood'" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +do break; while 'hood'; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A7.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A7.js new file mode 100644 index 000000000..78ca8c4ec --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A7.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. + +/** + * The "do-while" Statement is evaluted according to 12.6.1 and returns (normal, V, empty) + * + * @path ch12/12.6/12.6.1/S12.6.1_A7.js + * @description Using eval + */ + +var __condition=0 + +__evaluated = eval("do eval(\"__condition++\"); while (__condition<5)"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__condition !== 5) { + $ERROR('#1: The "do-while" statement is evaluted according to the Standard '); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__evaluated !== 4) { + $ERROR('#2: The "do-while" statement returns (normal, V, empty)'); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A8.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A8.js new file mode 100644 index 000000000..2f7c7e742 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A8.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. + +/** + * "continue" statement within a "do-while" Statement is allowed + * + * @path ch12/12.6/12.6.1/S12.6.1_A8.js + * @description Using eval + */ + +var __condition = 0, __odds=0; + +__evaluated = eval("do { __condition++; if (((''+__condition/2).split('.')).length>1) continue; __odds++;} while(__condition < 10)"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__odds !== 5) { + $ERROR('#1: __odds === 5. Actual: __odds ==='+ __odds ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__evaluated !== 4) { + $ERROR('#2: __evaluated === 4. Actual: __evaluated ==='+ __evaluated ); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A9.js b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A9.js new file mode 100644 index 000000000..e9e831b07 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/S12.6.1_A9.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. + +/** + * "do-while" Statement is evaluated without syntax checks + * + * @path ch12/12.6/12.6.1/S12.6.1_A9.js + * @description Throwing system exception whithin a "do-while" loop + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + do { + var x = 1; + abaracadabara; + } while(0); + $ERROR('#1: "abbracadabra" lead to throwing exception');
+
+} catch (e) {
+ if (e instanceof Test262Error) throw e; +} + +if (x !== 1) { + $ERROR('#1.1: x === 1. Actual: x ==='+ x ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/browser.js b/js/src/tests/test262/ch12/12.6/12.6.1/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/browser.js diff --git a/js/src/tests/test262/ch12/12.6/12.6.1/shell.js b/js/src/tests/test262/ch12/12.6/12.6.1/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.1/shell.js diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A1.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A1.js new file mode 100644 index 000000000..cb7fff722 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A1.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Expression from "while" IterationStatement is evaluated first; "false", "0", "null", "undefined" and "empty" strings used as the Expression are evaluated to "false" + * + * @path ch12/12.6/12.6.2/S12.6.2_A1.js + * @description Evaluating various Expressions + */ + +var __in__do; + +while ( false ) __in__do=1; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__in__do !== undefined) { + $ERROR('#1: false evaluates to false'); +} +// +////////////////////////////////////////////////////////////////////////////// + +while ( 0 ) __in__do=2; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__in__do !== undefined) { + $ERROR('#2: 0 evaluates to false'); +} +// +////////////////////////////////////////////////////////////////////////////// + +while ( "" ) __in__do=3; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (__in__do !== undefined) { + $ERROR('#3: empty string evaluates to false'); +} +// +////////////////////////////////////////////////////////////////////////////// + +while ( null ) __in__do=4; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if (__in__do !== undefined) { + $ERROR('#4: null evaluates to false'); +} +// +////////////////////////////////////////////////////////////////////////////// + +while ( undefined ) __in__do=35; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#5 +if (__in__do !== undefined) { + $ERROR('#5: undefined evaluates to false'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A10.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A10.js new file mode 100644 index 000000000..9a05fe317 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A10.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. + +/** + * FunctionExpression within a "while" IterationStatement is allowed, but no function with the given name will appear in the global context + * + * @path ch12/12.6/12.6.2/S12.6.2_A10.js + * @description Testing FunctionExpression too + */ + +var check=0; +while(function f(){}){ + if(typeof(f) === "function") { + check = -1; + break; + } else { + check = 1; + break; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (check !== 1) { + $ERROR('#1: FunctionExpression inside while construction expression allowed but function not declare'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A11.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A11.js new file mode 100644 index 000000000..6ff4c779c --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A11.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. + +/** + * "{}" Block within a "while" Expression is evaluated to true + * + * @path ch12/12.6/12.6.2/S12.6.2_A11.js + * @description Checking if execution of "while({}){}" passes + */ + +while({}){ + var __in__do=1; + if(__in__do)break; +}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__in__do !== 1) { + $ERROR('#1: "{}" in while expression evaluates to true'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A14_T1.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A14_T1.js new file mode 100644 index 000000000..f27b9df26 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A14_T1.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. + +/** + * FunctionExpression within a "while" Expression is allowed + * + * @path ch12/12.6/12.6.2/S12.6.2_A14_T1.js + * @description Using "function __func(){return 0;}" as an Expression + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +while(function __func(){return 0;}){ + var __reached = 1; + break; +}; +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__reached !== 1) { + $ERROR('#2: function expression inside of while expression is allowed'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A14_T2.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A14_T2.js new file mode 100644 index 000000000..cd867ea97 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A14_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. + +/** + * FunctionExpression within a "while" Expression is allowed + * + * @path ch12/12.6/12.6.2/S12.6.2_A14_T2.js + * @description Using function call as an Expression + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +while(function __func(){return 1;}()){ + var __reached = 1; + break; +}; +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__reached !== 1) { + $ERROR('#2: function expression inside of while expression is allowed'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A15.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A15.js new file mode 100644 index 000000000..e1e231dd4 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A15.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Block within a "while" Expression is not allowed + * + * @path ch12/12.6/12.6.2/S12.6.2_A15.js + * @description Expression is "{0}" + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +while({1}){ + break ; +}; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A2.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A2.js new file mode 100644 index 000000000..e3994d474 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A2.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. + +/** + * While evaluating The production IterationStatement: "while ( Expression ) Statement", Expression is evaluated first + * + * @path ch12/12.6/12.6.2/S12.6.2_A2.js + * @description Evaluating Statement with error Expression + */ + +try { + while ((function(){throw 1})()) __in__while = "reached"; + $ERROR('#1: \'while ((function(){throw 1})()) __in__while = "reached"\' lead to throwing exception'); +} catch (e) { + if (e !== 1) { + $ERROR('#1: Exception === 1. Actual: Exception ==='+e); + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof __in__while !== "undefined") { + $ERROR('#1.1: typeof __in__while === "undefined". Actual: typeof __in__while ==='+typeof __in__while); +} +// +////////////////////////////////////////////////////////////////////////////// + + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A3.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A3.js new file mode 100644 index 000000000..ec8934e8e --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A3.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. + +/** + * When "while" IterationStatement is evaluated, (normal, V, empty) is returned + * + * @path ch12/12.6/12.6.2/S12.6.2_A3.js + * @description Using eval + */ + +var __in__do; + +__evaluated = eval("while (false) __in__do=1;"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +if (__in__do !== undefined) { + $ERROR('#1: __in__do === undefined. Actual: __in__do ==='+ __in__do ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__evaluated !== undefined) { + $ERROR('#2: __evaluated === undefined. Actual: __evaluated ==='+ __evaluated ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A4_T1.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A4_T1.js new file mode 100644 index 000000000..5e20d53ba --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A4_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. + +/** + * "break" within a "while" Statement is allowed and performed as described in 12.8 + * + * @path ch12/12.6/12.6.2/S12.6.2_A4_T1.js + * @description "break" within a "while" Statement + */ + +while(1===1){ + __in__do__before__break="reached"; + break; + __in__do__after__break="where am i"; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__in__do__before__break !== "reached") { + $ERROR('#1: __in__do__before__break === "reached". Actual: __in__do__before__break ==='+ __in__do__before__break ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (typeof __in__do__after__break !== "undefined") { + $ERROR('#2: typeof __in__do__after__break === "undefined". Actual: typeof __in__do__after__break ==='+ typeof __in__do__after__break ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A4_T2.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A4_T2.js new file mode 100644 index 000000000..616145c02 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A4_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. + +/** + * "break" within a "while" Statement is allowed and performed as described in 12.8 + * + * @path ch12/12.6/12.6.2/S12.6.2_A4_T2.js + * @description "break" and VariableDeclaration within a "while" Statement + */ + +do_out : while(1===1) { + if (__in__do__before__break) break; + var __in__do__before__break="black"; + do_in : while (1) { + var __in__do__IN__before__break="hole"; + break do_in; + var __in__do__IN__after__break="sun"; + } ; + var __in__do__after__break="won't you come"; +}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!(__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break)) { + $ERROR('#1: Break inside do-while is allowed as its described at standard'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A4_T3.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A4_T3.js new file mode 100644 index 000000000..a86e95705 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A4_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. + +/** + * "break" within a "while" Statement is allowed and performed as described in 12.8 + * + * @path ch12/12.6/12.6.2/S12.6.2_A4_T3.js + * @description "break" and VariableDeclaration within a "while" Statement + */ + +do_out : while(1===1) { + if (__in__do__before__break) break; + var __in__do__before__break="once"; + do_in : while (1) { + var __in__do__IN__before__break="in"; + break do_out; + var __in__do__IN__after__break="the"; + } ; + var __in__do__after__break="lifetime"; +} ; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!(__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&!__in__do__after__break)) { + $ERROR('#1: Break inside do-while is allowed as its described at standard'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A4_T4.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A4_T4.js new file mode 100644 index 000000000..4dc75f137 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A4_T4.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. + +/** + * "break" within a "while" Statement is allowed and performed as described in 12.8 + * + * @path ch12/12.6/12.6.2/S12.6.2_A4_T4.js + * @description "break" and VariableDeclaration within a "while" Statement + */ + +do_out : while(1===1) { + if(__in__do__before__break)break; + var __in__do__before__break="can't"; + do_in : while (1) { + var __in__do__IN__before__break="get"; + break; + var __in__do__IN__after__break="no"; + } ; + var __in__do__after__break="Satisfaction"; +} ; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!(__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break)) { + $ERROR('#1: Break inside do-while is allowed as its described at standard'); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A4_T5.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A4_T5.js new file mode 100644 index 000000000..46e5b95c7 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A4_T5.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. + +/** + * "break" within a "while" Statement is allowed and performed as described in 12.8 + * + * @path ch12/12.6/12.6.2/S12.6.2_A4_T5.js + * @description Using labeled "break" in order to continue a "while" loop + */ + +//CHECK#1 +var i=0; +woohoo:{ + while(true){ + i++; + if ( ! (i < 10) ) { + break woohoo; + $ERROR('#1.1: "break woohoo" must break loop'); + } + } + if (i!==10) $ERROR('#1.2: i===10. Actual: i==='+ i ); +} + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A5.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A5.js new file mode 100644 index 000000000..899837466 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A5.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. + +/** + * While using "while" within an eval statement, source "break" is allowed and (normal, V, empty) is returned + * + * @path ch12/12.6/12.6.2/S12.6.2_A5.js + * @description Using eval + */ + +__evaluated = eval("while(1) {__in__do__before__break=1; break; __in__do__after__break=2;}"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__in__do__before__break !== 1) { + $ERROR('#1: __in__do__before__break === 1. Actual: __in__do__before__break ==='+ __in__do__before__break ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (typeof __in__do__after__break !== "undefined") { + $ERROR('#2: typeof __in__do__after__break === "undefined". Actual: typeof __in__do__after__break ==='+ typeof __in__do__after__break ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (__evaluated !== 1) { + $ERROR('#3: __evaluated === 1. Actual: __evaluated ==='+ __evaluated ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T1.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T1.js new file mode 100644 index 000000000..f9a4e9744 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_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. + +/** + * Expression in "while" IterationStatement is bracketed with braces + * + * @path ch12/12.6/12.6.2/S12.6.2_A6_T1.js + * @description Checking if execution of "while 1 break" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +while 1 break; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T2.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T2.js new file mode 100644 index 000000000..b7f61b8b4 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_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. + +/** + * Expression in "while" IterationStatement is bracketed with braces + * + * @path ch12/12.6/12.6.2/S12.6.2_A6_T2.js + * @description Checking if execution of "while 0 break" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +while 0 break; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T3.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T3.js new file mode 100644 index 000000000..4b0eaea03 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_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. + +/** + * Expression in "while" IterationStatement is bracketed with braces + * + * @path ch12/12.6/12.6.2/S12.6.2_A6_T3.js + * @description Checking if execution of "while true break" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +while true break; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T4.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T4.js new file mode 100644 index 000000000..8d17ce8f1 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_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. + +/** + * Expression in "while" IterationStatement is bracketed with braces + * + * @path ch12/12.6/12.6.2/S12.6.2_A6_T4.js + * @description Checking if execution of "while false break" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +while false break; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T5.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T5.js new file mode 100644 index 000000000..e1b677741 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_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. + +/** + * Expression in "while" IterationStatement is bracketed with braces + * + * @path ch12/12.6/12.6.2/S12.6.2_A6_T5.js + * @description Checking if execution of "while '' break" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +while '' break; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T6.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T6.js new file mode 100644 index 000000000..78ce3abdb --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T6.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. + +/** + * Expression in "while" IterationStatement is bracketed with braces + * + * @path ch12/12.6/12.6.2/S12.6.2_A6_T6.js + * @description Checking if execution of "while 'hood' break" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +while 'hood' break; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A7.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A7.js new file mode 100644 index 000000000..5743cd6d4 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A7.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. + +/** + * The "while" Statement is evaluted according to 12.6.2 and returns (normal, V, empty) + * + * @path ch12/12.6/12.6.2/S12.6.2_A7.js + * @description using eval + */ + +var __condition=0 + +__evaluated = eval("while (__condition<5) eval(\"__condition++\");"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__condition !== 5) { + $ERROR('#1: The "while" statement is evaluated as described in the Standard'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__evaluated !== 4) { + $ERROR('#2: The "while" statement returns (normal, V, empty)'); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A8.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A8.js new file mode 100644 index 000000000..a5af5748d --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A8.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. + +/** + * "continue" statement within a "while" Statement is allowed + * + * @path ch12/12.6/12.6.2/S12.6.2_A8.js + * @description using eval + */ + +var __condition = 0, __odds=0; + +__evaluated = eval("while(__condition < 10) { __condition++; if (((''+__condition/2).split('.')).length>1) continue; __odds++;}"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__odds !== 5) { + $ERROR('#1: __odds === 5. Actual: __odds ==='+ __odds ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__evaluated !== 4) { + $ERROR('#2: __evaluated === 4. Actual: __evaluated ==='+ __evaluated ); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A9.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A9.js new file mode 100644 index 000000000..f8cbed0a1 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A9.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. + +/** + * "while" Statement is evaluated without syntax checks + * + * @path ch12/12.6/12.6.2/S12.6.2_A9.js + * @description Throwing system exception inside "while" loop + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + while(x!=1) { + var x = 1; + abaracadabara; + }; + $ERROR('#1: "abbracadabra" lead to throwing exception');
+
+} catch (e) {
+ if (e instanceof Test262Error) throw e; +} + +if (x !== 1) { + $ERROR('#1.1: while statement evaluates as is, without syntax checks'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/browser.js b/js/src/tests/test262/ch12/12.6/12.6.2/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/browser.js diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/shell.js b/js/src/tests/test262/ch12/12.6/12.6.2/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/shell.js diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-1.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-1.js new file mode 100644 index 000000000..a0aa03156 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-1.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 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-1.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is an Object with value false
+ */
+
+
+function testcase() {
+ var accessed = false;
+ var obj = { value: false };
+ for (var i = 0; obj; ) {
+ accessed = true;
+ break;
+ }
+ return accessed;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-10.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-10.js new file mode 100644 index 000000000..cc1cb63d6 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-10.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 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-10.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is a String object (value is '1')
+ */
+
+
+function testcase() {
+ var accessed = false;
+ var strObj = new String("1");
+ for (var i = 0; strObj;) {
+ accessed = true;
+ break;
+ }
+ return accessed;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-11.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-11.js new file mode 100644 index 000000000..2bccf56df --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-11.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 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-11.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is undefined
+ */
+
+
+function testcase() {
+ var count = 0;
+ for (var i = 0; undefined;) {
+ count++;
+ }
+ return count === 0;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-12.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-12.js new file mode 100644 index 000000000..6698b966b --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-12.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 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-12.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is null
+ */
+
+
+function testcase() {
+ var count = 0;
+ for (var i = 0; null;) {
+ count++;
+ }
+ return count === 0;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-13.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-13.js new file mode 100644 index 000000000..4e7d39333 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-13.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 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-13.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is a boolean (value is false)
+ */
+
+
+function testcase() {
+ var count = 0;
+ for (var i = 0; false;) {
+ count++;
+ }
+ return count === 0;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-14.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-14.js new file mode 100644 index 000000000..865f68d77 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-14.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 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-14.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is a number (value is NaN)
+ */
+
+
+function testcase() {
+ var count = 0;
+ for (var i = 0; NaN;) {
+ count++;
+ }
+ return count === 0;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-15.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-15.js new file mode 100644 index 000000000..8f85811f3 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-15.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 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-15.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is a number (value is +0)
+ */
+
+
+function testcase() {
+ var count = 0;
+ for (var i = 0; +0;) {
+ count++;
+ }
+ return count === 0;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-16.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-16.js new file mode 100644 index 000000000..20d03326e --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-16.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 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-16.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is a number (value is -0)
+ */
+
+
+function testcase() {
+ var count = 0;
+ for (var i = 0; -0;) {
+ count++;
+ }
+ return count === 0;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-17.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-17.js new file mode 100644 index 000000000..faca41566 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-17.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 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-17.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is a number (value is a positive)
+ */
+
+
+function testcase() {
+ var accessed = false;
+ for (var i = 0; 2;) {
+ accessed = true;
+ break;
+ }
+ return accessed;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-18.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-18.js new file mode 100644 index 000000000..8fc6251de --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-18.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 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-18.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is a string (value is empty string)
+ */
+
+
+function testcase() {
+ var count = 0;
+ for (var i = 0; "";) {
+ count++;
+ }
+ return count === 0;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-19.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-19.js new file mode 100644 index 000000000..19dc79e05 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-19.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 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-19.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is a string (value is 'undefined')
+ */
+
+
+function testcase() {
+ var accessed = false;
+ for (var i = 0; "undefined";) {
+ accessed = true;
+ break;
+ }
+ return accessed;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-2.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-2.js new file mode 100644 index 000000000..eaf600c6e --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-2.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 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-2.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is a Boolean object
+ */
+
+
+function testcase() {
+ var accessed = false;
+ var boolObj = new Boolean(false);
+ for (var i = 0; boolObj;) {
+ accessed = true;
+ break;
+ }
+ return accessed;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-20.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-20.js new file mode 100644 index 000000000..6c8e61c59 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-20.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 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-20.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is a string (value is 'null')
+ */
+
+
+function testcase() {
+ var accessed = false;
+ for (var i = 0; "null";) {
+ accessed = true;
+ break;
+ }
+ return accessed;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-21.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-21.js new file mode 100644 index 000000000..d83bd0b18 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-21.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 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-21.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is a string (value is '1')
+ */
+
+
+function testcase() {
+ var accessed = false;
+ for (var i = 0; "1";) {
+ accessed = true;
+ break;
+ }
+ return accessed;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-3.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-3.js new file mode 100644 index 000000000..76f27f8bd --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-3.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 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-3.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is a Number object (value is NaN)
+ */
+
+
+function testcase() {
+ var accessed = false;
+ var numObj = new Number(NaN);
+ for (var i = 0; numObj;) {
+ accessed = true;
+ break;
+ }
+ return accessed;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-4.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-4.js new file mode 100644 index 000000000..81599d37b --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-4.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 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-4.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is a Number object (value is +0)
+ */
+
+
+function testcase() {
+ var accessed = false;
+ var numObj = new Number(+0);
+ for (var i = 0; numObj;) {
+ accessed = true;
+ break;
+ }
+ return accessed;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-5.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-5.js new file mode 100644 index 000000000..5a3199947 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-5.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 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-5.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is a Number object (value is -0)
+ */
+
+
+function testcase() {
+ var accessed = false;
+ var numObj = new Number(-0);
+ for (var i = 0; numObj;) {
+ accessed = true;
+ break;
+ }
+ return accessed;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-6.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-6.js new file mode 100644 index 000000000..6f8ed9cd3 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-6.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 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-6.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is a Number object (value is a positive)
+ */
+
+
+function testcase() {
+ var accessed = false;
+ var numObj = new Number(12);
+ for (var i = 0; numObj;) {
+ accessed = true;
+ break;
+ }
+ return accessed;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-7.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-7.js new file mode 100644 index 000000000..920911c94 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-7.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 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-7.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is a String object (value is empty string)
+ */
+
+
+function testcase() {
+ var accessed = false;
+ var strObj = new String("");
+ for (var i = 0; strObj;) {
+ accessed = true;
+ break;
+ }
+ return accessed;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-8.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-8.js new file mode 100644 index 000000000..f087aa207 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-8.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 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-8.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is a String object (value is 'undefined')
+ */
+
+
+function testcase() {
+ var accessed = false;
+ var strObj = new String("undefined");
+ for (var i = 0; strObj;) {
+ accessed = true;
+ break;
+ }
+ return accessed;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-9.js b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-9.js new file mode 100644 index 000000000..45ed58923 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/12.6.3_2-3-a-ii-9.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 12.6.3;
+ * The production
+ * IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ * is evaluated as follows:
+ *
+ * @path ch12/12.6/12.6.3/12.6.3_2-3-a-ii-9.js
+ * @description The for Statement - (normal, V, empty) will be returned when first Expression is a String object (value is 'null')
+ */
+
+
+function testcase() {
+ var accessed = false;
+ var strObj = new String("null");
+ for (var i = 0; strObj;) {
+ accessed = true;
+ break;
+ }
+ return accessed;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A1.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A1.js new file mode 100644 index 000000000..dd200559c --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A1.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. + +/** + * The "for {;;}" for Statement with empty expressions is allowed and leads to performing an infinite loop + * + * @path ch12/12.6/12.6.3/S12.6.3_A1.js + * @description Breaking an infinite loop by throwing exception + */ + +var __in__for = 0; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + for (;;){ + //__in__for++; + if(++__in__for>100)throw 1; +} +} catch (e) { + if (e !== 1) { + $ERROR('#1: for {;;} is admitted and leads to infinite loop'); + } +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__in__for !== 101) { + $ERROR('#2: __in__for === 101. Actual: __in__for ==='+ __in__for ); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A10.1.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A10.1.js new file mode 100644 index 000000000..13bfc59ff --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A10.1.js @@ -0,0 +1,111 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Nested "var-loops" nine blocks depth is evaluated properly + * + * @path ch12/12.6/12.6.3/S12.6.3_A10.1.js + * @description Checking if executing nested "var-loops" nine blocks depth is evaluated properly + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + __in__deepest__loop=__in__deepest__loop; +} catch (e) { + $ERROR('#1: "__in__deepest__loop=__in__deepest__loop" does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +try { + index0=index0; +} catch (e) { + $ERROR('#2: "index0=index0" does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +try { + index1=index1; +} catch (e) { + $ERROR('#3: "index1=index1" does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +try { + index4=index4; +} catch (e) { + $ERROR('#4: "index4=index4" does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#5 +try { + index5=index5; +} catch (e) { + $ERROR('#4: "index5=index5" does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#6 +try { + index7=index7; +} catch (e) { + $ERROR('#6: "index7=index7" does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#7 +try { + index8=index8; +} catch (e) { + $ERROR('#7: "index8=index8" does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +__str=""; + +for( var index0=0; index0<=1; index0++) { + for(var index1=0; index1<=index0; index1++) { + for( index2=0; index2<=index1; index2++) { + for( index3=0; index3<=index2; index3++) { + for(var index4=0; index4<=index3; index4++) { + for(var index5=0; index5<=index4; index5++) { + for( index6=0; index6<=index5; index6++) { + for(var index7=0; index7<=index6; index7++) { + for(var index8=0; index8<=index1; index8++) { + var __in__deepest__loop; + __str+=""+index0+index1+index2+index3+index4+index5+index6+index7+index8+'\n'; + } + } + } + } + } + } + } + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__str!== "000000000\n100000000\n110000000\n110000001\n111000000\n111000001\n111100000\n111100001\n111110000\n111110001\n111111000\n111111001\n111111100\n111111101\n111111110\n111111111\n") { + $ERROR('#2: __str === "000000000\\n100000000\\n110000000\\n110000001\\n111000000\\n111000001\\n111100000\\n111100001\\n111110000\\n111110001\\n111111000\\n111111001\\n111111100\\n111111101\\n111111110\\n111111111\\n". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A10.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A10.js new file mode 100644 index 000000000..fb17b0b2c --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A10.js @@ -0,0 +1,51 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Nested "var-loops" nine blocks depth is evaluated properly + * + * @path ch12/12.6/12.6.3/S12.6.3_A10.js + * @description Checking if executing nested "var-loops" nine blocks depth is evaluated properly + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +try { + __in__deepest__loop=__in__deepest__loop; +} catch (e) { + $ERROR('#1: "__in__deepest__loop=__in__deepest__loop" does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +__str=""; + +for( index0=0; index0<=1; index0++) { + for( index1=0; index1<=index0; index1++) { + for( index2=0; index2<=index1; index2++) { + for( index3=0; index3<=index2; index3++) { + for( index4=0; index4<=index3; index4++) { + for( index5=0; index5<=index4; index5++) { + for( index6=0; index6<=index5; index6++) { + for( index7=0; index7<=index6; index7++) { + for( index8=0; index8<=index1; index8++) { + var __in__deepest__loop; + __str+=""+index0+index1+index2+index3+index4+index5+index6+index7+index8+'\n'; + } + } + } + } + } + } + } + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__str!== "000000000\n100000000\n110000000\n110000001\n111000000\n111000001\n111100000\n111100001\n111110000\n111110001\n111111000\n111111001\n111111100\n111111101\n111111110\n111111111\n") { + $ERROR('#2: __str === "000000000\\n100000000\\n110000000\\n110000001\\n111000000\\n111000001\\n111100000\\n111100001\\n111110000\\n111110001\\n111111000\\n111111001\\n111111100\\n111111101\\n111111110\\n111111111\\n". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A11.1_T1.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A11.1_T1.js new file mode 100644 index 000000000..d050b3dbc --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A11.1_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If (Evaluate Statement).type is "continue" and (Evaluate Statement).target is in the current label set, iteration of labeled "var-loop" breaks + * + * @path ch12/12.6/12.6.3/S12.6.3_A11.1_T1.js + * @description Using "continue" in order to continue a loop + */ + +__str="" + +for(var index=0; index<10; index+=1) { + if (index<5)continue; + __str+=index; +} + +if (__str!=="56789") { + $ERROR('#1: __str === "56789". Actual: __str ==='+ __str ); +} + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A11.1_T2.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A11.1_T2.js new file mode 100644 index 000000000..cc0233d41 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A11.1_T2.js @@ -0,0 +1,63 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If (Evaluate Statement).type is "continue" and (Evaluate Statement).target is in the current label set, iteration of labeled "var-loop" breaks + * + * @path ch12/12.6/12.6.3/S12.6.3_A11.1_T2.js + * @description Embedded loops + */ + +__str=""; + +outer : for(var index=0; index<4; index+=1) { + nested : for(var index_n=0; index_n<=index; index_n++) { + if (index*index_n == 6)continue nested; + __str+=""+index+index_n; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__str !== "001011202122303133") { + $ERROR('#1: __str === "001011202122303133". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +__str=""; + +outer : for(var index=0; index<4; index+=1) { + nested : for(var index_n=0; index_n<=index; index_n++) { + if (index*index_n == 6)continue outer; + __str+=""+index+index_n; + } +} +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__str !== "0010112021223031") { + $ERROR('#2: __str === "0010112021223031". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +__str=""; + +outer : for(var index=0; index<4; index+=1) { + nested : for(var index_n=0; index_n<=index; index_n++) { + if (index*index_n == 6)continue ; + __str+=""+index+index_n; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (__str !== "001011202122303133") { + $ERROR('#3: __str === "001011202122303133". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + + + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A11.1_T3.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A11.1_T3.js new file mode 100644 index 000000000..d02abf292 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A11.1_T3.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. + +/** + * If (Evaluate Statement).type is "continue" and (Evaluate Statement).target is in the current label set, iteration of labeled "var-loop" breaks + * + * @path ch12/12.6/12.6.3/S12.6.3_A11.1_T3.js + * @description Trying to continue non-existent label + * @negative + */ + +__str=""; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +outer:for(var index=0;index<4;index+=1){ + nested:for(var index_n=0;index_n<=index;index_n++){ + if(index*index_n == 6)continue nonexist; + __str+=""+index+index_n; + } +} +// +////////////////////////////////////////////////////////////////////////////// + + + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A11_T1.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A11_T1.js new file mode 100644 index 000000000..192f1ebd5 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A11_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If (Evaluate Statement).type is "continue" and (Evaluate Statement).target is in the current label set, iteration of labeled loop breaks + * + * @path ch12/12.6/12.6.3/S12.6.3_A11_T1.js + * @description Simple test of continue loop with using "continue" + */ + +__str="" + +for(index=0; index<10; index+=1) { + if (index<5)continue; + __str+=index; +} + +if (__str!=="56789") { + $ERROR('#1: __str === "56789". Actual: __str ==='+ __str ); +} + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A11_T2.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A11_T2.js new file mode 100644 index 000000000..cdc606b5c --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A11_T2.js @@ -0,0 +1,63 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If (Evaluate Statement).type is "continue" and (Evaluate Statement).target is in the current label set, iteration of labeled loop breaks + * + * @path ch12/12.6/12.6.3/S12.6.3_A11_T2.js + * @description Embedded loops + */ + +__str=""; + +outer : for(index=0; index<4; index+=1) { + nested : for(index_n=0; index_n<=index; index_n++) { + if (index*index_n == 6)continue nested; + __str+=""+index+index_n; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__str !== "001011202122303133") { + $ERROR('#1: __str === "001011202122303133". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +__str=""; + +outer : for(index=0; index<4; index+=1) { + nested : for(index_n=0; index_n<=index; index_n++) { + if (index*index_n == 6)continue outer; + __str+=""+index+index_n; + } +} +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__str !== "0010112021223031") { + $ERROR('#2: __str === "0010112021223031". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +__str=""; + +outer : for(index=0; index<4; index+=1) { + nested : for(index_n=0; index_n<=index; index_n++) { + if (index*index_n == 6)continue ; + __str+=""+index+index_n; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (__str !== "001011202122303133") { + $ERROR('#3: __str === "001011202122303133". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + + + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A11_T3.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A11_T3.js new file mode 100644 index 000000000..2807bc86f --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A11_T3.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. + +/** + * If (Evaluate Statement).type is "continue" and (Evaluate Statement).target is in the current label set, iteration of labeled loop breaks + * + * @path ch12/12.6/12.6.3/S12.6.3_A11_T3.js + * @description Trying to continue non-existent label + * @negative + */ + +__str=""; + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +outer:for(index=0;index<4;index+=1){ + nested:for(index_n=0;index_n<=index;index_n++){ + if(index*index_n == 6)continue nonexist; + __str+=""+index+index_n; + } +} +// +////////////////////////////////////////////////////////////////////////////// + + + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A12.1_T1.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A12.1_T1.js new file mode 100644 index 000000000..48fc3b30c --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A12.1_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If (Evaluate Statement).type is "break" and (Evaluate Statement).target is in the current label set, (normal, (Evaluate Statement), empty) is returned while evaluating a "var-loop" + * + * @path ch12/12.6/12.6.3/S12.6.3_A12.1_T1.js + * @description Breaking a loop with "break" + */ + +__str="" + +for(var index=0; index<10; index+=1) { + if (index>5)break; + __str+=index; +} + +if (__str!=="012345") { + $ERROR('#1: __str === "012345". Actual: __str ==='+ __str ); +} + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A12.1_T2.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A12.1_T2.js new file mode 100644 index 000000000..939fd991d --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A12.1_T2.js @@ -0,0 +1,64 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If (Evaluate Statement).type is "break" and (Evaluate Statement).target is in the current label set, (normal, (Evaluate Statement), empty) is returned while evaluating a "var-loop" + * + * @path ch12/12.6/12.6.3/S12.6.3_A12.1_T2.js + * @description Embedded loops + */ + +__str=""; + +outer : for(var index=0; index<4; index+=1) { + nested : for(var index_n=0; index_n<=index; index_n++) { + if (index*index_n >= 4)break nested; + __str+=""+index+index_n; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__str !== "00101120213031") { + $ERROR('#1: __str === "00101120213031". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +__str=""; + +outer : for(var index=0; index<4; index+=1) { + nested : for(var index_n=0; index_n<=index; index_n++) { + if (index*index_n >= 4)break outer; + __str+=""+index+index_n; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__str !== "0010112021") { + $ERROR('#2: __str === "0010112021". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +__str=""; + +outer : for(var index=0; index<4; index+=1) { + nested : for(var index_n=0; index_n<=index; index_n++) { + if (index*index_n >= 4)break ; + __str+=""+index+index_n; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (__str !== "00101120213031") { + $ERROR('#3: __str === "00101120213031". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + + + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A12.1_T3.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A12.1_T3.js new file mode 100644 index 000000000..96a5accd9 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A12.1_T3.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. + +/** + * If (Evaluate Statement).type is "break" and (Evaluate Statement).target is in the current label set, (normal, (Evaluate Statement), empty) is returned while evaluating a "var-loop" + * + * @path ch12/12.6/12.6.3/S12.6.3_A12.1_T3.js + * @description Trying to break non-existent label + * @negative + */ + +__str=""; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +outer:for(var index=0;index<4;index+=1){ + nested:for(var index_n=0;index_n<=index;index_n++){ + if(index*index_n >= 4)break nonexist; + __str+=""+index+index_n; + } +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A12_T1.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A12_T1.js new file mode 100644 index 000000000..55031321d --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A12_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If (Evaluate Statement).type is "break" and (Evaluate Statement).target is in the current label set, (normal, (Evaluate Statement), empty) is returned while evaluating a loop + * + * @path ch12/12.6/12.6.3/S12.6.3_A12_T1.js + * @description Breaking a loop with "break" + */ + +__str="" + +for(index=0; index<10; index+=1) { + if (index>5)break; + __str+=index; +} + +if (__str!=="012345") { + $ERROR('#1:__str === "012345". Actual: __str ==='+__str ); +} + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A12_T2.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A12_T2.js new file mode 100644 index 000000000..e97dc7da3 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A12_T2.js @@ -0,0 +1,64 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If (Evaluate Statement).type is "break" and (Evaluate Statement).target is in the current label set, (normal, (Evaluate Statement), empty) is returned while evaluating a loop + * + * @path ch12/12.6/12.6.3/S12.6.3_A12_T2.js + * @description Embedded loops + */ + +__str=""; + +outer : for(index=0; index<4; index+=1) { + nested : for(index_n=0; index_n<=index; index_n++) { + if (index*index_n >= 4)break nested; + __str+=""+index+index_n; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__str !== "00101120213031") { + $ERROR('#1: __str === "00101120213031". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +__str=""; + +outer : for(index=0; index<4; index+=1) { + nested : for(index_n=0; index_n<=index; index_n++) { + if (index*index_n >= 4)break outer; + __str+=""+index+index_n; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__str !== "0010112021") { + $ERROR('#2: __str === "0010112021". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +__str=""; + +outer : for(index=0; index<4; index+=1) { + nested : for(index_n=0; index_n<=index; index_n++) { + if (index*index_n >= 4)break ; + __str+=""+index+index_n; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (__str !== "00101120213031") { + $ERROR('#3: __str === "00101120213031". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + + + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A12_T3.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A12_T3.js new file mode 100644 index 000000000..67fd236cd --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A12_T3.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. + +/** + * If (Evaluate Statement).type is "break" and (Evaluate Statement).target is in the current label set, (normal, (Evaluate Statement), empty) is returned while evaluating a loop + * + * @path ch12/12.6/12.6.3/S12.6.3_A12_T3.js + * @description Trying to break non-existent label + * @negative + */ + +__str=""; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +outer:for(index=0;index<4;index+=1){ + nested:for(index_n=0;index_n<=index;index_n++){ + if(index*index_n >= 4)break nonexist; + __str+=""+index+index_n; + } +}; +// +////////////////////////////////////////////////////////////////////////////// + + + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A13.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A13.js new file mode 100644 index 000000000..452902537 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A13.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 in "var VariableDeclarationListNoIn" of for IterationStatement is allowed + * + * @path ch12/12.6/12.6.3/S12.6.3_A13.js + * @description Declaring variable in "for" ExpressionNoIn + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + index = index; +} catch (e) { + $ERROR('#1: VariableDeclaration in "var VariableDeclarationListNoIn" of for IterationStatement is allowed'); +} +// +////////////////////////////////////////////////////////////////////////////// + + +for(var index=0; index<6; index++) { + ; +} + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A14.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A14.js new file mode 100644 index 000000000..182482dd9 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A14.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 IterationStatement: "for (var VariableDeclarationListNoIn; Expression; Expression) Statement" + * + * @path ch12/12.6/12.6.3/S12.6.3_A14.js + * @description Using +,*,/, as the second Expression + */ + +//CHECK#1 +for(var i=0;i<10;i++){} +if (i!==10) $ERROR('#1: i === 10. Actual: i ==='+ i ); + +//CHECK#2 +var j=0; +for(var i=1;i<10;i*=2){ + j++; +} +if (i!==16) $ERROR('#2.1: i === 16. Actual: i ==='+ i ); +if (j!==4) $ERROR('#2.2: j === 4. Actual: j ==='+ j ); + +//CHECK#3 +var j=0; +for(var i=16;i>1;i=i/2){ + j++; +} +if (i!==1) $ERROR('#3.1: i === 1. Actual: i ==='+ i ); +if (j!==4) $ERROR('#3.2: j === 4. Actual: j ==='+ j ); + +//CHECK#4 +var j=0; +for(var i=10;i>1;i--){ + j++; +} +if (i!==1) $ERROR('#4.1: i === 1. Actual: i ==='+ i ); +if (j!==9) $ERROR('#4.2: j === 9. Actual: j ==='+ j ); + +//CHECK#5 +var j=0; +for(var i=2;i<10;i*=i){ + j++; +} +if (i!==16) $ERROR('#5.1: i === 16. Actual: i ==='+ i ); +if (j!==2) $ERROR('#5.2: j === 2. Actual: j ==='+ j ); + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A15.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A15.js new file mode 100644 index 000000000..4ec6147b9 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A15.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. + +/** + * The production IterationStatement: "for (var VariableDeclarationListNoIn; Expression; Expression) Statement" + * + * @path ch12/12.6/12.6.3/S12.6.3_A15.js + * @description Statement must be evaluated before second Expression is evaluated + */ + +//CHECK#1 +for(var i=0;i<10;i++){ + i*=2; + break; +} +if (i!==0) $ERROR('#1: i === 0. Actual: i ==='+ i ); + +//CHECK#2 +for(var i=0;i<10;i++){ + i*=2; + if (i===3) $ERROR('#2: i !== 3'); +} + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A2.1.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A2.1.js new file mode 100644 index 000000000..78372a2d7 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A2.1.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. + +/** + * While evaluating "for (ExpressionNoIn ; ; Expression) Statement", Statement is evaulated first + * + * @path ch12/12.6/12.6.3/S12.6.3_A2.1.js + * @description Using "(function(){throw "NoInExpression"})()" as ExpressionNoIn + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + for((function(){throw "NoInExpression"})(); ;(function(){throw "SecondExpression"})()) { + throw "Statement"; + } + $ERROR('#1: (function(){throw "NoInExpression"})() lead to throwing exception'); +} catch (e) { + if (e !== "NoInExpression") { + $ERROR('#2: When for (ExpressionNoIn ; ; Expression) Statement is evaluated NoInExpression evaluates first'); + } +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A2.2.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A2.2.js new file mode 100644 index 000000000..f6391e2f7 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A2.2.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. + +/** + * While evaluating "for (ExpressionNoIn;;) Statement", Statement is evaulated first + * + * @path ch12/12.6/12.6.3/S12.6.3_A2.2.js + * @description Using "(function(){throw "NoInExpression"})()" as ExpressionNoIn + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + for((function(){throw "NoInExpression"})();;) { + throw "Statement"; + } + $ERROR('#1: (function(){throw "NoInExpression"})() lead to throwing exception'); +} catch (e) { + if (e !== "NoInExpression") { + $ERROR('#1: When for (ExpressionNoIn ; ; ) Statement is evaluated NoInExpression evaluates first'); + } +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A2.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A2.js new file mode 100644 index 000000000..86718d9d1 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A2.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. + +/** + * While evaluating "for (ExpressionNoIn; Expression; Expression) Statement", ExpressionNoIn is evaulated first + * + * @path ch12/12.6/12.6.3/S12.6.3_A2.js + * @description Using "(function(){throw "NoInExpression"})()" as ExpressionNoIn + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + for((function(){throw "NoInExpression";})(); (function(){throw "FirstExpression";})(); (function(){throw "SecondExpression";})()) { + var in_for = "reached"; + } + $ERROR('#1: (function(){throw "NoInExpression";})() lead to throwing exception'); +} catch (e) { + if (e !== "NoInExpression") { + $ERROR('#1: When for (ExpressionNoIn ; Expression ; Expression) Statement is evaluated ExpressionNoIn evaluates first'); + } +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (in_for !== undefined) { + $ERROR('#2: in_for === undefined. Actual: in_for ==='+ in_for ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A3.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A3.js new file mode 100644 index 000000000..2c46dbfbb --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A3.js @@ -0,0 +1,41 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * While evaluating "for (ExpressionNoIn; FirstExpression; SecondExpression) Statement", ExpressionNoIn is evaulated first, FirstExpressoin is evaluated second + * + * @path ch12/12.6/12.6.3/S12.6.3_A3.js + * @description Using "(function(){throw "FirstExpression"})()" as FirstExpression + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + for((function(){__in__NotInExpression__ = "checked";__in__NotInExpression__2 = "passed";})(); (function(){throw "FirstExpression"})(); (function(){throw "SecondExpression"})()) { + __in__for="reached"; + } + $ERROR('#1: (function(){throw "SecondExpression"} lead to throwing exception'); +} catch (e) { + if (e !== "FirstExpression") { + $ERROR('#1: When for (ExpressionNoIn ; FirstExpression ; SecondExpression) Statement is evaluated first evaluates ExpressionNoIn then FirstExpression'); + } +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if ((__in__NotInExpression__ !== "checked")&(__in__NotInExpression__2!=="passed")) { + $ERROR('#2: (__in__NotInExpression__ === "checked")&(__in__NotInExpression__2==="passed")'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (typeof __in__for !== "undefined") { + $ERROR('#3: typeof __in__for === "undefined". Actual: typeof __in__for ==='+ typeof __in__for ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A4.1.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A4.1.js new file mode 100644 index 000000000..a64935274 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A4.1.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. + +/** + * "in"-expression is not allowed as a ExpressionNoIn in "for (ExpressionNoIn; FirstExpression; SecondExpression) Statement" IterationStatement + * + * @path ch12/12.6/12.6.3/S12.6.3_A4.1.js + * @description Checking if execution of "for (var a in arr;1;){}" fails + * @negative + */ + +arr = [1,2,3,4,5]; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +for (var a in arr;1;){ + break; +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A4_T1.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A4_T1.js new file mode 100644 index 000000000..48e56c4b1 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A4_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. + +/** + * "in"-expression is not allowed as a ExpressionNoIn in "for (ExpressionNoIn; FirstExpression; SecondExpression) Statement" IterationStatement + * + * @path ch12/12.6/12.6.3/S12.6.3_A4_T1.js + * @description Checking if execution of "for (a in arr;1;){}" fails + * @negative + */ + +arr = [1,2,3,4,5]; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +for (a in arr;1;){ + break; +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A4_T2.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A4_T2.js new file mode 100644 index 000000000..2a292a808 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A4_T2.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. + +/** + * "in"-expression is not allowed as a ExpressionNoIn in "for (ExpressionNoIn; FirstExpression; SecondExpression) Statement" IterationStatement + * + * @path ch12/12.6/12.6.3/S12.6.3_A4_T2.js + * @description Checking if execution of "for (1 in arr;1;){}" fails + * @negative + */ + +arr = [1,2,3,4,5]; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +for(1 in arr;1;) { + break; +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A5.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A5.js new file mode 100644 index 000000000..6cab0f017 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A5.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * "in"-expression wrapped into "eval" statement is allowed as a ExpressionNoIn in "for (ExpressionNoIn; FirstExpression; SecondExpression) Statement" IterationStatement + * + * @path ch12/12.6/12.6.3/S12.6.3_A5.js + * @description Using eval "for(eval("i in arr");1;)" + */ + +arr = [1,2,3,4,5]; +i = 1; +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + for(eval("i in arr");1;) {break;}; +} catch (e) { + $ERROR('#1.1: for(eval("i in arr");1;) {break;}; does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +try { + for(eval("var i = 1 in arr");1;) {break;}; +} catch (e) { + $ERROR('#2.1: for(eval("var i = 1 in arr");1;) {break;}; does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +try { + for(eval("1 in arr");1;) {break;}; +} catch (e) { + $ERROR('#3.1: for(eval("1 in arr");1;) {break;}; does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A6.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A6.js new file mode 100644 index 000000000..1dfd5b457 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A6.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. + +/** + * While evaluating "for ( ; ; Expression) Statement", Statement is evaluated first and then Expression is evaluated + * + * @path ch12/12.6/12.6.3/S12.6.3_A6.js + * @description Using "(function(){throw "SecondExpression";})()" as an Expression + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + for(;;(function(){throw "SecondExpression";})()){ + var __in__for = "reached"; + } + $ERROR('#1: (function(){throw "SecondExpression"}() lead to throwing exception'); +} catch (e) { + if (e !== "SecondExpression") { + $ERROR('#1: When for ( ; ; Expression) Statement is evaluated Statement evaluates first then Expression evaluates'); + } +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__in__for !== "reached") { + $ERROR('#2: __in__for === "reached". Actual: __in__for ==='+ __in__for ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A7.1_T1.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A7.1_T1.js new file mode 100644 index 000000000..f8b2fdbd0 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A7.1_T1.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 three expressions and two semicolons in "for(with var)" braces are allowed. + * Appearing of for (ExpressionNoIn_opt ; Expression_opt ; Expression_opt; Expression_opt; Expression_opt;) statement leads to SyntaxError + * + * @path ch12/12.6/12.6.3/S12.6.3_A7.1_T1.js + * @description Checking if execution of "for(var index=0; index<10; index++; index--)" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +for(var index=0; index<10; index++; index--); +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A7.1_T2.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A7.1_T2.js new file mode 100644 index 000000000..550b14b19 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A7.1_T2.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 three expressions and two semicolons in "for(with var)" braces are allowed. + * Appearing of for (ExpressionNoIn_opt ; Expression_opt ; Expression_opt; Expression_opt; Expression_opt;) statement leads to SyntaxError + * + * @path ch12/12.6/12.6.3/S12.6.3_A7.1_T2.js + * @description Checking if execution of "for(var index=0; index<10; index+=4; index++; index--)" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +for(var index=0; index<10; index+=4; index++; index--) ; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A7_T1.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A7_T1.js new file mode 100644 index 000000000..39dcc1c6a --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A7_T1.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 three expressions and two semicolons in "for" braces are allowed. + * Appearing of for (ExpressionNoIn_opt ; Expression_opt ; Expression_opt; Expression_opt; Expression_opt;) statement leads to SyntaxError + * + * @path ch12/12.6/12.6.3/S12.6.3_A7_T1.js + * @description Checking if execution of "for(index=0; index<10; index++; index--)" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +for(index=0; index<10; index++; index--) ; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A7_T2.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A7_T2.js new file mode 100644 index 000000000..2f22dbf3c --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A7_T2.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 three expressions and two semicolons in "for" braces are allowed. + * Appearing of for (ExpressionNoIn_opt ; Expression_opt ; Expression_opt; Expression_opt; Expression_opt;) statement leads to SyntaxError + * + * @path ch12/12.6/12.6.3/S12.6.3_A7_T2.js + * @description Checking if execution of "for(index=0; index<10; index+=4; index++; index--)" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +for(index=0; index<10; index+=4; index++; index--) ; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A8.1_T1.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A8.1_T1.js new file mode 100644 index 000000000..ddd3c30e4 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A8.1_T1.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Blocks within "for(with var)" braces are not allowed + * + * @path ch12/12.6/12.6.3/S12.6.3_A8.1_T1.js + * @description Checking if execution of "for(var index=0; index<100; {index++; index*2;}) { arr.add(""+index);}" fails + * @negative + */ + +var arr = []; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +for(var index=0; index<100; {index++; index*2;}) { arr.add(""+index);}; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A8.1_T2.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A8.1_T2.js new file mode 100644 index 000000000..81cbed22b --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A8.1_T2.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. + +/** + * Blocks within "for(with var)" braces are not allowed + * + * @path ch12/12.6/12.6.3/S12.6.3_A8.1_T2.js + * @description Checking if execution of "for(var index=0; {index++;index<100;}; index*2;) { arr.add(""+index);}" fails + * @negative + */ + +var arr = []; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +for(var index=0; {index++;index<100;}; index*2;) { arr.add(""+index);}; +// +////////////////////////////////////////////////////////////////////////////// + + + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A8.1_T3.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A8.1_T3.js new file mode 100644 index 000000000..8c26060e3 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A8.1_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Blocks within "for(with var)" braces are not allowed + * + * @path ch12/12.6/12.6.3/S12.6.3_A8.1_T3.js + * @description Checking if execution of "for({var index=0; index+=1;} index++<=10; index*2;) { arr.add(""+index);}" fails + * @negative + */ + +var arr = []; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +for({var index=0; index+=1;} index++<=10; index*2;) { arr.add(""+index);}; +// +////////////////////////////////////////////////////////////////////////////// + + + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A8_T1.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A8_T1.js new file mode 100644 index 000000000..8f9ce29d6 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A8_T1.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Blocks within "for" braces are not allowed + * + * @path ch12/12.6/12.6.3/S12.6.3_A8_T1.js + * @description Checking if execution of "for(index=0; index<100; {index++; index*2;}) { arr.add(""+index);}" fails + * @negative + */ + +var arr = []; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +for(index=0; index<100; {index++; index*2;}) { arr.add(""+index);}; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A8_T2.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A8_T2.js new file mode 100644 index 000000000..406d23bbb --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A8_T2.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Blocks within "for" braces are not allowed + * + * @path ch12/12.6/12.6.3/S12.6.3_A8_T2.js + * @description Checking if execution of "for(index=0; {index++;index<100;}; index*2;) { arr.add(""+index);}" fails + * @negative + */ + +var arr = []; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +for(index=0; {index++;index<100;}; index*2;) { arr.add(""+index);}; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A8_T3.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A8_T3.js new file mode 100644 index 000000000..9843a3229 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A8_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Blocks within "for" braces are not allowed + * + * @path ch12/12.6/12.6.3/S12.6.3_A8_T3.js + * @description Checking if execution of "for({index=0; index+=1;} index++<=10; index*2;) { arr.add(""+index);}" fails + * @negative + */ + +var arr = []; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +for({index=0; index+=1;} index++<=10; index*2;) { arr.add(""+index);}; +// +////////////////////////////////////////////////////////////////////////////// + + + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A9.1.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A9.1.js new file mode 100644 index 000000000..c2031c9ab --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A9.1.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. + +/** + * The result of evaluating "for( ExpNoIn;Exp;Exp)" loop is returning (normal, evalValue, empty) + * + * @path ch12/12.6/12.6.3/S12.6.3_A9.1.js + * @description Using eval + */ + +supreme=5; + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +try { + var __evaluated = eval("for(count=0;;) {if (count===supreme)break;else count++; }"); + if (__evaluated !== 4) { + $ERROR('#1: __evaluated === 4. Actual: __evaluated ==='+ __evaluated ); + } +} catch (e) { + $ERROR('#1: var __evaluated = eval("for(count=0;;) {if (count===supreme)break;else count++; }"); does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A9.js b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A9.js new file mode 100644 index 000000000..11b88316f --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/S12.6.3_A9.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. + +/** + * The result of evaluating "for(var ExpNoIn;Exp;Exp)" loop is returning (normal, evalValue, empty) + * + * @path ch12/12.6/12.6.3/S12.6.3_A9.js + * @description Using eval + */ + +supreme=5; + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +try { + var __evaluated = eval("for(var count=0;;) {if (count===supreme)break;else count++; }"); + if (__evaluated !== 4) { + $ERROR('#1: __evaluated === 4. Actual: __evaluated ==='+ __evaluated ); + } +} catch (e) { + $ERROR('#1: var __evaluated = eval("for(var count=0;;) {if (count===supreme)break;else count++; }"); does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/browser.js b/js/src/tests/test262/ch12/12.6/12.6.3/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/browser.js diff --git a/js/src/tests/test262/ch12/12.6/12.6.3/shell.js b/js/src/tests/test262/ch12/12.6/12.6.3/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.3/shell.js diff --git a/js/src/tests/test262/ch12/12.6/12.6.4/12.6.4-1.js b/js/src/tests/test262/ch12/12.6/12.6.4/12.6.4-1.js new file mode 100644 index 000000000..3929b0a23 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.4/12.6.4-1.js @@ -0,0 +1,34 @@ +/// 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.6/12.6.4/12.6.4-1.js
+ * @description The for-in Statement - a property name must not be visited more than once in any enumeration.
+ */
+
+
+function testcase() {
+ var obj = { prop1: "abc", prop2: "bbc", prop3: "cnn" };
+
+ var countProp1 = 0;
+ var countProp2 = 0;
+ var countProp3 = 0;
+
+ for (var p in obj) {
+ if (obj.hasOwnProperty(p)) {
+ if (p === "prop1") {
+ countProp1++;
+ }
+ if (p === "prop2") {
+ countProp2++;
+ }
+ if (p === "prop3") {
+ countProp3++;
+ }
+ }
+ }
+ return countProp1 === 1 && countProp2 === 1 && countProp3 === 1;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.4/12.6.4-2.js b/js/src/tests/test262/ch12/12.6/12.6.4/12.6.4-2.js new file mode 100644 index 000000000..dca36c1ff --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.4/12.6.4-2.js @@ -0,0 +1,52 @@ +/// 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.6/12.6.4/12.6.4-2.js
+ * @description The for-in Statement - the values of [[Enumerable]] attributes are not considered when determining if a property of a prototype object is shadowed by a previous object on the prototype chain
+ */
+
+
+function testcase() {
+ var obj = {};
+
+ var proto = {};
+
+ Object.defineProperty(proto, "prop", {
+ value: "inheritedValue",
+ enumerable: false,
+ configurable: true,
+ writable: true
+ });
+
+ var ConstructFun = function () { };
+ ConstructFun.prototype = proto;
+
+ var child = new ConstructFun();
+
+ Object.defineProperty(child, "prop1", {
+ value: "overridedValue1",
+ enumerable: false
+ });
+ Object.defineProperty(child, "prop2", {
+ value: "overridedValue2",
+ enumerable: true
+ });
+ var accessedProp1 = false;
+ var accessedProp2 = false;
+
+ for (var p in child) {
+ if (child.hasOwnProperty(p)) {
+ if (p === "prop1") {
+ accessedProp1 = true;
+ }
+ if (p === "prop2") {
+ accessedProp2 = true;
+ }
+ }
+ }
+ return !accessedProp1 && accessedProp2 && child.prop1 === "overridedValue1" && child.prop2 === "overridedValue2";
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A1.js b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A1.js new file mode 100644 index 000000000..fd8c754bf --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A1.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. + +/** + * "for(key in undefined)" Statement is allowed + * + * @path ch12/12.6/12.6.4/S12.6.4_A1.js + * @description Checking if execution of "for(key in undefined)" passes + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + for(__key in undefined){ + var key=__key; + }; +} catch (e) { + $ERROR('#1: "for(key in undefined){}" does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (key!==undefined) { + $ERROR('#2: key === undefined. Actual: key === '+key); +} +// +////////////////////////////////////////////////////////////////////////////// + + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A14_T2.js b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A14_T2.js new file mode 100644 index 000000000..b90e3e99b --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A14_T2.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. + +/** + * FunctionExpession within a "for-in" Expression is allowed + * + * @path ch12/12.6/12.6.4/S12.6.4_A14_T2.js + * @description Using "function __func(){return {a:1};}()" as Expession + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +for(x in function __func(){return {a:1};}()){ + var __reached = x; +}; +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__reached !== "a") { + $ERROR('#2: function expession inside of for-in expression allowed'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A15.js b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A15.js new file mode 100644 index 000000000..c19908904 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A15.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Block within a "for-in" Expression is not allowed + * + * @path ch12/12.6/12.6.4/S12.6.4_A15.js + * @description Using block within "for-in" Expression + * @negative + */ + +var __arr=[1,2,3]; + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +for(x in {__arr}){ + break ; +}; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A2.js b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A2.js new file mode 100644 index 000000000..e8db640c0 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A2.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. + +/** + * "for(key in null)" Expression is allowed + * + * @path ch12/12.6/12.6.4/S12.6.4_A2.js + * @description Checking if execution of "for(key in null)" passes + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +try { + for(__key in null){ + var key=__key; + }; +} catch (e) { + $ERROR('#1: "for(__key in null){}" does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (key!==undefined) { + $ERROR('#2: key === undefined. Actual: key ==='+key); +} +// +////////////////////////////////////////////////////////////////////////////// + + + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A3.1.js b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A3.1.js new file mode 100644 index 000000000..d232fe48d --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A3.1.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. + +/** + * The production IterationStatement: "for (var VariableDeclarationNoIn in Expression) Statement" + * + * @path ch12/12.6/12.6.4/S12.6.4_A3.1.js + * @description Using an array as an Expression is appropriate. Here Expression is an array of numbers + */ + +__str=""; + +__evaluated = eval("for(var ind in (arr=[2,1,4,3]))__str+=arr[ind]"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__evaluated !== __str) { + $ERROR('#1: __evaluated === __str. Actual: __evaluated ==='+ __evaluated ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (!( (__str.indexOf("2")!==-1)&&(__str.indexOf("1")!==-1)&&(__str.indexOf("4")!==-1)&&(__str.indexOf("3")!==-1) )) { + $ERROR('#2: (__str.indexOf("2")!==-1)&&(__str.indexOf("1")!==-1)&&(__str.indexOf("4")!==-1)&&(__str.indexOf("3")!==-1)'); +} +// +////////////////////////////////////////////////////////////////////////////// + + + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A3.js b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A3.js new file mode 100644 index 000000000..2b34c38c7 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A3.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. + +/** + * The production IterationStatement: "for (var VariableDeclarationNoIn in Expression) Statement" + * + * @path ch12/12.6/12.6.4/S12.6.4_A3.js + * @description Using an array as an Expression is appropriate. Here Expression is an array of numbers. Eval is used + */ + +__str=""; + +__evaluated = eval("for(ind in (arr=[2,1,4,3]))__str+=arr[ind]"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__evaluated !== __str) { + $ERROR('#1: __evaluated === __str. Actual: __evaluated ==='+ __evaluated ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (!( (__str.indexOf("2")!==-1)&&(__str.indexOf("1")!==-1)&&(__str.indexOf("4")!==-1)&&(__str.indexOf("3")!==-1) )) { + $ERROR('#2: (__str.indexOf("2")!==-1)&&(__str.indexOf("1")!==-1)&&(__str.indexOf("4")!==-1)&&(__str.indexOf("3")!==-1)'); +} +// +////////////////////////////////////////////////////////////////////////////// + + + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A4.1.js b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A4.1.js new file mode 100644 index 000000000..a491b3f34 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A4.1.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. + +/** + * The production IterationStatement: "for (var VariableDeclarationNoIn in Expression) Statement" + * + * @path ch12/12.6/12.6.4/S12.6.4_A4.1.js + * @description Using Object as an Expression is appropriate. Eval is used + */ + +__str=""; + +__evaluated = eval("for(var ind in (hash={2:'b',1:'a',4:'d',3:'c'}))__str+=hash[ind]"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if ( !( (__evaluated.indexOf("a")!==-1)& (__evaluated.indexOf("b")!==-1)& (__evaluated.indexOf("c")!==-1)&(__evaluated.indexOf("d")!==-1) ) ) { + $ERROR('#1: (__evaluated.indexOf("a")!==-1)& (__evaluated.indexOf("b")!==-1)& (__evaluated.indexOf("c")!==-1)&(__evaluated.indexOf("d")!==-1)'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__str !== __evaluated) { + $ERROR('#2: __str === __evaluated. Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + + + + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A4.js b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A4.js new file mode 100644 index 000000000..79f496b8c --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A4.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. + +/** + * The production IterationStatement: "for (var VariableDeclarationNoIn in Expression) Statement" + * + * @path ch12/12.6/12.6.4/S12.6.4_A4.js + * @description Using Object as an Expression is appropriate. Eval is used + */ + +__str=""; + +__evaluated = eval("for(ind in (hash={2:'b',1:'a',4:'d',3:'c'}))__str+=hash[ind]"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if ( !( (__evaluated.indexOf("a")!==-1)& (__evaluated.indexOf("b")!==-1)& (__evaluated.indexOf("c")!==-1)&(__evaluated.indexOf("d")!==-1) ) ) { + $ERROR('#1: (__evaluated.indexOf("a")!==-1)& (__evaluated.indexOf("b")!==-1)& (__evaluated.indexOf("c")!==-1)&(__evaluated.indexOf("d")!==-1)'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__str !== __evaluated) { + $ERROR('#2: __str === __evaluated. Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + + + + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A5.1.js b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A5.1.js new file mode 100644 index 000000000..37992e1dd --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A5.1.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The production IterationStatement: "for (var VariableDeclarationNoIn in Expression) Statement" + * + * @path ch12/12.6/12.6.4/S12.6.4_A5.1.js + * @description Using hierarchical Object as an Expression is appropriate. The depth is two + */ + +__hash__map={a:{aa:1,ab:2,ac:3,ad:4},b:{ba:1,bb:2,bc:3,bd:4},c:{ca:1,cb:2,cc:3,cd:4},d:{da:1,db:2,dc:3,dd:4}}; + +__arr = ""; + +for(var __key in __hash__map){ + for (var __ind in __hash__map[__key]){ + __arr+=("" + __ind + __hash__map[__key][__ind]); + } +} + +if(!( +(__arr.indexOf("aa1")!==-1)& +(__arr.indexOf("ab2")!==-1)& +(__arr.indexOf("ac3")!==-1)& +(__arr.indexOf("ad4")!==-1)& +(__arr.indexOf("ba1")!==-1)& +(__arr.indexOf("bb2")!==-1)& +(__arr.indexOf("bc3")!==-1)& +(__arr.indexOf("bd4")!==-1)& +(__arr.indexOf("ca1")!==-1)& +(__arr.indexOf("cb2")!==-1)& +(__arr.indexOf("cc3")!==-1)& +(__arr.indexOf("cd4")!==-1)& +(__arr.indexOf("da1")!==-1)& +(__arr.indexOf("db2")!==-1)& +(__arr.indexOf("dc3")!==-1)& +(__arr.indexOf("dd4")!==-1) +)) $ERROR('#1: The nested for-in Statement applied to hierarchial object works properly as described in the Standard'); + + + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A5.js b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A5.js new file mode 100644 index 000000000..974659f10 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A5.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The production IterationStatement: "for (var VariableDeclarationNoIn in Expression) Statement" + * + * @path ch12/12.6/12.6.4/S12.6.4_A5.js + * @description Using hierarchical Object as an Expression is appropriate. The depth is two + */ + +__hash__map={a:{aa:1,ab:2,ac:3,ad:4},b:{ba:1,bb:2,bc:3,bd:4},c:{ca:1,cb:2,cc:3,cd:4},d:{da:1,db:2,dc:3,dd:4}}; + +__arr = ""; + +for(__key in __hash__map){ + for (__ind in __hash__map[__key]){ + __arr+=("" + __ind + __hash__map[__key][__ind]); + } +} + +if(!( +(__arr.indexOf("aa1")!==-1)& +(__arr.indexOf("ab2")!==-1)& +(__arr.indexOf("ac3")!==-1)& +(__arr.indexOf("ad4")!==-1)& +(__arr.indexOf("ba1")!==-1)& +(__arr.indexOf("bb2")!==-1)& +(__arr.indexOf("bc3")!==-1)& +(__arr.indexOf("bd4")!==-1)& +(__arr.indexOf("ca1")!==-1)& +(__arr.indexOf("cb2")!==-1)& +(__arr.indexOf("cc3")!==-1)& +(__arr.indexOf("cd4")!==-1)& +(__arr.indexOf("da1")!==-1)& +(__arr.indexOf("db2")!==-1)& +(__arr.indexOf("dc3")!==-1)& +(__arr.indexOf("dd4")!==-1) +)) $ERROR('#1: The nested for-in Statement applied to hierarchial object works properly as described in the Standard'); + + + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A6.1.js b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A6.1.js new file mode 100644 index 000000000..78cc2e842 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A6.1.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. + +/** + * The production IterationStatement: "for (var VariableDeclarationNoIn in Expression) Statement" + * + * @path ch12/12.6/12.6.4/S12.6.4_A6.1.js + * @description Using Object with custom prototype as an Expression is appropriate. The prototype is "{feat:2,hint:"protohint"}" + */ + +function FACTORY(){this.prop=1;this.hint="hinted"}; + +FACTORY.prototype = {feat:2,hint:"protohint"}; + +var __instance = new FACTORY; + +__accum=""; + +for (var key in __instance){ + __accum+=(key + __instance[key]); +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!((__accum.indexOf("prop1")!==-1)&&(__accum.indexOf("feat2")!==-1)&&(__accum.indexOf("hinthinted")!==-1))) { + $ERROR('#1: (__accum.indexOf("prop1")!==-1)&&(__accum.indexOf("feat2")!==-1)&&(__accum.indexOf("hinthinted")!==-1)'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__accum.indexOf("hintprotohint")!==-1) { + $ERROR('#2: __accum.indexOf("hintprotohint") === -1. Actual: __accum.indexOf("hintprotohint") ==='+ __accum.indexOf("hintprotohint") ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A6.js b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A6.js new file mode 100644 index 000000000..5a1f8d9c2 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A6.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. + +/** + * The production IterationStatement: "for (var VariableDeclarationNoIn in Expression) Statement" + * + * @path ch12/12.6/12.6.4/S12.6.4_A6.js + * @description Using Object with custom prototype as an Expression is appropriate. The prototype is "{feat:2,hint:"protohint"}" + */ + +function FACTORY(){this.prop=1;this.hint="hinted"}; + +FACTORY.prototype = {feat:2,hint:"protohint"}; + +var __instance = new FACTORY; + +__accum=""; + +for (key in __instance){ + __accum+=(key + __instance[key]); +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!((__accum.indexOf("prop1")!==-1)&&(__accum.indexOf("feat2")!==-1)&&(__accum.indexOf("hinthinted")!==-1))) { + $ERROR('#1: (__accum.indexOf("prop1")!==-1)&&(__accum.indexOf("feat2")!==-1)&&(__accum.indexOf("hinthinted")!==-1)'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__accum.indexOf("hintprotohint")!==-1) { + $ERROR('#2: __accum.indexOf("hintprotohint") === -1. Actual: __accum.indexOf("hintprotohint") ==='+ __accum.indexOf("hintprotohint") ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A7_T1.js b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A7_T1.js new file mode 100644 index 000000000..1105b7ff2 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A7_T1.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. + +/** + * Properties of the object being enumerated may be deleted during enumeration + * + * @path ch12/12.6/12.6.4/S12.6.4_A7_T1.js + * @description Checking "for (LeftHandSideExpression in Expression) Statement" case + */ + +__obj={aa:1,ba:2,ca:3}; + +__accum=""; + +for (__key in __obj){ + + erasator_T_1000(__obj,"b"); + + __accum+=(__key+__obj[__key]); + +} + + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!((__accum.indexOf("aa1")!==-1)&&(__accum.indexOf("ca3")!==-1))) { + $ERROR('#1: (__accum.indexOf("aa1")!==-1)&&(__accum.indexOf("ca3")!==-1)'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__accum.indexOf("ba2")!==-1) { + $ERROR('#2: __accum.indexOf("ba2") === -1. Actual: __accum.indexOf("ba2") ==='+ __accum.indexOf("ba2") ); +} +// +////////////////////////////////////////////////////////////////////////////// + + +// erasator is the hash map terminator +function erasator_T_1000(hash_map, charactr){ + for (key in hash_map){ + if (key.indexOf(charactr)===0) { + delete hash_map[key]; + }; + } +} + diff --git a/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A7_T2.js b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_A7_T2.js new file mode 100644 index 000000000..48be196ab --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.4/S12.6.4_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. + +/** + * Properties of the object being enumerated may be deleted during enumeration + * + * @path ch12/12.6/12.6.4/S12.6.4_A7_T2.js + * @description Checking "for (var VariableDeclarationNoIn in Expression) Statement" case + */ + +__obj={aa:1,ba:2,ca:3}; + +__accum=""; + +for (var __key in __obj){ + + erasator_T_1000(__obj,"b"); + + __accum+=(__key+__obj[__key]); + +} + + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!((__accum.indexOf("aa1")!==-1)&&(__accum.indexOf("ca3")!==-1))) { + $ERROR('#1: (__accum.indexOf("aa1")!==-1)&&(__accum.indexOf("ca3")!==-1)'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__accum.indexOf("ba2")!==-1) { + $ERROR('#2: __accum.indexOf("ba2") === -1. Actual: __accum.indexOf("ba2") ==='+ __accum.indexOf("ba2") ); +} +// +////////////////////////////////////////////////////////////////////////////// + + +// erasator is the hash map terminator +function erasator_T_1000(hash_map, charactr){ + for (key in hash_map){ + if (key.indexOf(charactr)===0) { + delete hash_map[key]; + }; + } +} + diff --git a/js/src/tests/test262/ch12/12.6/12.6.4/browser.js b/js/src/tests/test262/ch12/12.6/12.6.4/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.4/browser.js diff --git a/js/src/tests/test262/ch12/12.6/12.6.4/shell.js b/js/src/tests/test262/ch12/12.6/12.6.4/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.4/shell.js diff --git a/js/src/tests/test262/ch12/12.6/browser.js b/js/src/tests/test262/ch12/12.6/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/browser.js diff --git a/js/src/tests/test262/ch12/12.6/shell.js b/js/src/tests/test262/ch12/12.6/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/shell.js diff --git a/js/src/tests/test262/ch12/12.7/12.7-1.js b/js/src/tests/test262/ch12/12.7/12.7-1.js new file mode 100644 index 000000000..a19060a82 --- /dev/null +++ b/js/src/tests/test262/ch12/12.7/12.7-1.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.7/12.7-1.js
+ * @description The continue Statement - a continue statement without an identifier may have a LineTerminator before the semi-colon
+ */
+
+
+function testcase() {
+ var sum = 0;
+ for (var i = 1; i <= 10; i++) {
+ continue
+ ;
+ sum += i;
+ }
+ return sum === 0;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.7/S12.7_A1_T1.js b/js/src/tests/test262/ch12/12.7/S12.7_A1_T1.js new file mode 100644 index 000000000..ec172729f --- /dev/null +++ b/js/src/tests/test262/ch12/12.7/S12.7_A1_T1.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Appearing of continue without an IterationStatement leads to syntax error + * + * @path ch12/12.7/S12.7_A1_T1.js + * @description Checking if execution of single "continue" without any IterationStatement fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +var x=1; +continue; +var y=2; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.7/S12.7_A1_T2.js b/js/src/tests/test262/ch12/12.7/S12.7_A1_T2.js new file mode 100644 index 000000000..2aa90f8b1 --- /dev/null +++ b/js/src/tests/test262/ch12/12.7/S12.7_A1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Appearing of continue without an IterationStatement leads to syntax error + * + * @path ch12/12.7/S12.7_A1_T2.js + * @description Checking if single "continue" with Label but without any IterationStatement fails + * @negative + */ + +LABEL : x=3.14; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +var x=1; +continue LABEL; +var y=2; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.7/S12.7_A1_T3.js b/js/src/tests/test262/ch12/12.7/S12.7_A1_T3.js new file mode 100644 index 000000000..4652dc865 --- /dev/null +++ b/js/src/tests/test262/ch12/12.7/S12.7_A1_T3.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. + +/** + * Appearing of continue without an IterationStatement leads to syntax error + * + * @path ch12/12.7/S12.7_A1_T3.js + * @description Checking if laballed "continue" with no IterationStatement, placed into a block, fails + * @negative + */ + +LABEL : x=3.14; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +{ + var x=1; + continue LABEL; + var y=2; +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.7/S12.7_A1_T4.js b/js/src/tests/test262/ch12/12.7/S12.7_A1_T4.js new file mode 100644 index 000000000..ac34f2642 --- /dev/null +++ b/js/src/tests/test262/ch12/12.7/S12.7_A1_T4.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. + +/** + * Appearing of continue without an IterationStatement leads to syntax error + * + * @path ch12/12.7/S12.7_A1_T4.js + * @description Checking if execution of "continue" with no IterationStatement, placed into a block, fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +{ + var x=1; + continue; + var y=2; +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/js/src/tests/test262/ch12/12.7/S12.7_A2.js b/js/src/tests/test262/ch12/12.7/S12.7_A2.js new file mode 100644 index 000000000..3f76aa1a4 --- /dev/null +++ b/js/src/tests/test262/ch12/12.7/S12.7_A2.js @@ -0,0 +1,64 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Since LineTerminator between "continue" and Identifier is not allowed, "continue" is evaluated without label + * + * @path ch12/12.7/S12.7_A2.js + * @description Checking by using eval, inserting LineTerminator between continue and Identifier + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try{ + eval("FOR1 : for(var i=1;i<2;i++){FOR1NESTED : for(var j=1;j<2;j++) { continue\u000AFOR1; } while(0);}"); + if (j!==2) { + $ERROR('#1: Since LineTerminator(U-000A) between continue and Identifier not allowed continue evaluates without label'); + } +} catch(e){ + $ERROR('#1.1: eval("FOR1 : for(var i=1;i<2;i++){FOR1NESTED : for(var j=1;j<2;j++) { continue\\u000AFOR1; } while(0);}") does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +try{ + eval("FOR2 : for(var i=1;i<2;i++){FOR2NESTED : for(var j=1;j<2;j++) { continue\u000DFOR2; } while(0);}"); + if (j!==2) { + $ERROR('#2: Since LineTerminator(U-000D) between continue and Identifier not allowed continue evaluates without label'); + } +} catch(e){ + $ERROR('#2.1: eval("FOR2 : for(var i=1;i<2;i++){FOR2NESTED : for(var j=1;j<2;j++) { continue\\u000DFOR2; } while(0);}") does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +try{ + eval("FOR3 : for(var i=1;i<2;i++){FOR3NESTED : for(var j=1;j<2;j++) { continue\u2028FOR3; } while(0);}"); + if (j!==2) { + $ERROR('#3: Since LineTerminator(U-2028) between continue and Identifier not allowed continue evaluates without label'); + } +} catch(e){ + $ERROR('#3.1: eval("FOR3 : for(var i=1;i<2;i++){FOR3NESTED : for(var j=1;j<2;j++) { continue\\u2028FOR3; } while(0);}") does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +try{ + eval("FOR4 : for(var i=1;i<2;i++){FOR4NESTED : for(var j=1;j<2;j++) { continue\u2029FOR4; } while(0);}"); + if (j!==2) { + $ERROR('#4: Since LineTerminator(U-2029) between continue and Identifier not allowed continue evaluates without label'); + } +} catch(e){ + $ERROR('#4.1: eval("FOR4 : for(var i=1;i<2;i++){FOR4NESTED : for(var j=1;j<2;j++) { continue\\u2029FOR4; } while(0);}"); does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + + + diff --git a/js/src/tests/test262/ch12/12.7/S12.7_A5_T1.js b/js/src/tests/test262/ch12/12.7/S12.7_A5_T1.js new file mode 100644 index 000000000..14a8b5f7a --- /dev/null +++ b/js/src/tests/test262/ch12/12.7/S12.7_A5_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. + +/** + * When "continue Identifier" is evaluated Identifier must be label in the label set of an enclosing (but not crossing function boundaries) IterationStatement + * + * @path ch12/12.7/S12.7_A5_T1.js + * @description Trying to continue another labeled loop + * @negative + */ + +LABEL_OUT : var x=0, y=0; +LABEL_DO_LOOP : do { + LABEL_IN : x++; + if(x===10)break; + continue LABEL_ANOTHER_LOOP; + LABEL_IN_2 : y++; + function IN_DO_FUNC(){} +} while(0); + +LABEL_ANOTHER_LOOP : do { + ; +} while(0); + +function OUT_FUNC(){} + diff --git a/js/src/tests/test262/ch12/12.7/S12.7_A5_T2.js b/js/src/tests/test262/ch12/12.7/S12.7_A5_T2.js new file mode 100644 index 000000000..1d3f7e9c1 --- /dev/null +++ b/js/src/tests/test262/ch12/12.7/S12.7_A5_T2.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. + +/** + * When "continue Identifier" is evaluated Identifier must be label in the label set of an enclosing (but not crossing function boundaries) IterationStatement + * + * @path ch12/12.7/S12.7_A5_T2.js + * @description Identifier is a function name + * @negative + */ + +LABEL_OUT : var x=0, y=0; +LABEL_DO_LOOP : do { + LABEL_IN : x++; + if(x===10)break; + continue IN_DO_FUNC; + LABEL_IN_2 : y++; + function IN_DO_FUNC(){} +} while(0); + +LABEL_ANOTHER_LOOP : do { + ; +} while(0); + +function OUT_FUNC(){}; + diff --git a/js/src/tests/test262/ch12/12.7/S12.7_A5_T3.js b/js/src/tests/test262/ch12/12.7/S12.7_A5_T3.js new file mode 100644 index 000000000..16babd629 --- /dev/null +++ b/js/src/tests/test262/ch12/12.7/S12.7_A5_T3.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. + +/** + * When "continue Identifier" is evaluated Identifier must be label in the label set of an enclosing (but not crossing function boundaries) IterationStatement + * + * @path ch12/12.7/S12.7_A5_T3.js + * @description Identifier is within loop label + * @negative + */ + +LABEL_OUT : var x=0, y=0; + +LABEL_DO_LOOP : do { + LABEL_IN : x++; + if(x===10)break; + continue LABEL_IN; + LABEL_IN_2 : y++; + function IN_DO_FUNC(){} +} while(0); + +LABEL_ANOTHER_LOOP : do { + ; +} while(0); + +function OUT_FUNC(){} + diff --git a/js/src/tests/test262/ch12/12.7/S12.7_A6.js b/js/src/tests/test262/ch12/12.7/S12.7_A6.js new file mode 100644 index 000000000..11bb439aa --- /dev/null +++ b/js/src/tests/test262/ch12/12.7/S12.7_A6.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Appearing of "continue" within a function call that is within an IterationStatement yields SyntaxError + * + * @path ch12/12.7/S12.7_A6.js + * @description Using labaled "continue Identifier" within a function body + * @negative + */ + +var x=0,y=0; + +LABEL1 : do { + x++; + (function(){continue LABEL1;})(); + y++; +} while(0); + diff --git a/js/src/tests/test262/ch12/12.7/S12.7_A7.js b/js/src/tests/test262/ch12/12.7/S12.7_A7.js new file mode 100644 index 000000000..c43f701e1 --- /dev/null +++ b/js/src/tests/test262/ch12/12.7/S12.7_A7.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. + +/** + * Appearing of continue within eval statement that is within an IterationStatement yields SyntaxError + * + * @path ch12/12.7/S12.7_A7.js + * @description Using eval "eval("continue LABEL1")" + */ + +var x=0,y=0; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try{ + LABEL1 : do { + x++; + eval("continue LABEL1"); + y++; + } while(0); + $ERROR('#1: eval("continue LABEL1") does not lead to throwing exception'); +} catch(e){ + if(!(e instanceof SyntaxError)){ + $ERROR("1.1: Appearing of continue within eval statement inside of IterationStatement yields SyntaxError"); + } +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.7/S12.7_A8_T1.js b/js/src/tests/test262/ch12/12.7/S12.7_A8_T1.js new file mode 100644 index 000000000..76f8538a8 --- /dev/null +++ b/js/src/tests/test262/ch12/12.7/S12.7_A8_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. + +/** + * Appearing of "continue" within a "try/catch" Block yields SyntaxError + * + * @path ch12/12.7/S12.7_A8_T1.js + * @description Checking if execution of "continue Identifier" within catch Block fails + * @negative + */ + +var x=0,y=0; + +try{ + LABEL1 : do { + x++; + throw "gonna leave it"; + y++; + } while(0); + $ERROR('#1: throw "gonna leave it" lead to throwing exception'); +} catch(e){ + continue LABEL2; + LABEL2 : do { + x++; + y++; + } while(0); +}; + diff --git a/js/src/tests/test262/ch12/12.7/S12.7_A8_T2.js b/js/src/tests/test262/ch12/12.7/S12.7_A8_T2.js new file mode 100644 index 000000000..4d6f48e8b --- /dev/null +++ b/js/src/tests/test262/ch12/12.7/S12.7_A8_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. + +/** + * Appearing of "continue" within a "try/catch" Block yields SyntaxError + * + * @path ch12/12.7/S12.7_A8_T2.js + * @description Checking if execution of "continue" within catch Block fails + * @negative + */ + +var x=0,y=0; + +try{ + LABEL1 : do { + x++; + throw "gonna leave it"; + y++; + } while(0); + $ERROR('#1: throw "gonna leave it" lead to throwing exception'); +} catch(e){ + continue; + LABEL2 : do { + x++; + y++; + } while(0); +}; + diff --git a/js/src/tests/test262/ch12/12.7/S12.7_A9_T1.js b/js/src/tests/test262/ch12/12.7/S12.7_A9_T1.js new file mode 100644 index 000000000..e6ab1f542 --- /dev/null +++ b/js/src/tests/test262/ch12/12.7/S12.7_A9_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. + +/** + * Continue inside of try-catch nested in a loop is allowed + * + * @path ch12/12.7/S12.7_A9_T1.js + * @description Using "continue Identifier" within catch Block that is within a loop + */ + +var x=0,y=0; + +(function(){ +FOR : for(;;){ + try{ + x++; + if(x===10)return; + throw 1; + } catch(e){ + continue FOR; + } +} +})(); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (x!==10) { + $ERROR('#1: Continue inside of try-catch nested in loop is allowed'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.7/S12.7_A9_T2.js b/js/src/tests/test262/ch12/12.7/S12.7_A9_T2.js new file mode 100644 index 000000000..8763414eb --- /dev/null +++ b/js/src/tests/test262/ch12/12.7/S12.7_A9_T2.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. + +/** + * Continue inside of try-catch nested in a loop is allowed + * + * @path ch12/12.7/S12.7_A9_T2.js + * @description Using "continue" within catch Block that is within a loop + */ + +var x=0,y=0; + +(function(){ +FOR : for(;;){ + try{ + x++; + if(x===10)return; + throw 1; + } catch(e){ + continue; + } +} +})(); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (x!==10) { + $ERROR('#1: Continue inside of try-catch nested in loop is allowed'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.7/browser.js b/js/src/tests/test262/ch12/12.7/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.7/browser.js diff --git a/js/src/tests/test262/ch12/12.7/shell.js b/js/src/tests/test262/ch12/12.7/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.7/shell.js diff --git a/js/src/tests/test262/ch12/12.8/12.8-1.js b/js/src/tests/test262/ch12/12.8/12.8-1.js new file mode 100644 index 000000000..e32f54168 --- /dev/null +++ b/js/src/tests/test262/ch12/12.8/12.8-1.js @@ -0,0 +1,23 @@ +/// 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.8/12.8-1.js
+ * @description The break Statement - a break statement without an identifier may have a LineTerminator before the semi-colon
+ */
+
+
+function testcase() {
+ var sum = 0;
+ for (var i = 1; i <= 10; i++) {
+ if (i === 6) {
+ break
+ ;
+ }
+ sum += i;
+ }
+ return sum === 15;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.8/S12.8_A1_T1.js b/js/src/tests/test262/ch12/12.8/S12.8_A1_T1.js new file mode 100644 index 000000000..546e66780 --- /dev/null +++ b/js/src/tests/test262/ch12/12.8/S12.8_A1_T1.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Appearing of break without an IterationStatement leads to syntax error + * + * @path ch12/12.8/S12.8_A1_T1.js + * @description Checking if break statement with no loop fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +var x=1; +break; +var y=2; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.8/S12.8_A1_T2.js b/js/src/tests/test262/ch12/12.8/S12.8_A1_T2.js new file mode 100644 index 000000000..c141c7722 --- /dev/null +++ b/js/src/tests/test262/ch12/12.8/S12.8_A1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Appearing of break without an IterationStatement leads to syntax error + * + * @path ch12/12.8/S12.8_A1_T2.js + * @description Checking if break Identifier with no loop fails + * @negative + */ + +LABEL : x=3.14; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +var x=1; +break LABEL; +var y=2; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.8/S12.8_A1_T3.js b/js/src/tests/test262/ch12/12.8/S12.8_A1_T3.js new file mode 100644 index 000000000..6627be368 --- /dev/null +++ b/js/src/tests/test262/ch12/12.8/S12.8_A1_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Appearing of break without an IterationStatement leads to syntax error + * + * @path ch12/12.8/S12.8_A1_T3.js + * @description Checking if break statement with no loop, placed into a block, fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +{ + var x=1; + break; + var y=2; +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.8/S12.8_A1_T4.js b/js/src/tests/test262/ch12/12.8/S12.8_A1_T4.js new file mode 100644 index 000000000..1663fc5f5 --- /dev/null +++ b/js/src/tests/test262/ch12/12.8/S12.8_A1_T4.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. + +/** + * Appearing of break without an IterationStatement leads to syntax error + * + * @path ch12/12.8/S12.8_A1_T4.js + * @description Checking if break Identifier with no loop, placed into a block, fails + * @negative + */ + +LABEL : x=3.14; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +{ + var x=1; + break LABEL; + var y=2; +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.8/S12.8_A2.js b/js/src/tests/test262/ch12/12.8/S12.8_A2.js new file mode 100644 index 000000000..a1154aeca --- /dev/null +++ b/js/src/tests/test262/ch12/12.8/S12.8_A2.js @@ -0,0 +1,64 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Since LineTerminator between "break" and Identifier is not allowed, "break" is evaluated without label + * + * @path ch12/12.8/S12.8_A2.js + * @description Checking by using eval, inserting LineTerminator between break and Identifier + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try{ + eval("FOR1 : for(var i=1;i<2;i++){ LABEL1 : do {var x =1;break\u000AFOR1;var y=2;} while(0);}"); + if (i!==2) { + $ERROR('#1: Since LineTerminator(U-000A) between break and Identifier not allowed break evaluates without label'); + } +} catch(e){ + $ERROR('#1.1: eval("FOR1 : for(var i=1;i<2;i++){ LABEL1 : do {var x =1;break\\u000AFOR1;var y=2;} while(0);}") does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +try{ + eval("FOR2 : for(var i=1;i<2;i++){ LABEL2 : do {var x =1;break\u000DFOR2;var y=2;} while(0);}"); + if (i!==2) { + $ERROR('#2: Since LineTerminator(U-000D) between break and Identifier not allowed break evaluates without label'); + } +} catch(e){ + $ERROR('#2.1: eval("FOR2 : for(var i=1;i<2;i++){ LABEL2 : do {var x =1;break\\u000DFOR2;var y=2;} while(0);}") does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +try{ + eval("FOR3 : for(var i=1;i<2;i++){ LABEL3 : do {var x =1;break\u2028FOR3;var y=2;} while(0);}"); + if (i!==2) { + $ERROR('#3: Since LineTerminator(U-2028) between break and Identifier not allowed break evaluates without label'); + } +} catch(e){ + $ERROR('#3.1: eval("FOR3 : for(var i=1;i<2;i++){ LABEL3 : do {var x =1;break\\u2028FOR3;var y=2;} while(0);}") does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +try{ + eval("FOR4 : for(var i=1;i<2;i++){ LABEL4 : do {var x =1;break\u2029FOR4;var y=2;} while(0);}"); + if (i!==2) { + $ERROR('#4: Since LineTerminator(U-2029) between break and Identifier not allowed break evaluates without label'); + } +} catch(e){ + $ERROR('#4.1: eval("FOR4 : for(var i=1;i<2;i++){ LABEL4 : do {var x =1;break\\u2029FOR4;var y=2;} while(0);}") does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + + + diff --git a/js/src/tests/test262/ch12/12.8/S12.8_A3.js b/js/src/tests/test262/ch12/12.8/S12.8_A3.js new file mode 100644 index 000000000..d2aaa5ad3 --- /dev/null +++ b/js/src/tests/test262/ch12/12.8/S12.8_A3.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. + +/** + * When "break" is evaluated, (break, empty, empty) is returned + * + * @path ch12/12.8/S12.8_A3.js + * @description Using "break" without Identifier within labeled loop + */ + +LABEL_OUT : var x=0, y=0; + +LABEL_DO_LOOP : do { + LABEL_IN : x=2; + break ; + LABEL_IN_2 : var y=2; + + function IN_DO_FUNC(){} +} while(0); + +LABEL_ANOTHER_LOOP : do { + ; +} while(0); + +function OUT_FUNC(){} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if ((x!==2)&&(y!==0)) { + $ERROR('#1: x === 2 and y === 0. Actual: x ==='+x+' and y ==='+y); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.8/S12.8_A4_T1.js b/js/src/tests/test262/ch12/12.8/S12.8_A4_T1.js new file mode 100644 index 000000000..86e258a4e --- /dev/null +++ b/js/src/tests/test262/ch12/12.8/S12.8_A4_T1.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. + +/** + * When "break Identifier" is evaluated, (break, empty, Identifier) is returned + * + * @path ch12/12.8/S12.8_A4_T1.js + * @description Using "break Identifier" within labaeled loop + */ + +LABEL_OUT : var x=0, y=0; +(function(){ +LABEL_DO_LOOP : do { + LABEL_IN : x++; + if(x===10)return; + break LABEL_DO_LOOP; + LABEL_IN_2 : y++; + + function IN_DO_FUNC(){} +} while(0); + +LABEL_ANOTHER_LOOP : do { + ; +} while(0); + +function OUT_FUNC(){} +})(); +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if ((x!==1)&&(y!==0)) { + $ERROR('#1: x === 1 and y === 0. Actual: x === '+x+' and y ==='+ y ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.8/S12.8_A4_T2.js b/js/src/tests/test262/ch12/12.8/S12.8_A4_T2.js new file mode 100644 index 000000000..8662cf829 --- /dev/null +++ b/js/src/tests/test262/ch12/12.8/S12.8_A4_T2.js @@ -0,0 +1,41 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * When "break Identifier" is evaluated, (break, empty, Identifier) is returned + * + * @path ch12/12.8/S12.8_A4_T2.js + * @description Using embedded and labeled loops, breaking to nested loop + */ + +LABEL_OUT : var x=0, y=0, xx=0, yy=0; +(function(){ +LABEL_DO_LOOP : do { + LABEL_IN : x++; + if(x===10)return; + LABEL_NESTED_LOOP : do { + LABEL_IN_NESTED : xx++; + if(xx===10)return; + break LABEL_NESTED_LOOP; + LABEL_IN_NESTED_2 : yy++; + } while (0); + + LABEL_IN_2 : y++; + + function IN_DO_FUNC(){} +} while(0); + +LABEL_ANOTHER_LOOP : do { + ; +} while(0); + +function OUT_FUNC(){} +})(); +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if ((x!==1)&&(y!==1)&&(xx!==1)&(yy!==0)) { + $ERROR('#1: x === 1 and y === 1 and xx === 1 and yy === 0. Actual: x==='+x+' and y==='+y+' and xx==='+xx+' and yy==='+yy ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.8/S12.8_A4_T3.js b/js/src/tests/test262/ch12/12.8/S12.8_A4_T3.js new file mode 100644 index 000000000..7ca7fc2d6 --- /dev/null +++ b/js/src/tests/test262/ch12/12.8/S12.8_A4_T3.js @@ -0,0 +1,41 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * When "break Identifier" is evaluated, (break, empty, Identifier) is returned + * + * @path ch12/12.8/S12.8_A4_T3.js + * @description Using embedded and labeled loops, breaking to outer loop + */ + +LABEL_OUT : var x=0, y=0, xx=0, yy=0; +(function(){ +LABEL_DO_LOOP : do { + LABEL_IN : x++; + if(x===10)return; + LABEL_NESTED_LOOP : do { + LABEL_IN_NESTED : xx++; + if(xx===10)return; + break LABEL_DO_LOOP; + LABEL_IN_NESTED_2 : yy++; + } while (0); + + LABEL_IN_2 : y++; + + function IN_DO_FUNC(){} +} while(0); + +LABEL_ANOTHER_LOOP : do { + ; +} while(0); + +function OUT_FUNC(){} +})(); +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if ((x!==1)&&(y!==0)&&(xx!==1)&(yy!==0)) { + $ERROR('#1: x === 1 and y === 0 and xx === 1 and yy === 0. Actual: x==='+x+' and y==='+y+' and xx==='+xx+' and yy==='+yy ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.8/S12.8_A5_T1.js b/js/src/tests/test262/ch12/12.8/S12.8_A5_T1.js new file mode 100644 index 000000000..34fbed938 --- /dev/null +++ b/js/src/tests/test262/ch12/12.8/S12.8_A5_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. + +/** + * Identifier must be label in the label set of an enclosing (but not crossing function boundaries) IterationStatement + * + * @path ch12/12.8/S12.8_A5_T1.js + * @description Checking if breaking another labeled loop fails + * @negative + */ + +(function(){ + LABEL_OUT : var x=0, y=0; + LABEL_DO_LOOP : do { + LABEL_IN : x++; + if(x===10) + return; + break LABEL_ANOTHER_LOOP; + LABEL_IN_2 : y++; + function IN_DO_FUNC(){} + } while(0); + + LABEL_ANOTHER_LOOP : do { + ; + } while(0); + + function OUT_FUNC(){} +})(); + diff --git a/js/src/tests/test262/ch12/12.8/S12.8_A5_T2.js b/js/src/tests/test262/ch12/12.8/S12.8_A5_T2.js new file mode 100644 index 000000000..f843c3bb1 --- /dev/null +++ b/js/src/tests/test262/ch12/12.8/S12.8_A5_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. + +/** + * Identifier must be label in the label set of an enclosing (but not crossing function boundaries) IterationStatement + * + * @path ch12/12.8/S12.8_A5_T2.js + * @description Checking if using function name as an Identifier appears to be invalid + * @negative + */ + +(function(){ + LABEL_OUT : var x=0, y=0; + LABEL_DO_LOOP : do { + LABEL_IN : x++; + if(x===10) + return; + break IN_DO_FUNC; + LABEL_IN_2 : y++; + function IN_DO_FUNC(){} + } while(0); + + LABEL_ANOTHER_LOOP : do { + ; + } while(0); + + function OUT_FUNC(){} +})(); + diff --git a/js/src/tests/test262/ch12/12.8/S12.8_A5_T3.js b/js/src/tests/test262/ch12/12.8/S12.8_A5_T3.js new file mode 100644 index 000000000..d6f930705 --- /dev/null +++ b/js/src/tests/test262/ch12/12.8/S12.8_A5_T3.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. + +/** + * Identifier must be label in the label set of an enclosing (but not crossing function boundaries) IterationStatement + * + * @path ch12/12.8/S12.8_A5_T3.js + * @description Checking if using internal loop label as an Identifier appears to be invalid + * @negative + */ + +(function(){ + LABEL_OUT : var x=0, y=0; + LABEL_DO_LOOP : do { + LABEL_IN : x++; + if(x===10) + return; + break LABEL_IN; + LABEL_IN_2 : y++; + + function IN_DO_FUNC(){} + + } while(0); + + LABEL_ANOTHER_LOOP : do { + ; + } while(0); + + function OUT_FUNC(){} + +})(); + diff --git a/js/src/tests/test262/ch12/12.8/S12.8_A6.js b/js/src/tests/test262/ch12/12.8/S12.8_A6.js new file mode 100644 index 000000000..264f74d86 --- /dev/null +++ b/js/src/tests/test262/ch12/12.8/S12.8_A6.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Appearing of "break" within a function call that is nested in a IterationStatement yields SyntaxError + * + * @path ch12/12.8/S12.8_A6.js + * @description Checking if using "break Identifier" within a function body appears to be invalid + * @negative + */ + +var x=0,y=0; + +LABEL1 : do { + x++; + (function(){break LABEL1;})(); + y++; +} while(0); + diff --git a/js/src/tests/test262/ch12/12.8/S12.8_A7.js b/js/src/tests/test262/ch12/12.8/S12.8_A7.js new file mode 100644 index 000000000..a5f5bebaf --- /dev/null +++ b/js/src/tests/test262/ch12/12.8/S12.8_A7.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. + +/** + * Appearing of "break" within eval statement that is nested in an IterationStatement yields SyntaxError + * + * @path ch12/12.8/S12.8_A7.js + * @description Using eval "eval("break LABEL1")" + */ + +var x=0,y=0; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try{ + LABEL1 : do { + x++; + eval("break LABEL1"); + y++; + } while(0); + $ERROR('#1: eval("break LABEL1") does not lead to throwing exception'); +} catch(e){ + if(!(e instanceof SyntaxError)){ + $ERROR("1.1: Appearing of break within eval statement inside of IterationStatement yields SyntaxError"); + } +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.8/S12.8_A8_T1.js b/js/src/tests/test262/ch12/12.8/S12.8_A8_T1.js new file mode 100644 index 000000000..cbcba7f69 --- /dev/null +++ b/js/src/tests/test262/ch12/12.8/S12.8_A8_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. + +/** + * Appearing of "break" within "try/catch" Block yields SyntaxError + * + * @path ch12/12.8/S12.8_A8_T1.js + * @description Checking if using "break Identifier" from within catch Block appears to be invalid + * @negative + */ + +var x=0,y=0; + +try{ + LABEL1 : do { + x++; + throw "gonna leave it"; + y++; + } while(0); + $ERROR('#1: throw "gonna leave it" lead to throwing exception'); +} catch(e){ + break LABEL2; + LABEL2 : do { + x++; + y++; + } while(0); +} + + diff --git a/js/src/tests/test262/ch12/12.8/S12.8_A8_T2.js b/js/src/tests/test262/ch12/12.8/S12.8_A8_T2.js new file mode 100644 index 000000000..92771babf --- /dev/null +++ b/js/src/tests/test262/ch12/12.8/S12.8_A8_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. + +/** + * Appearing of "break" within "try/catch" Block yields SyntaxError + * + * @path ch12/12.8/S12.8_A8_T2.js + * @description Checking if using "break Identifier" from within catch Block appears to be invalid + * @negative + */ + +var x=0,y=0; + +try{ + LABEL1 : do { + x++; + throw "gonna leave it"; + y++; + } while(0); + $ERROR('#1: throw "gonna leave it" lead to throwing exception'); +} catch(e){ + break; + LABEL2 : do { + x++; + y++; + } while(0); +} + + diff --git a/js/src/tests/test262/ch12/12.8/S12.8_A9_T1.js b/js/src/tests/test262/ch12/12.8/S12.8_A9_T1.js new file mode 100644 index 000000000..60da11ef2 --- /dev/null +++ b/js/src/tests/test262/ch12/12.8/S12.8_A9_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. + +/** + * Using "break" within "try/catch" statement that is nested in a loop is allowed + * + * @path ch12/12.8/S12.8_A9_T1.js + * @description Using "continue Identifier" within "catch" statement + */ + +var x=0,y=0; + +(function(){ +FOR : for(;;){ + try{ + x++; + if(x===10)return; + throw 1; + } catch(e){ + break FOR; + } +} +})(); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (x!==1) { + $ERROR('#1: break inside of try-catch nested in loop is allowed'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.8/S12.8_A9_T2.js b/js/src/tests/test262/ch12/12.8/S12.8_A9_T2.js new file mode 100644 index 000000000..53dc3555c --- /dev/null +++ b/js/src/tests/test262/ch12/12.8/S12.8_A9_T2.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. + +/** + * Using "break" within "try/catch" statement that is nested in a loop is allowed + * + * @path ch12/12.8/S12.8_A9_T2.js + * @description Using "continue Identifier" within "catch" statement + */ + +var x=0,y=0; + +(function(){ +FOR : for(;;){ + try{ + x++; + if(x===10)return; + throw 1; + } catch(e){ + break ; + } +} +})(); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (x!==1) { + $ERROR('#1: break inside of try-catch nested in loop is allowed'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.8/browser.js b/js/src/tests/test262/ch12/12.8/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.8/browser.js diff --git a/js/src/tests/test262/ch12/12.8/shell.js b/js/src/tests/test262/ch12/12.8/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.8/shell.js diff --git a/js/src/tests/test262/ch12/12.9/12.9-1.js b/js/src/tests/test262/ch12/12.9/12.9-1.js new file mode 100644 index 000000000..098042e93 --- /dev/null +++ b/js/src/tests/test262/ch12/12.9/12.9-1.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.
+/**
+ * @path ch12/12.9/12.9-1.js
+ * @description The return Statement - a return statement without an expression may have a LineTerminator before the semi-colon
+ */
+
+
+function testcase() {
+ var sum = 0;
+ (function innerTest() {
+ for (var i = 1; i <= 10; i++) {
+ if (i === 6) {
+ return
+ ;
+ }
+ sum += i;
+ }
+ })();
+ return sum === 15;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch12/12.9/S12.9_A1_T1.js b/js/src/tests/test262/ch12/12.9/S12.9_A1_T1.js new file mode 100644 index 000000000..a4115f7ec --- /dev/null +++ b/js/src/tests/test262/ch12/12.9/S12.9_A1_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. + +/** + * Appearing of "return" without a function body leads to syntax error + * + * @path ch12/12.9/S12.9_A1_T1.js + * @description Checking if execution of "return" with no function fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +var x=1; +return; +var y=2; + diff --git a/js/src/tests/test262/ch12/12.9/S12.9_A1_T10.js b/js/src/tests/test262/ch12/12.9/S12.9_A1_T10.js new file mode 100644 index 000000000..63bcd816c --- /dev/null +++ b/js/src/tests/test262/ch12/12.9/S12.9_A1_T10.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. + +/** + * Appearing of "return" without a function body leads to syntax error + * + * @path ch12/12.9/S12.9_A1_T10.js + * @description Checking if execution of "return (0)" with no function fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +return (0); +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.9/S12.9_A1_T2.js b/js/src/tests/test262/ch12/12.9/S12.9_A1_T2.js new file mode 100644 index 000000000..74f657b60 --- /dev/null +++ b/js/src/tests/test262/ch12/12.9/S12.9_A1_T2.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Appearing of "return" without a function body leads to syntax error + * + * @path ch12/12.9/S12.9_A1_T2.js + * @description Checking if execution of "return x" with no function fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +var x=1; +return x; +var y=2; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.9/S12.9_A1_T3.js b/js/src/tests/test262/ch12/12.9/S12.9_A1_T3.js new file mode 100644 index 000000000..8f22b8859 --- /dev/null +++ b/js/src/tests/test262/ch12/12.9/S12.9_A1_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Appearing of "return" without a function body leads to syntax error + * + * @path ch12/12.9/S12.9_A1_T3.js + * @description Checking if execution of "return" within "try" statement fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + return 1; +} catch(e){ + return 1; +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.9/S12.9_A1_T4.js b/js/src/tests/test262/ch12/12.9/S12.9_A1_T4.js new file mode 100644 index 000000000..3add975cb --- /dev/null +++ b/js/src/tests/test262/ch12/12.9/S12.9_A1_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. + +/** + * Appearing of "return" without a function body leads to syntax error + * + * @path ch12/12.9/S12.9_A1_T4.js + * @description Checking if execution of "return" with no function fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +return; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.9/S12.9_A1_T5.js b/js/src/tests/test262/ch12/12.9/S12.9_A1_T5.js new file mode 100644 index 000000000..a53d7c764 --- /dev/null +++ b/js/src/tests/test262/ch12/12.9/S12.9_A1_T5.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Appearing of "return" without a function body leads to syntax error + * + * @path ch12/12.9/S12.9_A1_T5.js + * @description Checking if execution of "return" with no function, placed into a Block, fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +{ + var x=1; + return; + var y=2; +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.9/S12.9_A1_T6.js b/js/src/tests/test262/ch12/12.9/S12.9_A1_T6.js new file mode 100644 index 000000000..aea6ec977 --- /dev/null +++ b/js/src/tests/test262/ch12/12.9/S12.9_A1_T6.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Appearing of "return" without a function body leads to syntax error + * + * @path ch12/12.9/S12.9_A1_T6.js + * @description Checking if execution of "return" with no function, placed into a loop, fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +do { + var x=1; + return; + var y=2; +} while(0); +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.9/S12.9_A1_T7.js b/js/src/tests/test262/ch12/12.9/S12.9_A1_T7.js new file mode 100644 index 000000000..ad863d473 --- /dev/null +++ b/js/src/tests/test262/ch12/12.9/S12.9_A1_T7.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Appearing of "return" without a function body leads to syntax error + * + * @path ch12/12.9/S12.9_A1_T7.js + * @description Checking if execution of "return x" with no function, placed inside Block, fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +{ + var x=1; + return x; + var y=2; +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.9/S12.9_A1_T8.js b/js/src/tests/test262/ch12/12.9/S12.9_A1_T8.js new file mode 100644 index 000000000..edfbd1660 --- /dev/null +++ b/js/src/tests/test262/ch12/12.9/S12.9_A1_T8.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Appearing of "return" without a function body leads to syntax error + * + * @path ch12/12.9/S12.9_A1_T8.js + * @description Checking if execution of "return x" with no function, placed into a loop, fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +do { + var x=1; + return x; + var y=2; +} while(0); +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.9/S12.9_A1_T9.js b/js/src/tests/test262/ch12/12.9/S12.9_A1_T9.js new file mode 100644 index 000000000..57e39aee7 --- /dev/null +++ b/js/src/tests/test262/ch12/12.9/S12.9_A1_T9.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Appearing of "return" without a function body leads to syntax error + * + * @path ch12/12.9/S12.9_A1_T9.js + * @description Checking if execution of "return", placed into a catch Block, fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + throw 1; +} catch(e){ + return e; +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.9/S12.9_A2.js b/js/src/tests/test262/ch12/12.9/S12.9_A2.js new file mode 100644 index 000000000..177205dbb --- /dev/null +++ b/js/src/tests/test262/ch12/12.9/S12.9_A2.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. + +/** + * LineTerminator between return and Identifier_opt yields return without Identifier_opt + * + * @path ch12/12.9/S12.9_A2.js + * @description Checking by using eval, inserting LineTerminator between return and Variable + */ + +//CHECK#1 +try{ + if (eval("(function(){var x = 1;return\u000Ax;var y=2;})()") !== undefined) { + $ERROR("#1: LineTerminator(U-000A) between return and Identifier_opt yields return without Identifier_opt"); + } +} catch(e){ + $ERROR('#1: eval("(function(){var x = 1;return\\u000Ax;var y=2;})()") does not lead to throwing exception'); +} + + + + +//CHECK#2 +try{ + if (eval("(function(){var x = 1;return\u000Dx;var y=2;})()") !== undefined) { + $ERROR("#1: LineTerminator(U-000D) between return and Identifier_opt yields return without Identifier_opt"); + } +} catch(e){ + $ERROR('#2: eval("(function(){var x = 1;return\\u000Dx;var y=2;})()") does not lead to throwing exception'); +} + + + + +//CHECK#3 +try{ + if (eval("(function(){var x = 1;return\u2028x;var y=2;})()") !== undefined) { + $ERROR("#1: LineTerminator(U-2028) between return and Identifier_opt yields return without Identifier_opt"); + } +} catch(e){ + $ERROR('#3: eval("(function(){var x = 1;return\\u2028x;var y=2;})()") does not lead to throwing exception'); +} + + + + +//CHECK#4 +try{ + if (eval("(function(){var x =1;return\u2029x;var y=2;})()") !== undefined) { + $ERROR("#1: LineTerminator(U-2029) between return and Identifier_opt yields return without Identifier_opt"); + } +} catch(e){ + $ERROR('#4: eval("(function(){var x =1;return\\u2029x;var y=2;})()") does not lead to throwing exception'); +} + diff --git a/js/src/tests/test262/ch12/12.9/S12.9_A3.js b/js/src/tests/test262/ch12/12.9/S12.9_A3.js new file mode 100644 index 000000000..95b87c363 --- /dev/null +++ b/js/src/tests/test262/ch12/12.9/S12.9_A3.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. + +/** + * If Expression is omitted, the return value is undefined + * + * @path ch12/12.9/S12.9_A3.js + * @description Return without Expression + */ + +__evaluated = (function (){return;})(); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__evaluated !== undefined) { + $ERROR('#1: If Expression is omitted, the return value is undefined'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.9/S12.9_A4.js b/js/src/tests/test262/ch12/12.9/S12.9_A4.js new file mode 100644 index 000000000..97c923979 --- /dev/null +++ b/js/src/tests/test262/ch12/12.9/S12.9_A4.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 ReturnStatement : return Expression; is evaluated as: + * i) Evaluate Expression. + * ii) Call GetValue(Result(2)). + * iii) Return (return, Result(3), empty) + * + * @path ch12/12.9/S12.9_A4.js + * @description Return very sophisticated expression and function + */ + +// second derivative +function DD_operator(f, delta){return function(x){return (f(x+delta)-2*f(x)+f(x-delta))/(delta*delta)};} + +DDsin = DD_operator(Math.sin, 0.00001); + + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +// ((sin(x))')' = -sin(x) +if (DDsin( Math.PI/2 ) + Math.sin( Math.PI/2 ) > 0.00001) { + $ERROR('#1: return Expression yields to Return (return, GetValue(Evaluate Expression), empty)'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.9/S12.9_A5.js b/js/src/tests/test262/ch12/12.9/S12.9_A5.js new file mode 100644 index 000000000..3b0b98e43 --- /dev/null +++ b/js/src/tests/test262/ch12/12.9/S12.9_A5.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Code after ReturnStatement is not evaluated + * + * @path ch12/12.9/S12.9_A5.js + * @description Using code after Return statement + */ + +//CHECK#1 +var x1=1; +function myfunc1(){ + x1++; + return; + x1*=2; +} +myfunc1(); +if (x1!==2) $ERROR('#1: x1 === 2. Actual: x1 ==='+ x1 ); + +//CHECK#2 +var x2=1; +function myfunc2(){ + x2++; + return x2; + x2*=2; +} +myfunc2(); +if (x2!==2) $ERROR('#2: x2 === 2. Actual: x2 ==='+ x2 ); + +//CHECK#3 +var x3=1; +function myfunc3(){ + x3++; + return; + return x3; + x3*=2; +} +if (myfunc3()!==undefined) $ERROR('#3: myfunc3() === undefined. Actual: myfunc3() ==='+ myfunc3() ); + diff --git a/js/src/tests/test262/ch12/12.9/browser.js b/js/src/tests/test262/ch12/12.9/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.9/browser.js diff --git a/js/src/tests/test262/ch12/12.9/shell.js b/js/src/tests/test262/ch12/12.9/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.9/shell.js diff --git a/js/src/tests/test262/ch12/browser.js b/js/src/tests/test262/ch12/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/browser.js diff --git a/js/src/tests/test262/ch12/shell.js b/js/src/tests/test262/ch12/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/shell.js |