diff options
Diffstat (limited to 'js/src/tests/test262/ch12/12.10')
151 files changed, 11871 insertions, 0 deletions
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 |