diff options
Diffstat (limited to 'js/src/tests/test262/language/statements/with')
171 files changed, 12667 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/statements/with/12.10-0-1.js b/js/src/tests/test262/language/statements/with/12.10-0-1.js new file mode 100644 index 0000000000..0274f09000 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/12.10-0-1.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 12.10-0-1 +description: > + with does not change declaration scope - vars in with are visible + outside +flags: [noStrict] +---*/ + + var o = {}; + var f = function () { + /* capture foo binding before executing with */ + return foo; + } + + with (o) { + var foo = "12.10-0-1"; + } + +assert.sameValue(f(), "12.10-0-1", 'f()'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/12.10-0-10.js b/js/src/tests/test262/language/statements/with/12.10-0-10.js new file mode 100644 index 0000000000..308ca4c44d --- /dev/null +++ b/js/src/tests/test262/language/statements/with/12.10-0-10.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 12.10-0-10 +description: with introduces scope - name lookup finds function parameter +flags: [noStrict] +---*/ + + function f(o) { + + function innerf(o, x) { + with (o) { + return x; + } + } + + return innerf(o, 42); + } + +assert.sameValue(f({}), 42); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/12.10-0-11.js b/js/src/tests/test262/language/statements/with/12.10-0-11.js new file mode 100644 index 0000000000..4881f88bce --- /dev/null +++ b/js/src/tests/test262/language/statements/with/12.10-0-11.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 12.10-0-11 +description: with introduces scope - name lookup finds inner variable +flags: [noStrict] +---*/ + + function f(o) { + + function innerf(o) { + var x = 42; + + with (o) { + return x; + } + } + + return innerf(o); + } + +assert.sameValue(f({}), 42); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/12.10-0-12.js b/js/src/tests/test262/language/statements/with/12.10-0-12.js new file mode 100644 index 0000000000..647ab0cc2e --- /dev/null +++ b/js/src/tests/test262/language/statements/with/12.10-0-12.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 12.10-0-12 +description: with introduces scope - name lookup finds property +flags: [noStrict] +---*/ + + function f(o) { + + function innerf(o) { + with (o) { + return x; + } + } + + return innerf(o); + } + +assert.sameValue(f({x:42}), 42); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/12.10-0-3.js b/js/src/tests/test262/language/statements/with/12.10-0-3.js new file mode 100644 index 0000000000..5684a9364e --- /dev/null +++ b/js/src/tests/test262/language/statements/with/12.10-0-3.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 12.10-0-3 +description: with introduces scope - that is captured by function expression +flags: [noStrict] +---*/ + + var o = {prop: "12.10-0-3 before"}; + var f; + + with (o) { + f = function () { return prop; } + } + o.prop = "12.10-0-3 after"; + +assert.sameValue(f(), "12.10-0-3 after", 'f()'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/12.10-0-7.js b/js/src/tests/test262/language/statements/with/12.10-0-7.js new file mode 100644 index 0000000000..3be6a9b151 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/12.10-0-7.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 12.10-0-7 +description: with introduces scope - scope removed when exiting with statement +flags: [noStrict] +---*/ + + var o = {foo: 1}; + + with (o) { + foo = 42; + } + + try { + foo; + throw new Error(); + } + catch (e) { + assert(e instanceof ReferenceError); + } + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/12.10-0-8.js b/js/src/tests/test262/language/statements/with/12.10-0-8.js new file mode 100644 index 0000000000..a97e1be0c1 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/12.10-0-8.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 12.10-0-8 +description: with introduces scope - var initializer sets like named property +flags: [noStrict] +---*/ + + var o = {foo: 42}; + + with (o) { + var foo = "set in with"; + } + +assert.sameValue(o.foo, "set in with", 'o.foo'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/12.10-0-9.js b/js/src/tests/test262/language/statements/with/12.10-0-9.js new file mode 100644 index 0000000000..cadd074ba3 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/12.10-0-9.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 12.10-0-9 +description: with introduces scope - name lookup finds outer variable +flags: [noStrict] +---*/ + + function f(o) { + var x = 42; + + function innerf(o) { + with (o) { + return x; + } + } + + return innerf(o); + } + +assert.sameValue(f({}), 42); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/12.10-2-1.js b/js/src/tests/test262/language/statements/with/12.10-2-1.js new file mode 100644 index 0000000000..7a8142abad --- /dev/null +++ b/js/src/tests/test262/language/statements/with/12.10-2-1.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 12.10-2-1 +description: with - expression being Number +flags: [noStrict] +---*/ + + var o = 2; + var foo = 1; + with (o) { + foo = 42; + } + +assert.sameValue(foo, 42); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/12.10-2-2.js b/js/src/tests/test262/language/statements/with/12.10-2-2.js new file mode 100644 index 0000000000..d1344d0e23 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/12.10-2-2.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 12.10-2-2 +description: with - expression being Boolean +flags: [noStrict] +---*/ + + var o = true; + var foo = 1; + with (o) { + foo = 42; + } + +assert.sameValue(foo, 42); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/12.10-2-3.js b/js/src/tests/test262/language/statements/with/12.10-2-3.js new file mode 100644 index 0000000000..bbd6ebea6b --- /dev/null +++ b/js/src/tests/test262/language/statements/with/12.10-2-3.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 12.10-2-3 +description: with - expression being string +flags: [noStrict] +---*/ + + var o = "str"; + var foo = 1; + with (o) { + foo = 42; + } + +assert.sameValue(foo, 42); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/12.10-2-4.js b/js/src/tests/test262/language/statements/with/12.10-2-4.js new file mode 100644 index 0000000000..7834c1588b --- /dev/null +++ b/js/src/tests/test262/language/statements/with/12.10-2-4.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: ToObject conversion from undefined value must throw TypeError +es5id: 12.10-2-4 +description: Trying to convert undefined to Object +flags: [noStrict] +---*/ + +try{ + with(undefined) x = 2; + throw new Test262Error('#2.1: with(undefined) x = 2 must throw TypeError. Actual: x === ' + (x)); +} +catch(e){ + if((e instanceof TypeError) !== true){ + throw new Test262Error('#2.2: with(undefined) x = 2 must throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/12.10-2-5.js b/js/src/tests/test262/language/statements/with/12.10-2-5.js new file mode 100644 index 0000000000..893723f979 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/12.10-2-5.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: ToObject conversion from null value must throw TypeError +es5id: 12.10-2-5 +description: Trying to convert null to Object +flags: [noStrict] +---*/ + +try{ + with(null) x = 2; + throw new Test262Error('#2.1: with(null) x = 2 must throw TypeError. Actual: x === . Actual: ' + (x)); +} +catch(e){ + if((e instanceof TypeError) !== true){ + throw new Test262Error('#2.2: with(null) x = 2 must throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/12.10-7-1.js b/js/src/tests/test262/language/statements/with/12.10-7-1.js new file mode 100644 index 0000000000..d667ddf21c --- /dev/null +++ b/js/src/tests/test262/language/statements/with/12.10-7-1.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 12.10-7-1 +description: with introduces scope - restores the earlier environment on exit +flags: [noStrict] +---*/ + + var a = 1; + + var o = {a : 2}; + try { + with (o) { + a = 3; + throw 1; + a = 4; + } + } catch (e) { + // intentionally ignored + } + +assert.sameValue(a, 1, 'a'); +assert.sameValue(o.a, 3, 'o.a'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/12.10.1-10-s-strict.js b/js/src/tests/test262/language/statements/with/12.10.1-10-s-strict.js new file mode 100644 index 0000000000..d6eb11e8b3 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/12.10.1-10-s-strict.js @@ -0,0 +1,23 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 12.10.1-10-s +description: > + with statement in strict mode throws SyntaxError (eval, where the + container function is strict) +flags: [onlyStrict] +---*/ + + // 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. +assert.throws(SyntaxError, function() { + eval("\ + var o = {};\ + with (o) {}\ + "); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/12.10.1-11gs-strict.js b/js/src/tests/test262/language/statements/with/12.10.1-11gs-strict.js new file mode 100644 index 0000000000..2488b5b6df --- /dev/null +++ b/js/src/tests/test262/language/statements/with/12.10.1-11gs-strict.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 12.10.1-11gs +description: Strict Mode - SyntaxError is thrown when using with statement +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); + +with ({}) { } diff --git a/js/src/tests/test262/language/statements/with/12.10.1-12-s.js b/js/src/tests/test262/language/statements/with/12.10.1-12-s.js new file mode 100644 index 0000000000..5517c97d92 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/12.10.1-12-s.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 12.10.1-12-s +description: with statement in strict mode throws SyntaxError (strict eval) +flags: [noStrict] +---*/ + + +assert.throws(SyntaxError, function() { + eval("\ + 'use strict'; \ + var o = {}; \ + with (o) {}\ + "); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/12.10.1-13-s.js b/js/src/tests/test262/language/statements/with/12.10.1-13-s.js new file mode 100644 index 0000000000..787a52bfc5 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/12.10.1-13-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 12.10.1-13-s +description: > + Strict Mode - SyntaxError isn't thrown when WithStatement body is + in strict mode code +flags: [noStrict] +---*/ + + with ({}) { + "use strict"; + } + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/12.10.1-4-s.js b/js/src/tests/test262/language/statements/with/12.10.1-4-s.js new file mode 100644 index 0000000000..9f77e77e6c --- /dev/null +++ b/js/src/tests/test262/language/statements/with/12.10.1-4-s.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 12.10.1-4-s +description: with statement in strict mode throws SyntaxError (strict Function) +flags: [noStrict] +---*/ + + +assert.throws(SyntaxError, function() { + var f = Function("\ + \'use strict\'; \ + var o = {}; \ + with (o) {};\ + "); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/12.10.1-5-s-strict.js b/js/src/tests/test262/language/statements/with/12.10.1-5-s-strict.js new file mode 100644 index 0000000000..48883f9dc5 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/12.10.1-5-s-strict.js @@ -0,0 +1,15 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 12.10.1-5-s +description: > + with statement allowed in nested Function even if its container + Function is strict) +flags: [onlyStrict] +---*/ + + Function("\'use strict\'; var f1 = Function( \"var o = {}; with (o) {};\")"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/12.10.1-8-s.js b/js/src/tests/test262/language/statements/with/12.10.1-8-s.js new file mode 100644 index 0000000000..46c2ab992d --- /dev/null +++ b/js/src/tests/test262/language/statements/with/12.10.1-8-s.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 12.10.1-8-s +description: > + with statement in strict mode throws SyntaxError (function + expression, where the container Function is strict) +flags: [noStrict] +---*/ + + +assert.throws(SyntaxError, function() { + Function("\ + \'use strict\'; \ + var f1 = function () {\ + var o = {}; \ + with (o) {}; \ + }\ + "); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.10_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A1.10_T1.js new file mode 100644 index 0000000000..f88e79d5ce --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.10_T1.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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.10_T1 +description: > + Using interation statement within "with" statement leading to + normal completion +flags: [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)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + throw new Test262Error('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + throw new Test262Error('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + throw new Test262Error('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + throw new Test262Error('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + throw new Test262Error('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + throw new Test262Error('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + throw new Test262Error('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + throw new Test262Error('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + throw new Test262Error('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.10_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A1.10_T2.js new file mode 100644 index 0000000000..53666b8450 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.10_T2.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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.10_T2 +description: > + Using iteration statement within "with" statement leading to + completion by exception +flags: [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")){ + throw new Test262Error('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + throw new Test262Error('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + throw new Test262Error('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + throw new Test262Error('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + throw new Test262Error('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + throw new Test262Error('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + throw new Test262Error('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + throw new Test262Error('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + throw new Test262Error('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + throw new Test262Error('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.10_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A1.10_T3.js new file mode 100644 index 0000000000..1575181700 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.10_T3.js @@ -0,0 +1,154 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.10_T3 +description: > + Using iteration statment withing "with" statement leading to + completion by exception iteration statement inside with statement + - exception completion +flags: [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")){ + throw new Test262Error('#0: result === "myObj_value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === undefined)){ + throw new Test262Error('#4: p4 === undefined. Actual: p4 ==='+ p4 ); +} + +try { + p5; + throw new Test262Error('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +if(!(value === undefined)){ + throw new Test262Error('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "myObj_value")){ + throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.10_T4.js b/js/src/tests/test262/language/statements/with/S12.10_A1.10_T4.js new file mode 100644 index 0000000000..7ad7a462b6 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.10_T4.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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.10_T4 +description: > + Using iteration statement witthin "with" staement leading to + completion by break iteration statement inside with statement - + break completion +flags: [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)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + throw new Test262Error('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + throw new Test262Error('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + throw new Test262Error('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + throw new Test262Error('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + throw new Test262Error('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + throw new Test262Error('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + throw new Test262Error('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + throw new Test262Error('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + throw new Test262Error('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.10_T5.js b/js/src/tests/test262/language/statements/with/S12.10_A1.10_T5.js new file mode 100644 index 0000000000..bc2fc1841e --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.10_T5.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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.10_T5 +description: > + Using iteration statement within "with" statement leading to + completion by break +flags: [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)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === undefined)){ + throw new Test262Error('#4: p4 === undefined. Actual: p4 ==='+ p4 ); +} + +try { + p5; + throw new Test262Error('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +if(!(value === undefined)){ + throw new Test262Error('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "myObj_value")){ + throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.11_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A1.11_T1.js new file mode 100644 index 0000000000..da12e61a72 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.11_T1.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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.11_T1 +description: > + Calling a function within "with" statement declared without the + statement, leading to normal completion +flags: [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")){ + throw new Test262Error('#1: p1 === "x1". Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +try{ + p3; + throw new Test262Error('#3: p3 is nod defined'); +} +catch(e){ +} + +try { + p4; + throw new Test262Error('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "a")){ + throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === parseInt)){ + throw new Test262Error('#11: st_parseInt === parseInt. Actual: st_parseInt ==='+ st_parseInt ); +} + +assert.sameValue(st_NaN, NaN, "st_NaN is NaN"); + +if(!(st_Infinity === Infinity)){ + throw new Test262Error('#13: st_Infinity === Infinity. Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === eval)){ + throw new Test262Error('#14: st_eval === eval. Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === parseFloat)){ + throw new Test262Error('#15: st_parseFloat === parseFloat. Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === isNaN)){ + throw new Test262Error('#16: st_isNaN === isNaN. Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === isFinite)){ + throw new Test262Error('#17: st_isFinite === isFinite. Actual: st_isFinite ==='+ st_isFinite ); +} + +try { + value; + throw new Test262Error('#18: value is not defined'); +} catch(e) { +} + +if(!(myObj.value === "myObj_value")){ + throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.11_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A1.11_T2.js new file mode 100644 index 0000000000..8f53e950de --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.11_T2.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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.11_T2 +description: > + Calling a function within "with" statement declared without the + statement, leading to normal completion by "return" +flags: [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")){ + throw new Test262Error('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === "x1")){ + throw new Test262Error('#1: p1 === "x1". Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +try{ + p3; + throw new Test262Error('#3: p3 is nod defined'); +} +catch(e){ +} + +try { + p4; + throw new Test262Error('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "a")){ + throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === parseInt)){ + throw new Test262Error('#11: st_parseInt === parseInt. Actual: st_parseInt ==='+ st_parseInt ); +} + +assert.sameValue(st_NaN, NaN, "st_NaN is NaN"); + +if(!(st_Infinity === Infinity)){ + throw new Test262Error('#13: st_Infinity === Infinity. Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === eval)){ + throw new Test262Error('#14: st_eval === eval. Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === parseFloat)){ + throw new Test262Error('#15: st_parseFloat === parseFloat. Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === isNaN)){ + throw new Test262Error('#16: st_isNaN === isNaN. Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === isFinite)){ + throw new Test262Error('#17: st_isFinite === isFinite. Actual: st_isFinite ==='+ st_isFinite ); +} + +try { + value; + throw new Test262Error('#18: value is not defined'); +} catch(e) { +} + +if(!(myObj.value === "myObj_value")){ + throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.11_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A1.11_T3.js new file mode 100644 index 0000000000..d9cc6eb1d7 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.11_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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.11_T3 +description: > + Calling a function within "with" statement declared without the + statement, leading to normal completion by "return" +flags: [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)){ + throw new Test262Error('#0: result === undefined. Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try{ + p4; + throw new Test262Error('#4: p4 doesn\'t exists'); +} +catch(e){ +} + +try { + p5; + throw new Test262Error('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +try { + value; + throw new Test262Error('#18: value is not defined'); +} catch(e) { +} + +if(!(myObj.value === "myObj_value")){ + throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.11_T4.js b/js/src/tests/test262/language/statements/with/S12.10_A1.11_T4.js new file mode 100644 index 0000000000..b20e0c8857 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.11_T4.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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.11_T4 +description: > + Calling a function within "with" statement declared without the + statement, leading to completion by exception +flags: [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")){ + throw new Test262Error('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === "x1")){ + throw new Test262Error('#1: p1 === "x1". Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +try{ + p3; + throw new Test262Error('#3: p3 is nod defined'); +} +catch(e){ +} + +try { + p4; + throw new Test262Error('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "a")){ + throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === parseInt)){ + throw new Test262Error('#11: st_parseInt === parseInt. Actual: st_parseInt ==='+ st_parseInt ); +} + +assert.sameValue(st_NaN, NaN, 'st_NaN is NaN'); + +if(!(st_Infinity === Infinity)){ + throw new Test262Error('#13: st_Infinity === Infinity. Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === eval)){ + throw new Test262Error('#14: st_eval === eval. Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === parseFloat)){ + throw new Test262Error('#15: st_parseFloat === parseFloat. Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === isNaN)){ + throw new Test262Error('#16: st_isNaN === isNaN. Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === isFinite)){ + throw new Test262Error('#17: st_isFinite === isFinite. Actual: st_isFinite ==='+ st_isFinite ); +} + +try { + value; + throw new Test262Error('#18: value is not defined'); +} catch(e) { +} + +if(!(myObj.value === "myObj_value")){ + throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.11_T5.js b/js/src/tests/test262/language/statements/with/S12.10_A1.11_T5.js new file mode 100644 index 0000000000..6eb69e35ad --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.11_T5.js @@ -0,0 +1,158 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.11_T5 +description: > + Calling a function within "with" statement declared without the + statement, leading to completion by exception +flags: [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)){ + throw new Test262Error('#0: result === undefined. Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try{ + p4; + throw new Test262Error('#4: p4 doesn\'t exists'); +} +catch(e){ +} + +try { + p5; + throw new Test262Error('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +try { + value; + throw new Test262Error('#18: value is not defined'); +} catch(e) { +} + +if(!(myObj.value === "myObj_value")){ + throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.12_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A1.12_T1.js new file mode 100644 index 0000000000..8e62e38471 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.12_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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.12_T1 +description: > + Calling a function without "with" statement declared within the + statement, leading to normal completion +flags: [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)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try{ + p4; + throw new Test262Error('#4: p4 doesn\'t exists'); +} +catch(e){ +} + +if(!(p5 === "x5")){ + throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + throw new Test262Error('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + throw new Test262Error('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + throw new Test262Error('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + throw new Test262Error('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + throw new Test262Error('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + throw new Test262Error('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + throw new Test262Error('#17: myObj.isFinite !== isFinite'); +} + +try { + value; + throw new Test262Error('#18: value is not defined'); +} catch(e) { +} + +if(!(myObj.value === "myObj_value")){ + throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.12_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A1.12_T2.js new file mode 100644 index 0000000000..27942f5995 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.12_T2.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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.12_T2 +description: > + Calling a function without "with" statement declared within the + statement, leading to normal completion by "return" +flags: [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")){ + throw new Test262Error('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try{ + p4; + throw new Test262Error('#4: p4 doesn\'t exists'); +} +catch(e){ +} + +if(!(p5 === "x5")){ + throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + throw new Test262Error('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + throw new Test262Error('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + throw new Test262Error('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + throw new Test262Error('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + throw new Test262Error('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + throw new Test262Error('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + throw new Test262Error('#17: myObj.isFinite !== isFinite'); +} + +try{ + value; + throw new Test262Error('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.12_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A1.12_T3.js new file mode 100644 index 0000000000..3ed26a5e71 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.12_T3.js @@ -0,0 +1,154 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.12_T3 +description: > + Calling a function without "with" statement declared within the + statement, leading to normal completion by "return" +flags: [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)){ + throw new Test262Error('#0: result === undefined. Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + throw new Test262Error('#4: p4 is not defined'); +} catch(e) { +} + +try { + p5; + throw new Test262Error('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +try{ + value; + throw new Test262Error('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.12_T4.js b/js/src/tests/test262/language/statements/with/S12.10_A1.12_T4.js new file mode 100644 index 0000000000..7cbbb781dc --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.12_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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.12_T4 +description: > + Calling a function without "with" statement declared within the + statement, leading to completion by exception +flags: [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")){ + throw new Test262Error('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + throw new Test262Error('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + throw new Test262Error('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + throw new Test262Error('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + throw new Test262Error('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + throw new Test262Error('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + throw new Test262Error('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + throw new Test262Error('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + throw new Test262Error('#17: myObj.isFinite !== isFinite'); +} + +try { + value; + throw new Test262Error('#18: value is not defined'); +} catch(e) { +} + +if(!(myObj.value === "myObj_value")){ + throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.12_T5.js b/js/src/tests/test262/language/statements/with/S12.10_A1.12_T5.js new file mode 100644 index 0000000000..a09bb48a8a --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.12_T5.js @@ -0,0 +1,158 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.12_T5 +description: > + Calling a function without "with" statement declared within the + statement, leading to completion by exception +flags: [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)){ + throw new Test262Error('#0: result === undefined. Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + throw new Test262Error('#4: p4 is not defined'); +} catch(e) { +} + +try { + p5; + throw new Test262Error('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +try{ + value; + throw new Test262Error('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.1_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A1.1_T1.js new file mode 100644 index 0000000000..e168158186 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.1_T1.js @@ -0,0 +1,137 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.1_T1 +description: Using "with" inside of global context leading to normal completion +flags: [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)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + throw new Test262Error('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + throw new Test262Error('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + throw new Test262Error('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + throw new Test262Error('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + throw new Test262Error('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + throw new Test262Error('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + throw new Test262Error('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + throw new Test262Error('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + throw new Test262Error('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.1_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A1.1_T2.js new file mode 100644 index 0000000000..cc098e2d0b --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.1_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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.1_T2 +description: > + Using "with" inside of global context leading to completion by + exception +flags: [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")){ + throw new Test262Error('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + throw new Test262Error('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + throw new Test262Error('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + throw new Test262Error('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + throw new Test262Error('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + throw new Test262Error('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + throw new Test262Error('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + throw new Test262Error('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + throw new Test262Error('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + throw new Test262Error('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.1_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A1.1_T3.js new file mode 100644 index 0000000000..3d732d15a2 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.1_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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.1_T3 +description: > + Using "with" inside of global context leading to completion by + exception +flags: [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")){ + throw new Test262Error('#0: result === "myObj_value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === undefined)){ + throw new Test262Error('#4: p4 === undefined. Actual: p4 ==='+ p4 ); +} + +try { + p5; + throw new Test262Error('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +if(!(value === undefined)){ + throw new Test262Error('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "myObj_value")){ + throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.2_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A1.2_T1.js new file mode 100644 index 0000000000..6bcb233d38 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.2_T1.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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.2_T1 +description: > + Calling a function without "with" statement when the statement + itself is declared within the function declaration, leading to + normal completion +flags: [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)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + throw new Test262Error('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + throw new Test262Error('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + throw new Test262Error('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + throw new Test262Error('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + throw new Test262Error('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + throw new Test262Error('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + throw new Test262Error('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + throw new Test262Error('#17: myObj.isFinite !== isFinite'); +} + +try{ + value; + throw new Test262Error('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "value")){ + throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.2_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A1.2_T2.js new file mode 100644 index 0000000000..a2a37cd30d --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.2_T2.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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.2_T2 +description: > + Calling a function without "with" statement when the statement + itself is declared within the function declaration, leading to + normal completion by "return" +flags: [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")){ + throw new Test262Error('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + throw new Test262Error('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + throw new Test262Error('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + throw new Test262Error('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + throw new Test262Error('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + throw new Test262Error('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + throw new Test262Error('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + throw new Test262Error('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + throw new Test262Error('#17: myObj.isFinite !== isFinite'); +} + +try{ + value; + throw new Test262Error('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "value")){ + throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.2_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A1.2_T3.js new file mode 100644 index 0000000000..f42c5ea3e9 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.2_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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.2_T3 +description: > + Calling a function without "with" statement when the statement + itself is declared within the function declaration, leading to + normal completion by "return" +flags: [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")){ + throw new Test262Error('#0: result === "myObj_value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + throw new Test262Error('#4: p4 is not defined'); +} catch(e) { +} + +try { + p5; + throw new Test262Error('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +try{ + value; + throw new Test262Error('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.2_T4.js b/js/src/tests/test262/language/statements/with/S12.10_A1.2_T4.js new file mode 100644 index 0000000000..e4ceec0102 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.2_T4.js @@ -0,0 +1,157 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.2_T4 +description: > + Calling a function without "with" statement when the statement + itself is declared within the function declaration, leading to + completion by exception +flags: [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")){ + throw new Test262Error('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + throw new Test262Error('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + throw new Test262Error('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + throw new Test262Error('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + throw new Test262Error('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + throw new Test262Error('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + throw new Test262Error('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + throw new Test262Error('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + throw new Test262Error('#17: myObj.isFinite !== isFinite'); +} + +try{ + value; + throw new Test262Error('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "value")){ + throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.2_T5.js b/js/src/tests/test262/language/statements/with/S12.10_A1.2_T5.js new file mode 100644 index 0000000000..ac10e9fd1f --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.2_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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.2_T5 +description: > + Calling a function without "with" statement when the statement + itself is declared within the function declaration, leading to + completion by exception +flags: [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")){ + throw new Test262Error('#0: result === "myObj_value". Actual: result ==='+ result ); +} + +if(!(p2 === 2)){ + throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + throw new Test262Error('#4: p4 is not defined'); +} catch(e) { +} + +try { + p5; + throw new Test262Error('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +try{ + value; + throw new Test262Error('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.3_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A1.3_T1.js new file mode 100644 index 0000000000..6c018ae4bd --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.3_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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.3_T1 +description: > + Using "with" statement within function constructor, leading to + normal completition +flags: [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)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + throw new Test262Error('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + throw new Test262Error('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + throw new Test262Error('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + throw new Test262Error('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + throw new Test262Error('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + throw new Test262Error('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + throw new Test262Error('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + throw new Test262Error('#17: myObj.isFinite !== isFinite'); +} + +try{ + value; + throw new Test262Error('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "value")){ + throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.3_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A1.3_T2.js new file mode 100644 index 0000000000..b8ebe659cd --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.3_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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.3_T2 +description: > + Using "with" statement within function constructor, leading to + normal completition by "return" +flags: [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)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + throw new Test262Error('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + throw new Test262Error('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + throw new Test262Error('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + throw new Test262Error('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + throw new Test262Error('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + throw new Test262Error('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + throw new Test262Error('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + throw new Test262Error('#17: myObj.isFinite !== isFinite'); +} + +try{ + value; + throw new Test262Error('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "value")){ + throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.3_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A1.3_T3.js new file mode 100644 index 0000000000..86c7f9712f --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.3_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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.3_T3 +description: > + Using "with" statement within function constructor, leading to + normal completition by "return" +flags: [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)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + throw new Test262Error('#4: p4 is not defined'); +} catch(e) { +} + +try { + p5; + throw new Test262Error('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +try{ + value; + throw new Test262Error('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.3_T4.js b/js/src/tests/test262/language/statements/with/S12.10_A1.3_T4.js new file mode 100644 index 0000000000..4baa45391b --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.3_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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.3_T4 +description: > + Using "with" statement within function constructor, leading to + completition by exception +flags: [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")){ + throw new Test262Error('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +try { + p4; + throw new Test262Error('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + throw new Test262Error('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + throw new Test262Error('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + throw new Test262Error('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + throw new Test262Error('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + throw new Test262Error('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + throw new Test262Error('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + throw new Test262Error('#17: myObj.isFinite !== isFinite'); +} + +try{ + value; + throw new Test262Error('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "value")){ + throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.3_T5.js b/js/src/tests/test262/language/statements/with/S12.10_A1.3_T5.js new file mode 100644 index 0000000000..cac40c5bfe --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.3_T5.js @@ -0,0 +1,158 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.3_T5 +description: > + Using "with" statement within function constructor, leading to + completition by exception +flags: [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")){ + throw new Test262Error('#0: result === "myObj_value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + throw new Test262Error('#4: p4 is not defined'); +} catch(e) { +} + +try { + p5; + throw new Test262Error('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +try{ + value; + throw new Test262Error('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.4_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A1.4_T1.js new file mode 100644 index 0000000000..c2abf2a947 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.4_T1.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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.4_T1 +description: > + Using "with" statement within iteration statement, leading to + normal completion +flags: [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)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + throw new Test262Error('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + throw new Test262Error('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + throw new Test262Error('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + throw new Test262Error('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + throw new Test262Error('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + throw new Test262Error('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + throw new Test262Error('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + throw new Test262Error('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + throw new Test262Error('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.4_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A1.4_T2.js new file mode 100644 index 0000000000..d128b0c764 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.4_T2.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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.4_T2 +description: > + Using "with" statement within iteration statement, leading to + completion by exception +flags: [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")){ + throw new Test262Error('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + throw new Test262Error('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + throw new Test262Error('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + throw new Test262Error('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + throw new Test262Error('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + throw new Test262Error('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + throw new Test262Error('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + throw new Test262Error('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + throw new Test262Error('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + throw new Test262Error('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.4_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A1.4_T3.js new file mode 100644 index 0000000000..b87b9829f4 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.4_T3.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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.4_T3 +description: > + Using "with" statement within iteration statement, leading to + completion by exception +flags: [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")){ + throw new Test262Error('#0: result === "myObj_value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === undefined)){ + throw new Test262Error('#4: p4 === undefined. Actual: p4 ==='+ p4 ); +} + +try { + p5; + throw new Test262Error('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +if(!(value === undefined)){ + throw new Test262Error('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "myObj_value")){ + throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.4_T4.js b/js/src/tests/test262/language/statements/with/S12.10_A1.4_T4.js new file mode 100644 index 0000000000..d0b63138f3 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.4_T4.js @@ -0,0 +1,143 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.4_T4 +description: > + Using "with" statement within iteration statement, leading to + completion by break +flags: [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)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + throw new Test262Error('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + throw new Test262Error('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + throw new Test262Error('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + throw new Test262Error('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + throw new Test262Error('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + throw new Test262Error('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + throw new Test262Error('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + throw new Test262Error('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + throw new Test262Error('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.4_T5.js b/js/src/tests/test262/language/statements/with/S12.10_A1.4_T5.js new file mode 100644 index 0000000000..39c7c2d31b --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.4_T5.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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.4_T5 +description: > + Using "with" statement within iteration statement, leading to + completion by break +flags: [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)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === undefined)){ + throw new Test262Error('#4: p4 ===undefined. Actual: p4 ==='+ p4 ); +} + +try { + p5; + throw new Test262Error('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +if(!(value === undefined)){ + throw new Test262Error('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "myObj_value")){ + throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.5_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A1.5_T1.js new file mode 100644 index 0000000000..6c34245333 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.5_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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.5_T1 +description: > + Using "with" statement within "for-in" statement, leading to + normal completion +flags: [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)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + throw new Test262Error('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + throw new Test262Error('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + throw new Test262Error('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + throw new Test262Error('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + throw new Test262Error('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + throw new Test262Error('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + throw new Test262Error('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + throw new Test262Error('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + throw new Test262Error('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.5_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A1.5_T2.js new file mode 100644 index 0000000000..808706bfaa --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.5_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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.5_T2 +description: > + Using "with" statement within "for-in" statement, leading to + completion by exception +flags: [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")){ + throw new Test262Error('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + throw new Test262Error('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + throw new Test262Error('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + throw new Test262Error('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + throw new Test262Error('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + throw new Test262Error('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + throw new Test262Error('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + throw new Test262Error('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + throw new Test262Error('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + throw new Test262Error('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.5_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A1.5_T3.js new file mode 100644 index 0000000000..3878a38f58 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.5_T3.js @@ -0,0 +1,158 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.5_T3 +description: > + Using "with" statement within "for-in" statement, leading to + completion by exception +flags: [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")){ + throw new Test262Error('#0: result === "myObj_value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === undefined)){ + throw new Test262Error('#4: p4 === undefined. Actual: p4 ==='+ p4 ); +} + +try { + p5; + throw new Test262Error('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +if(!(value === undefined)){ + throw new Test262Error('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "myObj_value")){ + throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.5_T4.js b/js/src/tests/test262/language/statements/with/S12.10_A1.5_T4.js new file mode 100644 index 0000000000..43a98385dc --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.5_T4.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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.5_T4 +description: > + Using "with" statement within "for-in" statement, leading to + completion by break +flags: [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)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + throw new Test262Error('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + throw new Test262Error('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + throw new Test262Error('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + throw new Test262Error('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + throw new Test262Error('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + throw new Test262Error('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + throw new Test262Error('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + throw new Test262Error('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + throw new Test262Error('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.5_T5.js b/js/src/tests/test262/language/statements/with/S12.10_A1.5_T5.js new file mode 100644 index 0000000000..db784e9783 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.5_T5.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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.5_T5 +description: > + Using "with" statement within "for-in" statement, leading to + completion by break +flags: [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)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === undefined)){ + throw new Test262Error('#4: p4 === undefined. Actual: p4 ==='+ p4 ); +} + +try { + p5; + throw new Test262Error('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +if(!(value === undefined)){ + throw new Test262Error('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "myObj_value")){ + throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.6_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A1.6_T1.js new file mode 100644 index 0000000000..6d0a4ffada --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.6_T1.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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.6_T1 +description: > + Using "with" statement within another "with" statement, leading to + normal completion +flags: [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)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + throw new Test262Error('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + throw new Test262Error('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + throw new Test262Error('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + throw new Test262Error('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + throw new Test262Error('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + throw new Test262Error('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + throw new Test262Error('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + throw new Test262Error('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + throw new Test262Error('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.6_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A1.6_T2.js new file mode 100644 index 0000000000..536303002d --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.6_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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.6_T2 +description: > + Using "with" statement within another "with" statement, leading to + completion by exception +flags: [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")){ + throw new Test262Error('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + throw new Test262Error('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + throw new Test262Error('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + throw new Test262Error('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + throw new Test262Error('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + throw new Test262Error('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + throw new Test262Error('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + throw new Test262Error('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + throw new Test262Error('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + throw new Test262Error('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.6_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A1.6_T3.js new file mode 100644 index 0000000000..dea5bda8ad --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.6_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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.6_T3 +description: > + Using "with" statement within another "with" statement, leading to + completion by exception +flags: [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")){ + throw new Test262Error('#0: result === "myObj_value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === undefined)){ + throw new Test262Error('#4: p4 === undefined. Actual: p4 ==='+ p4 ); +} + +try { + p5; + throw new Test262Error('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +if(!(value === undefined)){ + throw new Test262Error('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "myObj_value")){ + throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.7_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A1.7_T1.js new file mode 100644 index 0000000000..cc8808db2a --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.7_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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.7_T1 +description: > + Calling a function within "with" statement declared within the + statement, leading to normal completion +flags: [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)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + throw new Test262Error('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + throw new Test262Error('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + throw new Test262Error('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + throw new Test262Error('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + throw new Test262Error('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + throw new Test262Error('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + throw new Test262Error('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + throw new Test262Error('#17: myObj.isFinite !== isFinite'); +} + +try{ + value; + throw new Test262Error('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.7_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A1.7_T2.js new file mode 100644 index 0000000000..373696da99 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.7_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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.7_T2 +description: > + Calling a function within "with" statement declared within the + statement, leading to normal completion by "return" +flags: [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")){ + throw new Test262Error('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + throw new Test262Error('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + throw new Test262Error('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + throw new Test262Error('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + throw new Test262Error('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + throw new Test262Error('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + throw new Test262Error('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + throw new Test262Error('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + throw new Test262Error('#17: myObj.isFinite !== isFinite'); +} + +try{ + value; + throw new Test262Error('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.7_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A1.7_T3.js new file mode 100644 index 0000000000..bf4566c9ac --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.7_T3.js @@ -0,0 +1,154 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.7_T3 +description: > + Calling a function within "with" statement declared within the + statement, leading to normal completion by "return" +flags: [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)){ + throw new Test262Error('#0: result === undefined. Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + throw new Test262Error('#4: p4 is not defined'); +} catch(e) { +} + +try { + p5; + throw new Test262Error('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +try{ + value; + throw new Test262Error('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.7_T4.js b/js/src/tests/test262/language/statements/with/S12.10_A1.7_T4.js new file mode 100644 index 0000000000..4cc55a667d --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.7_T4.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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.7_T4 +description: > + Calling a function within "with" statement declared within the + statement, leading to completion by exception +flags: [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")){ + throw new Test262Error('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + throw new Test262Error('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + throw new Test262Error('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + throw new Test262Error('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + throw new Test262Error('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + throw new Test262Error('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + throw new Test262Error('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + throw new Test262Error('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + throw new Test262Error('#17: myObj.isFinite !== isFinite'); +} + +try{ + value; + throw new Test262Error('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.7_T5.js b/js/src/tests/test262/language/statements/with/S12.10_A1.7_T5.js new file mode 100644 index 0000000000..ddc6080b3f --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.7_T5.js @@ -0,0 +1,158 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.7_T5 +description: > + Calling a function within "with" statement declared within the + statement, leading to completion by exception +flags: [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)){ + throw new Test262Error('#0: result === undefined. Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + throw new Test262Error('#4: p4 is not defined'); +} catch(e) { +} + +try { + p5; + throw new Test262Error('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +try{ + value; + throw new Test262Error('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.8_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A1.8_T1.js new file mode 100644 index 0000000000..1705f4ba90 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.8_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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.8_T1 +description: > + Declaring function constructor within "with" statement, leading to + normal completion +flags: [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)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + throw new Test262Error('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + throw new Test262Error('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + throw new Test262Error('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + throw new Test262Error('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + throw new Test262Error('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + throw new Test262Error('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + throw new Test262Error('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + throw new Test262Error('#17: myObj.isFinite !== isFinite'); +} + +try{ + value; + throw new Test262Error('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.8_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A1.8_T2.js new file mode 100644 index 0000000000..6595eb969b --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.8_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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.8_T2 +description: > + Declaring function constructor within "with" statement, leading to + normal completion by "return" +flags: [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)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} +try { + p4; + throw new Test262Error('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + throw new Test262Error('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + throw new Test262Error('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + throw new Test262Error('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + throw new Test262Error('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + throw new Test262Error('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + throw new Test262Error('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + throw new Test262Error('#17: myObj.isFinite !== isFinite'); +} + +try{ + value; + throw new Test262Error('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.8_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A1.8_T3.js new file mode 100644 index 0000000000..2d7febb9b9 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.8_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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.8_T3 +description: > + Declaring function constructor within "with" statement, leading to + normal completion by "return" +flags: [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)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + throw new Test262Error('#4: p4 is not defined'); +} catch(e) { +} + +try { + p5; + throw new Test262Error('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +try{ + value; + throw new Test262Error('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.8_T4.js b/js/src/tests/test262/language/statements/with/S12.10_A1.8_T4.js new file mode 100644 index 0000000000..2d15ca3a0f --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.8_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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.8_T4 +description: > + Declaring function constructor within "with" statement, leading to + completion by exception +flags: [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")){ + throw new Test262Error('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} +try { + p4; + throw new Test262Error('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + throw new Test262Error('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + throw new Test262Error('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + throw new Test262Error('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + throw new Test262Error('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + throw new Test262Error('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + throw new Test262Error('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + throw new Test262Error('#17: myObj.isFinite !== isFinite'); +} + +try{ + value; + throw new Test262Error('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.8_T5.js b/js/src/tests/test262/language/statements/with/S12.10_A1.8_T5.js new file mode 100644 index 0000000000..de5f1b6b3b --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.8_T5.js @@ -0,0 +1,158 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.8_T5 +description: > + Declaring function constructor within "with" statement, leading to + completion by exception +flags: [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)){ + throw new Test262Error('#0: result === undefined. Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + throw new Test262Error('#4: p4 is not defined'); +} catch(e) { +} + +try { + p5; + throw new Test262Error('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +try{ + value; + throw new Test262Error('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.9_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A1.9_T1.js new file mode 100644 index 0000000000..4b87e1bc71 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.9_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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.9_T1 +description: > + Using "for-in" statement within "with" statement, leading to + normal completion +flags: [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)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + throw new Test262Error('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + throw new Test262Error('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + throw new Test262Error('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + throw new Test262Error('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + throw new Test262Error('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + throw new Test262Error('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + throw new Test262Error('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + throw new Test262Error('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + throw new Test262Error('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.9_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A1.9_T2.js new file mode 100644 index 0000000000..0d3d5d98c5 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.9_T2.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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.9_T2 +description: > + Using "for-in" statement within "with" statement, leading to + completion by break +flags: [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)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + throw new Test262Error('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + throw new Test262Error('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + throw new Test262Error('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + throw new Test262Error('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + throw new Test262Error('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + throw new Test262Error('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + throw new Test262Error('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + throw new Test262Error('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + throw new Test262Error('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.9_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A1.9_T3.js new file mode 100644 index 0000000000..741b16bd4a --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A1.9_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. + +/*--- +info: | + The with statement adds a computed object to the front of the + scope chain of the current execution context +es5id: 12.10_A1.9_T3 +description: > + Using "for-in" statement within "with" statement, leading to + completion by break +flags: [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)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === undefined)){ + throw new Test262Error('#4: p4 === undefined. Actual: p4 ==='+ p4 ); +} + +try { + p5; + throw new Test262Error('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +if(!(value === undefined)){ + throw new Test262Error('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "myObj_value")){ + throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.10_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A3.10_T1.js new file mode 100644 index 0000000000..4520887214 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/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. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.10_T1 +description: > + Using iteration statement within "with" statement, leading to + normal completion +flags: [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){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + throw new Test262Error('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.10_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A3.10_T2.js new file mode 100644 index 0000000000..a5cbbd6dea --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.10_T2.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. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.10_T2 +description: > + Using iteration statement within "with" statement, leading + completion by exception +flags: [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){ + throw new Test262Error('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(p1 !== 1){ + throw new Test262Error('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "x1"){ + throw new Test262Error('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.10_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A3.10_T3.js new file mode 100644 index 0000000000..3c81eb1846 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.10_T3.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. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.10_T3 +description: > + Using iteration statement within "with" statement, leading + completion by exception +flags: [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){ + throw new Test262Error('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(p1 !== 1){ + throw new Test262Error('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "a"){ + throw new Test262Error('#3: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.10_T4.js b/js/src/tests/test262/language/statements/with/S12.10_A3.10_T4.js new file mode 100644 index 0000000000..b75e671465 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.10_T4.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. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.10_T4 +description: > + Using iteration statement within "with" statement, leading + completion be break +flags: [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){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + throw new Test262Error('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.10_T5.js b/js/src/tests/test262/language/statements/with/S12.10_A3.10_T5.js new file mode 100644 index 0000000000..03961d1c80 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.10_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. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.10_T5 +description: > + Using iteration statement within "with" statement, leading + completion be break +flags: [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){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "a"){ + throw new Test262Error('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.11_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A3.11_T1.js new file mode 100644 index 0000000000..3cde073da5 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.11_T1.js @@ -0,0 +1,38 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.11_T1 +description: > + Calling a function within "with" statement declared without the + statement, leading to normal completion +flags: [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")){ + throw new Test262Error('#1: p1 === "x1". Actual: p1 ==='+ p1 ); +} + +if(!(myObj.p1 === "a")){ + throw new Test262Error('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.11_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A3.11_T2.js new file mode 100644 index 0000000000..2a8f92ef6f --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.11_T2.js @@ -0,0 +1,44 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.11_T2 +description: > + Calling a function within "with" statement declared without the + statement, leading to normal completion by "return" +flags: [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")){ + throw new Test262Error('#1: p1 === "x1". Actual: p1 ==='+ p1 ); +} + +if(!(myObj.p1 === "a")){ + throw new Test262Error('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(result === "value")){ + throw new Test262Error('#3: result === "value". Actual: result ==='+ result ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.11_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A3.11_T3.js new file mode 100644 index 0000000000..b6be9fec2f --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.11_T3.js @@ -0,0 +1,44 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.11_T3 +description: > + Calling a function within "with" statement declared without the + statement, leading to normal completion by "return" +flags: [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)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(myObj.p1 === "a")){ + throw new Test262Error('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(result === "value")){ + throw new Test262Error('#3: result === "value". Actual: result ==='+ result ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.11_T4.js b/js/src/tests/test262/language/statements/with/S12.10_A3.11_T4.js new file mode 100644 index 0000000000..f15d886ad0 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.11_T4.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. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.11_T4 +description: > + Calling a function within "with" statement declared without the + statement, leading to completion by exception +flags: [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")){ + throw new Test262Error('#1: p1 === "x1". Actual: p1 ==='+ p1 ); +} + +if(!(myObj.p1 === "a")){ + throw new Test262Error('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(result === "value")){ + throw new Test262Error('#3: result === "value". Actual: result ==='+ result ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.11_T5.js b/js/src/tests/test262/language/statements/with/S12.10_A3.11_T5.js new file mode 100644 index 0000000000..c8c3f9a0e5 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.11_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. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.11_T5 +description: > + Calling a function within "with" statement declared without the + statement, leading to completion by exception +flags: [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)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(myObj.p1 === "a")){ + throw new Test262Error('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(result === "value")){ + throw new Test262Error('#3: result === "value". Actual: result ==='+ result ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.12_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A3.12_T1.js new file mode 100644 index 0000000000..cc854e0845 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.12_T1.js @@ -0,0 +1,38 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.12_T1 +description: > + Calling a function without "with" statement declared within the + statement, leading to normal completion +flags: [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)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(myObj.p1 === "x1")){ + throw new Test262Error('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.12_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A3.12_T2.js new file mode 100644 index 0000000000..da6cdbcf74 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.12_T2.js @@ -0,0 +1,44 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.12_T2 +description: > + Calling a function without "with" statement declared within the + statement, leading to normal completion by "return" +flags: [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)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(myObj.p1 === "x1")){ + throw new Test262Error('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(result === "myObj_value")){ + throw new Test262Error('#3: result === "myObj_value". Actual: result ==='+ result ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.12_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A3.12_T3.js new file mode 100644 index 0000000000..555e4b7c29 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.12_T3.js @@ -0,0 +1,43 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.12_T3 +description: > + Calling a function without "with" statement declared within the + statement, leading to normal completion by "return" +flags: [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)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(myObj.p1 === "a")){ + throw new Test262Error('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(result === "myObj_value")){ + throw new Test262Error('#3: result === "myObj_value". Actual: result ==='+ result ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.12_T4.js b/js/src/tests/test262/language/statements/with/S12.10_A3.12_T4.js new file mode 100644 index 0000000000..4f85b51f7a --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.12_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. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.12_T4 +description: > + Calling a function without "with" statement declared within the + statement, leading to completion by exception +flags: [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)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(myObj.p1 === "x1")){ + throw new Test262Error('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(result === "myObj_value")){ + throw new Test262Error('#3: result === "myObj_value". Actual: result ==='+ result ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.12_T5.js b/js/src/tests/test262/language/statements/with/S12.10_A3.12_T5.js new file mode 100644 index 0000000000..1783877ae3 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.12_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. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.12_T5 +description: > + Calling a function without "with" statement declared within the + statement, leading to completion by exception +flags: [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)){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(myObj.p1 === "a")){ + throw new Test262Error('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(result === "myObj_value")){ + throw new Test262Error('#3: result === "myObj_value". Actual: result ==='+ result ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.1_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A3.1_T1.js new file mode 100644 index 0000000000..d21fbfa222 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.1_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. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.1_T1 +description: Using "with" statement within global context - normal completion +flags: [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){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + throw new Test262Error('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.1_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A3.1_T2.js new file mode 100644 index 0000000000..7b9dfce0d9 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.1_T2.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.1_T2 +description: > + Using "with" statement within global context, leading to + completion by exception +flags: [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){ + throw new Test262Error('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(p1 !== 1){ + throw new Test262Error('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (myObj.p1 !== "x1") { + throw new Test262Error('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.1_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A3.1_T3.js new file mode 100644 index 0000000000..270dc995a3 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.1_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. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.1_T3 +description: > + Using "with" statement within global context, leading to + completion by exception +flags: [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)){ + throw new Test262Error('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(!(p1 === 1)){ + throw new Test262Error('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(!(myObj.p1 === "a")){ + throw new Test262Error('#3: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.2_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A3.2_T1.js new file mode 100644 index 0000000000..439f581876 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.2_T1.js @@ -0,0 +1,49 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.2_T1 +description: > + Declaring "with" statement within a function body, leading to + normal completion +flags: [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){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + throw new Test262Error('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.2_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A3.2_T2.js new file mode 100644 index 0000000000..63dd3686a0 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.2_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. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.2_T2 +description: > + Declaring "with" statement within a function body, leading to + normal completion by "return" +flags: [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){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(myObj.p1 !== "x1"){ + throw new Test262Error('#1: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.2_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A3.2_T3.js new file mode 100644 index 0000000000..aa72121a9d --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.2_T3.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. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.2_T3 +description: > + Declaring "with" statement within a function body, leading to + normal completion by "return" +flags: [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){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "a"){ + throw new Test262Error('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.2_T4.js b/js/src/tests/test262/language/statements/with/S12.10_A3.2_T4.js new file mode 100644 index 0000000000..fc84f24371 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.2_T4.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. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.2_T4 +description: > + Declaring "with" statement within a function body, leading to + completion by exception +flags: [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){ + throw new Test262Error('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(p1 !== 1){ + throw new Test262Error('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "x1"){ + throw new Test262Error('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.2_T5.js b/js/src/tests/test262/language/statements/with/S12.10_A3.2_T5.js new file mode 100644 index 0000000000..429f985657 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.2_T5.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.2_T5 +description: > + Declaring "with" statement within a function body, leading to + completion by exception +flags: [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){ + throw new Test262Error('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(p1 !== 1){ + throw new Test262Error('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "a"){ + throw new Test262Error('#3: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.3_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A3.3_T1.js new file mode 100644 index 0000000000..a7506c4195 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.3_T1.js @@ -0,0 +1,49 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.3_T1 +description: > + Declaring "with" statement within a function constructor, leading + to normal completion +flags: [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){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + throw new Test262Error('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.3_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A3.3_T2.js new file mode 100644 index 0000000000..6abefff4bd --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.3_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. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.3_T2 +description: > + Declaring "with" statement within a function constructor, leading + to normal completion by "return" +flags: [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){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + throw new Test262Error('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.3_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A3.3_T3.js new file mode 100644 index 0000000000..77e5b9027a --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.3_T3.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. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.3_T3 +description: > + Declaring "with" statement within a function constructor, leading + to normal completion by "return" +flags: [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){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "a"){ + throw new Test262Error('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.3_T4.js b/js/src/tests/test262/language/statements/with/S12.10_A3.3_T4.js new file mode 100644 index 0000000000..b3f03221b3 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.3_T4.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', the scope chain is + always restored to its former state +es5id: 12.10_A3.3_T4 +description: > + Declaring "with" statement within a function constructor, leading + to completion by exception +flags: [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) { + throw new Test262Error('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (p1 !== 1) { + throw new Test262Error('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (myObj.p1 !== "x1") { + throw new Test262Error('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.4_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A3.4_T1.js new file mode 100644 index 0000000000..e4cd8edcd1 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.4_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. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.4_T1 +description: > + Using "with" statement within iteration statement, leading to + normal completion +flags: [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){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + throw new Test262Error('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.4_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A3.4_T2.js new file mode 100644 index 0000000000..242d1e5e0e --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.4_T2.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. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.4_T2 +description: > + Using "with" statement within iteration statement, leading to + completion by exception +flags: [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){ + throw new Test262Error('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(p1 !== 1){ + throw new Test262Error('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "x1"){ + throw new Test262Error('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.4_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A3.4_T3.js new file mode 100644 index 0000000000..83a3c3c153 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.4_T3.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. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.4_T3 +description: > + Using "with" statement within iteration statement, leading to + completion by exception +flags: [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){ + throw new Test262Error('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(p1 !== 1){ + throw new Test262Error('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "a"){ + throw new Test262Error('#3: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.4_T4.js b/js/src/tests/test262/language/statements/with/S12.10_A3.4_T4.js new file mode 100644 index 0000000000..a0bf5cb675 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.4_T4.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. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.4_T4 +description: > + Using "with" statement within iteration statement, leading to + completion by break +flags: [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){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + throw new Test262Error('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.4_T5.js b/js/src/tests/test262/language/statements/with/S12.10_A3.4_T5.js new file mode 100644 index 0000000000..e4b1f0e74e --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.4_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. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.4_T5 +description: > + Using "with" statement within iteration statement, leading to + completion by break +flags: [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){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "a"){ + throw new Test262Error('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.5_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A3.5_T1.js new file mode 100644 index 0000000000..8f4cdb0b8a --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.5_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. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.5_T1 +description: > + Using "with" statement within "for-in" statement, leading to + normal completion +flags: [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){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + throw new Test262Error('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.5_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A3.5_T2.js new file mode 100644 index 0000000000..f3ef18ca9f --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.5_T2.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. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.5_T2 +description: > + Using "with" statement within "for-in" statement, leading to + completion by exception +flags: [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){ + throw new Test262Error('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(p1 !== 1){ + throw new Test262Error('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "x1"){ + throw new Test262Error('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.5_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A3.5_T3.js new file mode 100644 index 0000000000..8f9487d867 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.5_T3.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. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.5_T3 +description: > + Using "with" statement within "for-in" statement, leading to + completion by exception +flags: [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){ + throw new Test262Error('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(p1 !== 1){ + throw new Test262Error('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "a"){ + throw new Test262Error('#3: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.5_T4.js b/js/src/tests/test262/language/statements/with/S12.10_A3.5_T4.js new file mode 100644 index 0000000000..eb450e0044 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.5_T4.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. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.5_T4 +description: > + Using "with" statement within "for-in" statement, leading to + completion by break +flags: [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){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + throw new Test262Error('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.5_T5.js b/js/src/tests/test262/language/statements/with/S12.10_A3.5_T5.js new file mode 100644 index 0000000000..8bcde0f3b3 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/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. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.5_T5 +description: > + Using "with" statement within "for-in" statement, leading to + completion by break +flags: [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){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(myObj.p1 !== "a"){ + throw new Test262Error('#1: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.6_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A3.6_T1.js new file mode 100644 index 0000000000..b1d8c0516f --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.6_T1.js @@ -0,0 +1,61 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.6_T1 +description: > + Using "with" statement within another "with" statement, leading to + normal completion +flags: [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){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "a"){ + throw new Test262Error('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(theirObj.p1 !== "x1"){ + throw new Test262Error('#3: theirObj.p1 === "x1". Actual: theirObj.p1 ==='+ theirObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.6_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A3.6_T2.js new file mode 100644 index 0000000000..556b5c5bc6 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.6_T2.js @@ -0,0 +1,67 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.6_T2 +description: > + Using "with" statement within another "with" statement, leading to + completion by exception +flags: [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){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "a"){ + throw new Test262Error('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(theirObj.p1 !== "x1"){ + throw new Test262Error('#3: theirObj.p1 === "x1". Actual: theirObj.p1 ==='+ theirObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.6_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A3.6_T3.js new file mode 100644 index 0000000000..22c1e16087 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.6_T3.js @@ -0,0 +1,68 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.6_T3 +description: > + Using "with" statement within another "with" statement, leading to + completion by exception +flags: [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){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "a"){ + throw new Test262Error('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(theirObj.p1 !== true){ + throw new Test262Error('#3: theirObj.p1 === true. Actual: theirObj.p1 ==='+ theirObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.7_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A3.7_T1.js new file mode 100644 index 0000000000..20590f314e --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.7_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. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.7_T1 +description: > + Declaring and calling a function within "with" statement, leading + to normal completion +flags: [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){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + throw new Test262Error('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.7_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A3.7_T2.js new file mode 100644 index 0000000000..568959440c --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.7_T2.js @@ -0,0 +1,56 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.7_T2 +description: > + Declaring and calling a function within "with" statement, leading + to normal completion by "return" +flags: [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){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(result !== "myObj_value"){ + throw new Test262Error('#2: result === "myObj_value". Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "x1"){ + throw new Test262Error('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.7_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A3.7_T3.js new file mode 100644 index 0000000000..cb1c49ce61 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.7_T3.js @@ -0,0 +1,56 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.7_T3 +description: > + Declaring and calling a function within "with" statement, leading + to normal completion by "return" +flags: [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){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(result !== 'myObj_value'){ + throw new Test262Error('#2: result === \'myObj_value\'. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "a"){ + throw new Test262Error('#3: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.7_T4.js b/js/src/tests/test262/language/statements/with/S12.10_A3.7_T4.js new file mode 100644 index 0000000000..72669eb862 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.7_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. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.7_T4 +description: > + Declaring and calling a function within "with" statement, leading + to completion by exception +flags: [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){ + throw new Test262Error('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(p1 !== 1){ + throw new Test262Error('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "x1"){ + throw new Test262Error('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.7_T5.js b/js/src/tests/test262/language/statements/with/S12.10_A3.7_T5.js new file mode 100644 index 0000000000..3eca9b370b --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.7_T5.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. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.7_T5 +description: > + Declaring and calling a function within "with" statement, leading + to completion by exception +flags: [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){ + throw new Test262Error('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(p1 !== 1){ + throw new Test262Error('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "a"){ + throw new Test262Error('#3: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.8_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A3.8_T1.js new file mode 100644 index 0000000000..f41869553a --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.8_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. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.8_T1 +description: > + Declaring function constructor within "with" statement, leading to + normal completion +flags: [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){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + throw new Test262Error('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.8_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A3.8_T2.js new file mode 100644 index 0000000000..2a3b93f451 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.8_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. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.8_T2 +description: > + Declaring function constructor within "with" statement, leading to + normal completion by "return" +flags: [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){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + throw new Test262Error('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.8_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A3.8_T3.js new file mode 100644 index 0000000000..98d03278aa --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.8_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. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.8_T3 +description: > + Declaring function constructor within "with" statement, leading to + normal completion by "return" +flags: [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){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "a"){ + throw new Test262Error('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.8_T4.js b/js/src/tests/test262/language/statements/with/S12.10_A3.8_T4.js new file mode 100644 index 0000000000..0ecae4bbbe --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.8_T4.js @@ -0,0 +1,61 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.8_T4 +description: > + Declaring function constructor within "with" statement, leading to + completion by exception +flags: [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){ + throw new Test262Error('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(p1 !== 1){ + throw new Test262Error('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "x1"){ + throw new Test262Error('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.8_T5.js b/js/src/tests/test262/language/statements/with/S12.10_A3.8_T5.js new file mode 100644 index 0000000000..3d100ca54a --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.8_T5.js @@ -0,0 +1,61 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.8_T5 +description: > + Declaring function constructor within "with" statement, leading to + completion by exception +flags: [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){ + throw new Test262Error('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(p1 !== 1){ + throw new Test262Error('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "a"){ + throw new Test262Error('#3: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.9_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A3.9_T1.js new file mode 100644 index 0000000000..d37f5f6c70 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.9_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. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.9_T1 +description: > + Using "for-in" statement within "with" statement, leading to + normal completion +flags: [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){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + throw new Test262Error('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.9_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A3.9_T2.js new file mode 100644 index 0000000000..c8e60954e4 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.9_T2.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. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.9_T2 +description: > + Using "for-in" statement within "with" statement, leading to + completion by break +flags: [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){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + throw new Test262Error('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.9_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A3.9_T3.js new file mode 100644 index 0000000000..e29b70053a --- /dev/null +++ b/js/src/tests/test262/language/statements/with/S12.10_A3.9_T3.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. + +/*--- +info: | + No matter how control leaves the embedded 'Statement', + the scope chain is always restored to its former state +es5id: 12.10_A3.9_T3 +description: > + Using "for-in" statement within "with" statement, leading to + completion by break +flags: [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){ + throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "a"){ + throw new Test262Error('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A4_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A4_T1.js new file mode 100644 index 0000000000..883e51b89e --- /dev/null +++ b/js/src/tests/test262/language/statements/with/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. + +/*--- +info: Changing property using "eval" statement containing "with" statement +es5id: 12.10_A4_T1 +description: Changing string property +flags: [noStrict] +---*/ + +this.p1 = 1; +var myObj = { + p1: 'a', +} +eval("with(myObj){p1='b'}"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(myObj.p1 !== 'b'){ + throw new Test262Error('#1: myObj.p1 === "b". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 === 1){ + throw new Test262Error('#2: myObj.p1 !== 1'); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A4_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A4_T2.js new file mode 100644 index 0000000000..42947c36b5 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/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. + +/*--- +info: Changing property using "eval" statement containing "with" statement +es5id: 12.10_A4_T2 +description: Changing number property +flags: [noStrict] +---*/ + +this.p1 = 'a'; +var myObj = { + p1: 1, +} +eval("with(myObj){p1=2}"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(myObj.p1 !== 2){ + throw new Test262Error('#1: myObj.p1 === 2. Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 === 'a'){ + throw new Test262Error('#2: myObj.p1 !== \'a\''); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A4_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A4_T3.js new file mode 100644 index 0000000000..5daa1446b7 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/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. + +/*--- +info: Changing property using "eval" statement containing "with" statement +es5id: 12.10_A4_T3 +description: Changing boolean property +flags: [noStrict] +---*/ + +this.p1 = 'a'; +var myObj = { + p1: true, +} +eval("with(myObj){p1=false}"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(myObj.p1 !== false){ + throw new Test262Error('#1: myObj.p1 === false. Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 === 'a'){ + throw new Test262Error('#2: myObj.p1 !== \'a\''); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A4_T4.js b/js/src/tests/test262/language/statements/with/S12.10_A4_T4.js new file mode 100644 index 0000000000..64fc1b8284 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/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. + +/*--- +info: Changing property using "eval" statement containing "with" statement +es5id: 12.10_A4_T4 +description: Changing object property +flags: [noStrict] +---*/ + +this.p1 = 'a'; +var myObj = { + p1: {a:"hello"}, +} +eval("with(myObj){p1={b:'hi'}}"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(myObj.p1.a === "hello"){ + throw new Test262Error('#1: myObj.p1.a !== "hello"'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1.b !== "hi"){ + throw new Test262Error('#2: myObj.p1.b === "hi". Actual: myObj.p1.b ==='+ myObj.p1.b ); +} +// +////////////////////////////////////////////////////////////////////////////// + + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 === 'a'){ + throw new Test262Error('#3: myObj.p1 !== \'a\''); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A4_T5.js b/js/src/tests/test262/language/statements/with/S12.10_A4_T5.js new file mode 100644 index 0000000000..8d845ab3d2 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/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. + +/*--- +info: Changing property using "eval" statement containing "with" statement +es5id: 12.10_A4_T5 +description: Changing array property +flags: [noStrict] +---*/ + +this.p1 = 'a'; +var myObj = { + p1: [1,2,3], +} +eval("with(myObj){p1=[3,2,1]}"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(myObj.p1[2] !== 1){ + throw new Test262Error('#1: myObj.p1[2] === 1. Actual: myObj.p1[2] ==='+ myObj.p1[2] ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 === 'a'){ + throw new Test262Error('#2: myObj.p1 !== \'a\''); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A4_T6.js b/js/src/tests/test262/language/statements/with/S12.10_A4_T6.js new file mode 100644 index 0000000000..bf3480e112 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/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. + +/*--- +info: Changing property using "eval" statement containing "with" statement +es5id: 12.10_A4_T6 +description: Changing function property +flags: [noStrict] +---*/ + +this.p1 = 'a'; +var myObj = { + p1: function(){return 0;}, +} +eval("with(myObj){p1=function(){return 1;}}"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(myObj.p1() !== 1){ + throw new Test262Error('#1: myObj.p1 === 1. Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 === 'a'){ + throw new Test262Error('#2: myObj.p1 !== \'a\''); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A5_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A5_T1.js new file mode 100644 index 0000000000..c1dff2df68 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/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. + +/*--- +info: Deleting property using "eval" statement containing "with" statement +es5id: 12.10_A5_T1 +description: Deleting string property +flags: [noStrict] +---*/ + +this.p1 = 1; +var myObj = { + p1: 'a', + del:false +} +eval("with(myObj){del = delete p1}"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(myObj.p1 === 'a'){ + throw new Test262Error('#1: myObj.p1 !== "a"'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== undefined){ + throw new Test262Error('#2: myObj.p1 === undefined. Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.del !== true){ + throw new Test262Error('#3: myObj.del === true. Actual: myObj.del ==='+ myObj.del ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if(myObj.p1 === 1){ + throw new Test262Error('#4: myObj.p1 !== 1'); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A5_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A5_T2.js new file mode 100644 index 0000000000..e724989231 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/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. + +/*--- +info: Deleting property using "eval" statement containing "with" statement +es5id: 12.10_A5_T2 +description: Deleting number property +flags: [noStrict] +---*/ + +this.p1 = 'a'; +var myObj = { + p1: 1, + del:false +} +eval("with(myObj){del = delete p1}"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(myObj.p1 === 1){ + throw new Test262Error('#1: myObj.p1 !== 1'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== undefined){ + throw new Test262Error('#2: myObj.p1 === undefined . Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.del !== true){ + throw new Test262Error('#3: myObj.del === true. Actual: myObj.del ===. Actual: myObj.del ==='+ myObj.del +myObj.del); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if(myObj.p1 === 'a'){ + throw new Test262Error('#4: myObj.p1 !== \'a\''); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A5_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A5_T3.js new file mode 100644 index 0000000000..6c5e76a1db --- /dev/null +++ b/js/src/tests/test262/language/statements/with/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. + +/*--- +info: Deleting property using "eval" statement containing "with" statement +es5id: 12.10_A5_T3 +description: Deleting boolean property +flags: [noStrict] +---*/ + +this.p1 = 'a'; +var myObj = { + p1: true, + del:false +} + +eval("with(myObj){del = delete p1}"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(myObj.p1 === true){ + throw new Test262Error('#1: myObj.p1 !== true '); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== undefined){ + throw new Test262Error('#2: myObj.p1 === undefined . Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.del !== true){ + throw new Test262Error('#3: myObj.del === true . Actual: myObj.del ==='+ myObj.del ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if(myObj.p1 === 'a'){ + throw new Test262Error('#4: myObj.p1 !== \'a\''); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A5_T4.js b/js/src/tests/test262/language/statements/with/S12.10_A5_T4.js new file mode 100644 index 0000000000..24087deea5 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/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. + +/*--- +info: Deleting property using "eval" statement containing "with" statement +es5id: 12.10_A5_T4 +description: Deleting object property +flags: [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"){ + throw new Test262Error('#1: myObj.p1.a !== "hello" '); +} +}catch(e){var x=1}; +if(x !== 1){ + throw new Test262Error('#1: x === 1. Actual: x ==='+ x ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== undefined){ + throw new Test262Error('#2: myObj.p1 === undefined . Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.del !== true){ + throw new Test262Error('#3: myObj.del === true . Actual: myObj.del ==='+ myObj.del ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if(myObj.p1 === 'a'){ + throw new Test262Error('#4: myObj.p1 !== \'a\''); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A5_T5.js b/js/src/tests/test262/language/statements/with/S12.10_A5_T5.js new file mode 100644 index 0000000000..e15e97febe --- /dev/null +++ b/js/src/tests/test262/language/statements/with/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. + +/*--- +info: Deleting property using "eval" statement containing "with" statement +es5id: 12.10_A5_T5 +description: Deleting array property +flags: [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){ + throw new Test262Error('#1: myObj.p1[2] !== 3 '); +} +}catch(e){var x=1}; +if(x !== 1){ + throw new Test262Error('#1: x === 1. Actual: x ==='+ x ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== undefined){ + throw new Test262Error('#2: myObj.p1 === undefined . Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.del !== true){ + throw new Test262Error('#3: myObj.del === true . Actual: myObj.del ==='+ myObj.del ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if(myObj.p1 === 'a'){ + throw new Test262Error('#4: myObj.p1 !== \'a\''); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/S12.10_A5_T6.js b/js/src/tests/test262/language/statements/with/S12.10_A5_T6.js new file mode 100644 index 0000000000..eed35e5fb8 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/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. + +/*--- +info: Deleting property using "eval" statement containing "with" statement +es5id: 12.10_A5_T6 +description: Deleting function property +flags: [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){ + throw new Test262Error('#1: myObj.p1() !== 0 '); +} +}catch(e){var x=1}; +if(x !== 1){ + throw new Test262Error('#1: x === 1. Actual: x ==='+ x ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== undefined){ + throw new Test262Error('#2: myObj.p1 === undefined . Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.del !== true){ + throw new Test262Error('#3: myObj.del === true . Actual: myObj.del ==='+ myObj.del ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if(myObj.p1 === 'a'){ + throw new Test262Error('#4: myObj.p1 !== \'a\''); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/binding-blocked-by-unscopables.js b/js/src/tests/test262/language/statements/with/binding-blocked-by-unscopables.js new file mode 100644 index 0000000000..977a98912d --- /dev/null +++ b/js/src/tests/test262/language/statements/with/binding-blocked-by-unscopables.js @@ -0,0 +1,54 @@ +// Copyright 2015 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 8.1.1.2.1 +description: > + True-coercing `Symbol.unscopables` properties block access to object environment record +info: | + [...] + 6. If the withEnvironment flag of envRec is false, return true. + 7. Let unscopables be Get(bindings, @@unscopables). + 8. ReturnIfAbrupt(unscopables). + 9. If Type(unscopables) is Object, then + a. Let blocked be ToBoolean(Get(unscopables, N)). + b. ReturnIfAbrupt(blocked). + c. If blocked is true, return false. + + ES6: 13.11.7 (The `with` Statement) Runtime Semantics: Evaluation + [...] + 6. Set the withEnvironment flag of newEnv’s EnvironmentRecord to true. + [...] +flags: [noStrict] +features: [Symbol.unscopables] +---*/ + +var x = 0; +var env = { x: 1 }; +env[Symbol.unscopables] = { x: true }; + +with (env) { + assert.sameValue(x, 0, 'literal `true` value'); +} + +env[Symbol.unscopables].x = 'string'; +with (env) { + assert.sameValue(x, 0, 'non-empty string values'); +} + +env[Symbol.unscopables].x = 86; +with (env) { + assert.sameValue(x, 0, 'non-zero number values'); +} + +env[Symbol.unscopables].x = {}; +with (env) { + assert.sameValue(x, 0, 'object values'); +} + +env[Symbol.unscopables].x = Symbol.unscopables; +with (env) { + assert.sameValue(x, 0, 'Symbol values'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/binding-not-blocked-by-unscopables-falsey-prop.js b/js/src/tests/test262/language/statements/with/binding-not-blocked-by-unscopables-falsey-prop.js new file mode 100644 index 0000000000..b50112e5e6 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/binding-not-blocked-by-unscopables-falsey-prop.js @@ -0,0 +1,60 @@ +// Copyright 2015 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 8.1.1.2.1 +description: > + False-coercing `Symbol.unscopables` properties do not block access to object environment record +info: | + [...] + 6. If the withEnvironment flag of envRec is false, return true. + 7. Let unscopables be Get(bindings, @@unscopables). + 8. ReturnIfAbrupt(unscopables). + 9. If Type(unscopables) is Object, then + a. Let blocked be ToBoolean(Get(unscopables, N)). + b. ReturnIfAbrupt(blocked). + c. If blocked is true, return false. + 10. Return true. + + ES6: 13.11.7 (The `with` Statement) Runtime Semantics: Evaluation + [...] + 6. Set the withEnvironment flag of newEnv’s EnvironmentRecord to true. + [...] +flags: [noStrict] +features: [Symbol.unscopables] +---*/ + +var x = 0; +var env = { x: 1 }; +env[Symbol.unscopables] = {}; + +with (env) { + assert.sameValue(x, 1, 'undefined (no property defined)'); +} + +env[Symbol.unscopables].x = false; +with (env) { + assert.sameValue(x, 1, 'literal `false` value'); +} + +env[Symbol.unscopables].x = undefined; +with (env) { + assert.sameValue(x, 1, 'literal `undefined` value'); +} + +env[Symbol.unscopables].x = null; +with (env) { + assert.sameValue(x, 1, 'null value'); +} + +env[Symbol.unscopables].x = 0; +with (env) { + assert.sameValue(x, 1, 'literal `0` number value'); +} + +env[Symbol.unscopables].x = ''; +with (env) { + assert.sameValue(x, 1, 'empty string value'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/binding-not-blocked-by-unscopables-non-obj.js b/js/src/tests/test262/language/statements/with/binding-not-blocked-by-unscopables-non-obj.js new file mode 100644 index 0000000000..28082178cc --- /dev/null +++ b/js/src/tests/test262/language/statements/with/binding-not-blocked-by-unscopables-non-obj.js @@ -0,0 +1,34 @@ +// Copyright 2015 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 8.1.1.2.1 +description: Non-object values of `Symbol.unscopables` property are ignored +info: | + [...] + 6. If the withEnvironment flag of envRec is false, return true. + 7. Let unscopables be Get(bindings, @@unscopables). + 8. ReturnIfAbrupt(unscopables). + 9. If Type(unscopables) is Object, then + a. Let blocked be ToBoolean(Get(unscopables, N)). + b. ReturnIfAbrupt(blocked). + c. If blocked is true, return false. + 10. Return true. + + ES6: 13.11.7 (The `with` Statement) Runtime Semantics: Evaluation + [...] + 6. Set the withEnvironment flag of newEnv’s EnvironmentRecord to true. + [...] +flags: [noStrict] +features: [Symbol.unscopables] +---*/ + +var test262ToString = {}; +var env = { toString: test262ToString }; +env[Symbol.unscopables] = ''; + +with (env) { + assert.sameValue(toString, test262ToString); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/browser.js b/js/src/tests/test262/language/statements/with/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/browser.js diff --git a/js/src/tests/test262/language/statements/with/cptn-abrupt-empty.js b/js/src/tests/test262/language/statements/with/cptn-abrupt-empty.js new file mode 100644 index 0000000000..c57e3dfbdb --- /dev/null +++ b/js/src/tests/test262/language/statements/with/cptn-abrupt-empty.js @@ -0,0 +1,31 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-with-statement-runtime-semantics-evaluation +description: > + Statement completion value when body returns an empty abrupt completion +info: | + WithStatement : with ( Expression ) Statement + + [...] + 7. Let C be the result of evaluating Statement. + 8. Set the running execution context's LexicalEnvironment to oldEnv. + 9. Return Completion(UpdateEmpty(C, undefined)). +flags: [noStrict] +---*/ + +assert.sameValue( + eval('1; do { 2; with({}) { 3; break; } 4; } while (false);'), 3 +); +assert.sameValue( + eval('5; do { 6; with({}) { break; } 7; } while (false);'), undefined +); + +assert.sameValue( + eval('8; do { 9; with({}) { 10; continue; } 11; } while (false)'), 10 +); +assert.sameValue( + eval('12; do { 13; with({}) { continue; } 14; } while (false)'), undefined +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/cptn-nrml.js b/js/src/tests/test262/language/statements/with/cptn-nrml.js new file mode 100644 index 0000000000..f75d9beb34 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/cptn-nrml.js @@ -0,0 +1,21 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.11.7 +description: Statement completion value when body returns a normal completion +info: | + WithStatement : with ( Expression ) Statement + + [...] + 8. Let C be the result of evaluating Statement. + 9. Set the running execution context’s Lexical Environment to oldEnv. + 10. If C.[[type]] is normal and C.[[value]] is empty, return + NormalCompletion(undefined). + 11. Return Completion(C). +flags: [noStrict] +---*/ + +assert.sameValue(eval('1; with({}) { }'), undefined); +assert.sameValue(eval('2; with({}) { 3; }'), 3); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/decl-async-fun.js b/js/src/tests/test262/language/statements/with/decl-async-fun.js new file mode 100644 index 0000000000..94a7d6571b --- /dev/null +++ b/js/src/tests/test262/language/statements/with/decl-async-fun.js @@ -0,0 +1,22 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-with-statement +description: > + AsyncFunctionDeclaration is not allowed in statement position +info: | + ExpressionStatement[Yield, Await] : + [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }] + Expression[+In, ?Yield, ?Await] ; +negative: + phase: parse + type: SyntaxError +features: [async-functions] +flags: [noStrict] +---*/ + +$DONOTEVALUATE(); + +with ({}) async function f() {} diff --git a/js/src/tests/test262/language/statements/with/decl-async-gen.js b/js/src/tests/test262/language/statements/with/decl-async-gen.js new file mode 100644 index 0000000000..f9aa632bc7 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/decl-async-gen.js @@ -0,0 +1,22 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-with-statement +description: > + AsyncGeneratorDeclaration is not allowed in statement position +info: | + ExpressionStatement[Yield, Await] : + [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }] + Expression[+In, ?Yield, ?Await] ; +negative: + phase: parse + type: SyntaxError +features: [async-iteration] +flags: [noStrict] +---*/ + +$DONOTEVALUATE(); + +with ({}) async function* g() {} diff --git a/js/src/tests/test262/language/statements/with/decl-cls.js b/js/src/tests/test262/language/statements/with/decl-cls.js new file mode 100644 index 0000000000..2d6c8ced91 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/decl-cls.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Class declaration not allowed in statement position +esid: sec-with-statement +es6id: 13.11 +flags: [noStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +with ({}) class C {} diff --git a/js/src/tests/test262/language/statements/with/decl-const.js b/js/src/tests/test262/language/statements/with/decl-const.js new file mode 100644 index 0000000000..4e6c99a8b7 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/decl-const.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Lexical declaration (const) not allowed in statement position +esid: sec-with-statement +es6id: 13.11 +flags: [noStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +with ({}) const x = null; diff --git a/js/src/tests/test262/language/statements/with/decl-fun.js b/js/src/tests/test262/language/statements/with/decl-fun.js new file mode 100644 index 0000000000..e6b8ec9c8b --- /dev/null +++ b/js/src/tests/test262/language/statements/with/decl-fun.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Function declaration not allowed in statement position +esid: sec-with-statement +es6id: 13.11 +flags: [noStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +with ({}) function f() {} diff --git a/js/src/tests/test262/language/statements/with/decl-gen.js b/js/src/tests/test262/language/statements/with/decl-gen.js new file mode 100644 index 0000000000..b5c51aaf67 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/decl-gen.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Generator declaration not allowed in statement position +esid: sec-with-statement +es6id: 13.11 +flags: [noStrict] +negative: + phase: parse + type: SyntaxError +features: [generators] +---*/ + +$DONOTEVALUATE(); + +with ({}) function* g() {} diff --git a/js/src/tests/test262/language/statements/with/decl-let.js b/js/src/tests/test262/language/statements/with/decl-let.js new file mode 100644 index 0000000000..6e22af9ed7 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/decl-let.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Lexical declaration (let) not allowed in statement position +esid: sec-with-statement +es6id: 13.11 +flags: [noStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +with ({}) let x; diff --git a/js/src/tests/test262/language/statements/with/has-property-err.js b/js/src/tests/test262/language/statements/with/has-property-err.js new file mode 100644 index 0000000000..330ebee1a8 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/has-property-err.js @@ -0,0 +1,38 @@ +// Copyright (c) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-getidentifierreference +es6id: 8.1.2.1 +description: > + Behavior when binding query produces an abrupt completion +info: | + [...] + 2. Let envRec be lex's EnvironmentRecord. + 3. Let exists be ? envRec.HasBinding(name). + + 8.1.1.2.1 HasBinding + + 1. Let envRec be the object Environment Record for which the method was + invoked. + 2. Let bindings be the binding object for envRec. + 3. Let foundBinding be ? HasProperty(bindings, N). +flags: [noStrict] +features: [Proxy] +---*/ + +var thrower = new Proxy({}, { + has: function(_, name) { + if (name === 'test262') { + throw new Test262Error(); + } + } +}); + +with (thrower) { + assert.throws(Test262Error, function() { + test262; + }); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/labelled-fn-stmt.js b/js/src/tests/test262/language/statements/with/labelled-fn-stmt.js new file mode 100644 index 0000000000..254f44b94f --- /dev/null +++ b/js/src/tests/test262/language/statements/with/labelled-fn-stmt.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-with-statement-static-semantics-early-errors +es6id: 13.11.1 +description: > + A labelled function declaration is never permitted in the Statement position +info: | + WithStatementa: with ( Expression ) Statement + + [...] + - It is a Syntax Error if IsLabelledFunction(Statement) is true. + + NOTE It is only necessary to apply the second rule if the extension specified + in B.3.2 is implemented. + + In the absence of Annex B.3.2, a SyntaxError should be produced due to the + labelled function declaration itself. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +with ({}) label1: label2: function test262() {} diff --git a/js/src/tests/test262/language/statements/with/let-array-with-newline.js b/js/src/tests/test262/language/statements/with/let-array-with-newline.js new file mode 100644 index 0000000000..4711b0d0a7 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/let-array-with-newline.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-with-statement +description: > + ExpressionStatement has a lookahead restriction for `let [`. +info: | + ExpressionStatement[Yield, Await] : + [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }] + Expression[+In, ?Yield, ?Await] ; +negative: + phase: parse + type: SyntaxError +flags: [noStrict] +---*/ + +$DONOTEVALUATE(); + +// Wrapped in an if-statement to avoid reference errors at runtime. +if (false) { + with ({}) let + [a] = 0; +} diff --git a/js/src/tests/test262/language/statements/with/let-block-with-newline.js b/js/src/tests/test262/language/statements/with/let-block-with-newline.js new file mode 100644 index 0000000000..2a7f5a0693 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/let-block-with-newline.js @@ -0,0 +1,21 @@ +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-with-statement +description: > + ExpressionStatement doesn't have a lookahead restriction for `let {`. +info: | + ExpressionStatement[Yield, Await] : + [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }] + Expression[+In, ?Yield, ?Await] ; +flags: [noStrict] +---*/ + +// Wrapped in an if-statement to avoid reference errors at runtime. +if (false) { + with ({}) let // ASI + {} +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/let-identifier-with-newline.js b/js/src/tests/test262/language/statements/with/let-identifier-with-newline.js new file mode 100644 index 0000000000..c7d1b89b30 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/let-identifier-with-newline.js @@ -0,0 +1,21 @@ +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-with-statement +description: > + ExpressionStatement doesn't have a lookahead restriction for `let <binding-identifier>`. +info: | + ExpressionStatement[Yield, Await] : + [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }] + Expression[+In, ?Yield, ?Await] ; +flags: [noStrict] +---*/ + +// Wrapped in an if-statement to avoid reference errors at runtime. +if (false) { + with ({}) let // ASI + x = 1; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/scope-var-close.js b/js/src/tests/test262/language/statements/with/scope-var-close.js new file mode 100644 index 0000000000..59fc9175aa --- /dev/null +++ b/js/src/tests/test262/language/statements/with/scope-var-close.js @@ -0,0 +1,27 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-with-statement-runtime-semantics-evaluation +es6id: 13.11.7 +description: Removal of variable environment +info: | + 3. Let oldEnv be the running execution context's LexicalEnvironment. + 4. Let newEnv be NewObjectEnvironment(obj, oldEnv). + 5. Set the withEnvironment flag of newEnv's EnvironmentRecord to true. + 6. Set the running execution context's LexicalEnvironment to newEnv. + 7. Let C be the result of evaluating Statement. + 8. Set the running execution context's LexicalEnvironment to oldEnv. +flags: [noStrict] +---*/ + +var probeBody; + +with ({ x: 0 }) + var x = 1, _ = probeBody = function() { return x; }; + +var x = 2; + +assert.sameValue(probeBody(), 1, 'reference from statement body'); +assert.sameValue(x, 2, 'reference following statement'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/scope-var-open.js b/js/src/tests/test262/language/statements/with/scope-var-open.js new file mode 100644 index 0000000000..3047879f20 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/scope-var-open.js @@ -0,0 +1,28 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-with-statement-runtime-semantics-evaluation +es6id: 13.11.7 +description: Creation of new variable environment +info: | + 3. Let oldEnv be the running execution context's LexicalEnvironment. + 4. Let newEnv be NewObjectEnvironment(obj, oldEnv). + 5. Set the withEnvironment flag of newEnv's EnvironmentRecord to true. + 6. Set the running execution context's LexicalEnvironment to newEnv. + 7. Let C be the result of evaluating Statement. +flags: [noStrict] +---*/ + +var x = 0; +var objectRecord = { x: 2 }; +var probeBefore = function() { return x; }; +var probeExpr, probeBody; + +with (eval('var x = 1;'), probeExpr = function() { return x; }, objectRecord) + var x = 3, _ = probeBody = function() { return x; }; + +assert.sameValue(probeBefore(), 1, 'reference preceding statement'); +assert.sameValue(probeExpr(), 1, 'reference from expression'); +assert.sameValue(probeBody(), 3, 'reference from statement body'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/shell.js b/js/src/tests/test262/language/statements/with/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/shell.js diff --git a/js/src/tests/test262/language/statements/with/stict-script-strict.js b/js/src/tests/test262/language/statements/with/stict-script-strict.js new file mode 100644 index 0000000000..e70dbf93e8 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/stict-script-strict.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 12.10.1-11-s +description: > + Strict Mode - SyntaxError is thrown when using WithStatement in strict mode + code +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); + +with ({}) {} diff --git a/js/src/tests/test262/language/statements/with/strict-fn-decl-nested-1.js b/js/src/tests/test262/language/statements/with/strict-fn-decl-nested-1.js new file mode 100644 index 0000000000..9b0e601618 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/strict-fn-decl-nested-1.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 12.10.1-2-s +description: > + with statement in strict mode throws SyntaxError (nested function where + container is strict) +negative: + phase: parse + type: SyntaxError +flags: [noStrict] +---*/ + +$DONOTEVALUATE(); + +function foo() { + 'use strict'; + function f() { + var o = {}; + with (o) {}; + } +} diff --git a/js/src/tests/test262/language/statements/with/strict-fn-decl-nested-2.js b/js/src/tests/test262/language/statements/with/strict-fn-decl-nested-2.js new file mode 100644 index 0000000000..3240dd9d28 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/strict-fn-decl-nested-2.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 12.10.1-3-s +description: > + with statement in strict mode throws SyntaxError (nested strict function) +negative: + phase: parse + type: SyntaxError +flags: [noStrict] +---*/ + +$DONOTEVALUATE(); + +function foo() { + function f() { + 'use strict'; + var o = {}; + with (o) {}; + } +} diff --git a/js/src/tests/test262/language/statements/with/strict-fn-decl.js b/js/src/tests/test262/language/statements/with/strict-fn-decl.js new file mode 100644 index 0000000000..0d6d71b538 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/strict-fn-decl.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 12.10.1-1-s +description: with statement in strict mode throws SyntaxError (strict function) +flags: [noStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +function f() { + 'use strict'; + var o = {}; + with (o) {}; +} diff --git a/js/src/tests/test262/language/statements/with/strict-fn-expr-strict.js b/js/src/tests/test262/language/statements/with/strict-fn-expr-strict.js new file mode 100644 index 0000000000..8d6036d741 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/strict-fn-expr-strict.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 12.10.1-7-s +description: > + with statement in strict mode throws SyntaxError (function expression) +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); + +var f = function () { + var o = {}; + with (o) {}; +}; diff --git a/js/src/tests/test262/language/statements/with/strict-fn-method-strict.js b/js/src/tests/test262/language/statements/with/strict-fn-method-strict.js new file mode 100644 index 0000000000..2dc0dda35d --- /dev/null +++ b/js/src/tests/test262/language/statements/with/strict-fn-method-strict.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 12.10.1-14-s +description: > + Strict Mode - SyntaxError is thrown when the getter of a literal object + utilizes WithStatement +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); + +var obj = { get(a) { with(a){} } }; diff --git a/js/src/tests/test262/language/statements/with/unscopables-get-err.js b/js/src/tests/test262/language/statements/with/unscopables-get-err.js new file mode 100644 index 0000000000..8a00e4ed2b --- /dev/null +++ b/js/src/tests/test262/language/statements/with/unscopables-get-err.js @@ -0,0 +1,42 @@ +// Copyright 2015 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-getidentifierreference +es6id: 8.1.2.1 +description: > + Behavior when accessing `Symbol.unscopables` property value throws an error +info: | + [...] + 2. Let envRec be lex's EnvironmentRecord. + 3. Let exists be ? envRec.HasBinding(name). + + 8.1.1.2.1 HasBinding + + [...] + 5. If the withEnvironment flag of envRec is false, return true. + 6. Let unscopables be ? Get(bindings, @@unscopables). + + 13.11.7 (The `with` Statement) Runtime Semantics: Evaluation + + [...] + 5. Set the withEnvironment flag of newEnv’s EnvironmentRecord to true. + [...] +flags: [noStrict] +features: [Symbol.unscopables] +---*/ + +var env = { x: 86 }; +Object.defineProperty(env, Symbol.unscopables, { + get: function() { + throw new Test262Error(); + } +}); + +with (env) { + assert.throws(Test262Error, function() { + x; + }); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/unscopables-inc-dec.js b/js/src/tests/test262/language/statements/with/unscopables-inc-dec.js new file mode 100644 index 0000000000..bad2ecd079 --- /dev/null +++ b/js/src/tests/test262/language/statements/with/unscopables-inc-dec.js @@ -0,0 +1,53 @@ +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-hasbinding-n +description: > + @@unscopables should be looked up exactly once for inc/dec. +info: | + UpdateExpression : LeftHandSideExpression ++ + 1. Let lhs be the result of evaluating LeftHandSideExpression. + + GetIdentifierReference ( lex, name, strict ) + [...] + 3. Let exists be ? envRec.HasBinding(name). + + HasBinding ( N ) + [...] + 6. Let unscopables be ? Get(bindings, @@unscopables). +flags: [noStrict] +features: [Symbol.unscopables] +---*/ + +var unscopablesGetterCalled = 0; +var a, b, flag = true; +with (a = { x: 7 }) { + with (b = { x: 4, get [Symbol.unscopables]() { + unscopablesGetterCalled++; + return { x: flag=!flag }; + } }) { + x++; + } +} + +assert.sameValue(unscopablesGetterCalled, 1); +assert.sameValue(a.x, 7); +assert.sameValue(b.x, 5); + +unscopablesGetterCalled = 0; +flag = true; +with (a = { x: 7 }) { + with (b = { x: 4, get [Symbol.unscopables]() { + unscopablesGetterCalled++; + return { x: flag=!flag }; + } }) { + x--; + } +} + +assert.sameValue(unscopablesGetterCalled, 1); +assert.sameValue(a.x, 7); +assert.sameValue(b.x, 3); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/unscopables-not-referenced-for-undef.js b/js/src/tests/test262/language/statements/with/unscopables-not-referenced-for-undef.js new file mode 100644 index 0000000000..961593f60d --- /dev/null +++ b/js/src/tests/test262/language/statements/with/unscopables-not-referenced-for-undef.js @@ -0,0 +1,47 @@ +// Copyright 2015 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-getidentifierreference +es6id: 8.1.2.1 +description: > + `Symbol.unscopables` is not referenced when environment record does not have + requested property +info: | + [...] + 2. Let envRec be lex's EnvironmentRecord. + 3. Let exists be ? envRec.HasBinding(name). + + 8.1.1.2.1 HasBinding + + 1. Let envRec be the object Environment Record for which the method was + invoked. + 2. Let bindings be the binding object for envRec. + 3. Let foundBinding be ? HasProperty(bindings, N). + 4. If foundBinding is false, return false. + + 13.11.7 (The `with` Statement) Runtime Semantics: Evaluation + + [...] + 5. Set the withEnvironment flag of newEnv’s EnvironmentRecord to true. + [...] +flags: [noStrict] +features: [Symbol.unscopables] +---*/ + +var x = 0; +var env = {}; +var callCount = 0; +Object.defineProperty(env, Symbol.unscopables, { + get: function() { + callCount += 1; + } +}); + +with (env) { + x; +} + +assert.sameValue(callCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/with/unscopables-prop-get-err.js b/js/src/tests/test262/language/statements/with/unscopables-prop-get-err.js new file mode 100644 index 0000000000..a097be2e5d --- /dev/null +++ b/js/src/tests/test262/language/statements/with/unscopables-prop-get-err.js @@ -0,0 +1,48 @@ +// Copyright 2015 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-getidentifierreference +es6id: 8.1.2.1 +description: > + Behavior when accessing property of `Symbol.unscopables` property throws an + error +info: | + [...] + 2. Let envRec be lex's EnvironmentRecord. + 3. Let exists be ? envRec.HasBinding(name). + + 8.1.1.2.1 HasBinding + + [...] + 5. If the withEnvironment flag of envRec is false, return true. + 6. Let unscopables be ? Get(bindings, @@unscopables). + 7. If Type(unscopables) is Object, then + a. Let blocked be ToBoolean(? Get(unscopables, N)). + b. If blocked is true, return false. + + 13.11.7 (The `with` Statement) Runtime Semantics: Evaluation + + [...] + 5. Set the withEnvironment flag of newEnv’s EnvironmentRecord to true. + [...] +flags: [noStrict] +features: [Symbol.unscopables] +---*/ + +var env = { x: 86 }; +env[Symbol.unscopables] = {}; + +Object.defineProperty(env[Symbol.unscopables], 'x', { + get: function() { + throw new Test262Error(); + } +}); + +with (env) { + assert.throws(Test262Error, function() { + x; + }); +} + +reportCompare(0, 0); |