diff options
Diffstat (limited to 'external/contributions/Google/sputniktests/tests/Conformance/12_Statement')
417 files changed, 21942 insertions, 0 deletions
diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.10_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.10_T1.js new file mode 100644 index 000000000..2e748f597 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.10_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. + +/** + * @name: S12.10_A1.10_T1; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Using interation statement within "with" statement leading to normal completion; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +with(myObj){ + do{ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } + while(false); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + $ERROR('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.10_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.10_T2.js new file mode 100644 index 000000000..62239c832 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.10_T2.js @@ -0,0 +1,146 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A1.10_T2; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Using iteration statement within "with" statement leading to completion by exception + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + with(myObj){ + do{ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + throw value; + } + while(false); + } +} catch(e){ + result = e; +} + +if(!(result === "value")){ + $ERROR('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + $ERROR('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.10_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.10_T3.js new file mode 100644 index 000000000..2475cf952 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.10_T3.js @@ -0,0 +1,149 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A1.10_T3; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Using iteration statment withing "with" statement leading to completion by exception + * iteration statement inside with statement - exception completion; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + with(myObj){ + do{ + throw value; + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } + while(false); + } +} catch(e){ + result = e; +} + +if(!(result === "myObj_value")){ + $ERROR('#0: result === "myObj_value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === undefined)){ + $ERROR('#4: p4 === undefined. Actual: p4 ==='+ p4 ); +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.10_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.10_T4.js new file mode 100644 index 000000000..7fdc47020 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.10_T4.js @@ -0,0 +1,139 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A1.10_T4; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Using iteration statement witthin "with" staement leading to completion by break + * iteration statement inside with statement - break completion; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +with(myObj){ + do{ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + break; + } + while(false); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + $ERROR('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.10_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.10_T5.js new file mode 100644 index 000000000..601fb7a4b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.10_T5.js @@ -0,0 +1,140 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A1.10_T5; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Using iteration statement within "with" statement leading to completion by break + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +with(myObj){ + do{ + break; + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } + while(false); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === undefined)){ + $ERROR('#4: p4 === undefined. Actual: p4 ==='+ p4 ); +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.11_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.11_T1.js new file mode 100644 index 000000000..ead6eea3c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.11_T1.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. + +/** + * @name: S12.10_A1.11_T1; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Calling a function within "with" statement declared without the statement, leading to normal completion; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +var f = function(){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; +} + +with(myObj){ + f(); +} + +if(!(p1 === "x1")){ + $ERROR('#1: p1 === "x1". Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +try{ + p3; + $ERROR('#3: p3 is nod defined'); +} +catch(e){ +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === parseInt)){ + $ERROR('#11: st_parseInt === parseInt. Actual: st_parseInt ==='+ st_parseInt ); +} + +if(!isNaN(st_NaN)){ + $ERROR('#12: st_NaN === NaN. Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === Infinity)){ + $ERROR('#13: st_Infinity === Infinity. Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === eval)){ + $ERROR('#14: st_eval === eval. Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === parseFloat)){ + $ERROR('#15: st_parseFloat === parseFloat. Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === isNaN)){ + $ERROR('#16: st_isNaN === isNaN. Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === isFinite)){ + $ERROR('#17: st_isFinite === isFinite. Actual: st_isFinite ==='+ st_isFinite ); +} + +try { + value; + $ERROR('#18: value is not defined'); +} catch(e) { +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.11_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.11_T2.js new file mode 100644 index 000000000..91408438f --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.11_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. + +/** + * @name: S12.10_A1.11_T2; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Calling a function within "with" statement declared without the statement, leading to normal completion by "return"; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +var f = function(){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + return value; +} + +with(myObj){ + result = f(); +} + +if(!(result === "value")){ + $ERROR('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === "x1")){ + $ERROR('#1: p1 === "x1". Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +try{ + p3; + $ERROR('#3: p3 is nod defined'); +} +catch(e){ +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === parseInt)){ + $ERROR('#11: st_parseInt === parseInt. Actual: st_parseInt ==='+ st_parseInt ); +} + +if(!isNaN(st_NaN)){ + $ERROR('#12: st_NaN === NaN. Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === Infinity)){ + $ERROR('#13: st_Infinity === Infinity. Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === eval)){ + $ERROR('#14: st_eval === eval. Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === parseFloat)){ + $ERROR('#15: st_parseFloat === parseFloat. Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === isNaN)){ + $ERROR('#16: st_isNaN === isNaN. Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === isFinite)){ + $ERROR('#17: st_isFinite === isFinite. Actual: st_isFinite ==='+ st_isFinite ); +} + +try { + value; + $ERROR('#18: value is not defined'); +} catch(e) { +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.11_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.11_T3.js new file mode 100644 index 000000000..d59ab9d66 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.11_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. + +/** + * @name: S12.10_A1.11_T3; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Calling a function within "with" statement declared without the statement, leading to normal completion by "return"; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +var f = function(){ + return value; + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; +} + +with(myObj){ + result = f(); +} + +if(!(result === undefined)){ + $ERROR('#0: result === undefined. Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try{ + p4; + $ERROR('#4: p4 doesn\'t exists'); +} +catch(e){ +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +try { + value; + $ERROR('#18: value is not defined'); +} catch(e) { +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.11_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.11_T4.js new file mode 100644 index 000000000..d4ca6d312 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.11_T4.js @@ -0,0 +1,153 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A1.11_T4; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Calling a function within "with" statement declared without the statement, leading to completion by exception; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + var f = function(){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + throw value; + } + with(myObj){ + f(); + } +} catch(e){ + result = e; +} + +if(!(result === "value")){ + $ERROR('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === "x1")){ + $ERROR('#1: p1 === "x1". Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +try{ + p3; + $ERROR('#3: p3 is nod defined'); +} +catch(e){ +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === parseInt)){ + $ERROR('#11: st_parseInt === parseInt. Actual: st_parseInt ==='+ st_parseInt ); +} + +if(!isNaN(st_NaN)){ + $ERROR('#12: st_NaN === NaN. Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === Infinity)){ + $ERROR('#13: st_Infinity === Infinity. Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === eval)){ + $ERROR('#14: st_eval === eval. Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === parseFloat)){ + $ERROR('#15: st_parseFloat === parseFloat. Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === isNaN)){ + $ERROR('#16: st_isNaN === isNaN. Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === isFinite)){ + $ERROR('#17: st_isFinite === isFinite. Actual: st_isFinite ==='+ st_isFinite ); +} + +try { + value; + $ERROR('#18: value is not defined'); +} catch(e) { +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.11_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.11_T5.js new file mode 100644 index 000000000..fa33fb322 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.11_T5.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. + +/** + * @name: S12.10_A1.11_T5; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Calling a function within "with" statement declared without the statement, leading to completion by exception; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + var f = function(){ + throw value; + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } + with(myObj){ + f(); + } +} catch(e){ + result = e; +} + +if(!(result === undefined)){ + $ERROR('#0: result === undefined. Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try{ + p4; + $ERROR('#4: p4 doesn\'t exists'); +} +catch(e){ +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +try { + value; + $ERROR('#18: value is not defined'); +} catch(e) { +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.12_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.12_T1.js new file mode 100644 index 000000000..cb8ec8be5 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.12_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. + +/** + * @name: S12.10_A1.12_T1; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Calling a function without "with" statement declared within the statement, leading to normal completion; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +with(myObj){ + var f = function(){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } +} +f(); + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try{ + p4; + $ERROR('#4: p4 doesn\'t exists'); +} +catch(e){ +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +try { + value; + $ERROR('#18: value is not defined'); +} catch(e) { +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.12_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.12_T2.js new file mode 100644 index 000000000..c9364e9b2 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.12_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. + +/** + * @name: S12.10_A1.12_T2; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Calling a function without "with" statement declared within the statement, leading to normal completion by "return"; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +with(myObj){ + var f = function(){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + return value; + } +} +result = f(); + +if(!(result === "value")){ + $ERROR('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try{ + p4; + $ERROR('#4: p4 doesn\'t exists'); +} +catch(e){ +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.12_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.12_T3.js new file mode 100644 index 000000000..6ad8c60cb --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.12_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. + +/** + * @name: S12.10_A1.12_T3; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Calling a function without "with" statement declared within the statement, leading to normal completion by "return"; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +with(myObj){ + var f = function(){ + return value; + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } +} +result = f(); + +if(!(result === undefined)){ + $ERROR('#0: result === undefined. Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.12_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.12_T4.js new file mode 100644 index 000000000..2d169483e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.12_T4.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. + +/** + * @name: S12.10_A1.12_T4; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Calling a function without "with" statement declared within the statement, leading to completion by exception; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + with(myObj){ + var f = function(){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + throw value; + } + } + f(); +} catch(e){ + result = e; +} + +if(!(result === "value")){ + $ERROR('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +try { + value; + $ERROR('#18: value is not defined'); +} catch(e) { +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.12_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.12_T5.js new file mode 100644 index 000000000..e1bcb06dd --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.12_T5.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. + +/** + * @name: S12.10_A1.12_T5; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Calling a function without "with" statement declared within the statement, leading to completion by exception; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + with(myObj){ + var f = function(){ + throw value; + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } + } + f(); +} catch(e){ + result = e; +} + +if(!(result === undefined)){ + $ERROR('#0: result === undefined. Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.1_T1.js new file mode 100644 index 000000000..43f5b1609 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.1_T1.js @@ -0,0 +1,135 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A1.1_T1; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Using "with" inside of global context leading to normal completion; + * @strict_mode_negative +*/ + +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +with(myObj){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + $ERROR('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.1_T2.js new file mode 100644 index 000000000..62f2cc4ac --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.1_T2.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. + +/** + * @name: S12.10_A1.1_T2; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Using "with" inside of global context leading to completion by exception; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + with(myObj){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + throw value; + } +} catch(e){ + result = e; +} + +if(!(result === "value")){ + $ERROR('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + $ERROR('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.1_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.1_T3.js new file mode 100644 index 000000000..8bd895a14 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.1_T3.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. + +/** + * @name: S12.10_A1.1_T3; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Using "with" inside of global context leading to completion by exception; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + with(myObj){ + throw value; + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } +} catch(e){ + result = e; +} + +if(!(result === "myObj_value")){ + $ERROR('#0: result === "myObj_value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === undefined)){ + $ERROR('#4: p4 === undefined. Actual: p4 ==='+ p4 ); +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.2_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.2_T1.js new file mode 100644 index 000000000..f8f6fd3aa --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.2_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. + +/** + * @name: S12.10_A1.2_T1; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Calling a function without "with" statement when the statement itself is declared within the function declaration, leading to normal completion; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +var f = function(){ + with(myObj){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } +} +f(); + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.2_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.2_T2.js new file mode 100644 index 000000000..8f88481ae --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.2_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. + +/** + * @name: S12.10_A1.2_T2; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Calling a function without "with" statement when the statement itself is declared within the function declaration, leading to normal completion by "return"; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +var f = function(){ + with(myObj){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + return value; + } +} +result = f(); + +if(!(result === "value")){ + $ERROR('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.2_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.2_T3.js new file mode 100644 index 000000000..ce73cf31e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.2_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. + +/** + * @name: S12.10_A1.2_T3; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Calling a function without "with" statement when the statement itself is declared within the function declaration, leading to normal completion by "return"; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +var f = function(){ + with(myObj){ + return value; + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } +} +result = f(); + +if(!(result === "myObj_value")){ + $ERROR('#0: result === "myObj_value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.2_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.2_T4.js new file mode 100644 index 000000000..775df08f5 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.2_T4.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. + +/** + * @name: S12.10_A1.2_T4; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Calling a function without "with" statement when the statement itself is declared within the function declaration, leading to completion by exception; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + var f = function(){ + with(myObj){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + throw value; + } + } + f(); +} catch(e){ + result = e; +} + +if(!(result === "value")){ + $ERROR('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.2_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.2_T5.js new file mode 100644 index 000000000..884d4e696 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.2_T5.js @@ -0,0 +1,149 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A1.2_T5; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Calling a function without "with" statement when the statement itself is declared within the function declaration, leading to completion by exception; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + var f = function(){ + with(myObj){ + throw value; + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } + } + f(); +} catch(e){ + result = e; +} + +if(!(result === "myObj_value")){ + $ERROR('#0: result === "myObj_value". Actual: result ==='+ result ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.3_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.3_T1.js new file mode 100644 index 000000000..f8ce3c02c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.3_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. + +/** + * @name: S12.10_A1.3_T1; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Using "with" statement within function constructor, leading to normal completition; + * @strict_mode_negative +*/ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +var f = function(){ + with(myObj){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } +} +var obj = new f(); + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.3_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.3_T2.js new file mode 100644 index 000000000..22fa94bb0 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.3_T2.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. + +/** + * @name: S12.10_A1.3_T2; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Using "with" statement within function constructor, leading to normal completition by "return"; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +var f = function(){ + with(myObj){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + return value; + } +} +var obj = new f(); + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.3_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.3_T3.js new file mode 100644 index 000000000..c66601348 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.3_T3.js @@ -0,0 +1,146 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A1.3_T3; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Using "with" statement within function constructor, leading to normal completition by "return"; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +var f = function(){ + with(myObj){ + return value; + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } +} +var obj = new f(); + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.3_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.3_T4.js new file mode 100644 index 000000000..168ecfc14 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.3_T4.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. + +/** + * @name: S12.10_A1.3_T4; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Using "with" statement within function constructor, leading to completition by exception; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + var f = function(){ + with(myObj){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + throw value; + } + } + var obj = new f(); +} catch(e){ + result = e; +} + +if(!(result === "value")){ + $ERROR('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.3_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.3_T5.js new file mode 100644 index 000000000..3f88e55bf --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.3_T5.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. + +/** + * @name: S12.10_A1.3_T5; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Using "with" statement within function constructor, leading to completition by exception; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + var f = function(){ + with(myObj){ + throw value; + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } + } + var obj = new f(); +} catch(e){ + result = e; +} + +if(!(result === "myObj_value")){ + $ERROR('#0: result === "myObj_value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.4_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.4_T1.js new file mode 100644 index 000000000..7108acda2 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.4_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. + +/** + * @name: S12.10_A1.4_T1; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Using "with" statement within iteration statement, leading to normal completion; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +do{ + with(myObj){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } +} +while(false); + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + $ERROR('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.4_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.4_T2.js new file mode 100644 index 000000000..511075e22 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.4_T2.js @@ -0,0 +1,146 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A1.4_T2; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Using "with" statement within iteration statement, leading to completion by exception; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + do{ + with(myObj){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + throw value; + } + } + while(false); +} catch(e){ + result = e; +} + +if(!(result === "value")){ + $ERROR('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + $ERROR('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.4_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.4_T3.js new file mode 100644 index 000000000..0fcbf5d0c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.4_T3.js @@ -0,0 +1,148 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A1.4_T3; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Using "with" statement within iteration statement, leading to completion by exception; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + do{ + with(myObj){ + throw value; + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } + } + while(false); +} catch(e){ + result = e; +} + +if(!(result === "myObj_value")){ + $ERROR('#0: result === "myObj_value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === undefined)){ + $ERROR('#4: p4 === undefined. Actual: p4 ==='+ p4 ); +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.4_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.4_T4.js new file mode 100644 index 000000000..eaf0c8e6d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.4_T4.js @@ -0,0 +1,138 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A1.4_T4; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Using "with" statement within iteration statement, leading to completion by break; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +do{ + with(myObj){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + break; + } +} +while(false); + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + $ERROR('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.4_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.4_T5.js new file mode 100644 index 000000000..dee420ea7 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.4_T5.js @@ -0,0 +1,140 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A1.4_T5; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Using "with" statement within iteration statement, leading to completion by break; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +do{ + with(myObj){ + break; + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } +} +while(false); + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === undefined)){ + $ERROR('#4: p4 ===undefined. Actual: p4 ==='+ p4 ); +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.5_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.5_T1.js new file mode 100644 index 000000000..fa3c7e6c4 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.5_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. + +/** + * @name: S12.10_A1.5_T1; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Using "with" statement within "for-in" statement, leading to normal completion; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +for(var prop in myObj){ + with(myObj){ + if(prop === 'p1') { + st_p1 = p1; + p1 = 'x1'; + } + if(prop === 'p2') { + st_p2 = p2; + this.p2 = 'x2'; + } + if(prop === 'p3') { + st_p3 = p3; + del = delete p3; + } + if(prop === 'parseInt') st_parseInt = parseInt; + if(prop === 'NaN') st_NaN = NaN; + if(prop === 'Infinity') st_Infinity = Infinity; + if(prop === 'eval') st_eval = eval; + if(prop === 'parseFloat') st_parseFloat = parseFloat; + if(prop === 'isNaN') st_isNaN = isNaN; + if(prop === 'isFinite') st_isFinite = isFinite; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + $ERROR('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.5_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.5_T2.js new file mode 100644 index 000000000..5d52747d6 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.5_T2.js @@ -0,0 +1,145 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A1.5_T2; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Using "with" statement within "for-in" statement, leading to completion by exception; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + for(var prop in myObj){ + with(myObj){ + st_p1 = p1; + p1 = 'x1'; + st_p2 = p2; + this.p2 = 'x2'; + st_p3 = p3; + del = delete p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + throw value; + } + } +} catch(e){ + result = e; +} + +if(!(result === "value")){ + $ERROR('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + $ERROR('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.5_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.5_T3.js new file mode 100644 index 000000000..157b954a7 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.5_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. + +/** + * @name: S12.10_A1.5_T3; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Using "with" statement within "for-in" statement, leading to completion by exception; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + for(var prop in myObj){ + with(myObj){ + throw value; + if(prop === 'p1') { + st_p1 = p1; + p1 = 'x1'; + } + if(prop === 'p2') { + st_p2 = p2; + this.p2 = 'x2'; + } + if(prop === 'p3') { + st_p3 = p3; + del = delete p3; + } + if(prop === 'parseInt') st_parseInt = parseInt; + if(prop === 'NaN') st_NaN = NaN; + if(prop === 'Infinity') st_Infinity = Infinity; + if(prop === 'eval') st_eval = eval; + if(prop === 'parseFloat') st_parseFloat = parseFloat; + if(prop === 'isNaN') st_isNaN = isNaN; + if(prop === 'isFinite') st_isFinite = isFinite; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } + } +} catch(e){ + result = e; +} + +if(!(result === "myObj_value")){ + $ERROR('#0: result === "myObj_value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === undefined)){ + $ERROR('#4: p4 === undefined. Actual: p4 ==='+ p4 ); +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.5_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.5_T4.js new file mode 100644 index 000000000..1a5ad3866 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.5_T4.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. + +/** + * @name: S12.10_A1.5_T4; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Using "with" statement within "for-in" statement, leading to completion by break; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +for(var prop in myObj){ + with(myObj){ + st_p1 = p1; + p1 = 'x1'; + st_p2 = p2; + this.p2 = 'x2'; + st_p3 = p3; + del = delete p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + break; + } +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + $ERROR('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.5_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.5_T5.js new file mode 100644 index 000000000..1a72d740c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.5_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. + +/** + * @name: S12.10_A1.5_T5; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Using "with" statement within "for-in" statement, leading to completion by break; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +for(var prop in myObj){ + with(myObj){ + break; + if(prop === 'p1') { + st_p1 = p1; + p1 = 'x1'; + } + if(prop === 'p2') { + st_p2 = p2; + this.p2 = 'x2'; + } + if(prop === 'p3') { + st_p3 = p3; + del = delete p3; + } + if(prop === 'parseInt') st_parseInt = parseInt; + if(prop === 'NaN') st_NaN = NaN; + if(prop === 'Infinity') st_Infinity = Infinity; + if(prop === 'eval') st_eval = eval; + if(prop === 'parseFloat') st_parseFloat = parseFloat; + if(prop === 'isNaN') st_isNaN = isNaN; + if(prop === 'isFinite') st_isFinite = isFinite; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === undefined)){ + $ERROR('#4: p4 === undefined. Actual: p4 ==='+ p4 ); +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.6_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.6_T1.js new file mode 100644 index 000000000..701cf8b2d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.6_T1.js @@ -0,0 +1,136 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A1.6_T1; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Using "with" statement within another "with" statement, leading to normal completion; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +with(myObj){ + with(myObj){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + $ERROR('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.6_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.6_T2.js new file mode 100644 index 000000000..6b9f32524 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.6_T2.js @@ -0,0 +1,145 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A1.6_T2; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Using "with" statement within another "with" statement, leading to completion by exception; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + with(myObj){ + with(myObj){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + throw value; + } + } +} catch(e){ + result = e; +} + +if(!(result === "value")){ + $ERROR('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + $ERROR('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.6_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.6_T3.js new file mode 100644 index 000000000..3f8f75169 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.6_T3.js @@ -0,0 +1,147 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A1.6_T3; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Using "with" statement within another "with" statement, leading to completion by exception; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + with(myObj){ + with(myObj){ + throw value; + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } + } +} catch(e){ + result = e; +} + +if(!(result === "myObj_value")){ + $ERROR('#0: result === "myObj_value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === undefined)){ + $ERROR('#4: p4 === undefined. Actual: p4 ==='+ p4 ); +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.7_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.7_T1.js new file mode 100644 index 000000000..0f1e291df --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.7_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. + +/** + * @name: S12.10_A1.7_T1; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Calling a function within "with" statement declared within the statement, leading to normal completion; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +with(myObj){ + var f = function(){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } + f(); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.7_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.7_T2.js new file mode 100644 index 000000000..35862aa25 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.7_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. + +/** + * @name: S12.10_A1.7_T2; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Calling a function within "with" statement declared within the statement, leading to normal completion by "return"; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +with(myObj){ + var f = function(){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + return value; + } + result = f(); +} + +if(!(result === "value")){ + $ERROR('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.7_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.7_T3.js new file mode 100644 index 000000000..68f887dbb --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.7_T3.js @@ -0,0 +1,149 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A1.7_T3; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Calling a function within "with" statement declared within the statement, leading to normal completion by "return"; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +with(myObj){ + var f = function(){ + return value; + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } + result = f(); +} + +if(!(result === undefined)){ + $ERROR('#0: result === undefined. Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.7_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.7_T4.js new file mode 100644 index 000000000..54f9edcf2 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.7_T4.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. + +/** + * @name: S12.10_A1.7_T4; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Calling a function within "with" statement declared within the statement, leading to completion by exception; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + with(myObj){ + var f = function(){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + throw value; + } + f(); + } +} catch(e){ + result = e; +} + +if(!(result === "value")){ + $ERROR('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.7_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.7_T5.js new file mode 100644 index 000000000..4c9f1b010 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.7_T5.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. + +/** + * @name: S12.10_A1.7_T5; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Calling a function within "with" statement declared within the statement, leading to completion by exception; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + with(myObj){ + var f = function(){ + throw value; + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } + f(); + } +} catch(e){ + result = e; +} + +if(!(result === undefined)){ + $ERROR('#0: result === undefined. Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.8_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.8_T1.js new file mode 100644 index 000000000..ca1809325 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.8_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. + +/** + * @name: S12.10_A1.8_T1; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Declaring function constructor within "with" statement, leading to normal completion; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +with(myObj){ + var f = function(){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } + var obj = new f(); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.8_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.8_T2.js new file mode 100644 index 000000000..f65041c7d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.8_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. + +/** + * @name: S12.10_A1.8_T2; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Declaring function constructor within "with" statement, leading to normal completion by "return"; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +with(myObj){ + var f = function(){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + return value; + } + var obj = new f(); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.8_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.8_T3.js new file mode 100644 index 000000000..f341e365b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.8_T3.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. + +/** + * @name: S12.10_A1.8_T3; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Declaring function constructor within "with" statement, leading to normal completion by "return"; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +with(myObj){ + var f = function(){ + return value; + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } + var obj = new f(); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.8_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.8_T4.js new file mode 100644 index 000000000..fe72cb4d1 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.8_T4.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. + +/** + * @name: S12.10_A1.8_T4; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Declaring function constructor within "with" statement, leading to completion by exception; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + with(myObj){ + var f = function(){ + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + throw value; + } + var obj = new f(); + } +} catch(e){ + result = e; +} + +if(!(result === "value")){ + $ERROR('#0: result === "value". Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.8_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.8_T5.js new file mode 100644 index 000000000..4e83da95e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.8_T5.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. + +/** + * @name: S12.10_A1.8_T5; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Declaring function constructor within "with" statement, leading to completion by exception; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +try { + with(myObj){ + var f = function(){ + throw value; + st_p1 = p1; + st_p2 = p2; + st_p3 = p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + p1 = 'x1'; + this.p2 = 'x2'; + del = delete p3; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } + var obj = new f(); + } +} catch(e){ + result = e; +} + +if(!(result === undefined)){ + $ERROR('#0: result === undefined. Actual: result ==='+ result ); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +try { + p4; + $ERROR('#4: p4 is not defined'); +} catch(e) { +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +try{ + value; + $ERROR('#18: value is not defined'); +} +catch(e){ +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.9_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.9_T1.js new file mode 100644 index 000000000..411217c2a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.9_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. + +/** + * @name: S12.10_A1.9_T1; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Using "for-in" statement within "with" statement, leading to normal completion; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +with(myObj){ + for(var prop in myObj){ + if(prop === 'p1') { + st_p1 = p1; + p1 = 'x1'; + } + if(prop === 'p2') { + st_p2 = p2; + this.p2 = 'x2'; + } + if(prop === 'p3') { + st_p3 = p3; + del = delete p3; + } + if(prop === 'parseInt') st_parseInt = parseInt; + if(prop === 'NaN') st_NaN = NaN; + if(prop === 'Infinity') st_Infinity = Infinity; + if(prop === 'eval') st_eval = eval; + if(prop === 'parseFloat') st_parseFloat = parseFloat; + if(prop === 'isNaN') st_isNaN = isNaN; + if(prop === 'isFinite') st_isFinite = isFinite; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + $ERROR('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.9_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.9_T2.js new file mode 100644 index 000000000..e79e62b26 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.9_T2.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. + +/** + * @name: S12.10_A1.9_T2; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Using "for-in" statement within "with" statement, leading to completion by break; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +with(myObj){ + for(var prop in myObj){ + st_p1 = p1; + p1 = 'x1'; + st_p2 = p2; + this.p2 = 'x2'; + st_p3 = p3; + del = delete p3; + st_parseInt = parseInt; + st_NaN = NaN; + st_Infinity = Infinity; + st_eval = eval; + st_parseFloat = parseFloat; + st_isNaN = isNaN; + st_isFinite = isFinite; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + break; + } +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === "x2")){ + $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === "x4")){ + $ERROR('#4: p4 === "x4". Actual: p4 ==='+ p4 ); +} + +if(!(p5 === "x5")){ + $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === undefined)){ + $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt !== parseInt)){ + $ERROR('#11: myObj.parseInt !== parseInt'); +} + +if(!(st_NaN === "obj_NaN")){ + $ERROR('#12: myObj.NaN !== NaN'); +} + +if(!(st_Infinity !== Infinity)){ + $ERROR('#13: myObj.Infinity !== Infinity'); +} + +if(!(st_eval !== eval)){ + $ERROR('#14: myObj.eval !== eval'); +} + +if(!(st_parseFloat !== parseFloat)){ + $ERROR('#15: myObj.parseFloat !== parseFloat'); +} + +if(!(st_isNaN !== isNaN)){ + $ERROR('#16: myObj.isNaN !== isNaN'); +} + +if(!(st_isFinite !== isFinite)){ + $ERROR('#17: myObj.isFinite !== isFinite'); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "value")){ + $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.9_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.9_T3.js new file mode 100644 index 000000000..f7add5e40 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A1.9_T3.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. + +/** + * @name: S12.10_A1.9_T3; + * @section: 12.10; + * @assertion: The with statement adds a computed object to the front of the + * scope chain of the current execution context; + * @description: Using "for-in" statement within "with" statement, leading to completion by break; + * @strict_mode_negative + */ +this.p1 = 1; +this.p2 = 2; +this.p3 = 3; +var result = "result"; +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} +var del; +var st_p1 = "p1"; +var st_p2 = "p2"; +var st_p3 = "p3"; +var st_parseInt = "parseInt"; +var st_NaN = "NaN"; +var st_Infinity = "Infinity"; +var st_eval = "eval"; +var st_parseFloat = "parseFloat"; +var st_isNaN = "isNaN"; +var st_isFinite = "isFinite"; + +with(myObj){ + for(var prop in myObj){ + break; + if(prop === 'p1') { + st_p1 = p1; + p1 = 'x1'; + } + if(prop === 'p2') { + st_p2 = p2; + this.p2 = 'x2'; + } + if(prop === 'p3') { + st_p3 = p3; + del = delete p3; + } + if(prop === 'parseInt') st_parseInt = parseInt; + if(prop === 'NaN') st_NaN = NaN; + if(prop === 'Infinity') st_Infinity = Infinity; + if(prop === 'eval') st_eval = eval; + if(prop === 'parseFloat') st_parseFloat = parseFloat; + if(prop === 'isNaN') st_isNaN = isNaN; + if(prop === 'isFinite') st_isFinite = isFinite; + var p4 = 'x4'; + p5 = 'x5'; + var value = 'value'; + } +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(p2 === 2)){ + $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 ); +} + +if(!(p3 === 3)){ + $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 ); +} + +if(!(p4 === undefined)){ + $ERROR('#4: p4 === undefined. Actual: p4 ==='+ p4 ); +} + +try { + p5; + $ERROR('#5: p5 is not defined'); +} catch(e) { +} + +if(!(myObj.p1 === "a")){ + $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(myObj.p2 === "b")){ + $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); +} + +if(!(myObj.p3 === "c")){ + $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); +} + +if(!(myObj.p4 === undefined)){ + $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); +} + +if(!(myObj.p5 === undefined)){ + $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); +} + +if(!(st_parseInt === "parseInt")){ + $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); +} + +if(!(st_NaN === "NaN")){ + $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); +} + +if(!(st_Infinity === "Infinity")){ + $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); +} + +if(!(st_eval === "eval")){ + $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); +} + +if(!(st_parseFloat === "parseFloat")){ + $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); +} + +if(!(st_isNaN === "isNaN")){ + $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); +} + +if(!(st_isFinite === "isFinite")){ + $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); +} + +if(!(value === undefined)){ + $ERROR('#18: value === undefined. Actual: value ==='+ value ); +} + +if(!(myObj.value === "myObj_value")){ + $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.10_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.10_T1.js new file mode 100644 index 000000000..9171feed0 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.10_T1.js @@ -0,0 +1,46 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A3.10_T1; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Using iteration statement within "with" statement, leading to normal completion; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +with(myObj){ + do{ + p1 = 'x1'; + } while(false); +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + $ERROR('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.10_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.10_T2.js new file mode 100644 index 000000000..a0ce58c3e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.10_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. + +/** + * @name: S12.10_A3.10_T2; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Using iteration statement within "with" statement, leading completion by exception; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +try { + with(myObj){ + do{ + p1 = 'x1'; + throw value; + } while(false); + } +} catch(e){ + result = p1; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(result !== 1){ + $ERROR('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(p1 !== 1){ + $ERROR('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "x1"){ + $ERROR('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.10_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.10_T3.js new file mode 100644 index 000000000..0ec4391e2 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.10_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. + +/** + * @name: S12.10_A3.10_T3; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Using iteration statement within "with" statement, leading completion by exception; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +try { + with(myObj){ + do{ + throw value; + p1 = 'x1'; + } while(false); + } +} catch(e){ + result = p1; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(result !== 1){ + $ERROR('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(p1 !== 1){ + $ERROR('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "a"){ + $ERROR('#3: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.10_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.10_T4.js new file mode 100644 index 000000000..c85386b5d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.10_T4.js @@ -0,0 +1,46 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A3.10_T4; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Using iteration statement within "with" statement, leading completion be break; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +with(myObj){ + do{ + p1 = 'x1'; + break; + } while(false); +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + $ERROR('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.10_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.10_T5.js new file mode 100644 index 000000000..03274112b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.10_T5.js @@ -0,0 +1,44 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A3.10_T5; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Using iteration statement within "with" statement, leading completion be break; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +with(myObj){ + do{ + break; + p1 = 'x1'; + } while(false); +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "a"){ + $ERROR('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.11_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.11_T1.js new file mode 100644 index 000000000..44f13fabd --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.11_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. + +/** + * @name: S12.10_A3.11_T1; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Calling a function within "with" statement declared without the statement, leading to normal completion; + * @strict_mode_negative + */ +this.p1 = 1; +var result = "result"; +var myObj = {p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +var f = function(){ + p1 = 'x1'; +} + +with(myObj){ + f(); +} + +if(!(p1 === "x1")){ + $ERROR('#1: p1 === "x1". Actual: p1 ==='+ p1 ); +} + +if(!(myObj.p1 === "a")){ + $ERROR('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.11_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.11_T2.js new file mode 100644 index 000000000..9103764bb --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.11_T2.js @@ -0,0 +1,39 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A3.11_T2; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Calling a function within "with" statement declared without the statement, leading to normal completion by "return"; + * @strict_mode_negative + */ +this.p1 = 1; +var result = "result"; +var value = "value"; +var myObj = {p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +var f = function(){ + p1 = 'x1'; + return value; +} + +with(myObj){ + result = f(); +} + +if(!(p1 === "x1")){ + $ERROR('#1: p1 === "x1". Actual: p1 ==='+ p1 ); +} + +if(!(myObj.p1 === "a")){ + $ERROR('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(result === "value")){ + $ERROR('#3: result === "value". Actual: result ==='+ result ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.11_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.11_T3.js new file mode 100644 index 000000000..c7292d107 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.11_T3.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A3.11_T3; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Calling a function within "with" statement declared without the statement, leading to normal completion by "return"; + * @strict_mode_negative + */ +this.p1 = 1; +var result = "result"; +var value = "value"; +var myObj = {p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +var f = function(){ + return value; + p1 = 'x1'; +} + +with(myObj){ + result = f(); +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(myObj.p1 === "a")){ + $ERROR('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(result === "value")){ + $ERROR('#3: result === "value". Actual: result ==='+ result ); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.11_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.11_T4.js new file mode 100644 index 000000000..790ea31d9 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.11_T4.js @@ -0,0 +1,45 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A3.11_T4; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Calling a function within "with" statement declared without the statement, leading to completion by exception; + * @strict_mode_negative + */ +this.p1 = 1; +var result = "result"; +var value = "value"; +var myObj = {p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +try { + var f = function(){ + p1 = 'x1'; + throw value; + } + + with(myObj){ + f(); + } +} catch(e){ + result = e; +} + +if(!(p1 === "x1")){ + $ERROR('#1: p1 === "x1". Actual: p1 ==='+ p1 ); +} + +if(!(myObj.p1 === "a")){ + $ERROR('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(result === "value")){ + $ERROR('#3: result === "value". Actual: result ==='+ result ); +} + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.11_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.11_T5.js new file mode 100644 index 000000000..4cdabc677 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.11_T5.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. + +/** + * @name: S12.10_A3.11_T5; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Calling a function within "with" statement declared without the statement, leading to completion by exception; + * @strict_mode_negative + */ +this.p1 = 1; +var result = "result"; +var value = "value"; +var myObj = {p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +try { + var f = function(){ + throw value; + p1 = 'x1'; + } + with(myObj){ + f(); + } +} catch(e){ + result = e; +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(myObj.p1 === "a")){ + $ERROR('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(result === "value")){ + $ERROR('#3: result === "value". Actual: result ==='+ result ); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.12_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.12_T1.js new file mode 100644 index 000000000..91efaa23e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.12_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. + +/** + * @name: S12.10_A3.12_T1; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Calling a function without "with" statement declared within the statement, leading to normal completion; + * @strict_mode_negative + */ +this.p1 = 1; +var result = "result"; +var myObj = {p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +with(myObj){ + var f = function(){ + p1 = 'x1'; + } +} + +f(); + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.12_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.12_T2.js new file mode 100644 index 000000000..7c49c8a09 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.12_T2.js @@ -0,0 +1,39 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A3.12_T2; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Calling a function without "with" statement declared within the statement, leading to normal completion by "return"; + * @strict_mode_negative + */ +this.p1 = 1; +var result = "result"; +var value = "value"; +var myObj = {p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +with(myObj){ + var f = function(){ + p1 = 'x1' + return value; + } +} + +result = f(); + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(result === "myObj_value")){ + $ERROR('#3: result === "myObj_value". Actual: result ==='+ result ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.12_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.12_T3.js new file mode 100644 index 000000000..050bad4a1 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.12_T3.js @@ -0,0 +1,38 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A3.12_T3; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Calling a function without "with" statement declared within the statement, leading to normal completion by "return"; + * @strict_mode_negative + */ +this.p1 = 1; +var result = "result"; +var value = "value"; +var myObj = {p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +with(myObj){ + var f = function(){ + return value; + p1 = 'x1'; + } +} +result = f(); + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(myObj.p1 === "a")){ + $ERROR('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(result === "myObj_value")){ + $ERROR('#3: result === "myObj_value". Actual: result ==='+ result ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.12_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.12_T4.js new file mode 100644 index 000000000..ba6f77735 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.12_T4.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. + +/** + * @name: S12.10_A3.12_T4; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Calling a function without "with" statement declared within the statement, leading to completion by exception; + * @strict_mode_negative + */ +this.p1 = 1; +var result = "result"; +var value = "value"; +var myObj = {p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +try { + with(myObj){ + var f = function(){ + p1 = 'x1'; + throw value; + } + } + f(); +} catch(e){ + result = e; +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(myObj.p1 === "x1")){ + $ERROR('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(result === "myObj_value")){ + $ERROR('#3: result === "myObj_value". Actual: result ==='+ result ); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.12_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.12_T5.js new file mode 100644 index 000000000..fb27553b1 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.12_T5.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. + +/** + * @name: S12.10_A3.12_T5; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Calling a function without "with" statement declared within the statement, leading to completion by exception; + * @strict_mode_negative + */ +this.p1 = 1; +var result = "result"; +var value = "value"; +var myObj = {p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +try { + with(myObj){ + var f = function(){ + throw value; + p1 = 'x1'; + } + } + f(); +} catch(e){ + result = e; +} + +if(!(p1 === 1)){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} + +if(!(myObj.p1 === "a")){ + $ERROR('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} + +if(!(result === "myObj_value")){ + $ERROR('#3: result === "myObj_value". Actual: result ==='+ result ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.1_T1.js new file mode 100644 index 000000000..26c37ac14 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/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. + +/** + * @name: S12.10_A3.1_T1; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Using "with" statement within global context - normal completion; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + + +with(myObj){ + p1 = 'x1'; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + $ERROR('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.1_T2.js new file mode 100644 index 000000000..4746c2ad1 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.1_T2.js @@ -0,0 +1,58 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A3.1_T2; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Using "with" statement within global context, leading to completion by exception; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +try { + + with(myObj){ + + p1 = 'x1' + throw value; + + } +} catch(e){ + result = p1; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(result !== 1){ + $ERROR('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(p1 !== 1){ + $ERROR('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (myObj.p1 !== "x1") { + $ERROR('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.1_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.1_T3.js new file mode 100644 index 000000000..c757b57d9 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.1_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. + +/** + * @name: S12.10_A3.1_T3; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Using "with" statement within global context, leading to completion by exception; + * @strict_mode_negative + */ +this.p1 = 1; +var result = "result"; +var myObj = {p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +try { + + with(myObj){ + + throw value; + p1 = 'x1' + } +} catch(e){ + result = p1; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(!(result === 1)){ + $ERROR('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(!(p1 === 1)){ + $ERROR('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(!(myObj.p1 === "a")){ + $ERROR('#3: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + + + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.2_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.2_T1.js new file mode 100644 index 000000000..1da1b7ee2 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.2_T1.js @@ -0,0 +1,45 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A3.2_T1; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Declaring "with" statement within a function body, leading to normal completion; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +var f = function(){ + with(myObj){ + p1 = 'x1'; + } +} + +f(); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + $ERROR('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.2_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.2_T2.js new file mode 100644 index 000000000..cbca41680 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.2_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. + +/** + * @name: S12.10_A3.2_T2; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Declaring "with" statement within a function body, leading to normal completion by "return"; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +var f = function(){ + with(myObj){ + p1 = 'x1'; + return value; + } +}; + +f(); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(myObj.p1 !== "x1"){ + $ERROR('#1: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.2_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.2_T3.js new file mode 100644 index 000000000..a6b1b3c1e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.2_T3.js @@ -0,0 +1,46 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A3.2_T3; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Declaring "with" statement within a function body, leading to normal completion by "return"; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +var f = function(){ + with(myObj){ + return value; + p1 = 'x1'; + } +}; + +f(); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "a"){ + $ERROR('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.2_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.2_T4.js new file mode 100644 index 000000000..9e7dedad4 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.2_T4.js @@ -0,0 +1,59 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A3.2_T4; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Declaring "with" statement within a function body, leading to completion by exception; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +try { + var f = function(){ + with(myObj){ + p1 = 'x1'; + throw value; + } + }; + + f(); +} catch(e){ + result = p1; +} + + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(result !== 1){ + $ERROR('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(p1 !== 1){ + $ERROR('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "x1"){ + $ERROR('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.2_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.2_T5.js new file mode 100644 index 000000000..c1289305c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/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. + +/** + * @name: S12.10_A3.2_T5; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Declaring "with" statement within a function body, leading to completion by exception; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +}; + +try { + var f = function(){ + with(myObj){ + throw value; + p1 = 'x1'; + } + }; + f(); +} catch(e){ + result = p1; +} + + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(result !== 1){ + $ERROR('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(p1 !== 1){ + $ERROR('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "a"){ + $ERROR('#3: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + + + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.3_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.3_T1.js new file mode 100644 index 000000000..fc3ab3d91 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.3_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. + +/** + * @name: S12.10_A3.3_T1; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Declaring "with" statement within a function constructor, leading to normal completion; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +function __FACTORY(){ + with(myObj){ + p1 = 'x1'; + } +} + +var obj = new __FACTORY(); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + $ERROR('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.3_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.3_T2.js new file mode 100644 index 000000000..6b5969d5f --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.3_T2.js @@ -0,0 +1,46 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A3.3_T2; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Declaring "with" statement within a function constructor, leading to normal completion by "return"; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +function __FACTORY(){ + with(myObj){ + p1 = 'x1'; + return value; + } +} + +var obj = new __FACTORY; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + $ERROR('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.3_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.3_T3.js new file mode 100644 index 000000000..9affbbb98 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.3_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. + +/** + * @name: S12.10_A3.3_T3; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Declaring "with" statement within a function constructor, leading to normal completion by "return"; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +function __FACTORY(){ + with(myObj){ + return value; + p1 = 'x1'; + } +} + +var obj = new __FACTORY; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "a"){ + $ERROR('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.3_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.3_T4.js new file mode 100644 index 000000000..9932f9d9b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.3_T4.js @@ -0,0 +1,59 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A3.3_T4; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Declaring "with" statement within a function + * constructor, leading to completion by exception; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +}; + +function __FACTORY(){ + with(myObj){ + var p1 = 'x1'; + throw value; + } +} + +try { + var obj = new __FACTORY(); +} catch(e){ + result = p1; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (result !== 1) { + $ERROR('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (p1 !== 1) { + $ERROR('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (myObj.p1 !== "x1") { + $ERROR('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.3_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.3_T5.js new file mode 100644 index 000000000..7d6e8571a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.3_T5.js @@ -0,0 +1,58 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A3.3_T5; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Declaring "with" statement within a function constructor, leading to completion by exception; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +try { + function __FACTORY(){ + with(myObj){ + throw value; + p1 = 'x1'; + } + } + var obj = new __FACTORY(); +} catch(e){ + result = p1; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(result !== 1){ + $ERROR('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(p1 !== 1){ + $ERROR('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "a"){ + $ERROR('#3: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.4_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.4_T1.js new file mode 100644 index 000000000..c5bdd2c78 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.4_T1.js @@ -0,0 +1,45 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A3.4_T1; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Using "with" statement within iteration statement, leading to normal completion; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +do { + with(myObj){ + p1 = 'x1'; + } +} while(false); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + $ERROR('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.4_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.4_T2.js new file mode 100644 index 000000000..c975dd8c0 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.4_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. + +/** + * @name: S12.10_A3.4_T2; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Using "with" statement within iteration statement, leading to completion by exception; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +try { + do{ + with(myObj){ + p1 = 'x1'; + throw value; + } + } while(false); +} catch(e){ + result = p1; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(result !== 1){ + $ERROR('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(p1 !== 1){ + $ERROR('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "x1"){ + $ERROR('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.4_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.4_T3.js new file mode 100644 index 000000000..56615fc12 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.4_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. + +/** + * @name: S12.10_A3.4_T3; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Using "with" statement within iteration statement, leading to completion by exception; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +try { + do{ + with(myObj){ + throw value; + p1 = 'x1'; + } + } while(false); +} catch(e){ + result = p1; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(result !== 1){ + $ERROR('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(p1 !== 1){ + $ERROR('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "a"){ + $ERROR('#3: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.4_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.4_T4.js new file mode 100644 index 000000000..bf7d87fa2 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.4_T4.js @@ -0,0 +1,46 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A3.4_T4; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Using "with" statement within iteration statement, leading to completion by break; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +do { + with(myObj){ + p1 = 'x1'; + break; + } +} while(false); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + $ERROR('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.4_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.4_T5.js new file mode 100644 index 000000000..6da97f002 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.4_T5.js @@ -0,0 +1,46 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A3.4_T5; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Using "with" statement within iteration statement, leading to completion by break; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +do { + with(myObj){ + break; + p1 = 'x1'; + } +} while(false); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "a"){ + $ERROR('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.5_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.5_T1.js new file mode 100644 index 000000000..fe68264ca --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.5_T1.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. + +/** + * @name: S12.10_A3.5_T1; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Using "with" statement within "for-in" statement, leading to normal completion; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +for(var prop in myObj){ + with(myObj){ + p1 = 'x1'; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + $ERROR('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.5_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.5_T2.js new file mode 100644 index 000000000..23d728348 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.5_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. + +/** + * @name: S12.10_A3.5_T2; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Using "with" statement within "for-in" statement, leading to completion by exception; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +try { + for(var prop in myObj){ + with(myObj){ + p1 = 'x1'; + throw value; + } + } +} catch(e){ + result = p1; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(result !== 1){ + $ERROR('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(p1 !== 1){ + $ERROR('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "x1"){ + $ERROR('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.5_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.5_T3.js new file mode 100644 index 000000000..f2309145f --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.5_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. + +/** + * @name: S12.10_A3.5_T3; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Using "with" statement within "for-in" statement, leading to completion by exception; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +try { + for(var prop in myObj){ + with(myObj){ + throw value; + p1 = 'x1'; + } + } +} catch(e){ + result = p1; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(result !== 1){ + $ERROR('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(p1 !== 1){ + $ERROR('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "a"){ + $ERROR('#3: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.5_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.5_T4.js new file mode 100644 index 000000000..660cc145d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.5_T4.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. + +/** + * @name: S12.10_A3.5_T4; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Using "with" statement within "for-in" statement, leading to completion by break; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +for(var prop in myObj){ + with(myObj){ + p1 = 'x1'; + break; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + $ERROR('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.5_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.5_T5.js new file mode 100644 index 000000000..661994155 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.5_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. + +/** + * @name: S12.10_A3.5_T5; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Using "with" statement within "for-in" statement, leading to completion by break; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +for(var prop in myObj){ + with(myObj){ + break; + p1 = 'x1'; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(myObj.p1 !== "a"){ + $ERROR('#1: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.6_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.6_T1.js new file mode 100644 index 000000000..68f14f116 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.6_T1.js @@ -0,0 +1,59 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A3.6_T1; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Using "with" statement within another "with" statement, leading to normal completion; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +var theirObj = { + p1: true, + value: 'theirObj_value', + valueOf : function(){return 'thr_valueOf';} +} + +with(myObj){ + with(theirObj){ + p1 = 'x1'; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "a"){ + $ERROR('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(theirObj.p1 !== "x1"){ + $ERROR('#3: theirObj.p1 === "x1". Actual: theirObj.p1 ==='+ theirObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.6_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.6_T2.js new file mode 100644 index 000000000..c56da025c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.6_T2.js @@ -0,0 +1,64 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A3.6_T2; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Using "with" statement within another "with" statement, leading to completion by exception; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +var theirObj = { + p1: true, + value: 'theirObj_value', + valueOf : function(){return 'thr_valueOf';} +} + + +try { + with(myObj){ + with(theirObj){ + p1 = 'x1'; + throw value; + } + } +} catch(e){ + result = p1; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "a"){ + $ERROR('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(theirObj.p1 !== "x1"){ + $ERROR('#3: theirObj.p1 === "x1". Actual: theirObj.p1 ==='+ theirObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.6_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.6_T3.js new file mode 100644 index 000000000..54bd93a7c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.6_T3.js @@ -0,0 +1,65 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A3.6_T3; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Using "with" statement within another "with" statement, leading to completion by exception; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +var theirObj = { + p1: true, + value: 'theirObj_value', + valueOf : function(){return 'thr_valueOf';} +} + + +try { + with(myObj){ + with(theirObj){ + throw value; + p1 = 'x1'; + + } + } +} catch(e){ + result = p1; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "a"){ + $ERROR('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(theirObj.p1 !== true){ + $ERROR('#3: theirObj.p1 === true. Actual: theirObj.p1 ==='+ theirObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.7_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.7_T1.js new file mode 100644 index 000000000..666ed900d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.7_T1.js @@ -0,0 +1,45 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A3.7_T1; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Declaring and calling a function within "with" statement, leading to normal completion; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +with(myObj){ + (function(){ + p1 = 'x1'; + })(); +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + $ERROR('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.7_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.7_T2.js new file mode 100644 index 000000000..407bcddcc --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.7_T2.js @@ -0,0 +1,54 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A3.7_T2; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Declaring and calling a function within "with" statement, leading to normal completion by "return"; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +with(myObj){ + result=(function(){ + p1 = 'x1'; + return value; + })(); +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(result !== "myObj_value"){ + $ERROR('#2: result === "myObj_value". Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "x1"){ + $ERROR('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.7_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.7_T3.js new file mode 100644 index 000000000..34750863b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.7_T3.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A3.7_T3; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Declaring and calling a function within "with" statement, leading to normal completion by "return"; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +with(myObj){ + result=(function(){ + return value; + p1 = 'x1'; + })(); +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(result !== 'myObj_value'){ + $ERROR('#2: result === \'myObj_value\'. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "a"){ + $ERROR('#3: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.7_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.7_T4.js new file mode 100644 index 000000000..abf1a534a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.7_T4.js @@ -0,0 +1,56 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A3.7_T4; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Declaring and calling a function within "with" statement, leading to completion by exception; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +try { + with(myObj){ + (function (){ + p1 = 'x1'; + throw value; + })(); + } +} catch(e){ + result = p1; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(result !== 1){ + $ERROR('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(p1 !== 1){ + $ERROR('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "x1"){ + $ERROR('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.7_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.7_T5.js new file mode 100644 index 000000000..a31ec4583 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.7_T5.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. + +/** + * @name: S12.10_A3.7_T5; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Declaring and calling a function within "with" statement, leading to completion by exception; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +try { + with(myObj){ + (function f(){ + throw value; + p1 = 'x1'; + })(); + } +} catch(e){ + result = p1; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(result !== 1){ + $ERROR('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(p1 !== 1){ + $ERROR('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "a"){ + $ERROR('#3: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.8_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.8_T1.js new file mode 100644 index 000000000..88474f834 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.8_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. + +/** + * @name: S12.10_A3.8_T1; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Declaring function constructor within "with" statement, leading to normal completion; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +with(myObj){ + var __FACTORY = function(){ + p1 = 'x1'; + } + var obj = new __FACTORY; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + $ERROR('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.8_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.8_T2.js new file mode 100644 index 000000000..f208f29be --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.8_T2.js @@ -0,0 +1,45 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A3.8_T2; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Declaring function constructor within "with" statement, leading to normal completion by "return"; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +with(myObj){ + var __FACTORY = function(){ + p1 = 'x1'; + return value; + } + var obj = new __FACTORY; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + $ERROR('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.8_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.8_T3.js new file mode 100644 index 000000000..507384ecf --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.8_T3.js @@ -0,0 +1,45 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A3.8_T3; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Declaring function constructor within "with" statement, leading to normal completion by "return"; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +with(myObj){ + var __FACTORY = function(){ + return value; + p1 = 'x1'; + } + var obj = new __FACTORY; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "a"){ + $ERROR('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.8_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.8_T4.js new file mode 100644 index 000000000..2366bbb01 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.8_T4.js @@ -0,0 +1,57 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A3.8_T4; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Declaring function constructor within "with" statement, leading to completion by exception; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +try { + with(myObj){ + var __FACTORY = function(){ + p1 = 'x1'; + throw value; + } + var obj = new __FACTORY; + } +} catch(e){ + result = p1; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(result !== 1){ + $ERROR('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(p1 !== 1){ + $ERROR('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "x1"){ + $ERROR('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.8_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.8_T5.js new file mode 100644 index 000000000..a12766435 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.8_T5.js @@ -0,0 +1,57 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A3.8_T5; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Declaring function constructor within "with" statement, leading to completion by exception; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +try { + with(myObj){ + var __FACTORY = function(){ + throw value; + p1 = 'x1'; + } + var obj = new __FACTORY; + } +} catch(e){ + result = p1; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(result !== 1){ + $ERROR('#1: result === 1. Actual: result ==='+ result ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(p1 !== 1){ + $ERROR('#2: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 !== "a"){ + $ERROR('#3: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.9_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.9_T1.js new file mode 100644 index 000000000..4c03877e9 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.9_T1.js @@ -0,0 +1,45 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A3.9_T1; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Using "for-in" statement within "with" statement, leading to normal completion; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +with(myObj){ + for(var prop in myObj){ + p1 = 'x1'; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + $ERROR('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.9_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.9_T2.js new file mode 100644 index 000000000..b5fdee851 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.9_T2.js @@ -0,0 +1,45 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A3.9_T2; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Using "for-in" statement within "with" statement, leading to completion by break; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +with(myObj){ + for(var prop in myObj){ + p1 = 'x1'; + break; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "x1"){ + $ERROR('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.9_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.9_T3.js new file mode 100644 index 000000000..e5482ec64 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A3.9_T3.js @@ -0,0 +1,45 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A3.9_T3; + * @section: 12.10; + * @assertion: No matter how control leaves the embedded 'Statement', + * the scope chain is always restored to its former state; + * @description: Using "for-in" statement within "with" statement, leading to completion by break; + * @strict_mode_negative + */ + +this.p1 = 1; + +var result = "result"; + +var myObj = { + p1: 'a', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';} +} + +with(myObj){ + for(var prop in myObj){ + break; + p1 = 'x1'; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(p1 !== 1){ + $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== "a"){ + $ERROR('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A4_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A4_T1.js new file mode 100644 index 000000000..5beb7fd07 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A4_T1.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A4_T1; + * @section: 12.10; + * @assertion: Changing property using "eval" statement containing "with" statement; + * @description: Changing string property; + * @strict_mode_negative + */ + +this.p1 = 1; +var myObj = { + p1: 'a', +} +eval("with(myObj){p1='b'}"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(myObj.p1 !== 'b'){ + $ERROR('#1: myObj.p1 === "b". Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 === 1){ + $ERROR('#2: myObj.p1 !== 1'); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A4_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A4_T2.js new file mode 100644 index 000000000..207ecf8ca --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A4_T2.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A4_T2; + * @section: 12.10; + * @assertion: Changing property using "eval" statement containing "with" statement; + * @description: Changing number property; + * @strict_mode_negative + */ + +this.p1 = 'a'; +var myObj = { + p1: 1, +} +eval("with(myObj){p1=2}"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(myObj.p1 !== 2){ + $ERROR('#1: myObj.p1 === 2. Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 === 'a'){ + $ERROR('#2: myObj.p1 !== \'a\''); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A4_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A4_T3.js new file mode 100644 index 000000000..0b91f7b88 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A4_T3.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A4_T3; + * @section: 12.10; + * @assertion: Changing property using "eval" statement containing "with" statement; + * @description: Changing boolean property; + * @strict_mode_negative + */ + +this.p1 = 'a'; +var myObj = { + p1: true, +} +eval("with(myObj){p1=false}"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(myObj.p1 !== false){ + $ERROR('#1: myObj.p1 === false. Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 === 'a'){ + $ERROR('#2: myObj.p1 !== \'a\''); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A4_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A4_T4.js new file mode 100644 index 000000000..e9cc027bf --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A4_T4.js @@ -0,0 +1,41 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A4_T4; + * @section: 12.10; + * @assertion: Changing property using "eval" statement containing "with" statement; + * @description: Changing object property; + * @strict_mode_negative + */ + +this.p1 = 'a'; +var myObj = { + p1: {a:"hello"}, +} +eval("with(myObj){p1={b:'hi'}}"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(myObj.p1.a === "hello"){ + $ERROR('#1: myObj.p1.a !== "hello"'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1.b !== "hi"){ + $ERROR('#2: myObj.p1.b === "hi". Actual: myObj.p1.b ==='+ myObj.p1.b ); +} +// +////////////////////////////////////////////////////////////////////////////// + + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 === 'a'){ + $ERROR('#3: myObj.p1 !== \'a\''); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A4_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A4_T5.js new file mode 100644 index 000000000..a425de8ce --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A4_T5.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A4_T5; + * @section: 12.10; + * @assertion: Changing property using "eval" statement containing "with" statement; + * @description: Changing array property; + * @strict_mode_negative + */ + +this.p1 = 'a'; +var myObj = { + p1: [1,2,3], +} +eval("with(myObj){p1=[3,2,1]}"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(myObj.p1[2] !== 1){ + $ERROR('#1: myObj.p1[2] === 1. Actual: myObj.p1[2] ==='+ myObj.p1[2] ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 === 'a'){ + $ERROR('#2: myObj.p1 !== \'a\''); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A4_T6.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A4_T6.js new file mode 100644 index 000000000..036f64d7b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A4_T6.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A4_T6; + * @section: 12.10; + * @assertion: Changing property using "eval" statement containing "with" statement; + * @description: Changing function property; + * @strict_mode_negative + */ + +this.p1 = 'a'; +var myObj = { + p1: function(){return 0;}, +} +eval("with(myObj){p1=function(){return 1;}}"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(myObj.p1() !== 1){ + $ERROR('#1: myObj.p1 === 1. Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.p1 === 'a'){ + $ERROR('#2: myObj.p1 !== \'a\''); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A5_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A5_T1.js new file mode 100644 index 000000000..bbcce8bbe --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A5_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. + +/** + * @name: S12.10_A5_T1; + * @section: 12.10; + * @assertion: Deleting property using "eval" statement containing "with" statement; + * @description: Deleting string property; + * @strict_mode_negative + */ + +this.p1 = 1; +var myObj = { + p1: 'a', + del:false +} +eval("with(myObj){del = delete p1}"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(myObj.p1 === 'a'){ + $ERROR('#1: myObj.p1 !== "a"'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== undefined){ + $ERROR('#2: myObj.p1 === undefined. Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.del !== true){ + $ERROR('#3: myObj.del === true. Actual: myObj.del ==='+ myObj.del ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if(myObj.p1 === 1){ + $ERROR('#4: myObj.p1 !== 1'); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A5_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A5_T2.js new file mode 100644 index 000000000..29e3f28b8 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A5_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. + +/** + * @name: S12.10_A5_T2; + * @section: 12.10; + * @assertion: Deleting property using "eval" statement containing "with" statement; + * @description: Deleting number property; + * @strict_mode_negative + */ + +this.p1 = 'a'; +var myObj = { + p1: 1, + del:false +} +eval("with(myObj){del = delete p1}"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(myObj.p1 === 1){ + $ERROR('#1: myObj.p1 !== 1'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== undefined){ + $ERROR('#2: myObj.p1 === undefined . Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.del !== true){ + $ERROR('#3: myObj.del === true. Actual: myObj.del ===. Actual: myObj.del ==='+ myObj.del +myObj.del); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if(myObj.p1 === 'a'){ + $ERROR('#4: myObj.p1 !== \'a\''); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A5_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A5_T3.js new file mode 100644 index 000000000..d5632a21d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A5_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. + +/** + * @name: S12.10_A5_T3; + * @section: 12.10; + * @assertion: Deleting property using "eval" statement containing "with" statement; + * @description: Deleting boolean property; + * @strict_mode_negative + */ + +this.p1 = 'a'; +var myObj = { + p1: true, + del:false +} + +eval("with(myObj){del = delete p1}"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(myObj.p1 === true){ + $ERROR('#1: myObj.p1 !== true '); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== undefined){ + $ERROR('#2: myObj.p1 === undefined . Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.del !== true){ + $ERROR('#3: myObj.del === true . Actual: myObj.del ==='+ myObj.del ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if(myObj.p1 === 'a'){ + $ERROR('#4: myObj.p1 !== \'a\''); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A5_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A5_T4.js new file mode 100644 index 000000000..4316fabee --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A5_T4.js @@ -0,0 +1,54 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A5_T4; + * @section: 12.10; + * @assertion: Deleting property using "eval" statement containing "with" statement; + * @description: Deleting object property; + * @strict_mode_negative + */ + +this.p1 = 'a'; +var myObj = { + p1: {a:"hello"}, + del:false +} +eval("with(myObj){del = delete p1}"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try{ +if(myObj.p1.a === "hello"){ + $ERROR('#1: myObj.p1.a !== "hello" '); +} +}catch(e){var x=1}; +if(x !== 1){ + $ERROR('#1: x === 1. Actual: x ==='+ x ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== undefined){ + $ERROR('#2: myObj.p1 === undefined . Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.del !== true){ + $ERROR('#3: myObj.del === true . Actual: myObj.del ==='+ myObj.del ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if(myObj.p1 === 'a'){ + $ERROR('#4: myObj.p1 !== \'a\''); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A5_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A5_T5.js new file mode 100644 index 000000000..4351c21ec --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A5_T5.js @@ -0,0 +1,54 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A5_T5; + * @section: 12.10; + * @assertion: Deleting property using "eval" statement containing "with" statement; + * @description: Deleting array property; + * @strict_mode_negative + */ + +this.p1 = 'a'; +var myObj = { + p1: [1,2,3], + del:false +} +eval("with(myObj){del = delete p1}"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try{ +if(myObj.p1[2] === 3){ + $ERROR('#1: myObj.p1[2] !== 3 '); +} +}catch(e){var x=1}; +if(x !== 1){ + $ERROR('#1: x === 1. Actual: x ==='+ x ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== undefined){ + $ERROR('#2: myObj.p1 === undefined . Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.del !== true){ + $ERROR('#3: myObj.del === true . Actual: myObj.del ==='+ myObj.del ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if(myObj.p1 === 'a'){ + $ERROR('#4: myObj.p1 !== \'a\''); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A5_T6.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A5_T6.js new file mode 100644 index 000000000..b1202f195 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.10_The_with_Statement/S12.10_A5_T6.js @@ -0,0 +1,54 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.10_A5_T6; + * @section: 12.10; + * @assertion: Deleting property using "eval" statement containing "with" statement; + * @description: Deleting function property; + * @strict_mode_negative + */ + +this.p1 = 'a'; +var myObj = { + p1: function(){return 0;}, + del:false +} +eval("with(myObj){del = delete p1}"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try{ +if(myObj.p1() === 0){ + $ERROR('#1: myObj.p1() !== 0 '); +} +}catch(e){var x=1}; +if(x !== 1){ + $ERROR('#1: x === 1. Actual: x ==='+ x ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(myObj.p1 !== undefined){ + $ERROR('#2: myObj.p1 === undefined . Actual: myObj.p1 ==='+ myObj.p1 ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(myObj.del !== true){ + $ERROR('#3: myObj.del === true . Actual: myObj.del ==='+ myObj.del ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if(myObj.p1 === 'a'){ + $ERROR('#4: myObj.p1 !== \'a\''); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.11_The_switch_Statement/S12.11_A1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.11_The_switch_Statement/S12.11_A1_T1.js new file mode 100644 index 000000000..6e9432bcc --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.11_The_switch_Statement/S12.11_A1_T1.js @@ -0,0 +1,73 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.11_A1_T1; + * @section: 12.11; + * @assertion: If Result.type is break and Result.target is in the current + * label set, return (normal, Result.value, empty); + * @description: Simple test using switch statement; +*/ + +function SwitchTest(value){ + var result = 0; + + switch(value) { + case 0: + result += 2; + case 1: + result += 4; + break; + case 2: + result += 8; + case 3: + result += 16; + default: + result += 32; + break; + case 4: + result += 64; + } + + return result; +} + +if(!(SwitchTest(0) === 6)){ + $ERROR("#1: SwitchTest(0) === 6. Actual: SwitchTest(0) ==="+ SwitchTest(0) ); +} + +if(!(SwitchTest(1) === 4)){ + $ERROR("#2: SwitchTest(1) === 4. Actual: SwitchTest(1) ==="+ SwitchTest(1) ); +} + +if(!(SwitchTest(2) === 56)){ + $ERROR("#3: SwitchTest(2) === 56. Actual: SwitchTest(2) ==="+ SwitchTest(2) ); +} + +if(!(SwitchTest(3) === 48)){ + $ERROR("#4: SwitchTest(3) === 48. Actual: SwitchTest(3) ==="+ SwitchTest(3) ); +} + +if(!(SwitchTest(4) === 64)){ + $ERROR("#5: SwitchTest(4) === 64. Actual: SwitchTest(4) ==="+ SwitchTest(4) ); +} + +if(!(SwitchTest(true) === 32)){ + $ERROR("#6: SwitchTest(true) === 32. Actual: SwitchTest(true) ==="+ SwitchTest(true) ); +} + +if(!(SwitchTest(false) === 32)){ + $ERROR("#7: SwitchTest(false) === 32. Actual: SwitchTest(false) ==="+ SwitchTest(false) ); +} + +if(!(SwitchTest(null) === 32)){ + $ERROR("#8: SwitchTest(null) === 32. Actual: SwitchTest(null) ==="+ SwitchTest(null) ); +} + +if(!(SwitchTest(void 0) === 32)){ + $ERROR("#9: SwitchTest(void 0) === 32. Actual: SwitchTest(void 0) ==="+ SwitchTest(void 0) ); +} + +if(!(SwitchTest('0') === 32)){ + $ERROR("#10: SwitchTest('0') === 32. Actual: SwitchTest('0') ==="+ SwitchTest('0') ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.11_The_switch_Statement/S12.11_A1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.11_The_switch_Statement/S12.11_A1_T2.js new file mode 100644 index 000000000..7bcc32d6c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.11_The_switch_Statement/S12.11_A1_T2.js @@ -0,0 +1,87 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.11_A1_T2; + * @section: 12.11; + * @assertion: If Result.type is break and Result.target is in the current + * label set, return (normal, Result.value, empty); + * @description: Switch with different types of variables; +*/ + +var x = new Number(2); + +function SwitchTest(value){ + var result = 0; + + switch(value) { + case 0: + result += 2; + case '1': + result += 4; + break; + case new Number(2): + result += 8; + case 3: + result += 16; + default: + result += 32; + break; + case 4: + result += 64; + break; + case x: + result += 128; + break; + case 0: + result += 256; + case 1: + result += 512; + } + + return result; +} + +if(!(SwitchTest(0) === 6)){ + $ERROR("#1: SwitchTest(0) === 6. Actual: SwitchTest(0) ==="+ SwitchTest(0) ); +} + +if(!(SwitchTest(1) === 512)){ + $ERROR("#2: SwitchTest(1) === 512. Actual: SwitchTest(1) ==="+ SwitchTest(1) ); +} + +if(!(SwitchTest(2) === 32)){ + $ERROR("#3: SwitchTest(2) === 32. Actual: SwitchTest(2) ==="+ SwitchTest(2) ); +} + +if(!(SwitchTest(3) === 48)){ + $ERROR("#4: SwitchTest(3) === 48. Actual: SwitchTest(3) ==="+ SwitchTest(3) ); +} + +if(!(SwitchTest(4) === 64)){ + $ERROR("#5: SwitchTest(4) === 64. Actual: SwitchTest(4) ==="+ SwitchTest(4) ); +} + +if(!(SwitchTest(true) === 32)){ + $ERROR("#6: SwitchTest(true) === 32. Actual: SwitchTest(true) ==="+ SwitchTest(true) ); +} + +if(!(SwitchTest(false) === 32)){ + $ERROR("#7: SwitchTest(false) === 32. Actual: SwitchTest(false) ==="+ SwitchTest(false) ); +} + +if(!(SwitchTest(null) === 32)){ + $ERROR("#8: SwitchTest(null) === 32. Actual: SwitchTest(null) ==="+ SwitchTest(null) ); +} + +if(!(SwitchTest(void 0) === 32)){ + $ERROR("#9: SwitchTest(void 0) === 32. Actual: SwitchTest(void 0) ==="+ SwitchTest(void 0) ); +} + +if(!(SwitchTest('0') === 32)){ + $ERROR("#10: SwitchTest('0') === 32. Actual: SwitchTest('0') ==="+ SwitchTest('0') ); +} + +if(!(SwitchTest(x) === 128)){ + $ERROR("#10: SwitchTest(x) === 128. Actual: SwitchTest(x) ==="+ SwitchTest(x) ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.11_The_switch_Statement/S12.11_A1_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.11_The_switch_Statement/S12.11_A1_T3.js new file mode 100644 index 000000000..bf500dc4e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.11_The_switch_Statement/S12.11_A1_T3.js @@ -0,0 +1,91 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.11_A1_T3; + * @section: 12.11; + * @assertion: If Result.type is break and Result.target is in the current + * label set, return (normal, Result.value, empty); + * @description: Using case with null, NaN, Infinity; +*/ + +function SwitchTest(value){ + var result = 0; + + switch(value) { + case 0: + result += 2; + case 1: + result += 4; + break; + case 2: + result += 8; + case 3: + result += 16; + default: + result += 32; + break; + case null: + result += 64; + case NaN: + result += 128; + break; + case Infinity: + result += 256; + case 2+3: + result += 512; + break; + case undefined: + result += 1024; + } + + return result; +} + +if(!(SwitchTest(0) === 6)){ + $ERROR("#1: SwitchTest(0) === 6. Actual: SwitchTest(0) ==="+ SwitchTest(0) ); +} + +if(!(SwitchTest(1) === 4)){ + $ERROR("#2: SwitchTest(1) === 4. Actual: SwitchTest(1) ==="+ SwitchTest(1) ); +} + +if(!(SwitchTest(2) === 56)){ + $ERROR("#3: SwitchTest(2) === 56. Actual: SwitchTest(2) ==="+ SwitchTest(2) ); +} + +if(!(SwitchTest(3) === 48)){ + $ERROR("#4: SwitchTest(3) === 48. Actual: SwitchTest(3) ==="+ SwitchTest(3) ); +} + +if(!(SwitchTest(4) === 32)){ + $ERROR("#5: SwitchTest(4) === 32. Actual: SwitchTest(4) ==="+ SwitchTest(4) ); +} + +if(!(SwitchTest(5) === 512)){ + $ERROR("#5: SwitchTest(5) === 512. Actual: SwitchTest(5) ==="+ SwitchTest(5) ); +} + +if(!(SwitchTest(true) === 32)){ + $ERROR("#6: SwitchTest(true) === 32. Actual: SwitchTest(true) ==="+ SwitchTest(true) ); +} + +if(!(SwitchTest(false) === 32)){ + $ERROR("#7: SwitchTest(false) === 32. Actual: SwitchTest(false) ==="+ SwitchTest(false) ); +} + +if(!(SwitchTest(null) === 192)){ + $ERROR("#8: SwitchTest(null) === 192. Actual: SwitchTest(null) ==="+ SwitchTest(null) ); +} + +if(!(SwitchTest(void 0) === 1024)){ + $ERROR("#9: SwitchTest(void 0) === 1024. Actual: SwitchTest(void 0) ==="+ SwitchTest(void 0) ); +} + +if(!(SwitchTest(NaN) === 32)){ + $ERROR("#10: SwitchTest(NaN) === 32. Actual: SwitchTest(NaN) ==="+ SwitchTest(NaN) ); +} + +if(!(SwitchTest(Infinity) === 768)){ + $ERROR("#10: SwitchTest(NaN) === 768. Actual: SwitchTest(NaN) ==="+ SwitchTest(NaN) ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.11_The_switch_Statement/S12.11_A1_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.11_The_switch_Statement/S12.11_A1_T4.js new file mode 100644 index 000000000..e16208ead --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.11_The_switch_Statement/S12.11_A1_T4.js @@ -0,0 +1,79 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.11_A1_T4; + * @section: 12.11; + * @assertion: If Result.type is break and Result.target is in the current + * label set, return (normal, Result.value, empty); + * @description: Using case with isNaN and isNaN(value); +*/ + +function SwitchTest(value){ + var result = 0; + + switch(value) { + case 0: + result += 2; + case 1: + result += 4; + break; + case 2: + result += 8; + case isNaN(value): + result += 16; + default: + result += 32; + break; + case null: + result += 64; + case isNaN: + result += 128; + break; + case Infinity: + result += 256; + case 2+3: + result += 512; + break; + case undefined: + result += 1024; + } + + return result; +} + +if(!(SwitchTest(eval('Number(false)')) === 6)){ + $ERROR("#1: SwitchTest(0) === 6. Actual: SwitchTest(0) ==="+ SwitchTest(0) ); +} + +if(!(SwitchTest(parseInt) === 32)){ + $ERROR("#2: SwitchTest(parseInt) === 32. Actual: SwitchTest(parseInt) ==="+ SwitchTest(parseInt) ); +} + +if(!(SwitchTest(isNaN) === 128)){ + $ERROR("#3: SwitchTest(isNaN) === 128. Actual: SwitchTest(isNaN) ==="+ SwitchTest(isNaN) ); +} + +if(!(SwitchTest(true) === 32)){ + $ERROR("#6: SwitchTest(true) === 32. Actual: SwitchTest(true) ==="+ SwitchTest(true) ); +} + +if(!(SwitchTest(false) === 48)){ + $ERROR("#7: SwitchTest(false) === 48. Actual: SwitchTest(false) ==="+ SwitchTest(false) ); +} + +if(!(SwitchTest(null) === 192)){ + $ERROR("#8: SwitchTest(null) === 192. Actual: SwitchTest(null) ==="+ SwitchTest(null) ); +} + +if(!(SwitchTest(void 0) === 1024)){ + $ERROR("#9: SwitchTest(void 0) === 1024. Actual: SwitchTest(void 0) ==="+ SwitchTest(void 0) ); +} + +if(!(SwitchTest(NaN) === 32)){ + $ERROR("#10: SwitchTest(NaN) === 32. Actual: SwitchTest(NaN) ==="+ SwitchTest(NaN) ); +} + +if(!(SwitchTest(Infinity) === 768)){ + $ERROR("#10: SwitchTest(NaN) === 768. Actual: SwitchTest(NaN) ==="+ SwitchTest(NaN) ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.11_The_switch_Statement/S12.11_A2_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.11_The_switch_Statement/S12.11_A2_T1.js new file mode 100644 index 000000000..a49811116 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.11_The_switch_Statement/S12.11_A2_T1.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.11_A2_T1; + * @section: 12.11; + * @assertion: There can be only one DefaultClause; + * @description: Duplicate DefaultClause; + * @negative; +*/ + +function SwitchTest(value){ + var result = 0; + + switch(value) { + case 0: + result += 2; + default: + result += 32; + break; + default: + result += 32; + break; + } + + return result; +} + +var x = SwitchTest(0); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.11_The_switch_Statement/S12.11_A3_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.11_The_switch_Statement/S12.11_A3_T1.js new file mode 100644 index 000000000..475cbcf2c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.11_The_switch_Statement/S12.11_A3_T1.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.11_A3_T1; + * @section: 12.11; + * @assertion: Syntax constructions of switch statement; + * @description: Checking if execution of "switch() {}" fails; + * @negative; +*/ + +function SwitchTest(value){ + var result = 0; + + switch() { + case 0: + result += 2; + default: + result += 32; + break; + } + + return result; +} + +var x = SwitchTest(0); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.11_The_switch_Statement/S12.11_A3_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.11_The_switch_Statement/S12.11_A3_T2.js new file mode 100644 index 000000000..d4d8c0e93 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.11_The_switch_Statement/S12.11_A3_T2.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.11_A3_T2; + * @section: 12.11; + * @assertion: Syntax constructions of switch statement; + * @description: Checking if execution of "switch {}" fails; + * @negative; +*/ + +function SwitchTest(value){ + var result = 0; + + switch { + case 0: + result += 2; + default: + result += 32; + break; + } + + return result; +} + +var x = SwitchTest(0); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.11_The_switch_Statement/S12.11_A3_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.11_The_switch_Statement/S12.11_A3_T3.js new file mode 100644 index 000000000..2c0982971 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.11_The_switch_Statement/S12.11_A3_T3.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.11_A3_T3; + * @section: 12.11; + * @assertion: Syntax constructions of switch statement; + * @description: Checking if execution of "switch(value)" fails; + * @negative; +*/ + +switch(value); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.11_The_switch_Statement/S12.11_A3_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.11_The_switch_Statement/S12.11_A3_T4.js new file mode 100644 index 000000000..7f022d653 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.11_The_switch_Statement/S12.11_A3_T4.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.11_A3_T4; + * @section: 12.11; + * @assertion: Syntax constructions of switch statement; + * @description: Using "case" that has no Expresson after it. "CaseClause: case Expression : [StatementList]"; + * @negative; +*/ + +function SwitchTest(value){ + var result = 0; + + switch(value) { + case: + result += 2; + default: + result += 32; + break; + } + + return result; +} + +var x = SwitchTest(0); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.11_The_switch_Statement/S12.11_A3_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.11_The_switch_Statement/S12.11_A3_T5.js new file mode 100644 index 000000000..eba1868ec --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.11_The_switch_Statement/S12.11_A3_T5.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.11_A3_T5; + * @section: 12.11; + * @assertion: Syntax constructions of switch statement; + * @description: Introducing statement not followed by "case" keyword; + * @negative; +*/ + +function SwitchTest(value){ + var result = 0; + + switch(value) { + result =2; + case 0: + result += 2; + default: + result += 32; + break; + } + + return result; +} + +var x = SwitchTest(0); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.11_The_switch_Statement/S12.11_A4_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.11_The_switch_Statement/S12.11_A4_T1.js new file mode 100644 index 000000000..b7fbd2a82 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.11_The_switch_Statement/S12.11_A4_T1.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.11_A4_T1; + * @section: 12.11; + * @assertion: Embedded syntax constructions of switch statement; + * @description: Nesting one "switch" statement into StatementList of the other's; +*/ + +function SwitchTest(value){ + var result = 0; + + switch(value) { + case 0: + switch(value) { + case 0: + result += 3; + break; + default: + result += 32; + break; + } + result *= 2; + break; + result=3; + default: + result += 32; + break; + } + return result; +} + +var x = SwitchTest(0); +if(x!==6) $ERROR("#1: SwitchTest(0) === 6. Actual: SwitchTest(0) ==="+ SwitchTest(0) ); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.12_Labelled_Statements/S12.12_A1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.12_Labelled_Statements/S12.12_A1_T1.js new file mode 100644 index 000000000..724921c93 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.12_Labelled_Statements/S12.12_A1_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.12_A1_T1; + * @section: 12.12; + * @assertion: Labelled statements are only used in conjunction with labelled + * break and continue statements; + * @description: Checking if labelled break works. See continue and break sections; +*/ + +var object = {p1: 1, p2: 1}; +var result = 0; +lbl: for(var i in object){ + result += object[i]; + break lbl; +} + +if(!(result === 1)){ + $ERROR("'break label' should break execution of labelled iteration statement"); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A1.js new file mode 100644 index 000000000..be310e00d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A1.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.13_A1; + * @section: 12.13; + * @assertion: Sanity test for throw statement; + * @description: Trying to throw exception with "throw"; + * @negative; + */ + +throw "error"; diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A2_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A2_T1.js new file mode 100644 index 000000000..b017454aa --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A2_T1.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.13_A2_T1; + * @section: 12.13; + * @assertion: "throw Expression" returns (throw, GetValue(Result(1)), empty), where 1 evaluates Expression; + * @description: Throwing undefined; + */ + +// CHECK#1 +try{ + throw undefined; +} +catch(e){ + if (e!==undefined) $ERROR('#1: Exception === undefined. Actual: Exception ==='+ e ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A2_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A2_T2.js new file mode 100644 index 000000000..d0dfd9318 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A2_T2.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.13_A2_T2; + * @section: 12.13; + * @assertion: "throw Expression" returns (throw, GetValue(Result(1)), empty), where 1 evaluates Expression; + * @description: Throwing null; + */ + +// CHECK#1 +try{ + throw null; +} +catch(e){ + if (e!==null) $ERROR('#1: Exception === null. Actual: Exception ==='+ e ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A2_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A2_T3.js new file mode 100644 index 000000000..537e0bedf --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A2_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. + +/** + * @name: S12.13_A2_T3; + * @section: 12.13; + * @assertion: "throw Expression" returns (throw, GetValue(Result(1)), empty), where 1 evaluates Expression; + * @description: Throwing boolean; + */ + +// CHECK#1 +try{ + throw true; +} +catch(e){ + if (e!==true) $ERROR('#1: Exception ===true. Actual: Exception ==='+ e ); +} + +// CHECK#2 +try{ + throw false; +} +catch(e){ + if (e!==false) $ERROR('#2: Exception ===false. Actual: Exception ==='+ e ); +} + +// CHECK#3 +var b=false; +try{ + throw b; +} +catch(e){ + if (e!==false) $ERROR('#3: Exception ===false. Actual: Exception ==='+ e ); +} + +// CHECK#4 +var b=true; +try{ + throw b; +} +catch(e){ + if (e!==true) $ERROR('#4: Exception ===true. Actual: Exception ==='+ e ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A2_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A2_T4.js new file mode 100644 index 000000000..2f70a0ce0 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A2_T4.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.13_A2_T4; + * @section: 12.13; + * @assertion: "throw Expression" returns (throw, GetValue(Result(1)), empty), where 1 evaluates Expression; + * @description: Throwing string; + */ + +// CHECK#1 +try{ + throw "exception #1"; +} +catch(e){ + if (e!=="exception #1") $ERROR('#1: Exception ==="exception #1". Actual: Exception ==='+ e ); +} + +// CHECK#2 +var b="exception #1"; +try{ + throw b; +} +catch(e){ + if (e!=="exception #1") $ERROR('#2: Exception ==="exception #1". Actual: Exception ==='+ e ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A2_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A2_T5.js new file mode 100644 index 000000000..56ce263d2 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A2_T5.js @@ -0,0 +1,74 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.13_A2_T5; + * @section: 12.13; + * @assertion: "throw Expression" returns (throw, GetValue(Result(1)), empty), where 1 evaluates Expression; + * @description: Throwing number; + */ + +// CHECK#1 +try{ + throw 13; +} +catch(e){ + if (e!==13) $ERROR('#1: Exception ===13. Actual: Exception ==='+ e ); +} + +// CHECK#2 +var b=13; +try{ + throw b; +} +catch(e){ + if (e!==13) $ERROR('#2: Exception ===13. Actual: Exception ==='+ e ); +} + +// CHECK#3 +try{ + throw 2.13; +} +catch(e){ + if (e!==2.13) $ERROR('#3: Exception ===2.13. Actual: Exception ==='+ e ); +} + +// CHECK#4 +try{ + throw NaN; +} +catch(e){ + if (!isNaN(e)) $ERROR('#4: Exception is NaN'); +} + +// CHECK#5 +try{ + throw +Infinity; +} +catch(e){ + if (e!==+Infinity) $ERROR('#5: Exception ===+Infinity. Actual: Exception ==='+ e ); +} + +// CHECK#6 +try{ + throw -Infinity; +} +catch(e){ + if (e!==-Infinity) $ERROR('#6: Exception ===-Infinity. Actual: Exception ==='+ e ); +} + +// CHECK#7 +try{ + throw +0; +} +catch(e){ + if (e!==+0) $ERROR('#7: Exception ===+0. Actual: Exception ==='+ e ); +} + +// CHECK#8 +try{ + throw -0; +} +catch(e){ + if (e!==-0) $ERROR('#8: Exception ===-0. Actual: Exception ==='+ e ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A2_T6.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A2_T6.js new file mode 100644 index 000000000..1c9c8ce6c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A2_T6.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. + +/** + * @name: S12.13_A2_T6; + * @section: 12.13; + * @assertion: "throw Expression" returns (throw, GetValue(Result(1)), empty), where 1 evaluates Expression; + * @description: Throwing object; + */ + +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';}, + i:7 +} + +try{ + throw myObj; +} +catch(e){ +// CHECK#1 + if (e.p1!=="a") $ERROR('#1: e.p1 === "a". Actual: e.p1 ==='+ e.p1 ); +// CHECK#2 + if (e.value!=='myObj_value') $ERROR('#2: e.p1 === \'myObj_value\'. Actual: e.p1 ==='+ e.p1 ); +// CHECK#3 + if (e.eval()!=='obj_eval') $ERROR('#3: e.p1 === \'obj_eval\'. Actual: e.p1 ==='+ e.p1 ); +} + +// CHECK#4 +myObj.i=6 +try{ + throw myObj; +} +catch(e){} +if (myObj.i!==6) $ERROR('#4: Handling of catch must be correct'); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A2_T7.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A2_T7.js new file mode 100644 index 000000000..a6464faef --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A2_T7.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.13_A2_T7; + * @section: 12.13; + * @assertion: "throw Expression" returns (throw, GetValue(Result(1)), empty), where 1 evaluates Expression; + * @description: Throwing Array; + */ + +var mycars = new Array(); +mycars[0] = "Saab"; +mycars[1] = "Volvo"; +mycars[2] = "BMW"; + +var mycars2 = new Array(); +mycars2[0] = "Mercedes"; +mycars2[1] = "Jeep"; +mycars2[2] = "Suzuki"; + +// CHECK#1 +try{ + throw mycars; +} +catch(e){ + for (var i=0;i<3;i++){ + if (e[i]!==mycars[i]) $ERROR('#1.'+i+': Exception['+i+'] === mycars['+i+']. Actual: Exception['+i+'] ==='+ e[i] ); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A3_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A3_T1.js new file mode 100644 index 000000000..bc420d5c2 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A3_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. + +/** + * @name: S12.13_A3_T1; + * @section: 12.13; + * @assertion: 1. Evaluate Expression; + * @description: Evaluating boolean expression; + */ + +// CHECK#1 +var b=true; +try{ + throw b&&false; +} +catch(e){ + if (e!==false) $ERROR('#1: Exception === false(operaton &&). Actual: Exception ==='+ e ); +} + +// CHECK#2 +var b=true; +try{ + throw b||false; +} +catch(e){ + if (e!==true) $ERROR('#2: Exception === true(operaton ||). Actual: Exception ==='+ e ); +} + +// CHECK#3 +try{ + throw !false; +} +catch(e){ + if (e!==true) $ERROR('#3: Exception === true(operaton !). Actual: Exception ==='+ e ); +} + +// CHECK#4 +var b=true; +try{ + throw !(b&&false); +} +catch(e){ + if (e!==true) $ERROR('#4: Exception === true(operaton &&). Actual: Exception ==='+ e ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A3_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A3_T2.js new file mode 100644 index 000000000..4dbf33d0c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A3_T2.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.13_A3_T2; + * @section: 12.13; + * @assertion: 1. Evaluate Expression; + * @description: Evaluating string expression; + */ + +// CHECK#1 +try{ + throw "exception"+" #1"; +} +catch(e){ + if (e!=="exception #1") $ERROR('#1: Exception === "exception #1"(operaton +). Actual: Exception ==='+ e ); +} + +// CHECK#2 +var b="exception" +var a=" #1"; +try{ + throw b+a; +} +catch(e){ + if (e!=="exception #1") $ERROR('#2: Exception === "exception #1"(operaton +). Actual: Exception ==='+ e ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A3_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A3_T3.js new file mode 100644 index 000000000..f2a60cab8 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A3_T3.js @@ -0,0 +1,91 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.13_A3_T3; + * @section: 12.13; + * @assertion: 1. Evaluate Expression; + * @description: Evaluating number expression; + */ + +// CHECK#1 +try{ + throw 10+3; +} +catch(e){ + if (e!==13) $ERROR('#1: Exception ===13(operaton +). Actual: Exception ==='+ e); +} + +// CHECK#2 +var b=10; +var a=3; +try{ + throw a+b; +} +catch(e){ + if (e!==13) $ERROR('#2: Exception ===13(operaton +). Actual: Exception ==='+ e); +} + +// CHECK#3 +try{ + throw 3.15-1.02; +} +catch(e){ + if (e!==2.13) $ERROR('#3: Exception ===2.13(operaton -). Actual: Exception ==='+ e); +} + +// CHECK#4 +try{ + throw 2*2; +} +catch(e){ + if (e!==4) $ERROR('#4: Exception ===4(operaton *). Actual: Exception ==='+ e); +} + +// CHECK#5 +try{ + throw 1+Infinity; +} +catch(e){ + if (e!==+Infinity) $ERROR('#5: Exception ===+Infinity(operaton +). Actual: Exception ==='+ e); +} + +// CHECK#6 +try{ + throw 1-Infinity; +} +catch(e){ + if (e!==-Infinity) $ERROR('#6: Exception ===-Infinity(operaton -). Actual: Exception ==='+ e); +} + +// CHECK#7 +try{ + throw 10/5; +} +catch(e){ + if (e!==2) $ERROR('#7: Exception ===2(operaton /). Actual: Exception ==='+ e); +} + +// CHECK#8 +try{ + throw 8>>2; +} +catch(e){ + if (e!==2) $ERROR('#8: Exception ===2(operaton >>). Actual: Exception ==='+ e); +} + +// CHECK#9 +try{ + throw 2<<2; +} +catch(e){ + if (e!==8) $ERROR('#9: Exception ===8(operaton <<). Actual: Exception ==='+ e); +} + +// CHECK#10 +try{ + throw 123%100; +} +catch(e){ + if (e!==23) $ERROR('#10: Exception ===23(operaton %). Actual: Exception ==='+ e); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A3_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A3_T4.js new file mode 100644 index 000000000..ed0204eac --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A3_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. + +/** + * @name: S12.13_A3_T4; + * @section: 12.13; + * @assertion: 1. Evaluate Expression; + * @description: Evaluating array expression; + */ + +var mycars = new Array(); +mycars[0] = "Saab"; +mycars[1] = "Volvo"; +mycars[2] = "BMW"; + +var mycars2 = new Array(); +mycars2[0] = "Mercedes"; +mycars2[1] = "Jeep"; +mycars2[2] = "Suzuki"; + +// CHECK#1 +try{ + throw mycars.concat(mycars2); +} +catch(e){ + for (var i=0;i<3;i++){ + if (e[i]!==mycars[i]) $ERROR('#1.'+i+': Exception['+i+']===mycars['+i+'](operation .concat). Actual: Exception['+i+']==='+ e[i] ); + } + for (var i=3;i<6;i++){ + if (e[i]!==mycars2[i-3]) $ERROR('#1.'+i+': Exception['+i+']===mycars2['+(i-3)+'](operation .concat). Actual: Exception['+i+']==='+ e[i] ); + } +} + +// CHECK#2 +try{ + throw new Array("Mercedes","Jeep","Suzuki"); +} +catch(e){ + for (var i=0;i<3;i++){ + if (e[i]!==mycars2[i]) $ERROR('#2.'+i+': Exception['+i+']===mycars2['+i+'](operation new). Actual: Exception['+i+']==='+ e[i] ); + } +} + +// CHECK#3 +try{ + throw mycars.concat(new Array("Mercedes","Jeep","Suzuki")); +} +catch(e){ + for (var i=0;i<3;i++){ + if (e[i]!==mycars[i]) $ERROR('#3.'+i+': Exception['+i+']===mycars['+i+'](operation .concat(new)). Actual: Exception['+i+']==='+ e[i] ); + } + for (var i=3;i<6;i++){ + if (e[i]!==mycars2[i-3]) $ERROR('#3.'+i+': Exception['+i+']===mycars2['+(i-3)+'](operation .concat(new)). Actual: Exception['+i+']==='+ e[i] ); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A3_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A3_T5.js new file mode 100644 index 000000000..c64f4387e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A3_T5.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.13_A3_T5; + * @section: 12.13; + * @assertion: 1. Evaluate Expression; + * @description: Evaluating equation expression; + */ + +// CHECK#1 +var a=true; +var b=false; +try{ + throw ((a&&(!b))?"exception":" #1"); +} +catch(e){ + if (e!=="exception") $ERROR('#1: Exception ==="exception"(operaton ? , ). Actual: Exception ==='+e ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A3_T6.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A3_T6.js new file mode 100644 index 000000000..88bc25518 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.13_The_throw_statement/S12.13_A3_T6.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. + +/** + * @name: S12.13_A3_T6; + * @section: 12.13; + * @assertion: 1. Evaluate Expression; + * @description: Evaluating functions; + */ + +// CHECK#1 +var i=0; +function adding1(){ + i++; + return 1; +} +try{ + throw (adding1()); +} +catch(e){ + if (e!==1) $ERROR('#1: Exception ===1. Actual: Exception ==='+ e); +} + +// CHECK#2 +var i=0; +function adding2(){ + i++; + return i; +} +try{ + throw adding2(); +} +catch(e){} +if (i!==1) $ERROR('#2: i===1. Actual: i==='+ i); + +// CHECK#3 +var i=0; +function adding3(){ + i++; +} +try{ + throw adding3(); +} +catch(e){} +if (i!==1) $ERROR('#3: i===1. Actual: i==='+i); + +// CHECK#4 +function adding4(i){ + i++; + return i; +} +try{ + throw (adding4(1)); +} +catch(e){ + if (e!==2) $ERROR('#4: Exception ===2. Actual: Exception ==='+ e); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A1.js new file mode 100644 index 000000000..be1377005 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A1.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. + +/** + * @name: S12.14_A1; + * @section: 12.14; + * @assertion: The production TryStatement : try Block Catch is evaluated as follows: 2. If Result(1).type is not throw, return Result(1); + * @description: Executing TryStatement : try Block Catch. The statements doesn't cause actual exceptions; + */ + +// CHECK#1 +try { + var x=0; +} +catch (e) { + $ERROR('#1: If Result(1).type is not throw, return Result(1). Actual: 4 Return(Result(3))'); +} + +// CHECK#2 +var c1=0; +try{ + var x1=1; +} +finally +{ + c1=1; +} +if(x1!==1){ + $ERROR('#2.1: "try" block must be evaluated. Actual: try Block has not been evaluated'); +} +if (c1!==1){ + $ERROR('#2.2: "finally" block must be evaluated. Actual: finally Block has not been evaluated'); +} + +// CHECK#3 +var c2=0; +try{ + var x2=1; +} +catch(e){ + $ERROR('#3.1: If Result(1).type is not throw, return Result(1). Actual: 4 Return(Result(3))'); +} +finally{ + c2=1; +} +if(x2!==1){ + $ERROR('#3.2: "try" block must be evaluated. Actual: try Block has not been evaluated'); +} +if (c2!==1){ + $ERROR('#3.3: "finally" block must be evaluated. Actual: finally Block has not been evaluated'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A10_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A10_T1.js new file mode 100644 index 000000000..bc083cae9 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A10_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A10_T1; + * @section: 12.14; + * @assertion: Using "try" with "catch" or "finally" statement within/without a "while" statement; + * @description: Throwing exception while executing iteration statement placed into try Block; + */ + +// CHECK#1 +var i=0; +try{ +while(i<10){ + if(i===5) throw i; + i++; +} +} +catch(e){ + if(e!==5)$ERROR('#1: Exception === 5. Actual: Exception ==='+ e ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A10_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A10_T2.js new file mode 100644 index 000000000..083cc9b4b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A10_T2.js @@ -0,0 +1,115 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A10_T2; + * @section: 12.14; + * @assertion: Using "try" with "catch" or "finally" statement within/without a "while" statement; + * @description: Try statement inside loop, where use continue loop; + */ + +// CHECK#1 +var c1=0,fin=0; +while(c1<2){ + try{ + c1+=1; + continue; + } + catch(er1){} + finally{ + fin=1; + } + fin=-1; +}; +if(fin!==1){ + $ERROR('#1: "finally" block must be evaluated at "try{continue} catch finally" construction'); +} + +// CHECK#2 +var c2=0,fin2=0; +while(c2<2){ + try{ + throw "ex1"; + } + catch(er1){ + c2+=1; + continue; + } + finally{ + fin2=1; + } + fin2=-1; +} +if(fin2!==1){ + $ERROR('#2: "finally" block must be evaluated at "try catch{continue} finally" construction'); +} + +// CHECK#3 +var c3=0,fin3=0; +while(c3<2){ + try{ + throw "ex1"; + } + catch(er1){ + c3+=1; + } + finally{ + fin3=1; + continue; + } + fin3=0; +} +if(fin3!==1){ + $ERROR('#3: "finally" block must be evaluated at "try catch finally{continue}" construction'); +} + +// CHECK#4 +var c4=0,fin4=0; +while(c4<2){ + try{ + c4+=1; + continue; + } + finally{ + fin4=1; + } + fin4=-1; +}; +if(fin4!==1){ + $ERROR('#4: "finally" block must be evaluated at "try{continue} finally" construction'); +} + +// CHECK#5 +var c5=0; +while(c5<2){ + try{ + throw "ex1"; + } + catch(er1){ + c5+=1; + continue; + } +} +if(c5!==2){ + $ERROR('#5: "try catch{continue}" must work correctly'); +} + +// CHECK#6 +var c6=0,fin6=0; +while(c6<2){ + try{ + c6+=1; + throw "ex1" + } + finally{ + fin6=1; + continue; + } + fin6=-1; +} +if(fin6!==1){ + $ERROR('#6.1: "finally" block must be evaluated'); +} +if(c6!==2){ + $ERROR('#6.2: "try finally{continue}" must work correctly'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A10_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A10_T3.js new file mode 100644 index 000000000..7bf95fd30 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A10_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. + +/** + * @name: S12.14_A10_T3; + * @section: 12.14; + * @assertion: Using "try" with "catch" or "finally" statement within/without a "while" statement; + * @description: Try statement inside loop, where use break; + */ + +// CHECK#1 +var c1=0,fin=0; +while(c1<2){ + try{ + c1+=1; + break; + } + catch(er1){} + finally{ + fin=1; + } + fin=-1; + c1+=2; +} +if(fin!==1){ + $ERROR('#1.1: "finally" block must be evaluated'); +} +if(c1!==1){ + $ERROR('#1.2: "try{break}catch finally" must work correctly'); +} + +// CHECK#2 +var c2=0,fin2=0; +while(c2<2){ + try{ + throw "ex1"; + } + catch(er1){ + c2+=1; + break; + } + finally{ + fin2=1; + } + c2+=2; + fin2=-1; +} +if(fin2!==1){ + $ERROR('#2.1: "finally" block must be evaluated'); +} +if(c2!==1){ + $ERROR('#2.2: "try catch{break} finally" must work correctly'); +} + +// CHECK#3 +var c3=0,fin3=0; +while(c3<2){ + try{ + throw "ex1"; + } + catch(er1){ + c3+=1; + } + finally{ + fin3=1; + break; + } + c3+=2; + fin3=0; +} +if(fin3!==1){ + $ERROR('#3.1: "finally" block must be evaluated'); +} +if(c3!==1){ + $ERROR('#3.2: "try catch finally{break}" must work correctly'); +} + +// CHECK#4 +var c4=0,fin4=0; +while(c4<2){ + try{ + c4+=1; + break; + } + finally{ + fin4=1; + } + fin4=-1; + c4+=2; +} +if(fin4!==1){ + $ERROR('#4.1: "finally" block must be evaluated'); +} +if(c4!==1){ + $ERROR('#4.2: "try{break} finally" must work correctly'); +} + +// CHECK#5 +var c5=0; +while(c5<2){ + try{ + throw "ex1"; + } + catch(er1){ + break; + } +} +if(c5!==0){ + $ERROR('#5: "try catch{break}" must work correctly'); +} + +// CHECK#6 +var c6=0; +while(c6<2){ + try{ + c6+=1; + break; + } + catch(er1){} + c6+=2; +} +if(c6!==1){ + $ERROR('#6: "try{break} catch" must work correctly'); +} + +// CHECK#7 +var c7=0,fin7=0; +try{ + while(c7<2){ + try{ + c7+=1; + throw "ex1"; + } + finally{ + fin7=1; + break; + } + fin7=-1; + c7+=2; + } +} +catch(ex1){ + c7=10; +} +if(fin7!==1){ + $ERROR('#7.1: "finally" block must be evaluated'); +} +if(c7!==1){ + $ERROR('#7.2: "try finally{break}" must work correctly'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A10_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A10_T4.js new file mode 100644 index 000000000..1f0e49e7e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A10_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. + +/** + * @name: S12.14_A10_T4; + * @section: 12.14; + * @assertion: Using "try" with "catch" or "finally" statement within/without a "while" statement; + * @description: Try statement inside loop, where combinate using break and continue; + */ + +// CHECK#1 +var c1=0,fin=0; +while(c1<2){ + try{ + c1+=1; + break; + } + catch(er1){} + finally{ + fin=1; + continue; + } + fin=-1; + c1+=2; +} +if(fin!==1){ + $ERROR('#1.1: "finally" block must be evaluated'); +} +if(c1!==2){ + $ERROR('#1.2: "try{break} catch finally{continue}" must work correctly'); +} + +// CHECK#2 +var c2=0,fin2=0; +while(c2<2){ + try{ + throw "ex1"; + } + catch(er1){ + c2+=1; + break; + } + finally{ + fin2=1; + continue; + } + c2+=2; + fin2=-1; +} +if(fin2!==1){ + $ERROR('#2.1: "finally" block must be evaluated'); +} +if(c2!==2){ + $ERROR('#2.2: "try catch{break} finally{continue} must work correctly'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A10_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A10_T5.js new file mode 100644 index 000000000..a9f152725 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A10_T5.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. + +/** + * @name: S12.14_A10_T5; + * @section: 12.14; + * @assertion: Using "try" with "catch" or "finally" statement within/without a "while" statement; + * @description: Throw some exceptions from different place of loop body; + */ + +// CHECK#1 +var c=0, i=0; +var fin=0; +while(i<10){ + i+=1; + try{ + if(c===0){ + throw "ex1"; + $ERROR('#1.1: throw "ex1" lead to throwing exception'); + } + c+=2; + if(c===1){ + throw "ex2"; + $ERROR('#1.2: throw "ex2" lead to throwing exception'); + } + } + catch(er1){ + c-=1; + continue; + $ERROR('#1.3: "try catch{continue} finally" must work correctly'); + } + finally{ + fin+=1; + } +} +if(fin!==10){ + $ERROR('#1.4: "finally" block must be evaluated'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A11_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A11_T1.js new file mode 100644 index 000000000..0722243c5 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A11_T1.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A11_T1; + * @section: 12.14; + * @assertion: Using "try" with "catch" or "finally" statement within/without a "for" statement; + * @description: Loop inside try Block, where throw exception; + */ + +// CHECK#1 +try{ + for(var i=0;i<10;i++){ + if(i===5) throw i; + } +} +catch(e){ + if(e!==5)$ERROR('#1: Exception === 5. Actual: Exception ==='+ e ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A11_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A11_T2.js new file mode 100644 index 000000000..07847e5de --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A11_T2.js @@ -0,0 +1,122 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A11_T2; + * @section: 12.14; + * @assertion: Using "try" with "catch" or "finally" statement within/without a "for" statement; + * @description: Try statement inside loop, where use continue loop; + */ + +// CHECK#1 +var fin=0; +for(var i=0;i<5;i++){ + try{ + i+=1; + continue; + } + catch(er1){} + finally{ + fin=1; + } + fin=-1; +} +if(fin!==1){ + $ERROR('#1: "finally" block must be evaluated at "try{continue} catch finally" construction'); +} + +// CHECK#2 +var c2=0,fin2=0; +for(var i=0;i<5;i++){ + try{ + throw "ex1"; + } + catch(er1){ + c2+=1; + continue; + } + finally{ + fin2=1; + } + fin2=-1; +} +if(fin2!==1){ + $ERROR('#2.1: "finally" block must be evaluated'); +} +if(c2!==5){ + $ERROR('#2.1: "try catch{continue} finally" must work correctly'); +} + +// CHECK#3 +var c3=0,fin3=0; +for(var i=0;i<5;i++){ + try{ + throw "ex1"; + } + catch(er1){ + c3+=1; + } + finally{ + fin3=1; + continue; + } + fin3=0; +} +if(fin3!==1){ + $ERROR('#3.1: "finally" block must be evaluated'); +} +if(c3!==5){ + $ERROR('#3.2: "try catch finally{continue}" must work correctly'); +} + +// CHECK#4 +var fin=0; +for(var i=0;i<5;i++){ + try{ + i+=1; + continue; + } + finally{ + fin=1; + } + fin=-1; +}; +if(fin!==1){ + $ERROR('#4: "finally" block must be evaluated at "try{continue} finally" construction'); +} + +// CHECK#5 +var c5=0; +for(var c5=0;c5<10;){ + try{ + throw "ex1"; + } + catch(er1){ + c5+=1; + continue; + } + c5+=12; +}; +if(c5!==10){ + $ERROR('#5: "try catch{continue} must work correctly'); +} + +// CHECK#6 +var c6=0,fin6=0; +for(var c6=0;c6<10;){ + try{ + c6+=1; + throw "ex1" + } + finally{ + fin6=1; + continue; + } + fin6=-1; +}; +if(fin6!==1){ + $ERROR('#6.1: "finally" block must be evaluated'); +} +if(c6!==10){ + $ERROR('#6.2: "try finally{continue}" must work correctly'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A11_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A11_T3.js new file mode 100644 index 000000000..dc4444c7c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A11_T3.js @@ -0,0 +1,149 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A11_T3; + * @section: 12.14; + * @assertion: Using "try" with "catch" or "finally" statement within/without a "for" statement; + * @description: Try statement inside loop, where use break; + */ + +// CHECK#1 +var c1=0,fin=0; +for(var i=0;i<5;i++){ + try{ + c1+=1; + break; + } + catch(er1){} + finally{ + fin=1; + } + fin=-1; + c1+=2; +}; +if(fin!==1){ + $ERROR('#1.1: "finally" block must be evaluated'); +} +if(c1!==1){ + $ERROR('#1.2: "try{break}catch finally" must work correctly'); +} + +// CHECK#2 +var c2=0,fin2=0; +for(var i=0;i<5;i++){ + try{ + throw "ex1"; + } + catch(er1){ + c2+=1; + break; + } + finally{ + fin2=1; + } + c2+=2; + fin2=-1; +}; +if(fin2!==1){ + $ERROR('#2.1: "finally" block must be evaluated'); +} +if(c2!==1){ + $ERROR('#2.2: "try catch{break} finally" must work correctly'); +} + +// CHECK#3 +var c3=0,fin3=0; +for(var i=0;i<5;i++){ + try{ + throw "ex1"; + } + catch(er1){ + c3+=1; + } + finally{ + fin3=1; + break; + } + c3+=2; + fin3=0; +}; +if(fin3!==1){ + $ERROR('#3.1: "finally" block must be evaluated'); +} +if(c3!==1){ + $ERROR('#3.2: "try catch finally{break}" must work correctly'); +} + +// CHECK#4 +var c4=0,fin4=0; +for(var i=0;i<5;i++){ + try{ + c4+=1; + break; + } + finally{ + fin4=1; + } + fin4=-1; + c4+=2; +}; +if(fin4!==1){ + $ERROR('#4.1: "finally" block must be evaluated'); +} +if(c4!==1){ + $ERROR('#4.2: "try{break} finally" must work correctly'); +} + +// CHECK#5 +for(var i=0;i<5;i++){ + try{ + throw "ex1"; + } + catch(er1){ + break; + } +}; +if(i!==0){ + $ERROR('#5: "try catch{break}" must work correctly'); +} + +// CHECK#6 +var c6=0; +for(var c6=0;c6<5;){ + try{ + c6+=1; + break; + } + catch(er1){} + c6+=2; +}; +if(c6!==1){ + $ERROR('#6: "try{break} catch" must work correctly'); +} + +// CHECK#7 +var c7=0,fin7=0; +try{ + for(var c7=0;c7<5;){ + try{ + c7+=1; + throw "ex1"; + } + finally{ + fin7=1; + break; + } + fin7=-1; + c7+=2; + } +} +catch(ex1){ + c7=10; +} +if(fin7!==1){ + $ERROR('#7.1: "finally" block must be evaluated'); +} +if(c7!==1){ + $ERROR('#7.2: "try finally{break}" must work correctly'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A11_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A11_T4.js new file mode 100644 index 000000000..25934836f --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A11_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. + +/** + * @name: S12.14_A11_T4; + * @section: 12.14; + * @assertion: Using "try" with "catch" or "finally" statement within/without a "for" statement; + * @description: Try statement inside loop, where combinate using break and continue; + */ + +// CHECK#1 +var c1=0,fin=0; +for(var i=0;i<5;i++){ + try{ + c1+=1; + break; + } + catch(er1){} + finally{ + fin=1; + continue; + } + fin=-1; + c1+=2; +} +if(fin!==1){ + $ERROR('#1.1: "finally" block must be evaluated'); +} +if(c1!==5){ + $ERROR('#1.2: "try{break} catch finally{continue}" must work correctly'); +} + +// CHECK#2 +var c2=0,fin2=0; +for(var i=0;i<5;i++){ + try{ + throw "ex1"; + } + catch(er1){ + c2+=1; + break; + } + finally{ + fin2=1; + continue; + } + c2+=2; + fin2=-1; +} +if(fin2!==1){ + $ERROR('#2.1: "finally" block must be evaluated'); +} +if(c2!==5){ + $ERROR('#2.2: "try catch{break} finally{continue}" must work correctly'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A12_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A12_T1.js new file mode 100644 index 000000000..14c7cb41a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A12_T1.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A12_T1; + * @section: 12.14; + * @assertion: Using "try" with "catch" or "finally" statement within/without a "for-in" statement; + * @description: Loop inside try Block, where throw exception; + */ + +var x; +var mycars = new Array(); +mycars[0] = "Saab"; +mycars[1] = "Volvo"; +mycars[2] = "BMW"; + +// CHECK#1 +try{ + for (x in mycars){ + if (mycars[x]==="BMW") throw "ex"; + } +} +catch(e){ + if(e!=="ex")$ERROR('#1: Exception ==="ex". Actual: Exception ==='+ e ); +} + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A12_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A12_T2.js new file mode 100644 index 000000000..9d97197fb --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A12_T2.js @@ -0,0 +1,131 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A12_T2; + * @section: 12.14; + * @assertion: Using "try" with "catch" or "finally" statement within/without a "for-in" statement; + * @description: Try statement inside loop, where use continue loop; + */ + +var x; +var mycars = new Array(); +mycars[0] = "Saab"; +mycars[1] = "Volvo"; +mycars[2] = "BMW"; + +// CHECK#1 +var fin=0; +var i=0; +for (x in mycars){ + try{ + i+=1; + continue; + } + catch(er1){} + finally{ + fin=1; + } + fin=-1; +} +if(fin!==1){ + $ERROR('#1.1: "finally" block must be evaluated'); +} +if(i!==3){ + $ERROR('#1.2: "try{continue} catch finally" must work correctly'); +} + +// CHECK#2 +var c2=0,fin2=0; +for (x in mycars){ + try{ + throw "ex1"; + } + catch(er1){ + c2+=1; + continue; + } + finally{ + fin2=1; + } + fin2=-1; +} +if(fin2!==1){ + $ERROR('#2.1: "finally" block must be evaluated'); +} +if(c2!==3){ + $ERROR('#2.1: "try catch{continue} finally" must work correctly'); +} + +// CHECK#3 +var c3=0,fin3=0; +for (x in mycars){ + try{ + throw "ex1"; + } + catch(er1){ + c3+=1; + } + finally{ + fin3=1; + continue; + } + fin3=0; +} +if(c3!==3){ + $ERROR('#3.1: "finally" block must be evaluated'); +} +if(fin3!==1){ + $ERROR('#3.2: "try catch finally{continue}" must work correctly'); +} + +// CHECK#4 +var fin=0; +for (x in mycars){ + try{ + continue; + } + finally{ + fin=1; + } + fin=-1; +} +if(fin!==1){ + $ERROR('#4: "finally" block must be evaluated at "try{continue} finally" construction'); +} + +// CHECK#5 +var c5=0; +for (x in mycars){ + try{ + throw "ex1"; + } + catch(er1){ + c5+=1; + continue; + } + c5+=12; +} +if(c5!==3){ + $ERROR('#5: "try catch{continue}" must work correctly'); +} + +// CHECK#6 +var c6=0,fin6=0; +for (x in mycars){ + try{ + c6+=1; + throw "ex1"; + } + finally{ + fin6=1; + continue; + } + fin6=-1; +} +if(fin6!==1){ + $ERROR('#6.1: "finally" block must be evaluated'); +} +if(c6!==3){ + $ERROR('#6.2: "try finally{continue}" must work correctly'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A12_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A12_T3.js new file mode 100644 index 000000000..e4749adbe --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A12_T3.js @@ -0,0 +1,161 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A12_T3; + * @section: 12.14; + * @assertion: Using "try" with "catch" or "finally" statement within/without a "for-in" statement; + * @description: Try statement inside loop, where use break; + */ + +var x; +var mycars = new Array(); +mycars[0] = "Saab"; +mycars[1] = "Volvo"; +mycars[2] = "BMW"; + +// CHECK#1 +var c1=0,fin=0; +for (x in mycars){ + try{ + c1+=1; + break; + } + catch(er1){ + c1+=1; + } + finally{ + fin=1; + } + fin=-1; + c1+=2; +}; +if(fin!==1){ + $ERROR('#1.1: "finally" block must be evaluated'); +} +if(c1!==1){ + $ERROR('#1.2: "try{break}catch finally" must work correctly'); +} + +// CHECK#2 +var c2=0,fin2=0; +for (x in mycars){ + try{ + throw "ex1"; + } + catch(er1){ + c2+=1; + break; + } + finally{ + fin2=1; + } + c2+=2; + fin2=-1; +} +if(fin2!==1){ + $ERROR('#2.1: "finally" block must be evaluated'); +} +if(c2!==1){ + $ERROR('#2.2: "try catch{break} finally" must work correctly'); +} + +// CHECK#3 +var c3=0,fin3=0; +for (x in mycars){ + try{ + throw "ex1"; + } + catch(er1){ + c3+=1; + } + finally{ + fin3=1; + break; + } + c3+=2; + fin3=0; +} +if(fin3!==1){ + $ERROR('#3.1: "finally" block must be evaluated'); +} +if(c3!==1){ + $ERROR('#3.2: "try catch finally{break}" must work correctly'); +} + +// CHECK#4 +var c4=0,fin4=0; +for (x in mycars){ + try{ + c4+=1; + break; + } + finally{ + fin4=1; + } + fin4=-1; + c4+=2; +} +if(fin4!==1){ + $ERROR('#4.1: "finally" block must be evaluated'); +} +if(c4!==1){ + $ERROR('#4.2: "try{break} finally" must work correctly'); +} + +// CHECK#5 +var c5=0; +for (x in mycars){ + try{ + throw "ex1"; + c5++; + } + catch(er1){ + break; + c5++; + } + c5++; +} +if(c5!==0){ + $ERROR('#5: "try catch{break}" must work correctly'); +} + +// CHECK#6 +var c6=0; +for (x in mycars){ + try{ + c6+=1; + break; + } + catch(er1){} + c6+=2; +} +if(c6!==1){ + $ERROR('#6: "try{break} catch" must work correctly'); +} + +// CHECK#7 +var c7=0,fin7=0; +try{ + for (x in mycars){ + try{ + c7+=1; + throw "ex1"; + } + finally{ + fin7=1; + break; + } + fin7=-1; + c7+=2; + } +} +catch(ex1){ + c7=10; +} +if(fin7!==1){ + $ERROR('#7.1: "finally" block must be evaluated'); +} +if(c7!==1){ + $ERROR('#7.2: "try finally{break}" must work correctly'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A12_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A12_T4.js new file mode 100644 index 000000000..07c979fde --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A12_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. + +/** + * @name: S12.14_A12_T4; + * @section: 12.14; + * @assertion: Using "try" with "catch" or "finally" statement within/without a "for-in" statement; + * @description: Try statement inside loop, where combinate using break and continue; + */ + +var x; +var mycars = new Array(); +mycars[0] = "Saab"; +mycars[1] = "Volvo"; +mycars[2] = "BMW"; + +// CHECK#1 +var c1=0,fin=0; +for (x in mycars){ + try{ + c1+=1; + break; + } + catch(er1){} + finally{ + fin=1; + continue; + } + fin=-1; + c1+=2; +} +if(fin!==1){ + $ERROR('#1.1: "finally" block must be evaluated'); +} +if(c1!==3){ + $ERROR('#1.2: "try{break} catch finally{continue}" must work correctly'); +} + +// CHECK#2 +var c2=0,fin2=0; +for (x in mycars){ + try{ + throw "ex1"; + } + catch(er1){ + c2+=1; + break; + } + finally{ + fin2=1; + continue; + } + c2+=2; + fin2=-1; +} +if(fin2!==1){ + $ERROR('#2.1: "finally" block must be evaluated'); +} +if(c2!==3){ + $ERROR('#2.2: "try catch{break} finally{continue}" must work correctly'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A13_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A13_T1.js new file mode 100644 index 000000000..7535db7f0 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A13_T1.js @@ -0,0 +1,78 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A13_T1; + * @section: 12.14; + * @assertion: Using "try" with "catch" or "finally" statement with a "return" statement; + * @description: Using try/catch syntax construction; + */ + +// CHECK#1 +function myFunction1(){ + try{ + return 1; + } + catch(err){ + $ERROR('#1.1: "return 1" inside function does not lead to throwing exception'); + return 0; + } + return 2; +} +var x1=myFunction1(); +if(x1!==1){ + $ERROR('#1.2: x1===1. Actual: x1==='+x1); +} + +// CHECK#2 +function myFunction2(){ + try{ + throw "exc"; + return 1; + }catch(err){ + return 2; + } + return 3; +} +var x2=myFunction2(); +if (x2!==2){ + $ERROR('#2: x2===2. Actual: x2==='+x2); +} + +// CHECK#3 +function myFunction3(){ + try{ + return someValue; + }catch(err){ + return 1; + } + return 2; +} +var x3=myFunction3(); +if (x3!==1){ + $ERROR('#3: x3===1. Actual: x3==='+x3); +} + +// CHECK#4 +function myFunction4(){ + try{ + throw "ex1"; + return 1; + }catch(err){ + throw "ex2" + return 0; + } + return 2; +} +try{ + var x4=myFunction4(); + $ERROR('#4.1: Throwing exception inside function lead to throwing exception outside this function'); +} +catch(e){ + if(e==="ex1"){ + $ERROR('#4.2: Exception !=="ex1". Actual: catch previous exception'); + } + if(e!=="ex2"){ + $ERROR('#4.3: Exception ==="ex2". Actual: Exception ==='+ e ); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A13_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A13_T2.js new file mode 100644 index 000000000..53ae98fe2 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A13_T2.js @@ -0,0 +1,181 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A13_T2; + * @section: 12.14; + * @assertion: Using "try" with "catch" or "finally" statement with a "return" statement; + * @description: Using try/finally syntax construction; + */ + +// CHECK#1 +var c1=0; +function myFunction1(){ + try{ + return 1; + }finally{ + c1=1; + } + return 2; +} +var x1=myFunction1(); +if(x1!==1){ + $ERROR('#1.1: x1===1. Actual: x1==='+x1); +} +if (c1!==1){ + $ERROR('#1.2: "finally" block must be evaluated'); +} + +// CHECK#2 +var c2=0; +function myFunction2(){ + try{ + throw "exc"; + return 1; + }finally{ + c2=1; + } + return 2; +} +try{ + var x2=myFunction2(); + $ERROR('#2.1: Throwing exception inside function lead to throwing exception outside this function'); +} +catch(e){ + if (c2!==1){ + $ERROR('#2.2: "finally" block must be evaluated'); + } +} + +// CHECK#3 +var c3=0; +function myFunction3(){ + try{ + return someValue; + }finally{ + c3=1; + } + return 2; +} +try{ + var x3=myFunction3(); + $ERROR('#3.1: Throwing exception inside function lead to throwing exception outside this function'); +} +catch(e){ + if (c3!==1){ + $ERROR('#3.2: "finally" block must be evaluated'); + } +} + +// CHECK#4 +var c4=0; +function myFunction4(){ + try{ + return 1; + }finally{ + c4=1; + throw "exc"; + return 0; + } + return 2; +} +try{ + var x4=myFunction4(); + $ERROR('#4.2: Throwing exception inside function lead to throwing exception outside this function'); +} +catch(e){ + if (c4!==1){ + $ERROR('#4.3: "finally" block must be evaluated'); + } +} + +// CHECK#5 +var c5=0; +function myFunction5(){ + try{ + return 1; + }finally{ + c5=1; + return someValue; + return 0; + } + return 2; +} +try{ + var x5=myFunction5(); + $ERROR('#5.2: Throwing exception inside function lead to throwing exception outside this function'); +} +catch(e){ + if (c5!==1){ + $ERROR('#5.3: "finally" block must be evaluated'); + } +} + +// CHECK#6 +var c6=0; +function myFunction6(){ + try{ + throw "ex1"; + return 1; + }finally{ + c6=1; + throw "ex2"; + return 2; + } + return 3; +} +try{ + var x6=myFunction6(); + $ERROR('#6.1: Throwing exception inside function lead to throwing exception outside this function'); +} +catch(e){ + if(e==="ex1"){ + $ERROR('#6.2: Exception !=="ex1". Actual: catch previous exception'); + } + if(e!=="ex2"){ + $ERROR('#6.3: Exception !=="ex1". Actual: '+e); + } + if (c6!==1){ + $ERROR('#6.4: "finally" block must be evaluated'); + } +} + +// CHECK#7 +var c7=0; +function myFunction7(){ + try{ + return 1; + }finally{ + c7=1; + return 2; + } + return 3; +} +var x7=myFunction7(); +if(x7!==2){ + $ERROR('#7.1: "catch" block must be evaluated'); +} +if (c7!==1){ + $ERROR('#7.2: "finally" block must be evaluated'); +} + +// CHECK#8 +var c8=0; +function myFunction8(){ + try{ + throw "ex1"; + }finally{ + c8=1; + return 2; + } + return 3; +} +try{ + var x8=myFunction8(); +} +catch(ex1){ + c8=10; +} +if (c8!==1){ + $ERROR('#8: "finally" block must be evaluated'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A13_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A13_T3.js new file mode 100644 index 000000000..bc64ecf3b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A13_T3.js @@ -0,0 +1,185 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A13_T3; + * @section: 12.14; + * @assertion: Using "try" with "catch" or "finally" statement with a "return" statement; + * @description: Using try/catch/finally syntax construction; + */ + +// CHECK#1 +var c1=0; +function myFunction1(){ + try{ + return 1; + }catch(err){ + $ERROR('#1.1: "return 1" inside function does not lead to throwing exception'); + return 0; + }finally{ + c1=1; + } + return 2; +} +var x1=myFunction1(); +if(x1!==1){ + $ERROR('#1.3: x1===1. Actual: x1==='+x1); +} +if (c1!==1){ + $ERROR('#1.4: "finally" block must be evaluated'); +} + +// CHECK#2 +var c2=0; +function myFunction2(){ + try{ + throw "exc"; + return 1; + }catch(err){ + return 0; + }finally{ + c2=1; + } + return 2; +} +var x2=myFunction2(); +if (c2!==1){ + $ERROR('#2.1: "finally" block must be evaluated'); +} +if (x2!==0){ + $ERROR('#2.2: x2===0. Actual: x2==='+x2); +} + +// CHECK#3 +var c3=0; +function myFunction3(){ + try{ + return someValue; + }catch(err){ + return 1; + }finally{ + c3=1; + } + return 2; +} +var x3=myFunction3(); +if (c3!==1){ + $ERROR('#3.1: "finally" block must be evaluated'); +} +if (x3!==1){ + $ERROR('#3.2: x3===1. Actual: x3==='+x3); +} + +// CHECK#4 +var c4=0; +function myFunction4(){ + try{ + throw "ex1"; + return 1; + }catch(err){ + throw "ex2" + return 0; + }finally{ + c4=1; + } + return 2; +} +try{ + var x4=myFunction4(); + $ERROR('#4.1: Throwing exception inside function lead to throwing exception outside this function'); +} +catch(e){ + if(e==="ex1"){ + $ERROR('#4.2: Exception !== "ex1". Actual: catch previous exception'); + } + if(e!=="ex2"){ + $ERROR('#4.3: Exception === "ex2". Actual: Exception ==='+ e ); + } + if (c4!==1){ + $ERROR('#4.4: "finally" block must be evaluated'); + } +} + +// CHECK#5 +var c5=0; +function myFunction5(){ + try{ + throw "ex1"; + return 1; + }catch(err){ + return 0; + }finally{ + c5=1; + throw "ex2"; + } + return 2; +} +try{ + var x5=myFunction5(); + $ERROR('#5.1: Throwing exception inside function lead to throwing exception outside this function'); +} +catch(e){ + if(e==="ex1"){ + $ERROR('#5.2: Exception !== "ex1". Actual: catch previous exception'); + } + if(e!=="ex2"){ + $ERROR('#5.3: Exception === "ex2". Actual: Exception ==='+ e ); + } + if (c5!==1){ + $ERROR('#5.4: "finally" block must be evaluated'); + } +} + +// CHECK#6 +var c6=0; +function myFunction6(){ + try{ + throw "ex1"; + return 1; + }catch(err){ + throw "ex2"; + return 0; + }finally{ + c6=1; + throw "ex3"; + } + return 2; +} +try{ + var x6=myFunction6(); + $ERROR('#6.1: Throwing exception inside function lead to throwing exception outside this function'); +} +catch(e){ + if(e==="ex1"){ + $ERROR('#6.2: Exception !== "ex1". Actual: catch previous exception'); + } + if(e==="ex2"){ + $ERROR('#6.3: Exception !== "ex2". Actual: catch previous exception'); + } + if(e!=="ex3"){ + $ERROR('#6.4: Exception === "ex3". Actual: Exception ==='+ e ); + } + if(c6!==1) $ERROR('#6.5: "finally" block must be evaluated'); +} + +// CHECK#7 +var c7=0; +function myFunction7(){ + try{ + throw "ex1"; + return 1; + }catch(err){ + throw "ex2"; + return 0; + }finally{ + c7=1; + return 2; + } + return 3; +} +try{ + var x7=myFunction7(); + if(x7!==2) $ERROR('#7.1: x7===2. Actual: x7==='+x7); +} +catch(e){} +if(c7!==1) $ERROR('#7.2: "finally" block must be evaluated'); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A14.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A14.js new file mode 100644 index 000000000..d6b9298d4 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A14.js @@ -0,0 +1,78 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A14; + * @section: 12.14; + * @assertion: Using "try" with "catch" or "finally" statement within/without a "with" statement; + * @description: Using try/catch/finally in With and With in try/catch/finally; + * @strict_mode_negative SyntaxError; + */ + +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} + +// CHECK#1 +try{ + with(myObj){ + throw "ex"; + } +} +catch(e){ + if (e!=="ex") $ERROR('#1: Exception ==="ex". Actual: Exception ==='+ e ); +} + +// CHECK#2 +with(myObj){ + try{ + throw p1; + } + catch(e){ + if (e!=="a") $ERROR('#2.1: Exception ==="a". Actual: Exception ==='+ e ); + p1='pass'; + } +} +if(myObj.p1!=='pass') $ERROR('#2.2: "throw p1" lead to throwing exception'); + +// CHECK#3 +with(myObj){ + try{ + p1='fail'; + throw p2; + } + catch(e){ + if (e!=="b") $ERROR('#3.1: Exception ==="b". Actual: Exception ==='+ e ); + p1='pass'; + } + finally{ + p2='pass'; + } +} +if(myObj.p1!=='pass') $ERROR('#3.2: "throw p2" lead to throwing exception'); +if(myObj.p2!=='pass') $ERROR('#3.3: "finally" block must be evaluated'); + +// CHECK#4 +myObj.p1='fail'; +try{ + with(myObj){ + try{ + throw p3; + } + finally{ + p1='pass'; + } + } +} +catch(e){} +if(myObj.p1!=='pass') $ERROR('#4: "finally" block must be evaluated'); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A15.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A15.js new file mode 100644 index 000000000..60087fb5e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A15.js @@ -0,0 +1,91 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A15; + * @section: 12.14; + * @assertion: Using "try" with "catch" or "finally" statement within/without a "switch" statement; + * @description: Insert try/catch/finally to switch statement; + */ + +// CHECK#1 +function SwitchTest1(value){ + var result = 0; + try{ + switch(value) { + case 1: + result += 4; + throw result; + break; + default: + result += 32; + break; + case 4: + result += 64; + throw "ex"; + } + return result; + } + catch(e){ + if ((value===1)&&(e!==4)) $ERROR('#1.1: Exception ===4. Actual: Exception ==='+ e ); + if ((value===4)&&(e!=="ex")) $ERROR('#1.2: Exception ==="ex". Actual: Exception ==='+ e ); + } + finally{ + return result; + } +} +if (SwitchTest1(1)!==4) $ERROR('#1.3: SwitchTest1(1)===4. Actual: SwitchTest1(1)==='+ SwitchTest1(1) ); +if (SwitchTest1(4)!==64) $ERROR('#1.4: SwitchTest1(4)===64. Actual: SwitchTest1(4)==='+ SwitchTest1(4) ); + +// CHECK#2 +var c2=0; +function SwitchTest2(value){ + var result = 0; + switch(value) { + case 0: + try{ + result += 2; + break; + } + finally{ + c2=1; + } + case 1: + result += 4; + break; + default: + result += 32; + break; + } + return result; +} +if (SwitchTest2(1)!==4) $ERROR('#2.1: SwitchTest1(1)===4. Actual: SwitchTest1(1)==='+ SwitchTest1(1) ); +if (c2===1) $ERROR('#2.2: Evaluate finally block'); +if (SwitchTest2(0)!==2) $ERROR('#2.3: SwitchTest1(0)===2. Actual: SwitchTest1(0)==='+ SwitchTest1(0) ); +if (c2!==1) $ERROR('#2.4: "finally" block must be evaluated'); + +// CHECK#3 +function SwitchTest3(value){ + var result = 0; + switch(value) { + case 0: + try{ + result += 2; + throw "ex"; + } + finally{ + break; + } + default: + result += 32; + break; + } + return result; +} +try{ + var x3=SwitchTest3(0); + if (x3!==2) $ERROR('#3.1: x3===2. Actual: x3==='+x3); +} +catch(e){ + $ERROR('#3.2: Catching exception inside function does not lead to throwing exception outside this function'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T1.js new file mode 100644 index 000000000..4fefdd726 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T1.js @@ -0,0 +1,13 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A16_T1; + * @section: 12.14; + * @assertion: TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally"; + * @description: Checking if pure "try" syntax construction passes; + * @negative + */ + +// CHECK#1 +try diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T10.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T10.js new file mode 100644 index 000000000..f9f7cd60a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T10.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A16_T10; + * @section: 12.14; + * @assertion: TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally"; + * @description: Catch: "catch (Identifier ) Block"; + * @negative + */ + +// CHECK#1 +try{} +catch(){} +finally{} + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T11.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T11.js new file mode 100644 index 000000000..32c33b382 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T11.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A16_T11; + * @section: 12.14; + * @assertion: TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally"; + * @description: Catch and Finally are placed into the Block of "try" (whitle expected outside); + * @negative + */ + +// CHECK#1 +try{ + { + } + catch(e){} + finally{} +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T12.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T12.js new file mode 100644 index 000000000..61693d517 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T12.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A16_T12; + * @section: 12.14; + * @assertion: TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally"; + * @description: Embedded "try" statements followed by two "catch" statements; + * @negative + */ + +// CHECK#1 +try +{ + try + { + } +} +catch(e1){} +catch(e2){} + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T13.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T13.js new file mode 100644 index 000000000..ff38025e2 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T13.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. + +/** + * @name: S12.14_A16_T13; + * @section: 12.14; + * @assertion: TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally"; + * @description: Catch: "catch (Identifier ) Block". Checking if execution of "22" passes at the place of Identifier of "catch"; + * @negative + */ + +// CHECK#1 +try +{ +} +catch("22") +{ +} + + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T14.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T14.js new file mode 100644 index 000000000..31bb1d66e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T14.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A16_T14; + * @section: 12.14; + * @assertion: TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally"; + * @description: Checking if passing argument to "try" statement fails; + * @negative + */ + +// CHECK#1 +try(e1){ +} +catch(e){} + + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T15.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T15.js new file mode 100644 index 000000000..0c5441749 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T15.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A16_T15; + * @section: 12.14; + * @assertion: TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally"; + * @description: Finally: "finally Block". Checking if passing argument to "try" statement fails; + * @negative + */ + +// CHECK#1 +try{ +} +finally(e){} + + + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T2.js new file mode 100644 index 000000000..1f9deb436 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T2.js @@ -0,0 +1,13 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A16_T2; + * @section: 12.14; + * @assertion: TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally"; + * @description: Checking if execution of "catch" with no "try" fails; + * @negative + */ + +// CHECK#1 +catch diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T3.js new file mode 100644 index 000000000..09db8002d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T3.js @@ -0,0 +1,13 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A16_T3; + * @section: 12.14; + * @assertion: TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally"; + * @description: Checking if execution of "finally" with no "try" fails; + * @negative + */ + +// CHECK#1 +finally diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T4.js new file mode 100644 index 000000000..7d0a3b089 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T4.js @@ -0,0 +1,14 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A16_T4; + * @section: 12.14; + * @assertion: TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally"; + * @description: Catch: "catch (Identifier ) Block". Checking if execution of "catch" that takes no arguments fails; + * @negative + */ + +// CHECK#1 +try{} +catch{} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T5.js new file mode 100644 index 000000000..067dd0539 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T5.js @@ -0,0 +1,14 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A16_T5; + * @section: 12.14; + * @assertion: TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally"; + * @description: Catch: "catch (Identifier ) Block". Checking if execution of "catch" with no Block fails; + * @negative + */ + +// CHECK#1 +try{} +catch() diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T6.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T6.js new file mode 100644 index 000000000..c29bd071a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T6.js @@ -0,0 +1,14 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A16_T6; + * @section: 12.14, 12.1; + * @assertion: TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally"; + * @description: Block: "{ StatementList }". Checking if execution of "try{ catch{}{}" fails; + * @negative + */ + +// CHECK#1 +try{ +catch(){} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T7.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T7.js new file mode 100644 index 000000000..b18356355 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T7.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A16_T7; + * @section: 12.14, 12.1; + * @assertion: TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally"; + * @description: Block: "{ StatementList }". Checking if execution of "try{} catch(){" fails; + * @negative + */ + +// CHECK#1 +try{} +catch(){ + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T8.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T8.js new file mode 100644 index 000000000..53af6e95b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T8.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A16_T8; + * @section: 12.14, 12.1; + * @assertion: TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally"; + * @description: Block: "{ StatementList }". Catch: "catch (Identifier ) Block". Checking if execution of "try{} catch(){finally{}" fails; + * @negative + */ + +// CHECK#1 +try{} +catch(){ +finally{} + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T9.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T9.js new file mode 100644 index 000000000..c2a031a37 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T9.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A16_T9; + * @section: 12.14; + * @assertion: TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally"; + * @description: Checking if execution of "catch(){} finally{}" fails; + * @negative + */ + +// CHECK#1 +catch(){} +finally{} + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A17.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A17.js new file mode 100644 index 000000000..3b5ff12ff --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A17.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. + +/** + * @name: S12.14_A17; + * @section: 12.14; + * @assertion: Using "try" with "catch" or "finally" statement in a constructor; + * @description: Creating exceptions within constructor; + */ + +var i=1; +function Integer( value, exception ) { + try{ + this.value = checkValue( value ); + if(exception) $ERROR('#'+i+'.1: Must be exception'); + } + catch(e){ + this.value = e.toString(); + if(!exception) $ERROR('#'+i+'.2: Don`t must be exception'); + } + i++; +} + +function checkValue(value){ + if(Math.floor(value)!=value||isNaN(value)){ + throw (INVALID_INTEGER_VALUE +": " + value); + } + else{ + return value; + } +} + +// CHECK#1 +new Integer(13, false); +// CHECK#2 +new Integer(NaN, true); +// CHECK#3 +new Integer(0, false); +// CHECK#4 +new Integer(Infinity, false); +// CHECK#5 +new Integer(-1.23, true); +// CHECK#6 +new Integer(Math.LN2, true); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T1.js new file mode 100644 index 000000000..d31249a05 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T1.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A18_T1; + * @section: 12.14, 12.13; + * @assertion: Catching objects with try/catch/finally statement; + * @description: Catching undefined; + */ + +// CHECK#1 +try{ + throw undefined; +} +catch(e){ + if (e!==undefined) $ERROR('#1: Exception === undefined. Actual: '+e); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T2.js new file mode 100644 index 000000000..985c79a52 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T2.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A18_T2; + * @section: 12.14, 12.13; + * @assertion: Catching objects with try/catch/finally statement; + * @description: Catching null; + */ + +// CHECK#1 +try{ + throw null; +} +catch(e){ + if (e!==null) $ERROR('#1: Exception ===null. Actual: '+e); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T3.js new file mode 100644 index 000000000..edd42501e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T3.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. + +/** + * @name: S12.14_A18_T3; + * @section: 12.14, 12.13; + * @assertion: Catching objects with try/catch/finally statement; + * @description: Catching boolean; + */ + +// CHECK#1 +try{ + throw true; +} +catch(e){ + if (e!==true) $ERROR('#1: Exception ===true. Actual: Exception ==='+ e ); +} + +// CHECK#2 +try{ + throw false; +} +catch(e){ + if (e!==false) $ERROR('#2: Exception ===false. Actual: Exception ==='+ e ); +} + +// CHECK#3 +var b=false; +try{ + throw b; +} +catch(e){ + if (e!==false) $ERROR('#3: Exception ===false. Actual: Exception ==='+ e ); +} + +// CHECK#4 +var b=true; +try{ + throw b; +} +catch(e){ + if (e!==true) $ERROR('#4: Exception ===true. Actual: Exception ==='+ e ); +} + +// CHECK#5 +var b=true; +try{ + throw b&&false; +} +catch(e){ + if (e!==false) $ERROR('#5: Exception ===false. Actual: Exception ==='+ e ); +} + +// CHECK#5 +var b=true; +try{ + throw b||false; +} +catch(e){ + if (e!==true) $ERROR('#6: Exception ===true. Actual: Exception ==='+ e ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T4.js new file mode 100644 index 000000000..d3f76e83b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T4.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. + +/** + * @name: S12.14_A18_T4; + * @section: 12.14, 12.13; + * @assertion: Catching objects with try/catch/finally statement; + * @description: Catching string; + */ + +// CHECK#1 +try{ + throw "exception #1"; +} +catch(e){ + if (e!=="exception #1") $ERROR('#1: Exception ==="exception #1". Actual: Exception ==='+ e ); +} + +// CHECK#2 +try{ + throw "exception"+" #1"; +} +catch(e){ + if (e!=="exception #1") $ERROR('#2: Exception ==="exception #1". Actual: Exception ==='+ e ); +} + +// CHECK#3 +var b="exception #1"; +try{ + throw b; +} +catch(e){ + if (e!=="exception #1") $ERROR('#3: Exception ==="exception #1". Actual: Exception ==='+ e ); +} + +// CHECK#4 +var a="exception"; +var b=" #1"; +try{ + throw a+b; +} +catch(e){ + if (e!=="exception #1") $ERROR('#4: Exception ==="exception #1". Actual: Exception ==='+ e ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T5.js new file mode 100644 index 000000000..699c88ce3 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T5.js @@ -0,0 +1,101 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A18_T5; + * @section: 12.14, 12.13; + * @assertion: Catching objects with try/catch/finally statement; + * @description: Catching Number; + */ + +// CHECK#1 +try{ + throw 13; +} +catch(e){ + if (e!==13) $ERROR('#1: Exception ===13. Actual: Exception ==='+ e ); +} + +// CHECK#2 +try{ + throw 10+3; +} +catch(e){ + if (e!==13) $ERROR('#2: Exception ===13. Actual: Exception ==='+ e ); +} + +// CHECK#3 +var b=13; +try{ + throw b; +} +catch(e){ + if (e!==13) $ERROR('#3: Exception ===13. Actual: Exception ==='+ e ); +} + +// CHECK#4 +var a=3; +var b=10; +try{ + throw a+b; +} +catch(e){ + if (e!==13) $ERROR('#4: Exception ===13. Actual: Exception ==='+ e ); +} + +// CHECK#5 +try{ + throw 2.13; +} +catch(e){ + if (e!==2.13) $ERROR('#5: Exception ===2.13. Actual: Exception ==='+ e ); +} + +// CHECK#6 +var ex=2/3; +try{ + throw 2/3; +} +catch(e){ + if (e!==ex) $ERROR('#6: Exception ===2/3. Actual: Exception ==='+ e ); +} + +// CHECK#7 +try{ + throw NaN; +} +catch(e){ + if (!isNaN(e)) $ERROR('#7: Exception is NaN'); +} + +// CHECK#8 +try{ + throw +Infinity; +} +catch(e){ + if (e!==+Infinity) $ERROR('#8: Exception ===+Infinity. Actual: Exception ==='+ e ); +} + +// CHECK#9 +try{ + throw -Infinity; +} +catch(e){ + if (e!==-Infinity) $ERROR('#9: Exception ===-Infinity. Actual: Exception ==='+ e ); +} + +// CHECK#10 +try{ + throw +0; +} +catch(e){ + if (e!==+0) $ERROR('#10: Exception ===+0. Actual: Exception ==='+ e ); +} + +// CHECK#11 +try{ + throw -0; +} +catch(e){ + if (e!==-0) $ERROR('#11: Exception ===-0. Actual: Exception ==='+ e ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T6.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T6.js new file mode 100644 index 000000000..3f21bdf42 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T6.js @@ -0,0 +1,53 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A18_T6; + * @section: 12.14, 12.13; + * @assertion: Catching objects with try/catch/finally statement; + * @description: Catching Object; + */ +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';}, + i:7, +} + +try{ + throw myObj; +} +catch(e){ +// CHECK#1 + if (e.p1!=="a") $ERROR('#1: e.p1==="a". Actual: e.p1==='+ e.p1 ); +// CHECK#2 + if (e.value!=='myObj_value') $ERROR('#2: e.value===\'myObj_value\'. Actual: e.value==='+ e.value ); +// CHECK#3 + if (e.eval()!=='obj_eval') $ERROR('#3: e.eval()===\'obj_eval\'. Actual: e.eval()==='+ e.eval() ); +} + +// CHECK#4 +myObj.i=6; +try{ + throw myObj; +} +catch(e){} +if (myObj.i!==6) $ERROR('#4: Handling of catch must be correct'); + +// CHECK#5 +myObj.i=6; +try{ + throw myObj; +} +catch(e){ + e.i=10; +} +if (myObj.i!==10) $ERROR('#5: Handling of catch must be correct'); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T7.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T7.js new file mode 100644 index 000000000..b66fbac9a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T7.js @@ -0,0 +1,65 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A18_T7; + * @section: 12.14, 12.13; + * @assertion: Catching objects with try/catch/finally statement; + * @description: Catching Array; + */ + +var mycars = new Array(); +mycars[0] = "Saab"; +mycars[1] = "Volvo"; +mycars[2] = "BMW"; + +var mycars2 = new Array(); +mycars2[0] = "Mercedes"; +mycars2[1] = "Jeep"; +mycars2[2] = "Suzuki"; + +// CHECK#1 +try{ + throw mycars; +} +catch(e){ + for (var i=0;i<3;i++){ + if (e[i]!==mycars[i]) $ERROR('#1.'+i+': Exception['+i+']===mycars['+i+']. Actual: Exception['+i+']==='+ e[i] ); + } +} + +// CHECK#2 +try{ + throw mycars.concat(mycars2); +} +catch(e){ + for (var i=0;i<3;i++){ + if (e[i]!==mycars[i]) $ERROR('#2.'+i+': Exception['+i+']===mycars['+i+']. Actual: Exception['+i+']==='+ e[i] ); + } + for (var i=3;i<6;i++){ + if (e[i]!==mycars2[i-3]) $ERROR('#2.'+i+': Exception['+i+']===mycars2['+i+']. Actual: Exception['+i+']==='+ e[i] ); + } +} + +// CHECK#3 +try{ + throw new Array("Mercedes","Jeep","Suzuki"); +} +catch(e){ + for (var i=0;i<3;i++){ + if (e[i]!==mycars2[i]) $ERROR('#3.'+i+': Exception['+i+']===mycars2['+i+']. Actual: Exception['+i+']==='+ e[i]); + } +} + +// CHECK#4 +try{ + throw mycars.concat(new Array("Mercedes","Jeep","Suzuki")); +} +catch(e){ + for (var i=0;i<3;i++){ + if (e[i]!==mycars[i]) $ERROR('#4.'+i+': Exception['+i+']===mycars['+i+']. Actual: Exception['+i+']==='+ e[i] ); + } + for (var i=3;i<6;i++){ + if (e[i]!==mycars2[i-3]) $ERROR('#4.'+i+': Exception['+i+']===mycars2['+(i-3)+']. Actual: Exception['+i+']==='+ e[i]); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A19_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A19_T1.js new file mode 100644 index 000000000..80a07116a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A19_T1.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. + +/** + * @name: S12.14_A19_T1; + * @section: 12.14, 15.11, 16; + * @assertion: Catching system exceptions of different types with try statement; + * @description: Testing try/catch syntax construction; + */ + +// CHECK#1 +try{ + throw (Error("hello")); +} +catch(e){ + if (e.toString()!=="Error: hello") $ERROR('#1: Exception.toString()==="Error: hello". Actual: Exception is '+e); +} + +// CHECK#2 +try{ + throw (new Error("hello")); +} +catch(e){ + if (e.toString()!=="Error: hello") $ERROR('#2: Exception.toString()==="Error: hello". Actual: Exception is '+e); +} + +// CHECK#3 +var c3=0; +try{ + throw EvalError(1); +} +catch(e){ + if (e.toString()!=="EvalError: 1") $ERROR('#3: Exception.toString()==="EvalError: 1". Actual: Exception is '+e); +} + +// CHECK#4 +try{ + throw RangeError(1); +} +catch(e){ + if (e.toString()!=="RangeError: 1") $ERROR('#4: Exception.toString()==="RangeError: 1". Actual: Exception is '+e); +} + +// CHECK#5 +try{ + throw ReferenceError(1); +} +catch(e){ + if (e.toString()!=="ReferenceError: 1") $ERROR('#5: Exception.toString()==="ReferenceError: 1". Actual: Exception is '+e); +} + +// CHECK#6 +var c6=0; +try{ + throw TypeError(1); +} +catch(e){ + if (e.toString()!=="TypeError: 1") $ERROR('#6: Exception.toString()==="TypeError: 1". Actual: Exception is '+e); +} + +// CHECK#7 +try{ + throw URIError("message", "fileName", "1"); +} +catch(e){ + if (e.toString()!=="URIError: message") $ERROR('#7: Exception.toString()==="URIError: message". Actual: Exception is '+e); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A19_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A19_T2.js new file mode 100644 index 000000000..c1ff03c8d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A19_T2.js @@ -0,0 +1,101 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A19_T2; + * @section: 12.14; + * @assertion: Catching system exceptions of different types with try statement; + * @description: Testing try/catch/finally syntax construction; + */ + +var fin=0; +// CHECK#1 +try{ + throw (Error("hello")); +} +catch(e){ + if (e.toString()!=="Error: hello") $ERROR('#1.1: Exception.toString()==="Error: hello". Actual: Exception is '+e); +} +finally{ + fin=1; +} +if (fin!==1) $ERROR('#1.2: "finally" block must be evaluated'); + +// CHECK#2 +fin=0; +try{ + throw (new Error("hello")); +} +catch(e){ + if (e.toString()!=="Error: hello") $ERROR('#2.1: Exception.toString()==="Error: hello". Actual: Exception is '+e); +} +finally{ + fin=1; +} +if (fin!==1) $ERROR('#2.2: "finally" block must be evaluated'); + +// CHECK#3 +fin=0; +var c3=0; +try{ + throw EvalError(1); +} +catch(e){ + if (e.toString()!=="EvalError: 1") $ERROR('#3.1: Exception.toString()==="EvalError: 1". Actual: Exception is '+e); +} +finally{ + fin=1; +} +if (fin!==1) $ERROR('#3.2: "finally" block must be evaluated'); + +// CHECK#4 +fin=0; +try{ + throw RangeError(1); +} +catch(e){ + if (e.toString()!=="RangeError: 1") $ERROR('#4.1: Exception.toString()==="RangeError: 1". Actual: Exception is '+e); +} +finally{ + fin=1; +} +if (fin!==1) $ERROR('#4.2: "finally" block must be evaluated'); + +// CHECK#5 +fin=0; +try{ + throw ReferenceError(1); +} +catch(e){ + if (e.toString()!=="ReferenceError: 1") $ERROR('#5.1: Exception.toString()==="ReferenceError: 1". Actual: Exception is '+e); +} +finally{ + fin=1; +} +if (fin!==1) $ERROR('#5.2: "finally" block must be evaluated'); + +// CHECK#6 +fin=0; +try{ + throw TypeError(1); +} +catch(e){ + if (e.toString()!=="TypeError: 1") $ERROR('#6.1: Exception.toString()==="TypeError: 1". Actual: Exception is '+e); +} +finally{ + fin=1; +} +if (fin!==1) $ERROR('#6.2: "finally" block must be evaluated'); + +// CHECK#7 +fin=0; +try{ + throw URIError("message", "fileName", "1"); +} +catch(e){ + if (e.toString()!=="URIError: message") $ERROR('#7.1: Exception.toString()==="URIError: message". Actual: Exception is '+e); +} +finally{ + fin=1; +} +if (fin!==1) $ERROR('#7.2: "finally" block must be evaluated'); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A2.js new file mode 100644 index 000000000..83b637fe5 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A2.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. + +/** + * @name: S12.14_A2; + * @section: 12.14; + * @assertion: Throwing exception with "throw" and catching it with "try" statement; + * @description: Checking if execution of "catch" catches an exception thrown with "throw"; + */ + +// CHECK#1 +try { + throw "catchme"; + $ERROR('#1: throw "catchme" lead to throwing exception'); +} +catch(e){} + +// CHECK#2 +var c2=0; +try{ + try{ + throw "exc"; + $ERROR('#2.1: throw "exc" lead to throwing exception'); + }finally{ + c2=1; + } +} +catch(e){ + if (c2!==1){ + $ERROR('#2.2: "finally" block must be evaluated'); + } +} + +// CHECK#3 +var c3=0; +try{ + throw "exc"; + $ERROR('#3.1: throw "exc" lead to throwing exception'); +} +catch(err){ + var x3=1; +} +finally{ + c3=1; +} +if (x3!==1){ + $ERROR('#3.2: "catch" block must be evaluated'); +} +if (c3!==1){ + $ERROR('#3.3: "finally" block must be evaluated'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A3.js new file mode 100644 index 000000000..0d69b28b6 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A3.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A3; + * @section: 12.14; + * @assertion: Catching system exception with "try" statement; + * @description: Checking if execution of "catch" catches system exceptions; + */ + +// CHECK#1 +try{ + y; + $ERROR('#1: "y" lead to throwing exception'); +} +catch(e){} + +// CHECK#2 +var c2=0; +try{ + try{ + someValue; + $ERROR('#3.1: "someValues" lead to throwing exception'); + } + finally{ + c2=1; + } +} +catch(e){ + if (c2!==1){ + $ERROR('#3.2: "finally" block must be evaluated'); + } +} + +// CHECK#3 +var c3=0,x3=0; +try{ + x3=someValue; + $ERROR('#3.1: "x3=someValues" lead to throwing exception'); +} +catch(err){ + x3=1; +} +finally{ + c3=1; +} +if (x3!==1){ + $ERROR('#3.2: "catch" block must be evaluated'); +} +if (c3!==1){ + $ERROR('#3.3: "finally" block must be evaluated'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A4.js new file mode 100644 index 000000000..e76809232 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A4.js @@ -0,0 +1,36 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A4; + * @section: 12.14; + * @assertion: Sanity test for "catch(Indetifier) statement"; + * @description: Checking if deleting an exception fails; + * @strict_mode_negative SyntaxError; + */ + +// CHECK#1 +try { + throw "catchme"; + $ERROR('#1.1: throw "catchme" lead to throwing exception'); +} +catch (e) { + if (delete e){ + $ERROR('#1.2: Exception has DontDelete property'); + } + if (e!=="catchme") { + $ERROR('#1.3: Exception === "catchme". Actual: Exception ==='+ e ); + } +} + +// CHECK#2 +try { + throw "catchme"; + $ERROR('#2.1: throw "catchme" lead to throwing exception'); +} +catch(e){} +try{ + e; + $ERROR('#2.2: Deleting catching exception after ending "catch" block'); +} +catch(err){} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A5.js new file mode 100644 index 000000000..5be0e3786 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A5.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. + +/** + * @name: S12.14_A5; + * @section: 12.14; + * @assertion: The production TryStatement: "try Block Finally" and the production TryStatement: "try Block Catch Finally"; + * @description: Checking "catch" catches the Identifier in appropriate way; + */ + +// CHECK#1 +try { + throw "catchme"; + throw "dontcatchme"; + $ERROR('#1.1: throw "catchme" lead to throwing exception'); +} +catch (e) { + if(e==="dontcatchme"){ + $ERROR('#1.2: Exception !== "dontcatchme"'); + } + if (e!=="catchme") { + $ERROR('#1.3: Exception === "catchme". Actual: Exception ==='+ e ); + } +} + +// CHECK#2 +function SwitchTest1(value){ + var result = 0; + try{ + switch(value) { + case 1: + result += 4; + throw result; + break; + case 4: + result += 64; + throw "ex"; + } + return result; + } + catch(e){ + if ((value===1)&&(e!==4)) $ERROR('#2.1: Exception === 4. Actual: '+e); + if ((value===4)&&(e!=="ex"))$ERROR('#2.2: Exception === "ex". Actual: '+e); + } + finally{ + return result; + } +} +if (SwitchTest1(1)!==4) $ERROR('#2.3: "finally" block must be evaluated'); +if (SwitchTest1(4)!==64)$ERROR('#2.4: "finally" block must be evaluated'); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A6.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A6.js new file mode 100644 index 000000000..fbdb4287d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A6.js @@ -0,0 +1,66 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A6; + * @section: 12.14; + * @assertion: The production TryStatement: "try Block Catch Finally"; + * @description: Executing sequence of "try" statements, using counters with varying values within; + */ + +// CHECK#1 +var c1=0; +try { + c1+=1; + y; + $ERROR('#1.1: "y" lead to throwing exception'); +} +catch (e) { + c1*=2; +} +if (c1!==2){ + $ERROR('#1.2: Sequence evaluation of commands try/catch is 1. try, 2. catch'); +} + +// CHECK#2 +var c2=0; +try{ + c2+=1; +} +finally{ + c2*=2; +} +if (c2!==2){ + $ERROR('#2: Sequence evaluation of commands try/finally is 1. try, 2. finally'); +} + +// CHECK#3 +var c3=0; +try{ + c3=1; + z; +} +catch(err){ + c3*=2; +} +finally{ + c3+=1; +} +if (c3!==3){ + $ERROR('#3: Sequence evaluation of commands try/catch/finally(with exception) is 1. try, 2. catch, 3. finally'); +} + +// CHECK#4 +var c4=0; +try{ + c4=1; +} +catch(err){ + c4*=3; +} +finally{ + c4+=1; +} +if (c4!==2){ + $ERROR('#4: Sequence evaluation of commands try/catch/finally(without exception) is 1. try, 2. finally'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A7_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A7_T1.js new file mode 100644 index 000000000..b6b2609a3 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A7_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. + +/** + * @name: S12.14_A7_T1; + * @section: 12.14; + * @assertion: Evaluating the nested productions TryStatement; + * @description: Checking if the production of nested TryStatement statements evaluates correct; + */ + +// CHECK#1 +try{ + try{ + throw "ex2"; + } + catch(er2){ + if (er2!=="ex2") + $ERROR('#1.1: Exception === "ex2". Actual: Exception ==='+ e ); + throw "ex1"; + } + } + catch(er1){ + if (er1!=="ex1") $ERROR('#1.2: Exception === "ex1". Actual: '+er1); + if (er1==="ex2") $ERROR('#1.3: Exception !== "ex2". Actual: catch previous embedded exception'); +} + +// CHECK#2 +try{ + throw "ex1"; +} +catch(er1){ + try{ + throw "ex2"; + } + catch(er1){ + if (er1==="ex1") $ERROR('#2.1: Exception !== "ex1". Actual: catch previous catching exception'); + if (er1!=="ex2") $ERROR('#2.2: Exception === "ex2". Actual: Exception ==='+ er1 ); + } + if (er1!=="ex1") $ERROR('#2.3: Exception === "ex1". Actual: Exception ==='+ er1 ); + if (er1==="ex2") $ERROR('#2.4: Exception !== "ex2". Actual: catch previous catching exception'); +} + +// CHECK#3 +try{ + throw "ex1"; +} +catch(er1){ + if (er1!=="ex1") $ERROR('#3.1: Exception ==="ex1". Actual: Exception ==='+ er1 ); +} +finally{ + try{ + throw "ex2"; + } + catch(er1){ + if (er1==="ex1") $ERROR('#3.2: Exception !=="ex1". Actual: catch previous embedded exception'); + if (er1!=="ex2") $ERROR('#3.3: Exception ==="ex2". Actual: Exception ==='+ er1 ); + } +} + +// CHECK#4 +var c4=0; +try{ + throw "ex1"; +} +catch(er1){ + try{ + throw "ex2"; + } + catch(er1){ + if (er1==="ex1") $ERROR('#4.1: Exception !=="ex1". Actual: catch previous catching exception'); + if (er1!=="ex2") $ERROR('#4.2: Exception ==="ex2". Actual: Exception ==='+ er1 ); + } + if (er1!=="ex1") $ERROR('#4.3: Exception ==="ex1". Actual: Exception ==='+ er1 ); + if (er1==="ex2") $ERROR('#4.4: Exception !=="ex2". Actual: Catch previous embedded exception'); +} +finally{ + c4=1; +} +if (c4!==1) $ERROR('#4.5: "finally" block must be evaluated'); + +// CHECK#5 +var c5=0; +try{ + try{ + throw "ex2"; + } + catch(er1){ + if (er1!=="ex2") $ERROR('#5.1: Exception ==="ex2". Actual: Exception ==='+ er1 ); + } + throw "ex1"; +} +catch(er1){ + if (er1!=="ex1") $ERROR('#5.2: Exception ==="ex1". Actual: Exception ==='+ er1 ); + if (er1==="ex2") $ERROR('#5.3: Exception !=="ex2". Actual: catch previous embedded exception'); +} +finally{ + c5=1; +} +if (c5!==1) $ERROR('#5.4: "finally" block must be evaluated'); + +// CHECK#6 +var c6=0; +try{ + try{ + throw "ex1"; + } + catch(er1){ + if (er1!=="ex1") $ERROR('#6.1: Exception ==="ex1". Actual: Exception ==='+ er1 ); + } +} +finally{ + c6=1; +} +if (c6!==1) $ERROR('#6.2: "finally" block must be evaluated'); + +// CHECK#7 +var c7=0; +try{ + try{ + throw "ex1"; + } + finally{ + try{ + c7=1; + throw "ex2"; + } + catch(er1){ + if (er1!=="ex2") $ERROR('#7.1: Exception ==="ex2". Actual: Exception ==='+ er1 ); + if (er1==="ex1") $ERROR('#7.2: Exception !=="ex1". Actual: catch previous embedded exception'); + c7++; + } + } +} +catch(er1){ + if (er1!=="ex1") $ERROR('#7.3: Exception ==="ex1". Actual: Exception ==='+ er1 ); +} +if (c7!==2) $ERROR('#7.4: "finally" block must be evaluated'); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A7_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A7_T2.js new file mode 100644 index 000000000..aba1d046f --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A7_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. + +/** + * @name: S12.14_A7_T2; + * @section: 12.14; + * @assertion: Evaluating the nested productions TryStatement; + * @description: Checking if the production of nested TryStatement statements evaluates correct; + */ + +// CHECK#1 +try{ + try{ + throw "ex2"; + } + finally{ + throw "ex1"; + } +} +catch(er1){ + if (er1!=="ex1") $ERROR('#1.2: Exception === "ex1". Actual: Exception ==='+er1 ); + if (er1==="ex2") $ERROR('#1.3: Exception !== "ex2". Actual: catch previous embedded exception'); +} + +// CHECK#2 +try{ + try{ + throw "ex1"; + } + catch(er1){ + if (er1!=="ex1") $ERROR('#2.1: Exception === "ex1". Actual: Exception ==='+er1 ); + try{ + throw "ex2"; + } + finally{ + throw "ex3"; + } + $ERROR('#2.2: throw "ex1" lead to throwing exception'); + } +} +catch(er1){ + if (er1!=="ex3") $ERROR('#2.3: Exception === "ex3". Actual: Exception ==='+er1 ); +} + +// CHECK#3 +try{ + try{ + throw "ex1"; + } + catch(er1){ + if (er1!=="ex1") $ERROR('#3.1: Exception === "ex1". Actual: Exception ==='+er1 ); + } + finally{ + try{ + throw "ex2"; + } + finally{ + throw "ex3"; + } + } +} +catch(er1){ + if (er1!=="ex3") $ERROR('#3.2: Exception === "ex3". Actual: Exception ==='+er1 ); +} + +// CHECK#4 +var c4=0; +try{ + try{ + throw "ex1"; + } + catch(er1){ + if (er1!=="ex1") $ERROR('#4.1: Exception === "ex1". Actual: Exception ==='+er1 ); + try{ + throw "ex2"; + } + finally{ + throw "ex3"; + } + } + finally{ + c4=1; + } +} +catch(er1){ + if (er1!=="ex3") $ERROR('#4.2: Exception === "ex3". Actual: Exception ==='+er1 ); +} +if (c4!==1) $ERROR('#4.3: "finally" block must be evaluated'); + +// CHECK#5 +var c5=0; +try{ + try{ + throw "ex2"; + } + finally{ + throw "ex3"; + } + throw "ex1"; +} +catch(er1){ + if (er1!=="ex3") $ERROR('#5.1: Exception === "ex3". Actual: Exception ==='+er1 ); + if (er1==="ex2") $ERROR('#5.2: Exception !== "ex2". Actual: catch previous embedded exception'); + if (er1==="ex1") $ERROR('#5.3: Exception !=="ex1". Actual: catch previous embedded exception'); +} +finally{ + c5=1; +} +if (c5!==1) $ERROR('#5.4: "finally" block must be evaluated'); + +// CHECK#6 +var c6=0; +try{ + try{ + try{ + throw "ex1"; + } + finally{ + throw "ex2"; + } + } + finally{ + c6=1; + } +} +catch(er1){ + if (er1!=="ex2") $ERROR('#6.1: Exception === "ex2". Actual: Exception ==='+er1 ); +} +if (c6!==1) $ERROR('#6.2: "finally" block must be evaluated'); + +// CHECK#7 +var c7=0; +try{ + try{ + throw "ex1"; + } + finally{ + try{ + c7=1; + throw "ex2"; + } + finally{ + c7++; + throw "ex3"; + } + } +} +catch(er1){ + if (er1!=="ex3") $ERROR('#7.1: Exception === "ex3". Actual: Exception ==='+er1 ); +} +if (c7!==2) $ERROR('#7.2: Embedded "try/finally" blocks must be evaluated'); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A7_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A7_T3.js new file mode 100644 index 000000000..986cddd0e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A7_T3.js @@ -0,0 +1,168 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A7_T3; + * @section: 12.14; + * @assertion: Evaluating the nested productions TryStatement; + * @description: Checking if the production of nested TryStatement statements evaluates correct; + */ + +// CHECK#1 +try{ + try{ + throw "ex2"; + } + catch(er2){ + if (er2!=="ex2") $ERROR('#1.1: Exception === "ex2". Actual: Exception ==='+er2); + throw "ex1"; + } + finally{ + throw "ex3"; + } +} +catch(er1){ + if (er1!=="ex3") $ERROR('#1.2: Exception === "ex3". Actual: Exception ==='+er1); + if (er1==="ex2") $ERROR('#1.3: Exception !=="ex2". Actual: catch previous catched exception'); + if (er1==="ex1") $ERROR('#1.4: Exception !=="ex1". Actual: catch previous embedded exception'); +} + +// CHECK#2 +var c2=0; +try{ + throw "ex1"; +} +catch(er1){ + try{ + throw "ex2"; + } + catch(er1){ + if (er1==="ex1") $ERROR('#2.1: Exception !=="ex1". Actual: catch previous catched exception'); + if (er1!=="ex2") $ERROR('#2.2: Exception === "ex2". Actual: Exception ==='+er1); + } + finally{ + c2=1; + } + if (er1!=="ex1") $ERROR('#2.3: Exception === "ex1". Actual: Exception ==='+er1); + if (er1==="ex2") $ERROR('#2.4: Exception !== "ex2". Actual: catch previous embedded exception'); +} +if (c2!==1) $ERROR('#2.5: "finally" block must be evaluated'); + +// CHECK#3 +var c3=0; +try{ + throw "ex1"; +} +catch(er1){ + if (er1!=="ex1") $ERROR('#3.1: Exception === "ex1". Actual: Exception ==='+er1); +} +finally{ + try{ + throw "ex2"; + } + catch(er1){ + if (er1==="ex1") $ERROR('#3.2: Exception !=="ex1". Actual: catch previous catched exception'); + if (er1!=="ex2") $ERROR('#3.3: Exception === "ex2". Actual: Exception ==='+er1); + } + finally{ + c3=1; + } +} +if (c3!==1) $ERROR('#3.4: "finally" block must be evaluated'); + +// CHECK#4 +var c4=0; +try{ + try{ + throw "ex1"; + } + catch(er1){ + try{ + throw "ex2"; + } + catch(er1){ + if (er1==="ex1") $ERROR('#4.1: Exception !=="ex2". Actual: catch previous catched exception'); + if (er1!=="ex2") $ERROR('#4.2: Exception === "ex2". Actual: Exception ==='+er1); + } + finally{ + c4=2; + throw "ex3"; + } + if (er1!=="ex1") $ERROR('#4.3: Exception === "ex2". Actual: Exception ==='+er1); + if (er1==="ex2") $ERROR('#4.4: Exception !=="ex2". Actual: catch previous catched exception'); + if (er1==="ex3") $ERROR('#4.5: Exception !=="ex3". Actual: Catch previous embedded exception'); + } + finally{ + c4*=2; + } +} +catch(er1){} +if (c4!==4) $ERROR('#4.6: "finally" block must be evaluated'); + +// CHECK#5 +var c5=0; +try{ + try{ + throw "ex2"; + } + catch(er1){ + if (er1!=="ex2") $ERROR('#5.1: Exception === "ex2". Actual: Exception ==='+er1); + } + finally{ + throw "ex3"; + } + throw "ex1"; +} +catch(er1){ + if (er1!=="ex3") $ERROR('#5.2: Exception === "ex3". Actual: Exception ==='+er1); + if (er1==="ex2") $ERROR('#5.3: Exception !=="ex2". Actual: catch previous catched exception'); + if (er1==="ex1") $ERROR('#5.4: Exception !=="ex1". Actual: catch previous embedded exception'); +} +finally{ + c5=1; +} +if (c5!==1) $ERROR('#5.5: "finally" block must be evaluated'); + +// CHECK#6 +var c6=0; +try{ + try{ + throw "ex1"; + } + catch(er1){ + if (er1!=="ex1") $ERROR('#6.1: Exception === "ex1". Actual: Exception ==='+er1); + } + finally{ + c6=2; + } +} +finally{ + c6*=2; +} +if (c6!==4) $ERROR('#6.2: "finally" block must be evaluated'); + +// CHECK#7 +var c7=0; +try{ + try{ + throw "ex1"; + } + finally{ + try{ + c7=1; + throw "ex2"; + } + catch(er1){ + if (er1!=="ex2") $ERROR('#7.1: Exception === "ex2". Actual: Exception ==='+er1); + if (er1==="ex1") $ERROR('#7.2: Exception !=="ex2". Actual: catch previous catched exception'); + c7++; + } + finally{ + c7*=2; + } + } +} +catch(er1){ + if (er1!=="ex1") $ERROR('#7.3: Exception === "ex1". Actual: Exception ==='+er1); +} +if (c7!==4) $ERROR('#7.4: "finally" block must be evaluated'); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A8.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A8.js new file mode 100644 index 000000000..70773f9fa --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A8.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A8; + * @section: 12.14; + * @assertion: "try" with "catch" or "finally" statement within/without an "if" statement; + * @description: Throwing exception within an "if" statement; + */ + +// CHECK#1 +var c1=1; +try{ + if(c1===1){ + throw "ex1"; + $ERROR('#1.1: throw "ex1" lead to throwing exception'); + } + $ERROR('#1.2: throw "ex1" inside the "if" statement lead to throwing exception'); +} +catch(er1){ + if (er1!=="ex1") $ERROR('#1.3: Exception ==="ex1". Actual: Exception ==='+er1); +} + +// CHECK#2 +var c2=1; +if(c2===1){ + try{ + throw "ex1"; + $ERROR('#2.1: throw "ex1" lead to throwing exception'); + } + catch(er1){ + if(er1!="ex1") $ERROR('#2.2: Exception ==="ex1". Actual: Exception ==='+er1); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A9_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A9_T1.js new file mode 100644 index 000000000..fdc80da99 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A9_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A9_T1; + * @section: 12.14; + * @assertion: "try" with "catch" or "finally" statement within/without an "do while" statement; + * @description: Loop within a "try" Block, from where exception is thrown; + */ + +// CHECK#1 +var i=0; +try{ + do{ + if(i===5) throw i; + i++; + } + while(i<10); +} +catch(e){ + if(e!==5)$ERROR('#1: Exception ===5. Actual: Exception ==='+ e ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A9_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A9_T2.js new file mode 100644 index 000000000..343a24161 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A9_T2.js @@ -0,0 +1,121 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A9_T2; + * @section: 12.14; + * @assertion: "try" with "catch" or "finally" statement within/without an "do while" statement; + * @description: "try" statement within a loop, the statement contains "continue" statement; + */ + +// CHECK#1 +var c1=0,fin=0; +do{ + try{ + c1+=1; + continue; + } + catch(er1){} + finally{ + fin=1; + } + fin=-1; +} +while(c1<2); +if(fin!==1){ + $ERROR('#1: "finally" block must be evaluated at "try{continue} catch finally" construction'); +} + +// CHECK#2 +var c2=0,fin2=0; +do{ + try{ + throw "ex1"; + } + catch(er1){ + c2+=1; + continue; + } + finally{ + fin2=1; + } + fin2=-1; +} +while(c2<2); +if(fin2!==1){ + $ERROR('#2: "finally" block must be evaluated at "try catch{continue} finally" construction'); +} + +// CHECK#3 +var c3=0,fin3=0; +do{ + try{ + throw "ex1"; + } + catch(er1){ + c3+=1; + } + finally{ + fin3=1; + continue; + } + fin3=0; +} +while(c3<2); +if(fin3!==1){ + $ERROR('#3: "finally" block must be evaluated at "try catch finally{continue}" construction'); +} + +// CHECK#4 +var c4=0,fin4=0; +do{ + try{ + c4+=1; + continue; + } + finally{ + fin4=1; + } + fin4=-1; +} +while(c4<2); +if(fin4!==1){ + $ERROR('#4: "finally" block must be evaluated at "try{continue} finally" construction'); +} + +// CHECK#5 +var c5=0; +do{ + try{ + throw "ex1"; + } + catch(er1){ + c5+=1; + continue; + } +} +while(c5<2); +if(c5!==2){ + $ERROR('#5: "try catch{continue}" must work correctly'); +} + +// CHECK#6 +var c6=0,fin6=0; +do{ + try{ + c6+=1; + throw "ex1" + } + finally{ + fin6=1; + continue; + } + fin6=-1; +} +while(c6<2); +if(fin6!==1){ + $ERROR('#6.1: "finally" block must be evaluated'); +} +if(c6!==2){ + $ERROR('#6.2: "try finally{continue}" must work correctly'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A9_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A9_T3.js new file mode 100644 index 000000000..0fdf97307 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A9_T3.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. + +/** + * @name: S12.14_A9_T3; + * @section: 12.14; + * @assertion: "try" with "catch" or "finally" statement within/without an "do while" statement; + * @description: "try" statement within a loop, the statement contains "break" statement; + */ + +// CHECK#1 +var c1=0,fin=0; +do{ + try{ + c1+=1; + break; + } + catch(er1){} + finally{ + fin=1; + } + fin=-1; + c1+=2; +} +while(c1<2); +if(fin!==1){ + $ERROR('#1.1: "finally" block must be evaluated'); +} +if(c1!==1){ + $ERROR('#1.2: "try{break}catch finally" must work correctly'); +} + +// CHECK#2 +var c2=0,fin2=0; +do{ + try{ + throw "ex1"; + } + catch(er1){ + c2+=1; + break; + } + finally{ + fin2=1; + } + c2+=2; + fin2=-1; +} +while(c2<2); +if(fin2!==1){ + $ERROR('#2.1: "finally" block must be evaluated'); +} +if(c2!==1){ + $ERROR('#2.2: "try catch{break} finally" must work correctly'); +} + +// CHECK#3 +var c3=0,fin3=0; +do{ + try{ + throw "ex1"; + } + catch(er1){ + c3+=1; + } + finally{ + fin3=1; + break; + } + c3+=2; + fin3=0; +} +while(c3<2); +if(fin3!==1){ + $ERROR('#3.1: "finally" block must be evaluated'); +} +if(c3!==1){ + $ERROR('#3.2: "try catch finally{break}" must work correctly'); +} + +// CHECK#4 +var c4=0,fin4=0; +do{ + try{ + c4+=1; + break; + } + finally{ + fin4=1; + } + fin4=-1; + c4+=2; +} +while(c4<2); +if(fin4!==1){ + $ERROR('#4.1: "finally" block must be evaluated'); +} +if(c4!==1){ + $ERROR('#4.2: "try{break} finally" must work correctly'); +} + +// CHECK#5 +var c5=0; +do{ + try{ + throw "ex1"; + } + catch(er1){ + break; + } +} +while(c5<2); +if(c5!==0){ + $ERROR('#5: "try catch{break}" must work correctly'); +} + +// CHECK#6 +var c6=0; +do{ + try{ + c6+=1; + break; + } + catch(er1){} + c6+=2; +} +while(c6<2); +if(c6!==1){ + $ERROR('#6: "try{break} catch" must work correctly'); +} + +// CHECK#7 +var c7=0,fin7=0; +try{ + do{ + try{ + c7+=1; + throw "ex1"; + } + finally{ + fin7=1; + break; + } + fin7=-1; + c7+=2; + } + while(c7<2); +} +catch(ex1){ + c7=10; +} +if(fin7!==1){ + $ERROR('#7.1: "finally" block must be evaluated'); +} +if(c7!==1){ + $ERROR('#7.2: try finally{break} error'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A9_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A9_T4.js new file mode 100644 index 000000000..72fbc4436 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A9_T4.js @@ -0,0 +1,57 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A9_T4; + * @section: 12.14; + * @assertion: "try" with "catch" or "finally" statement within/without an "do while" statement; + * @description: "try" statement within a loop, the statement contains "continue" and "break" statements; + */ + +// CHECK#1 +var c1=0,fin=0; +do{ + try{ + c1+=1; + break; + } + catch(er1){} + finally{ + fin=1; + continue; + } + fin=-1; + c1+=2; +} +while(c1<2); +if(fin!==1){ + $ERROR('#1.1: "finally" block must be evaluated'); +} +if(c1!==2){ + $ERROR('#1.2: "try{break} catch finally{continue}" must work correctly'); +} + +// CHECK#2 +var c2=0,fin2=0; +do{ + try{ + throw "ex1"; + } + catch(er1){ + c2+=1; + break; + } + finally{ + fin2=1; + continue; + } + c2+=2; + fin2=-1; +} +while(c2<2); +if(fin2!==1){ + $ERROR('#2.1: "finally" block must be evaluated'); +} +if(c2!==2){ + $ERROR('#2.2: "try catch{break} finally{continue}" must work correctly'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A9_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A9_T5.js new file mode 100644 index 000000000..1aaa65ad5 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A9_T5.js @@ -0,0 +1,41 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A9_T5; + * @section: 12.14; + * @assertion: "try" with "catch" or "finally" statement within/without an "do while" statement; + * @description: Checking if exceptions are thrown correctly from wherever of loop body; + */ + + +// CHECK#1 +var c=0, i=0; +var fin=0; +do{ + i+=1; + try{ + if(c===0){ + throw "ex1"; + $ERROR('#1.1: throw "ex1" lead to throwing exception'); + } + c+=2; + if(c===1){ + throw "ex2"; + $ERROR('#1.2: throw "ex2" lead to throwing exception'); + } + } + catch(er1){ + c-=1; + continue; + $ERROR('#1.3: "try catch{continue} finally" must work correctly'); + } + finally{ + fin+=1; + } +} +while(i<10); +if(fin!==10){ + $ERROR('#1.4: "finally" block must be evaluated'); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.1_Block/S12.1_A1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.1_Block/S12.1_A1.js new file mode 100644 index 000000000..e9f3f79e2 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.1_Block/S12.1_A1.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.1_A1; +* @section: 12.1; +* @assertion: The production Block { } in strict code can't contain +* function declaration; +* @description: Trying to declare function at the Block statement; +* @negative SyntaxError; +*/ + +"use strict"; +if (!strict_mode) { throw new SyntaxError('unspecified case'); } + +{ + function __func(){} +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.1_Block/S12.1_A2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.1_Block/S12.1_A2.js new file mode 100644 index 000000000..bfe3e1e37 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.1_Block/S12.1_A2.js @@ -0,0 +1,36 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.1_A2; +* @section: 12.1; +* @assertion: The production StatementList Statement is evaluated as follows +* 1. Evaluate Statement. +* 2. If an exception was thrown, return (throw, V, empty) where V is the exception; +* @description: Throwing exception within a Block; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + x(); + $ERROR('#1: "x()" lead to throwing exception'); +} catch (e) { + $PRINT(e.message); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +try { + throw "catchme"; + $ERROR('#2: throw "catchme" lead to throwing exception'); +} catch (e) { + if (e!=="catchme") { + $ERROR('#2.1: Exception === "catchme". Actual: Exception ==='+ e ); + } +} + +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.1_Block/S12.1_A4_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.1_Block/S12.1_A4_T1.js new file mode 100644 index 000000000..40e155826 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.1_Block/S12.1_A4_T1.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.1_A4_T1; +* @section: 12.1; +* @assertion: The production Block can't be inside of expression; +* @description: Checking if execution of "y={__func}()" fails; +* @negative; +*/ + +function __func(){}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +y={__func}(); +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.1_Block/S12.1_A4_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.1_Block/S12.1_A4_T2.js new file mode 100644 index 000000000..95bccaf05 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.1_Block/S12.1_A4_T2.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.1_A4_T2; +* @section: 12.1; +* @assertion: The production Block can't be inside of expression; +* @description: Checking if execution of "y={x}" fails; +* @negative; +*/ + +x=1; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +y={x}; +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.1_Block/S12.1_A5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.1_Block/S12.1_A5.js new file mode 100644 index 000000000..94a236751 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.1_Block/S12.1_A5.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. + +/** +* @name: S12.1_A5; +* @section: 12.1; +* @assertion: StatementList: StatementList Statement inside the Block is evaluated from left to right; +* @description: Throwing exceptions within embedded/sequence Blocks; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + throw 1; + throw 2; + throw 3; + $ERROR('1.1: throw 1 lead to throwing exception'); +} catch (e) { + if (e!==1) { + $ERROR('#1.2: Exception === 1. Actual: Exception ==='+ e); + } +} +//////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +try { + { + throw 1; + throw 2; + } + throw 3; + $ERROR('#2.1: throw 1 lead to throwing exception'); +} catch (e) { + if (e!==1) { + $ERROR('#2.2: Exception === 1. Actual: Exception ==='+ e); + } +} +//////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +try { + throw 1; + { + throw 2; + throw 3; + } + $ERROR('#3.1: throw 1 lead to throwing exception'); +} catch (e) { + if (e!==1) { + $ERROR('#3.2: Exception === 1. Actual: Exception ==='+ e); + } +} +//////////////////////////////////////////////////////////////////////////////// + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A1.js new file mode 100644 index 000000000..3dfb7f792 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A1.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.2_A1; +* @section: 12.2; +* @assertion: Variables are created when the program is entered. Variables are initialised to "undefined" +* when created. A variable with an Initialiser is assigned the value of its AssignmentExpression when the +* VariableStatement is executed, not when the variable is created; +* @description: Creating variables after entering the execution scope; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + __x = __x; + __y = __x ? "good fellow" : "liar"; // __y assigned to "liar" since __x undefined + __z = __z === __x ? 1 : 0; // __z assigned to 1 since both __x and __z are undefined +} catch (e) { + $ERROR('#1: Using declarated variable before it declaration is admitted'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +try{ + __something__undefined = __something__undefined; + $ERROR('#2: "__something__undefined = __something__undefined" lead to throwing exception'); +} catch(e){ + $PRINT(e.message); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if ((__y !== "liar")&(__z !== 1)) { + $ERROR('#3: (__y === "liar") and (__z === 1). Actual: __y ==='+__y+' and __z ==='+__z ); +} +// +////////////////////////////////////////////////////////////////////////////// + +var __x, __y = true, __z = __y ? "smeagol" : "golum"; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if (!__y&!(__z = "smeagol")) { + $ERROR('#4: A variable with an Initialiser is assigned the value of its AssignmentExpression when the VariableStatement is executed'); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A10.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A10.js new file mode 100644 index 000000000..85516e7c5 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A10.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.2_A10; +* @section: 12.2; +* @assertion: "var" statement within "for" statement is allowed; +* @description: Declaring variable within a "for" IterationStatement; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + __ind=__ind; +} catch (e) { + $ERROR('#1: var inside "for" is admitted '+e.message); +} +// +////////////////////////////////////////////////////////////////////////////// + +for (var __ind;;){ + break; +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A11.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A11.js new file mode 100644 index 000000000..a011f166c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A11.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.2_A11; +* @section: 12.2; +* @assertion: When using property attributes, {ReadOnly} is not used; +* @description: Changing variable value using property attributes; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +this['__declared__var'] = "baloon"; +if (this['__declared__var'] !== "baloon") { + $ERROR('#1: this[\'__declared__var\'] === "baloon". Actual: this[\'__declared__var\'] ==='+ this['__declared__var'] ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__declared__var !== "baloon") { + $ERROR('#2: __declared__var === "baloon". Actual: __declared__var ==='+ __declared__var ); +} +// +////////////////////////////////////////////////////////////////////////////// + +var __declared__var; diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A12.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A12.js new file mode 100644 index 000000000..8f76e5a6d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A12.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. + +/** +* @name: S12.2_A12; +* @section: 12.2; +* @assertion: VariableDeclaration within "do-while" loop is allowed; +* @description: Declaring variable within "do-while" statement; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + x=x; +} catch (e) { + $ERROR('#1: Declaration variable inside "do-while" statement is admitted'); +} +// +////////////////////////////////////////////////////////////////////////////// + +do var x; while (false); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A2.js new file mode 100644 index 000000000..c51ad25ec --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A2.js @@ -0,0 +1,46 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.2_A2; +* @section: 12.2; +* @assertion: Variables are defined with global scope (that is, they are created as members of the global object, as described in 10.1.3) using property attributes { DontDelete}; +* @description: Checking if deleting global variables that have the attributes {DontDelete} fails; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (delete(__variable)) { + $ERROR('#1: delete(__variable)===false'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (delete(this["__variable"])) { + $ERROR('#2: delete(this["__variable"])===false'); +} +// +////////////////////////////////////////////////////////////////////////////// + + +var __variable; +var __variable = "defined"; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (delete(__variable) | delete(this["__variable"])) { + $ERROR('#3: (delete(__variable) | delete(this["__variable"]))===false' ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if ((__variable !== "defined")|(this["__variable"] !=="defined")) { + $ERROR('#4: __variable === "defined" and this["__variable"] ==="defined"'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A3.js new file mode 100644 index 000000000..5f0e4bfbf --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A3.js @@ -0,0 +1,54 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.2_A3; +* @section: 12.2; +* @assertion: FunctionDeclaration produces a new scope; +* @description: Using Global scope and Function scope together; +*/ + +var __var = "OUT"; + +(function(){ + var __var ="IN"; + (function(){__var = "INNER_SPACE";})(); + (function(){var __var = "INNER_SUN";})(); + ////////////////////////////////////////////////////////////////////////////// + //CHECK#1 + if (__var !== "INNER_SPACE") { + $ERROR('#1: __var === "INNER_SPACE". Actual: __var ==='+ __var ); + } + // + ////////////////////////////////////////////////////////////////////////////// +})(); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__var !== "OUT") { + $ERROR('#2: __var === "OUT". Actual: __var ==='+ __var ); +} +// +////////////////////////////////////////////////////////////////////////////// + + +(function(){ + __var ="IN"; + (function(){__var = "INNERED"})(); + (function(){var __var = "INNAGER"})(); + ////////////////////////////////////////////////////////////////////////////// + //CHECK#3 + if (__var!=="INNERED") { + $ERROR('#3: __var==="INNERED". Actual: __var==='+ __var ); + } + // + ////////////////////////////////////////////////////////////////////////////// +})(); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if (__var!=="INNERED") { + $ERROR('#4: __var==="INNERED". Actual: __var==='+ __var ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A4.js new file mode 100644 index 000000000..7a93d7403 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A4.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.2_A4; +* @section: 12.2; +* @assertion: Unicode characters in variable Identifier are allowed; +* @description: Create and use unicode characters in variable Identifier; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + __var=__var; +} catch (e) { + $ERROR('#1: Unicode characters in variable Identifier allowed'); +} +// +////////////////////////////////////////////////////////////////////////////// + +var \u005f\u005f\u0076\u0061\u0072 = 1; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__var !== 1) { + $ERROR('#2: __var === 1. Actual: __var ==='+ __var ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A5.js new file mode 100644 index 000000000..0943ff5bc --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A5.js @@ -0,0 +1,31 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.2_A5; +* @section: 12.2; +* @assertion: VariableDeclaration within Eval statement is initialized as the program reaches the eval statement; +* @description: Executing eval("var x"); +*/ +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try{ + x=x; + $ERROR('#1: "x=x" lead to throwing exception'); +}catch(e){ + $PRINT(e.message); +}; +// +////////////////////////////////////////////////////////////////////////////// + +eval("var x"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +try{ + x=x; +}catch(e){ + $ERROR('#2: VariableDeclaration inside Eval statement is initialized when program reaches the eval statement '+e.message); +}; +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A6_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A6_T1.js new file mode 100644 index 000000000..066e946a0 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A6_T1.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.2_A6_T1; +* @section: 12.2; +* @assertion: VariableDeclaration within "try-catch" statement is allowed; +* @description: Declaring variable within "try-catch" statement; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try{ + intry__var=intry__var; +}catch(e){ + $ERROR('#1: Variable declaration inside "try" block is admitted'); +}; +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +try{ + incatch__var=incatch__var; +}catch(e){ + $ERROR('#2: Variable declaration inside "catch" block is admitted'); +}; +// +////////////////////////////////////////////////////////////////////////////// + +try{ + var intry__var; +}catch(e){ + var incatch__var; +}; diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A6_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A6_T2.js new file mode 100644 index 000000000..d0eef8190 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A6_T2.js @@ -0,0 +1,37 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.2_A6_T2; +* @section: 12.2; +* @assertion: VariableDeclaration within "try-catch" statement is allowed; +* @description: Declaring variables within "try-catch" statement; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try{ + intry__intry__var=intry__intry__var; + intry__incatch__var=intry__incatch__var; + incatch__intry__var=incatch__intry__var; + incatch__incatch__var=incatch__incatch__var; +}catch(e){ + $ERROR('#1: Variable declaration inside "try-catch" block is admitted'); +}; +// +////////////////////////////////////////////////////////////////////////////// + +try{ + try { + var intry__intry__var; + } catch (e) { + var intry__incatch__var; + } +}catch(e){ + try { + var incatch__intry__var; + } catch (e) { + var incatch__incatch__var; + } + +}; diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A7.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A7.js new file mode 100644 index 000000000..5cfa65f78 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A7.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.2_A7; +* @section: 12.2; +* @assertion: VariableDeclaration within "for" statement is allowed; +* @description: Declaring variable within "for" statement; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try{ + infor_var = infor_var; +}catch(e){ + $ERROR('#1: Variable declaration inside "for" loop is admitted'); +}; +// +////////////////////////////////////////////////////////////////////////////// + +for (;;){ + break; + var infor_var; +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A8_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A8_T1.js new file mode 100644 index 000000000..c9990a961 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A8_T1.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.2_A8_T1; +* @section: 12.2; +* @assertion: Only AssignmentExpression is admitted when variable is initialized; +* @description: Checking if execution of "var x += 1" fails; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +var x += 1; +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A8_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A8_T2.js new file mode 100644 index 000000000..25a140926 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A8_T2.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.2_A8_T2; +* @section: 12.2; +* @assertion: Only AssignmentExpression is admitted when variable is initialized; +* @description: Checking if execution of "var x | true" fails; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +var x | true; +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A8_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A8_T3.js new file mode 100644 index 000000000..1873eacb8 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A8_T3.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.2_A8_T3; +* @section: 12.2; +* @assertion: Only AssignmentExpression is admitted when variable is initialized; +* @description: Checking if execution of "var x && 1" fails; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +var x && 1; +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A8_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A8_T4.js new file mode 100644 index 000000000..e7a2a5f93 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A8_T4.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.2_A8_T4; +* @section: 12.2; +* @assertion: Only AssignmentExpression is admitted when variable is initialized; +* @description: Checking if execution of "var x++" fails; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +var x++; +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A8_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A8_T5.js new file mode 100644 index 000000000..b03b1bb28 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A8_T5.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.2_A8_T5; +* @section: 12.2; +* @assertion: Only AssignmentExpression is admitted when variable is initialized; +* @description: Checking if execution of "var --x" fails; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +var --x; +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A8_T6.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A8_T6.js new file mode 100644 index 000000000..7244cab65 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A8_T6.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.2_A8_T6; +* @section: 12.2; +* @assertion: Only AssignmentExpression is admitted when variable is initialized; +* @description: Checking if execution of "var x*1" fails; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +var x*1; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A8_T7.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A8_T7.js new file mode 100644 index 000000000..bb579d3b5 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A8_T7.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.2_A8_T7; +* @section: 12.2; +* @assertion: Only AssignmentExpression is admitted when variable is initialized; +* @description: Checking if execution of "var x>>1" fails; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +var x>>1; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A8_T8.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A8_T8.js new file mode 100644 index 000000000..f6a468c86 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A8_T8.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.2_A8_T8; +* @section: 12.2; +* @assertion: Only AssignmentExpression is admitted when variable is initialized; +* @description: Checking if execution of "var x in __arr" fails; +* @negative; +*/ + +__arr = []; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +var x in __arr; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A9.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A9.js new file mode 100644 index 000000000..2dae7e7ae --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.2_Variable_Statement/S12.2_A9.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.2_A9; +* @section: 12.2; +* @assertion: When using property attributes, {DontEnum} is not used; +* @description: Enumerating property attributes of "this" and then searching for the declared variable; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +for (__prop in this){ + if (__prop === "__declared__var") + enumed=true; +} +if (!(enumed)) { + $ERROR('#1: When using property attributes, {DontEnum} not used'); +} +// +////////////////////////////////////////////////////////////////////////////// + +var __declared__var; diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.3_Empty_Statement/S12.3_A1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.3_Empty_Statement/S12.3_A1.js new file mode 100644 index 000000000..50a307246 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.3_Empty_Statement/S12.3_A1.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.3_A1; +* @section: 12.3; +* @assertion: The production EmptyStatement ; is evaluated as follows Return (normal, empty, empty); +* @description: Using EmptyStatement ;; +*/ + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;; ;;;;;; ;; ;; ;;;;;; ;;;;;;;; ;; ;; ;;;;; +;;;;; ;; ;;;; ;;;; ;; ;; ;; ;; ;; ;;;;; +;;;;; ;;;; ;; ;;;; ;; ;;;;;; ;; ;;;; ;;;;; +;;;;; ;; ;; ;; ;; ;; ;; ;; ;;;;; +;;;;; ;;;;;; ;; ;; ;; ;; ;; ;;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.4_Expression_Statement/S12.4_A1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.4_Expression_Statement/S12.4_A1.js new file mode 100644 index 000000000..7d15abbb0 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.4_Expression_Statement/S12.4_A1.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.4_A1; +* @section: 12.4; +* @assertion: An ExpressionStatement can not start with the function keyword because that might make it ambiguous with a FunctionDeclaration; +* @description: Checking if execution of "function(){}()" fails; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +function(){}(); +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.4_Expression_Statement/S12.4_A2_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.4_Expression_Statement/S12.4_A2_T1.js new file mode 100644 index 000000000..1309c226e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.4_Expression_Statement/S12.4_A2_T1.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.4_A2_T1; +* @section: 12.4; +* @assertion: The production ExpressionStatement : [lookahead \notin {{, function}] Expression; is evaluated as follows: +* 1. Evaluate Expression. +* 2. Call GetValue(Result(1)). +* 3. Return (normal, Result(2), empty); +* @description: Checking by using eval "(eval("x+1+x==1"))"; +*/ + +x=1; + +__evaluated = eval("x+1+x==1"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__evaluated !== false) { + $ERROR('#1: __evaluated === false. Actual: __evaluated ==='+ __evaluated ); +} +// +////////////////////////////////////////////////////////////////////////////// + +__evaluated = eval("1+1+1==1"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__evaluated !== false) { + $ERROR('#2: __evaluated === false. Actual: __evaluated ==='+ __evaluated ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.4_Expression_Statement/S12.4_A2_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.4_Expression_Statement/S12.4_A2_T2.js new file mode 100644 index 000000000..0628fe559 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.4_Expression_Statement/S12.4_A2_T2.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.4_A2_T2; +* @section: 12.4; +* @assertion: The production ExpressionStatement : [lookahead \notin {{, function}] Expression; is evaluated as follows: +* 1. Evaluate Expression. +* 2. Call GetValue(Result(1)). +* 3. Return (normal, Result(2), empty); +* @description: Checking by using eval(eval(x), where x is any string); +*/ + +x="5+1|0===0"; + +__evaluated = eval(x); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__evaluated !== 7) { + $ERROR('#1: __evaluated === 7. Actual: __evaluated ==='+ __evaluated ); +} +// +////////////////////////////////////////////////////////////////////////////// + +__evaluated = eval("2*"+x+">-1"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__evaluated !== 11) { + $ERROR('#2: __evaluated === 11. Actual: __evaluated ==='+ __evaluated ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A1.1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A1.1_T1.js new file mode 100644 index 000000000..ff85fa84f --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A1.1_T1.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.5_A1.1_T1; +* @section: 12.5; +* @assertion: 0, null, undefined, false, empty string, NaN in expression is evaluated to false; +* @description: Using "if" without "else" construction; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 + +if(0) + $ERROR('#1: 0 in expression is evaluated to false '); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(false) + $ERROR('#2: false in expression is evaluated to false '); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(null) + $ERROR('#3: null in expression is evaluated to false '); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if(undefined) + $ERROR('#4: undefined in expression is evaluated to false '); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#5 +if("") + $ERROR('#5: empty string in expression is evaluated to false '); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#6 +if(NaN) + $ERROR('#5: NaN in expression is evaluated to false '); +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A1.1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A1.1_T2.js new file mode 100644 index 000000000..0a4207d9d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A1.1_T2.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.5_A1.1_T2; +* @section: 12.5; +* @assertion: 0, null, undefined, false, empty string, NaN in expression is evaluated to false; +* @description: Using "if/else" construction; +*/ + +var c=0; +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(0) + $ERROR('#1.1: 0 in expression is evaluated to false '); +else + c++; +if (c!=1) $ERROR('#1.2: else branch don`t execute'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(false) + $ERROR('#2.1: false in expression is evaluated to false '); +else + c++; +if (c!=2) $ERROR('#2.2: else branch don`t execute'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(null) + $ERROR('#3.1: null in expression is evaluated to false '); +else + c++; +if (c!=3) $ERROR('#3.2: else branch don`t execute'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if(undefined) + $ERROR('#4.1: undefined in expression is evaluated to false '); +else + c++; +if (c!=4) $ERROR('#4.2: else branch don`t execute'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#5 +if("") + $ERROR('#5.1: empty string in expression is evaluated to false '); +else + c++; +if (c!=5) $ERROR('#5.2: else branch don`t execute'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#6 +if(NaN) + $ERROR('#6.1: NaN in expression is evaluated to false '); +else + c++; +if (c!=6) $ERROR('#6.2: else branch don`t execute'); +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A1.2_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A1.2_T1.js new file mode 100644 index 000000000..aed99c549 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A1.2_T1.js @@ -0,0 +1,71 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.5_A1.2_T1; +* @section: 12.5; +* @assertion: 1, true, non-empty string and others in expression is evaluated to true when using operator "new"; +* @description: Using "if" without "else" construction; +*/ +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(!(new Number(1))) + $ERROR('#1: new 1 in expression is evaluated to true'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(!(new Boolean(true))) + $ERROR('#2: new true in expression is evaluated to true'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(!(new String("1"))) + $ERROR('#3: new "1" in expression is evaluated to true'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if(!(new String("A"))) + $ERROR('#4: new "A" in expression is evaluated to true'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#5 +if(!(new Boolean(false))) + $ERROR('#2: new false in expression is evaluated to true '); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#6 +if(!(new Number(NaN))) + $ERROR('#6: new NaN in expression is evaluated to true '); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#7 +if(!(new Number(null))) + $ERROR('#7: new null in expression is evaluated to true '); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#8 +if(!(new String(undefined))) + $ERROR('#8: new undefined in expression is evaluated to true '); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#9 +if(!(new String(""))) + $ERROR('#9: new empty string in expression is evaluated to true '); +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A1.2_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A1.2_T2.js new file mode 100644 index 000000000..c7b07179d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A1.2_T2.js @@ -0,0 +1,100 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.5_A1.2_T2; +* @section: 12.5; +* @assertion: 1, true, non-empty string and others in expression is evaluated to true when using operator "new"; +* @description: Using "if/else" construction; +*/ + +var c=0; +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(!(new Number(1))) + $ERROR('#1.1: new 1 in expression is evaluated to true'); +else + c++; +if (c!=1) $ERROR('#1.2: else branch don`t execute'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(!(new Boolean(true))) + $ERROR('#2.1: new true in expression is evaluated to true'); +else + c++; +if (c!=2) $ERROR('#2.2: else branch don`t execute'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(!(new String("1"))) + $ERROR('#3.1: new "1" in expression is evaluated to true'); +else + c++; +if (c!=3) $ERROR('#3.2: else branch don`t execute'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if(!(new String("A"))) + $ERROR('#4.1: new "A" in expression is evaluated to true'); +else + c++; +if (c!=4) $ERROR('#4.2: else branch don`t execute'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#5 +if(!(new Boolean(false))) + $ERROR('#5.1: new false in expression is evaluated to true '); +else + c++; +if (c!=5) $ERROR('#5.2: else branch don`t execute'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#6 +if(!(new Number(NaN))) + $ERROR('#6.1: new NaN in expression is evaluated to true '); +else + c++; +if (c!=6) $ERROR('#6.2: else branch don`t execute'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#7 +if(!(new Number(null))) + $ERROR('#7.1: new null in expression is evaluated to true '); +else + c++; +if (c!=7) $ERROR('#7.2: else branch don`t execute'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#8 +if(!(new String(undefined))) + $ERROR('#8.1: new undefined in expression is evaluated to true '); +else + c++; +if (c!=8) $ERROR('#8.2: else branch don`t execute'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#9 +if(!(new String(""))) + $ERROR('#9.1: new empty string in expression is evaluated to true '); +else + c++; +if (c!=9) $ERROR('#9.2: else branch don`t execute'); +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A10_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A10_T1.js new file mode 100644 index 000000000..bc714d2f8 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A10_T1.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.5_A10_T1; +* @section: 12.5; +* @assertion: Function expession inside the "if" expression is allowed; +* @description: Using function expession(function __func(){return 0;}) inside the "if" expression ; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +if(function __func(){return 0;}){ + ; +}else { + $ERROR('#1: Function expession inside the "if" expression is allowed'); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A10_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A10_T2.js new file mode 100644 index 000000000..11e90e851 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A10_T2.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.5_A10_T2; +* @section: 12.5; +* @assertion: Function expession inside the "if" expression is allowed; +* @description: Using function expession "function __func(){return 0;}()" within "if" expression; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +if(function __func(){return 0;}()){ + $ERROR('#1: Function expession inside the if expression is allowed'); +}else { + ; +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A11.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A11.js new file mode 100644 index 000000000..5b537369f --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A11.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.5_A11; +* @section: 12.5; +* @assertion: {} within the "if" expression is not allowed; +* @description: Checking if execution of "if({1})" fails; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +if({1}) + { + ; + }else + { + ; + } +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A12_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A12_T1.js new file mode 100644 index 000000000..f3e5e86a9 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A12_T1.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. + +/** +* @name: S12.5_A12_T1; +* @section: 12.5; +* @assertion: Embedded "if/else" constructions are allowed; +* @description: Using embedded "if/else" into "if/else" constructions; +*/ + +//CHECK# 1 +if(true) + if (false) + $ERROR('#1.1: At embedded "if/else" constructions engine must select right branches'); + else + ; +else + if (true) + $ERROR('#1.2: At embedded "if/else" constructions engine must select right branches'); + else + $ERROR('#1.3: At embedded "if/else" constructions engine must select right branches'); + +//CHECK# 2 +if(true) + if (true) + ; + else + $ERROR('#2.1: At embedded "if/else" constructions engine must select right branches'); +else + if (true) + $ERROR('#2.2: At embedded "if/else" constructions engine must select right branches'); + else + $ERROR('#2.3: At embedded "if/else" constructions engine must select right branches'); + +//CHECK# 3 +if(false) + if (true) + $ERROR('#3.1: At embedded "if/else" constructions engine must select right branches'); + else + $ERROR('#3.2: At embedded "if/else" constructions engine must select right branches'); +else + if (true) + ; + else + $ERROR('#3.3: At embedded "if/else" constructions engine must select right branches'); + +//CHECK# 4 +if(false) + if (true) + $ERROR('#4.1: At embedded "if/else" constructions engine must select right branches'); + else + $ERROR('#4.2: At embedded "if/else" constructions engine must select right branches'); +else + if (false) + $ERROR('#4.3: At embedded "if/else" constructions engine must select right branches'); + else + ; diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A12_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A12_T2.js new file mode 100644 index 000000000..a4d020030 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A12_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. + +/** +* @name: S12.5_A12_T2; +* @section: 12.5; +* @assertion: Embedded "if/else" constructions are allowed; +* @description: Using embedded "if" into "if/else" constructions; +*/ + +//CHECK# 1 +if(true){ + if (false) + $ERROR('#1.1: At embedded "if/else" constructions engine must select right branches'); +} +else{ + if (true) + $ERROR('#1.2: At embedded "if/else" constructions engine must select right branches'); +} + +//CHECK# 2 +if(true){ + if (true) + ; +} +else{ + if (true) + $ERROR('#2.2: At embedded "if/else" constructions engine must select right branches'); +} + +//CHECK# 3 +if(false){ + if (true) + $ERROR('#3.1: At embedded "if/else" constructions engine must select right branches'); +} +else{ + if (true) + ; +} + +//CHECK# 4 +if(false){ + if (true) + $ERROR('#4.1: At embedded "if/else" constructions engine must select right branches'); +} +else{ + if (false) + $ERROR('#4.3: At embedded "if/else" constructions engine must select right branches'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A12_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A12_T3.js new file mode 100644 index 000000000..cc91974b8 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A12_T3.js @@ -0,0 +1,37 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.5_A12_T3; +* @section: 12.5; +* @assertion: Embedded "if/else" constructions are allowed; +* @description: Using embedded "if/else" into "if" without "else" constructions; +*/ + +//CHECK# 1 +if(true) + if (false) + $ERROR('#1.1: At embedded "if/else" constructions engine must select right branches'); + else + ; + +//CHECK# 2 +if(true) + if (true) + ; + else + $ERROR('#2.1: At embedded "if/else" constructions engine must select right branches'); + +//CHECK# 3 +if(false) + if (true) + $ERROR('#3.1: At embedded "if/else" constructions engine must select right branches'); + else + $ERROR('#3.2: At embedded "if/else" constructions engine must select right branches'); + +//CHECK# 4 +if(false) + if (true) + $ERROR('#4.1: At embedded "if/else" constructions engine must select right branches'); + else + $ERROR('#4.2: At embedded "if/else" constructions engine must select right branches'); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A12_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A12_T4.js new file mode 100644 index 000000000..6880ebaed --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A12_T4.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.5_A12_T4; +* @section: 12.5; +* @assertion: Embedded "if/else" constructions are allowed; +* @description: Using embedded "if" into "if" constructions; +*/ + +//CHECK# 1 +if(true) + if (false) + $ERROR('#1.1: At embedded "if/else" constructions engine must select right branches'); + +//CHECK# 2 +var c=0; +if(true) + if (true) + c=2; +if (c!==2) + $ERROR('#2: At embedded "if/else" constructions engine must select right branches'); + +//CHECK# 3 +if(false) + if (true) + $ERROR('#3.1: At embedded "if/else" constructions engine must select right branches'); + +//CHECK# 4 +if(false) + if (true) + $ERROR('#4.1: At embedded "if/else" constructions engine must select right branches'); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A1_T1.js new file mode 100644 index 000000000..1ed297216 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A1_T1.js @@ -0,0 +1,37 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.5_A1_T1; +* @section: 12.5; +* @assertion: 1, true, non-empty string in expression is evaluated to true; +* @description: Using "if" without "else" construction; +*/ +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(!(1)) + $ERROR('#1: 1 in expression is evaluated to true'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(!(true)) + $ERROR('#2: true in expression is evaluated to true'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(!("1")) + $ERROR('#3: "1" in expression is evaluated to true'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if(!("A")) + $ERROR('#4: "A" in expression is evaluated to true'); +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A1_T2.js new file mode 100644 index 000000000..c07c94bf7 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A1_T2.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. + +/** +* @name: S12.5_A1_T2; +* @section: 12.5; +* @assertion: 1, true, non-empty string in expression is evaluated to true; +* @description: Using "if/else" construction; +*/ + +var c=0; +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(!(1)) + $ERROR('#1.1: 1 in expression is evaluated to true'); +else + c++; +if (c!=1) $ERROR('#1.2: else branch don`t execute'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(!(true)) + $ERROR('#2.1: true in expression is evaluated to true'); +else + c++; +if (c!=2) $ERROR('#2.2: else branch don`t execute'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if(!("1")) + $ERROR('#3.1: "1" in expression is evaluated to true'); +else + c++; +if (c!=3) $ERROR('#3.2: else branch don`t execute'); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if(!("A")) + $ERROR('#4.1: "A" in expression is evaluated to true'); +else + c++; +if (c!=4) $ERROR('#4.2: else branch don`t execute'); +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A2.js new file mode 100644 index 000000000..39cce3eaf --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A2.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.5_A2; +* @section: 12.5; +* @assertion: In the "if" Statement eval in Expression is admitted; +* @description: Checking by using eval "eval("true")"; +* @negative; +*/ + +if (eval("true")) $FAIL('#1: In the "if" Statement eval as Expression is admitted'); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A3.js new file mode 100644 index 000000000..44f751989 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A3.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.5_A3; +* @section: 12.5; +* @assertion: When the production "IfStatement: if ( Expression ) Statement else Statement" is evaluated, Expression is evaluated first; +* @description: The Expression is "(function(){throw 1})()"; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + if ((function(){throw 1})()) abracadabra +} catch (e) { + if (e !== 1) { + $ERROR('#1: Exception === 1. Actual: Exception ==='+ e); + } +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +try { + if ((function(){throw 1})()) abracadabra; else blablachat; +} catch (e) { + if (e !== 1) { + $ERROR('#2: Exception === 1. Actual: Exception ==='+ e); + } +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A4.js new file mode 100644 index 000000000..ff3d6c9f3 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A4.js @@ -0,0 +1,36 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.5_A4; +* @section: 12.5; +* @assertion: When the production "IfStatement: if ( Expression ) Statement else Statement" is evaluated, Statement(s) is(are) evaluated second; +* @description: The first statement is "(function(){throw "instatement"})()"; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + if (true) (function(){throw "instatement"})(); + $FAIL("#1 failed") +} catch (e) { + if (e !== "instatement") { + $ERROR('#1: Exception === "instatement". Actual: Exception ==='+ e); + } +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +try { + if (false) (function(){throw "truebranch"})(); (function(){throw "missbranch"})(); + $FAIL("#2 failed") +} catch (e) { + if (e !== "missbranch") { + $ERROR('#2: Exception === "missbranch". Actual: Exception ==='+ e); + } +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A5.js new file mode 100644 index 000000000..9bb131cec --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A5.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. + +/** +* @name: S12.5_A5; +* @section: 12.5; +* @assertion: FunctionDeclaration inside the "if" Expression is evaluated as true and function will not be declarated; +* @description: The "if" Expression is "function __func(){throw "FunctionExpression";}"; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + __func=__func; + $ERROR('#1: "__func=__func" lead to throwing exception'); +} catch (e) { + ; +} +// +////////////////////////////////////////////////////////////////////////////// + + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +try { + if(function __func(){throw "FunctionExpression";}) (function(){throw "TrueBranch"})(); else (function(){"MissBranch"})(); +} catch (e) { + if (e !== "TrueBranch") { + $ERROR('#2: Exception ==="TrueBranch". Actual: Exception ==='+ e); + } +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +try { + __func=__func; + $ERROR('#3: "__func=__func" lead to throwing exception'); +} catch (e) { + ; +} +// +////////////////////////////////////////////////////////////////////////////// + + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A6_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A6_T1.js new file mode 100644 index 000000000..847de9f66 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A6_T1.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.5_A6_T1; +* @section: 12.5; +* @assertion: In the If statement expression must be enclosed in braces; +* @description: Checking if execution of "if true" fails; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if true; +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A6_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A6_T2.js new file mode 100644 index 000000000..1a96746a7 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A6_T2.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.5_A6_T2; +* @section: 12.5; +* @assertion: In the If statement expression must be enclosed in braces; +* @description: Checking if execution of "if false" fails; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if false; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A7.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A7.js new file mode 100644 index 000000000..7d213f3c6 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A7.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.5_A7; +* @section: 12.5; +* @assertion: In the "if" statement empty statement is allowed and is evaluated to "undefined"; +* @description: Checking by using eval "eval("if(1);"))"; +*/ + + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + var __evaluated = eval("if(1);"); + if (__evaluated !== undefined) { + $ERROR('#1: __evaluated === undefined. Actual: __evaluated ==='+ __evaluated ); + } + +} catch (e) { + $ERROR('#1.1: "__evaluated = eval("if(1);")" does not lead to throwing exception'); + +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A8.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A8.js new file mode 100644 index 000000000..9668ca363 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A8.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.5_A8; +* @section: 12.5; +* @assertion: In the "if" Statement empty expression is not allowed; +* @description: Checking if execution of "if()" fails; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(); +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A9_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A9_T1.js new file mode 100644 index 000000000..498bd3578 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A9_T1.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.5_A9_T1; +* @section: 12.5; +* @assertion: Function declaration within an "if" statement in strict +* code is not allowed; +* @description: Declaring function within an "if" statement; +* @negative SyntaxError; +*/ + +"use strict"; +if (!strict_mode) { throw new SyntaxError('unspecified case'); } + +if (true) { + function __func(){}; +} else { + function __func(){}; +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A9_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A9_T2.js new file mode 100644 index 000000000..ae979d8f7 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A9_T2.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.5_A9_T2; +* @section: 12.5; +* @assertion: Function declaration within an "if" statement in strict +* code is not allowed; +* @description: Declaring function within an "if" that is declared +* within the strict function; +* @negative SyntaxError; +*/ + +(function(){ +"use strict"; + +if (true) { + function __func(){}; +} else { + function __func(){}; +} + +}); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A9_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A9_T3.js new file mode 100644 index 000000000..f6c7aa616 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A9_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.5_A9_T3; +* @section: 12.5; +* @assertion: Function declaration within an "if" statement is not allowed; +* @description: Declaring function within an "if" statement that is declared within the function declaration; +* @negative; +*/ + +function(){ + +if (true) { + function __func(){}; +} else { + function __func(){}; +} + +}; diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A1.js new file mode 100644 index 000000000..e0436e37a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A1.js @@ -0,0 +1,41 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.1_A1; +* @section: 12.6.1; +* @assertion: When the production "do Statement while ( Expression )" is evaluated, Statement is evaluated first; +* @description: Evaluating various Expressions; +*/ + +var __in__do; + +do __in__do=1; while ( false ); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__in__do!==1) { + $ERROR('#1: false evaluates to false'); +} +// +////////////////////////////////////////////////////////////////////////////// + +do __in__do=2; while ( 0 ); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__in__do!==2) { + $ERROR('#2: 0 evaluates to false'); +} +// +////////////////////////////////////////////////////////////////////////////// + +do __in__do=3; while ( "" ); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (__in__do!==3) { + $ERROR('#3: "" evaluates to false'); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A10.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A10.js new file mode 100644 index 000000000..cfde1eab4 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A10.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.1_A10; +* @section: 12.6.1, 13; +* @assertion: FunctionExpression within a "do-while" statement is allowed, but no function with the given name will appear in the global context; +* @description: Also this a test on FunctionExpression; +*/ + +var check = 0; +do { + if(typeof(f) === "function"){ + check = -1; + break; + } else { + check = 1; + break; + } +} while(function f(){}); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (check !== 1) { + $ERROR('#1: FunctionExpression within a "do-while" statement is allowed, but no function with the given name will appear in the global context'); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A11.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A11.js new file mode 100644 index 000000000..965524f40 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A11.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.1_A11; +* @section: 12.6.1; +* @assertion: Block "{}" in a "do-while" Expression is evaluated to true; +* @description: Checking if execution of "do {} while({})" passes; +*/ + +do { + var __in__do=1; + if(__in__do)break; +} while({}); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__in__do !== 1) { + $ERROR('#1: "{}" in do-while expression evaluates to true'); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A12.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A12.js new file mode 100644 index 000000000..c47400ca4 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A12.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.1_A12; +* @section: 12.6.1; +* @assertion: Any statement within "do-while" construction must be a compound; +* @description: Checking if execution of "do var x=1; var y =2; while (0)" fails; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +do var x=1; var y =2; while (0); +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A13_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A13_T1.js new file mode 100644 index 000000000..28e118c87 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A13_T1.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.1_A13_T1; +* @section: 12.6.1, 13; +* @assertion: FunctionDeclaration within a "do-while" Block in strict +* code is not allowed; +* @description: Declaring function within a "do-while" loop; +* @negative SyntaxError; +*/ + +"use strict"; +if (!strict_mode) { throw new SyntaxError('unspecified case'); } + +do{ + function __func(){}; +} while(0); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A13_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A13_T2.js new file mode 100644 index 000000000..78cd75881 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A13_T2.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.1_A13_T2; +* @section: 12.6.1, 13; +* @assertion: FunctionDeclaration within a "do-while" Block in strict +* code is not allowed; +* @description: Declaring a function within a "do-while" loop that is +* within a strict function; +* @negative SyntaxError; +*/ + +(function(){ +"use strict"; +do{ + function __func(){}; +}while(0); + +}); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A13_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A13_T3.js new file mode 100644 index 000000000..35c94b10a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A13_T3.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.1_A13_T3; +* @section: 12.6.1, 13; +* @assertion: FunctionDeclaration within a "do-while" Block is not allowed; +* @description: Declaring a function within a "do-while" loop that is within a function declaration itself; +* @negative; +*/ + +function(){ + +do{ + function __func(){}; +}while(0); + +}; diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A14_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A14_T1.js new file mode 100644 index 000000000..81261187d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A14_T1.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.1_A14_T1; +* @section: 12.6.1, 13; +* @assertion: FunctionExpression within a "do-while" Expression is allowed; +* @description: Using FunctionExpression "function __func(){return 0;}" as an Expression; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +do{ + var __reached = 1; + break; +}while(function __func(){return 0;}); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__reached !== 1) { + $ERROR('#2: function expession inside of do-while expression is allowed'); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A14_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A14_T2.js new file mode 100644 index 000000000..e02bc250a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A14_T2.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.1_A14_T2; +* @section: 12.6.1; +* @assertion: FunctionExpression within a "do-while" Expression is allowed; +* @description: Using FunctionExpression "function __func(){return 0;}()" as an Expression; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +do{ + var __reached = 1; + break; +}while(function __func(){return 0;}()); +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__reached !== 1) { + $ERROR('#2: function expession inside of do-while expression is allowed'); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A15.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A15.js new file mode 100644 index 000000000..4c34d8a1d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A15.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.1_A15; +* @section: 12.6.1; +* @assertion: Block within a "do-while" Expression is not allowed; +* @description: Using "{0}" Block as an Expression; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +do{ + ; +}while({0}); +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A2.js new file mode 100644 index 000000000..0d15c34b9 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.1_A2; +* @section: 12.6.1; +* @assertion: While evaluating "do Statement while ( Expression )", Statement is evaluated first and only after it is done Expression is checked; +* @description: Evaluating Statement with error Expression; +*/ + +try { + do __in__do = "reached"; while (abbracadabra); + $ERROR('#1: \'do __in__do = "reached"; while (abbracadabra)\' lead to throwing exception'); +} catch (e) {} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__in__do !== "reached") { + $ERROR('#1.1: __in__do === "reached". Actual: __in__do ==='+ __in__do ); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A3.js new file mode 100644 index 000000000..a949f53ea --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A3.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.1_A3; +* @section: 12.6.1; +* @assertion: When the production "do Statement while ( Expression )" is evaluated, then (normal, V, empty) is returned; +* @description: Using eval "eval("do __in__do=1; while (false)")"; +*/ + +__evaluated = eval("do __in__do=1; while (false)"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +if (__in__do !== 1) { + $ERROR('#1: __in__do === 1. Actual: __in__do ==='+ __in__do ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__evaluated !== 1) { + $ERROR('#2: __evaluated === 1. Actual: __evaluated ==='+ __evaluated ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A4_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A4_T1.js new file mode 100644 index 000000000..5f7d4db29 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A4_T1.js @@ -0,0 +1,31 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.1_A4_T1; +* @section: 12.6.1, 12.8; +* @assertion: "break" within a "do-while" Statement is allowed and performed as described in 12.8; +* @description: Using "break" within a "do-while" loop; +*/ + +do { + __in__do__before__break="reached"; + break; + __in__do__after__break="where am i"; +} while(2===1); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__in__do__before__break !== "reached") { + $ERROR('#1: __in__do__before__break === "reached". Actual: __in__do__before__break ==='+ __in__do__before__break ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (typeof __in__do__after__break !== "undefined") { + $ERROR('#2: typeof __in__do__after__break === "undefined". Actual: typeof __in__do__after__break ==='+ typeof __in__do__after__break ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A4_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A4_T2.js new file mode 100644 index 000000000..07a25c78d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A4_T2.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.1_A4_T2; +* @section: 12.6.1, 12.8; +* @assertion: "break" within a "do-while" Statement is allowed and performed as described in 12.8; +* @description: "break" and VariableDeclaration within a "do-while" statement; +*/ + +do_out : do { + var __in__do__before__break="black"; + do_in : do { + var __in__do__IN__before__break="hole"; + break do_in; + var __in__do__IN__after__break="sun"; + } while (0); + var __in__do__after__break="won't you come"; +} while(2==1); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!(__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break)) { + $ERROR('#1: (__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break)===true. Actual: (__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break)==='+ (__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break) ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A4_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A4_T3.js new file mode 100644 index 000000000..e80351a70 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A4_T3.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.1_A4_T3; +* @section: 12.6.1, 12.2, 12.8; +* @assertion: "break" within a "do-while" Statement is allowed and performed as described in 12.8; +* @description: "break" and VariableDeclaration within a "do-while" statement; +*/ + +do_out : do { + var __in__do__before__break="once"; + do_in : do { + var __in__do__IN__before__break="in"; + break do_out; + var __in__do__IN__after__break="the"; + } while (0); + var __in__do__after__break="lifetime"; +} while(2===1); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!(__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&!__in__do__after__break)) { + $ERROR('#1: (__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&!__in__do__after__break)===true. Actual: (__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&!__in__do__after__break)==='+ (__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&!__in__do__after__break) ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A4_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A4_T4.js new file mode 100644 index 000000000..ba5cc9503 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A4_T4.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.1_A4_T4; +* @section: 12.6.1, 12.8; +* @assertion: "break" within a "do-while" Statement is allowed and performed as described in 12.8; +* @description: "break" and VariableDeclaration within a "do-while" statement; +*/ + +do_out : do { + var __in__do__before__break="reached"; + do_in : do { + var __in__do__IN__before__break="reached"; + break; + var __in__do__IN__after__break="where am i"; + } while (0); + var __in__do__after__break="where am i"; +} while(2===1); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!(__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break)) { + $ERROR('#1: (__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break)===true. Actual: (__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break)==='+ (__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break) ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A4_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A4_T5.js new file mode 100644 index 000000000..15b078cd0 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A4_T5.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.1_A4_T5; +* @section: 12.6.1, 12.8; +* @assertion: "break" within a "do-while" Statement is allowed and performed as described in 12.8; +* @description: Using labeled "break" in order to continue a loop; +*/ + +//CHECK#1 +var i=0; +woohoo:{ + do{ + i++; + if ( ! (i < 10) ) { + break woohoo; + $ERROR('#1.1: "break woohoo" must break loop'); + } + } while ( true ); + if (i!==10) $ERROR('#1.2: i===10. Actual: i==='+ i ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A5.js new file mode 100644 index 000000000..a333d9f7a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A5.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.1_A5; +* @section: 12.6.1; +* @assertion: After "do-while" is broken, (normal, V, empty) is returned; +* @description: Using eval; +*/ + +__evaluated = eval("do {__in__do__before__break=1; break; __in__do__after__break=2;} while(0)"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__in__do__before__break !== 1) { + $ERROR('#1: __in__do__before__break === 1. Actual: __in__do__before__break ==='+ __in__do__before__break ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (typeof __in__do__after__break !== "undefined") { + $ERROR('#2: typeof __in__do__after__break === "undefined". Actual: typeof __in__do__after__break ==='+ typeof __in__do__after__break ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (__evaluated !== 1) { + $ERROR('#3: __evaluated === 1. Actual: __evaluated ==='+ __evaluated ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A6_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A6_T1.js new file mode 100644 index 000000000..5ec9340a3 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A6_T1.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.1_A6_T1; +* @section: 12.6.1; +* @assertion: Expression in "do-while" IterationStatement is bracketed with braces; +* @description: Checking if execution of "do{} while 1" fails; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +do break; while 1; +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A6_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A6_T2.js new file mode 100644 index 000000000..f385f1a04 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A6_T2.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.1_A6_T2; +* @section: 12.6.1; +* @assertion: Expression in "do-while" IterationStatement is bracketed with braces; +* @description: Checking if execution of "do{} while 0" fails; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +do break; while 0; +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A6_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A6_T3.js new file mode 100644 index 000000000..d5d136704 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A6_T3.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.1_A6_T3; +* @section: 12.6.1; +* @assertion: Expression in "do-while" IterationStatement is bracketed with braces; +* @description: Checking if execution of "do{}while true" fails; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +do break; while true; +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A6_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A6_T4.js new file mode 100644 index 000000000..14add62bf --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A6_T4.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.1_A6_T4; +* @section: 12.6.1; +* @assertion: Expression in "do-while" IterationStatement is bracketed with braces; +* @description: Checking if execution of "do{}while false" fails; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +do break; while false; +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A6_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A6_T5.js new file mode 100644 index 000000000..f2fca45b4 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A6_T5.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.1_A6_T5; +* @section: 12.6.1; +* @assertion: Expression in "do-while" IterationStatement is bracketed with braces; +* @description: Checking if execution of "do{}while ''" fails; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +do break; while ''; +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A6_T6.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A6_T6.js new file mode 100644 index 000000000..51f58e8db --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A6_T6.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.1_A6_T6; +* @section: 12.6.1; +* @assertion: Expression in "do-while" IterationStatement is bracketed with braces; +* @description: Checking if execution of "do{}while 'hood'" fails; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +do break; while 'hood'; +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A7.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A7.js new file mode 100644 index 000000000..2d2276c53 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A7.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.1_A7; +* @section: 12.6.1; +* @assertion: The "do-while" Statement is evaluted according to 12.6.1 and returns (normal, V, empty); +* @description: Using eval; +*/ + +var __condition=0 + +__evaluated = eval("do eval(\"__condition++\"); while (__condition<5)"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__condition !== 5) { + $ERROR('#1: The "do-while" statement is evaluted according to the Standard '); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__evaluated !== 4) { + $ERROR('#2: The "do-while" statement returns (normal, V, empty)'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A8.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A8.js new file mode 100644 index 000000000..5378fc43a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A8.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.1_A8; +* @section: 12.6.1; +* @assertion: "continue" statement within a "do-while" Statement is allowed; +* @description: Using eval; +*/ + +var __condition = 0, __odds=0; + +__evaluated = eval("do { __condition++; if (((''+__condition/2).split('.')).length>1) continue; __odds++;} while(__condition < 10)"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__odds !== 5) { + $ERROR('#1: __odds === 5. Actual: __odds ==='+ __odds ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__evaluated !== 4) { + $ERROR('#2: __evaluated === 4. Actual: __evaluated ==='+ __evaluated ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A9.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A9.js new file mode 100644 index 000000000..7a9d3692c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.1_The_do_while_Statement/S12.6.1_A9.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.1_A9; +* @section: 12.6.1; +* @assertion: "do-while" Statement is evaluated without syntax checks; +* @description: Throwing system exception whithin a "do-while" loop; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + do { + var x = 1; + abaracadabara; + } while(0); + $ERROR('#1: "abbracadabra" lead to throwing exception'); + +} catch (e) {} + +if (x !== 1) { + $ERROR('#1.1: x === 1. Actual: x ==='+ x ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A1.js new file mode 100644 index 000000000..a40bc3546 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A1.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. + +/** +* @name: S12.6.2_A1; +* @section: 12.6.2; +* @assertion: Expression from "while" IterationStatement is evaluated first; "false", "0", "null", "undefined" and "empty" strings used as the Expression are evaluated to "false"; +* @description: Evaluating various Expressions; +*/ + +var __in__do; + +while ( false ) __in__do=1; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__in__do !== undefined) { + $ERROR('#1: false evaluates to false'); +} +// +////////////////////////////////////////////////////////////////////////////// + +while ( 0 ) __in__do=2; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__in__do !== undefined) { + $ERROR('#2: 0 evaluates to false'); +} +// +////////////////////////////////////////////////////////////////////////////// + +while ( "" ) __in__do=3; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (__in__do !== undefined) { + $ERROR('#3: empty string evaluates to false'); +} +// +////////////////////////////////////////////////////////////////////////////// + +while ( null ) __in__do=4; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if (__in__do !== undefined) { + $ERROR('#4: null evaluates to false'); +} +// +////////////////////////////////////////////////////////////////////////////// + +while ( undefined ) __in__do=35; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#5 +if (__in__do !== undefined) { + $ERROR('#5: undefined evaluates to false'); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A10.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A10.js new file mode 100644 index 000000000..61b68d29f --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A10.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.2_A10; +* @section: 12.6.2, 13.2; +* @assertion: FunctionExpression within a "while" IterationStatement is allowed, but no function with the given name will appear in the global context; +* @description: Testing FunctionExpression too; +*/ + +var check=0; +while(function f(){}){ + if(typeof(f) === "function") { + check = -1; + break; + } else { + check = 1; + break; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (check !== 1) { + $ERROR('#1: FunctionExpression inside while construction expression allowed but function not declare'); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A11.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A11.js new file mode 100644 index 000000000..e7339f535 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A11.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.2_A11; +* @section: 12.6.2; +* @assertion: "{}" Block within a "while" Expression is evaluated to true; +* @description: Checking if execution of "while({}){}" passes; +*/ + +while({}){ + var __in__do=1; + if(__in__do)break; +}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__in__do !== 1) { + $ERROR('#1: "{}" in while expression evaluates to true'); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A13_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A13_T1.js new file mode 100644 index 000000000..450ef8456 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A13_T1.js @@ -0,0 +1,14 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.2_A13_T1; +* @section: 12.6.2; +* @assertion: FunctionDeclaration within a "while" Statement is not allowed; +* @description: Checking if declaring a function within a "while" Statement leads to an exception; +* @negative; +*/ + +while(0){ + function __func(){}; +}; diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A13_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A13_T2.js new file mode 100644 index 000000000..9a33659f7 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A13_T2.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.2_A13_T2; +* @section: 12.6.2; +* @assertion: FunctionDeclaration within a "while" Statement is not allowed; +* @description: Checking if declaring a function within a "while" Statement that is in a function call leads to an exception; +* @negative; +*/ + +(function(){ + +while(0){ + function __func(){}; +}; + +})(); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A13_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A13_T3.js new file mode 100644 index 000000000..355c76c44 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A13_T3.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.2_A13_T3; +* @section: 12.6.2; +* @assertion: FunctionDeclaration within a "while" Statement is not allowed; +* @description: Checking if declaring a function within a "while" Statement that is in a function body leads to an exception; +* @negative; +*/ + +function(){ + +while(0){ + function __func(){}; +}; + +}; diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A14_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A14_T1.js new file mode 100644 index 000000000..8f754fd29 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A14_T1.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.2_A14_T1; +* @section: 12.6.2; +* @assertion: FunctionExpression within a "while" Expression is allowed; +* @description: Using "function __func(){return 0;}" as an Expression; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +while(function __func(){return 0;}){ + var __reached = 1; + break; +}; +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__reached !== 1) { + $ERROR('#2: function expression inside of while expression is allowed'); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A14_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A14_T2.js new file mode 100644 index 000000000..2dcd72b4c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A14_T2.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.2_A14_T2; +* @section: 12.6.2; +* @assertion: FunctionExpression within a "while" Expression is allowed; +* @description: Using function call as an Expression; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +while(function __func(){return 1;}()){ + var __reached = 1; + break; +}; +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__reached !== 1) { + $ERROR('#2: function expression inside of while expression is allowed'); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A15.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A15.js new file mode 100644 index 000000000..ceb42f28d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A15.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.2_A15; +* @section: 12.6.2; +* @assertion: Block within a "while" Expression is not allowed; +* @description: Expression is "{0}"; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +while({1}){ + break ; +}; +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A2.js new file mode 100644 index 000000000..d7c60b066 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A2.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.2_A2; +* @section: 12.6.2; +* @assertion: While evaluating The production IterationStatement: "while ( Expression ) Statement", Expression is evaluated first; +* @description: Evaluating Statement with error Expression; +*/ + +try { + while ((function(){throw 1})()) __in__while = "reached"; + $ERROR('#1: \'while ((function(){throw 1})()) __in__while = "reached"\' lead to throwing exception'); +} catch (e) { + if (e !== 1) { + $ERROR('#1: Exception === 1. Actual: Exception ==='+e); + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof __in__while !== "undefined") { + $ERROR('#1.1: typeof __in__while === "undefined". Actual: typeof __in__while ==='+typeof __in__while); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A3.js new file mode 100644 index 000000000..50c04cd5e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A3.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.2_A3; +* @section: 12.6.2; +* @assertion: When "while" IterationStatement is evaluated, (normal, V, empty) is returned; +* @description: Using eval; +*/ + +var __in__do; + +__evaluated = eval("while (false) __in__do=1;"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +if (__in__do !== undefined) { + $ERROR('#1: __in__do === undefined. Actual: __in__do ==='+ __in__do ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__evaluated !== undefined) { + $ERROR('#2: __evaluated === undefined. Actual: __evaluated ==='+ __evaluated ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A4_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A4_T1.js new file mode 100644 index 000000000..a3c9f473c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A4_T1.js @@ -0,0 +1,31 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.2_A4_T1; +* @section: 12.6.2, 12.8; +* @assertion: "break" within a "while" Statement is allowed and performed as described in 12.8; +* @description: "break" within a "while" Statement; +*/ + +while(1===1){ + __in__do__before__break="reached"; + break; + __in__do__after__break="where am i"; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__in__do__before__break !== "reached") { + $ERROR('#1: __in__do__before__break === "reached". Actual: __in__do__before__break ==='+ __in__do__before__break ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (typeof __in__do__after__break !== "undefined") { + $ERROR('#2: typeof __in__do__after__break === "undefined". Actual: typeof __in__do__after__break ==='+ typeof __in__do__after__break ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A4_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A4_T2.js new file mode 100644 index 000000000..05f086b8a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A4_T2.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.2_A4_T2; +* @section: 12.6.2; +* @assertion: "break" within a "while" Statement is allowed and performed as described in 12.8; +* @description: "break" and VariableDeclaration within a "while" Statement; +*/ + +do_out : while(1===1) { + if (__in__do__before__break) break; + var __in__do__before__break="black"; + do_in : while (1) { + var __in__do__IN__before__break="hole"; + break do_in; + var __in__do__IN__after__break="sun"; + } ; + var __in__do__after__break="won't you come"; +}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!(__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break)) { + $ERROR('#1: Break inside do-while is allowed as its described at standard'); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A4_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A4_T3.js new file mode 100644 index 000000000..14a480c97 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A4_T3.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.2_A4_T3; +* @section: 12.6.2, 12.2; +* @assertion: "break" within a "while" Statement is allowed and performed as described in 12.8; +* @description: "break" and VariableDeclaration within a "while" Statement; +*/ + +do_out : while(1===1) { + if (__in__do__before__break) break; + var __in__do__before__break="once"; + do_in : while (1) { + var __in__do__IN__before__break="in"; + break do_out; + var __in__do__IN__after__break="the"; + } ; + var __in__do__after__break="lifetime"; +} ; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!(__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&!__in__do__after__break)) { + $ERROR('#1: Break inside do-while is allowed as its described at standard'); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A4_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A4_T4.js new file mode 100644 index 000000000..22dc89e43 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A4_T4.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.2_A4_T4; +* @section: 12.6.2; +* @assertion: "break" within a "while" Statement is allowed and performed as described in 12.8; +* @description: "break" and VariableDeclaration within a "while" Statement; +*/ + +do_out : while(1===1) { + if(__in__do__before__break)break; + var __in__do__before__break="can't"; + do_in : while (1) { + var __in__do__IN__before__break="get"; + break; + var __in__do__IN__after__break="no"; + } ; + var __in__do__after__break="Satisfaction"; +} ; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!(__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break)) { + $ERROR('#1: Break inside do-while is allowed as its described at standard'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A4_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A4_T5.js new file mode 100644 index 000000000..f60561de7 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A4_T5.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.2_A4_T5; +* @section: 12.6.2; +* @assertion: "break" within a "while" Statement is allowed and performed as described in 12.8; +* @description: Using labeled "break" in order to continue a "while" loop; +*/ + +//CHECK#1 +var i=0; +woohoo:{ + while(true){ + i++; + if ( ! (i < 10) ) { + break woohoo; + $ERROR('#1.1: "break woohoo" must break loop'); + } + } + if (i!==10) $ERROR('#1.2: i===10. Actual: i==='+ i ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A5.js new file mode 100644 index 000000000..32584229f --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A5.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.2_A5; +* @section: 12.6.2; +* @assertion: While using "while" within an eval statement, source "break" is allowed and (normal, V, empty) is returned; +* @description: Using eval; +*/ + +__evaluated = eval("while(1) {__in__do__before__break=1; break; __in__do__after__break=2;}"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__in__do__before__break !== 1) { + $ERROR('#1: __in__do__before__break === 1. Actual: __in__do__before__break ==='+ __in__do__before__break ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (typeof __in__do__after__break !== "undefined") { + $ERROR('#2: typeof __in__do__after__break === "undefined". Actual: typeof __in__do__after__break ==='+ typeof __in__do__after__break ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (__evaluated !== 1) { + $ERROR('#3: __evaluated === 1. Actual: __evaluated ==='+ __evaluated ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A6_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A6_T1.js new file mode 100644 index 000000000..3745a65c3 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A6_T1.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.2_A6_T1; +* @section: 12.6.2; +* @assertion: Expression in "while" IterationStatement is bracketed with braces; +* @description: Checking if execution of "while 1 break" fails; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +while 1 break; +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A6_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A6_T2.js new file mode 100644 index 000000000..edc09800a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A6_T2.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.2_A6_T2; +* @section: 12.6.2; +* @assertion: Expression in "while" IterationStatement is bracketed with braces; +* @description: Checking if execution of "while 0 break" fails; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +while 0 break; +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A6_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A6_T3.js new file mode 100644 index 000000000..291eceb00 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A6_T3.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.2_A6_T3; +* @section: 12.6.2; +* @assertion: Expression in "while" IterationStatement is bracketed with braces; +* @description: Checking if execution of "while true break" fails; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +while true break; +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A6_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A6_T4.js new file mode 100644 index 000000000..b283fa3a2 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A6_T4.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.2_A6_T4; +* @section: 12.6.2; +* @assertion: Expression in "while" IterationStatement is bracketed with braces; +* @description: Checking if execution of "while false break" fails; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +while false break; +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A6_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A6_T5.js new file mode 100644 index 000000000..3e6609daf --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A6_T5.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.2_A6_T5; +* @section: 12.6.2; +* @assertion: Expression in "while" IterationStatement is bracketed with braces; +* @description: Checking if execution of "while '' break" fails; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +while '' break; +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A6_T6.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A6_T6.js new file mode 100644 index 000000000..b3325633f --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A6_T6.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.2_A6_T6; +* @section: 12.6.2; +* @assertion: Expression in "while" IterationStatement is bracketed with braces; +* @description: Checking if execution of "while 'hood' break" fails; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +while 'hood' break; +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A7.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A7.js new file mode 100644 index 000000000..643d34538 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A7.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.2_A7; +* @section: 12.6.2; +* @assertion: The "while" Statement is evaluted according to 12.6.2 and returns (normal, V, empty); +* @description: using eval; +*/ + +var __condition=0 + +__evaluated = eval("while (__condition<5) eval(\"__condition++\");"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__condition !== 5) { + $ERROR('#1: The "while" statement is evaluated as described in the Standard'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__evaluated !== 4) { + $ERROR('#2: The "while" statement returns (normal, V, empty)'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A8.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A8.js new file mode 100644 index 000000000..b87ddfce6 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A8.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.2_A8; +* @section: 12.6.2; +* @assertion: "continue" statement within a "while" Statement is allowed; +* @description: using eval; +*/ + +var __condition = 0, __odds=0; + +__evaluated = eval("while(__condition < 10) { __condition++; if (((''+__condition/2).split('.')).length>1) continue; __odds++;}"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__odds !== 5) { + $ERROR('#1: __odds === 5. Actual: __odds ==='+ __odds ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__evaluated !== 4) { + $ERROR('#2: __evaluated === 4. Actual: __evaluated ==='+ __evaluated ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A9.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A9.js new file mode 100644 index 000000000..17ea92f2e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.2_The_while_statement/S12.6.2_A9.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.2_A9; +* @section: 12.6.2; +* @assertion: "while" Statement is evaluated without syntax checks; +* @description: Throwing system exception inside "while" loop; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + while(x!=1) { + var x = 1; + abaracadabara; + }; + $ERROR('#1: "abbracadabra" lead to throwing exception'); + +} catch (e) {} + +if (x !== 1) { + $ERROR('#1.1: while statement evaluates as is, without syntax checks'); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A1.js new file mode 100644 index 000000000..2d75c69c1 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A1.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.3_A1; +* @section: 12.6.3; +* @assertion: The "for {;;}" for Statement with empty expressions is allowed and leads to performing an infinite loop; +* @description: Breaking an infinite loop by throwing exception; +*/ +var __in__for = 0; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + for (;;){ + //__in__for++; + if(++__in__for>100)throw 1; +} +} catch (e) { + if (e !== 1) { + $ERROR('#1: for {;;} is admitted and leads to infinite loop'); + } +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__in__for !== 101) { + $ERROR('#2: __in__for === 101. Actual: __in__for ==='+ __in__for ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A10.1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A10.1.js new file mode 100644 index 000000000..b49105566 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A10.1.js @@ -0,0 +1,110 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.3_A10.1; +* @section: 12.6.3; +* @assertion: Nested "var-loops" nine blocks depth is evaluated properly; +* @description: Checking if executing nested "var-loops" nine blocks depth is evaluated properly; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + __in__deepest__loop=__in__deepest__loop; +} catch (e) { + $ERROR('#1: "__in__deepest__loop=__in__deepest__loop" does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +try { + index0=index0; +} catch (e) { + $ERROR('#2: "index0=index0" does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +try { + index1=index1; +} catch (e) { + $ERROR('#3: "index1=index1" does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +try { + index4=index4; +} catch (e) { + $ERROR('#4: "index4=index4" does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#5 +try { + index5=index5; +} catch (e) { + $ERROR('#4: "index5=index5" does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#6 +try { + index7=index7; +} catch (e) { + $ERROR('#6: "index7=index7" does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#7 +try { + index8=index8; +} catch (e) { + $ERROR('#7: "index8=index8" does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +__str=""; + +for( var index0=0; index0<=1; index0++) { + for(var index1=0; index1<=index0; index1++) { + for( index2=0; index2<=index1; index2++) { + for( index3=0; index3<=index2; index3++) { + for(var index4=0; index4<=index3; index4++) { + for(var index5=0; index5<=index4; index5++) { + for( index6=0; index6<=index5; index6++) { + for(var index7=0; index7<=index6; index7++) { + for(var index8=0; index8<=index1; index8++) { + var __in__deepest__loop; + __str+=""+index0+index1+index2+index3+index4+index5+index6+index7+index8+'\n'; + } + } + } + } + } + } + } + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__str!== "000000000\n100000000\n110000000\n110000001\n111000000\n111000001\n111100000\n111100001\n111110000\n111110001\n111111000\n111111001\n111111100\n111111101\n111111110\n111111111\n") { + $ERROR('#2: __str === "000000000\\n100000000\\n110000000\\n110000001\\n111000000\\n111000001\\n111100000\\n111100001\\n111110000\\n111110001\\n111111000\\n111111001\\n111111100\\n111111101\\n111111110\\n111111111\\n". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A10.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A10.js new file mode 100644 index 000000000..2548489ee --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A10.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. + +/** +* @name: S12.6.3_A10; +* @section: 12.6.3; +* @assertion: Nested "var-loops" nine blocks depth is evaluated properly; +* @description: Checking if executing nested "var-loops" nine blocks depth is evaluated properly; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +try { + __in__deepest__loop=__in__deepest__loop; +} catch (e) { + $ERROR('#1: "__in__deepest__loop=__in__deepest__loop" does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +__str=""; + +for( index0=0; index0<=1; index0++) { + for( index1=0; index1<=index0; index1++) { + for( index2=0; index2<=index1; index2++) { + for( index3=0; index3<=index2; index3++) { + for( index4=0; index4<=index3; index4++) { + for( index5=0; index5<=index4; index5++) { + for( index6=0; index6<=index5; index6++) { + for( index7=0; index7<=index6; index7++) { + for( index8=0; index8<=index1; index8++) { + var __in__deepest__loop; + __str+=""+index0+index1+index2+index3+index4+index5+index6+index7+index8+'\n'; + } + } + } + } + } + } + } + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__str!== "000000000\n100000000\n110000000\n110000001\n111000000\n111000001\n111100000\n111100001\n111110000\n111110001\n111111000\n111111001\n111111100\n111111101\n111111110\n111111111\n") { + $ERROR('#2: __str === "000000000\\n100000000\\n110000000\\n110000001\\n111000000\\n111000001\\n111100000\\n111100001\\n111110000\\n111110001\\n111111000\\n111111001\\n111111100\\n111111101\\n111111110\\n111111111\\n". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11.1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11.1_T1.js new file mode 100644 index 000000000..ec4db06db --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11.1_T1.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.3_A11.1_T1; +* @section: 12.6.3; +* @assertion: If (Evaluate Statement).type is "continue" and (Evaluate Statement).target is in the current label set, iteration of labeled "var-loop" breaks; +* @description: Using "continue" in order to continue a loop; +*/ +__str="" + +for(var index=0; index<10; index+=1) { + if (index<5)continue; + __str+=index; +} + +if (__str!=="56789") { + $ERROR('#1: __str === "56789". Actual: __str ==='+ __str ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11.1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11.1_T2.js new file mode 100644 index 000000000..b6654593c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11.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. + +/** +* @name: S12.6.3_A11.1_T2; +* @section: 12.6.3; +* @assertion: If (Evaluate Statement).type is "continue" and (Evaluate Statement).target is in the current label set, iteration of labeled "var-loop" breaks; +* @description: Embedded loops; +*/ + +__str=""; + +outer : for(var index=0; index<4; index+=1) { + nested : for(var index_n=0; index_n<=index; index_n++) { + if (index*index_n == 6)continue nested; + __str+=""+index+index_n; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__str !== "001011202122303133") { + $ERROR('#1: __str === "001011202122303133". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +__str=""; + +outer : for(var index=0; index<4; index+=1) { + nested : for(var index_n=0; index_n<=index; index_n++) { + if (index*index_n == 6)continue outer; + __str+=""+index+index_n; + } +} +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__str !== "0010112021223031") { + $ERROR('#2: __str === "0010112021223031". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +__str=""; + +outer : for(var index=0; index<4; index+=1) { + nested : for(var index_n=0; index_n<=index; index_n++) { + if (index*index_n == 6)continue ; + __str+=""+index+index_n; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (__str !== "001011202122303133") { + $ERROR('#3: __str === "001011202122303133". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11.1_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11.1_T3.js new file mode 100644 index 000000000..7b54ec8f8 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11.1_T3.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.3_A11.1_T3; +* @section: 12.6.3; +* @assertion: If (Evaluate Statement).type is "continue" and (Evaluate Statement).target is in the current label set, iteration of labeled "var-loop" breaks; +* @description: Trying to continue non-existent label; +* @negative; +*/ + +__str=""; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +outer:for(var index=0;index<4;index+=1){ + nested:for(var index_n=0;index_n<=index;index_n++){ + if(index*index_n == 6)continue nonexist; + __str+=""+index+index_n; + } +} +// +////////////////////////////////////////////////////////////////////////////// + + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11_T1.js new file mode 100644 index 000000000..dfad4ec90 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11_T1.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.3_A11_T1; +* @section: 12.6.3; +* @assertion: If (Evaluate Statement).type is "continue" and (Evaluate Statement).target is in the current label set, iteration of labeled loop breaks; +* @description: Simple test of continue loop with using "continue"; +*/ +__str="" + +for(index=0; index<10; index+=1) { + if (index<5)continue; + __str+=index; +} + +if (__str!=="56789") { + $ERROR('#1: __str === "56789". Actual: __str ==='+ __str ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11_T2.js new file mode 100644 index 000000000..5657f2ed8 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11_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. + +/** +* @name: S12.6.3_A11_T2; +* @section: 12.6.3; +* @assertion: If (Evaluate Statement).type is "continue" and (Evaluate Statement).target is in the current label set, iteration of labeled loop breaks; +* @description: Embedded loops; +*/ + +__str=""; + +outer : for(index=0; index<4; index+=1) { + nested : for(index_n=0; index_n<=index; index_n++) { + if (index*index_n == 6)continue nested; + __str+=""+index+index_n; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__str !== "001011202122303133") { + $ERROR('#1: __str === "001011202122303133". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +__str=""; + +outer : for(index=0; index<4; index+=1) { + nested : for(index_n=0; index_n<=index; index_n++) { + if (index*index_n == 6)continue outer; + __str+=""+index+index_n; + } +} +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__str !== "0010112021223031") { + $ERROR('#2: __str === "0010112021223031". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +__str=""; + +outer : for(index=0; index<4; index+=1) { + nested : for(index_n=0; index_n<=index; index_n++) { + if (index*index_n == 6)continue ; + __str+=""+index+index_n; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (__str !== "001011202122303133") { + $ERROR('#3: __str === "001011202122303133". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11_T3.js new file mode 100644 index 000000000..7bfec8231 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11_T3.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.3_A11_T3; +* @section: 12.6.3; +* @assertion: If (Evaluate Statement).type is "continue" and (Evaluate Statement).target is in the current label set, iteration of labeled loop breaks; +* @description: Trying to continue non-existent label; +* @negative; +*/ + +__str=""; + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +outer:for(index=0;index<4;index+=1){ + nested:for(index_n=0;index_n<=index;index_n++){ + if(index*index_n == 6)continue nonexist; + __str+=""+index+index_n; + } +} +// +////////////////////////////////////////////////////////////////////////////// + + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12.1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12.1_T1.js new file mode 100644 index 000000000..b65e699a3 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12.1_T1.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.3_A12.1_T1; +* @section: 12.6.3; +* @assertion: If (Evaluate Statement).type is "break" and (Evaluate Statement).target is in the current label set, (normal, (Evaluate Statement), empty) is returned while evaluating a "var-loop"; +* @description: Breaking a loop with "break"; +*/ +__str="" + +for(var index=0; index<10; index+=1) { + if (index>5)break; + __str+=index; +} + +if (__str!=="012345") { + $ERROR('#1: __str === "012345". Actual: __str ==='+ __str ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12.1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12.1_T2.js new file mode 100644 index 000000000..861ad63d5 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12.1_T2.js @@ -0,0 +1,63 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.3_A12.1_T2; +* @section: 12.6.3; +* @assertion: If (Evaluate Statement).type is "break" and (Evaluate Statement).target is in the current label set, (normal, (Evaluate Statement), empty) is returned while evaluating a "var-loop"; +* @description: Embedded loops; +*/ + +__str=""; + +outer : for(var index=0; index<4; index+=1) { + nested : for(var index_n=0; index_n<=index; index_n++) { + if (index*index_n >= 4)break nested; + __str+=""+index+index_n; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__str !== "00101120213031") { + $ERROR('#1: __str === "00101120213031". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +__str=""; + +outer : for(var index=0; index<4; index+=1) { + nested : for(var index_n=0; index_n<=index; index_n++) { + if (index*index_n >= 4)break outer; + __str+=""+index+index_n; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__str !== "0010112021") { + $ERROR('#2: __str === "0010112021". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +__str=""; + +outer : for(var index=0; index<4; index+=1) { + nested : for(var index_n=0; index_n<=index; index_n++) { + if (index*index_n >= 4)break ; + __str+=""+index+index_n; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (__str !== "00101120213031") { + $ERROR('#3: __str === "00101120213031". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12.1_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12.1_T3.js new file mode 100644 index 000000000..ce159e5c6 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12.1_T3.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.3_A12.1_T3; +* @section: 12.6.3; +* @assertion: If (Evaluate Statement).type is "break" and (Evaluate Statement).target is in the current label set, (normal, (Evaluate Statement), empty) is returned while evaluating a "var-loop"; +* @description: Trying to break non-existent label; +* @negative; +*/ + +__str=""; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +outer:for(var index=0;index<4;index+=1){ + nested:for(var index_n=0;index_n<=index;index_n++){ + if(index*index_n >= 4)break nonexist; + __str+=""+index+index_n; + } +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12_T1.js new file mode 100644 index 000000000..c5933fe19 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12_T1.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.3_A12_T1; +* @section: 12.6.3; +* @assertion: If (Evaluate Statement).type is "break" and (Evaluate Statement).target is in the current label set, (normal, (Evaluate Statement), empty) is returned while evaluating a loop; +* @description: Breaking a loop with "break"; +*/ +__str="" + +for(index=0; index<10; index+=1) { + if (index>5)break; + __str+=index; +} + +if (__str!=="012345") { + $ERROR('#1:__str === "012345". Actual: __str ==='+__str ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12_T2.js new file mode 100644 index 000000000..38b79a552 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12_T2.js @@ -0,0 +1,63 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.3_A12_T2; +* @section: 12.6.3; +* @assertion: If (Evaluate Statement).type is "break" and (Evaluate Statement).target is in the current label set, (normal, (Evaluate Statement), empty) is returned while evaluating a loop; +* @description: Embedded loops; +*/ + +__str=""; + +outer : for(index=0; index<4; index+=1) { + nested : for(index_n=0; index_n<=index; index_n++) { + if (index*index_n >= 4)break nested; + __str+=""+index+index_n; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__str !== "00101120213031") { + $ERROR('#1: __str === "00101120213031". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +__str=""; + +outer : for(index=0; index<4; index+=1) { + nested : for(index_n=0; index_n<=index; index_n++) { + if (index*index_n >= 4)break outer; + __str+=""+index+index_n; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__str !== "0010112021") { + $ERROR('#2: __str === "0010112021". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +__str=""; + +outer : for(index=0; index<4; index+=1) { + nested : for(index_n=0; index_n<=index; index_n++) { + if (index*index_n >= 4)break ; + __str+=""+index+index_n; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (__str !== "00101120213031") { + $ERROR('#3: __str === "00101120213031". Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12_T3.js new file mode 100644 index 000000000..6c5cb096b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12_T3.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.3_A12_T3; +* @section: 12.6.3; +* @assertion: If (Evaluate Statement).type is "break" and (Evaluate Statement).target is in the current label set, (normal, (Evaluate Statement), empty) is returned while evaluating a loop; +* @description: Trying to break non-existent label; +* @negative; +*/ + +__str=""; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +outer:for(index=0;index<4;index+=1){ + nested:for(index_n=0;index_n<=index;index_n++){ + if(index*index_n >= 4)break nonexist; + __str+=""+index+index_n; + } +}; +// +////////////////////////////////////////////////////////////////////////////// + + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A13.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A13.js new file mode 100644 index 000000000..c1a29a61f --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A13.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.3_A13; +* @section: 12.6.3; +* @assertion: VariableDeclaration in "var VariableDeclarationListNoIn" of for IterationStatement is allowed; +* @description: Declaring variable in "for" ExpressionNoIn; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + index = index; +} catch (e) { + $ERROR('#1: VariableDeclaration in "var VariableDeclarationListNoIn" of for IterationStatement is allowed'); +} +// +////////////////////////////////////////////////////////////////////////////// + + +for(var index=0; index<6; index++) { + ; +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A14.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A14.js new file mode 100644 index 000000000..e7175d1b6 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A14.js @@ -0,0 +1,45 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.3_A14; +* @section: 12.6.3; +* @assertion: The production IterationStatement: "for (var VariableDeclarationListNoIn; Expression; Expression) Statement"; +* @description: Using +,*,/, as the second Expression; +*/ + +//CHECK#1 +for(var i=0;i<10;i++){} +if (i!==10) $ERROR('#1: i === 10. Actual: i ==='+ i ); + +//CHECK#2 +var j=0; +for(var i=1;i<10;i*=2){ + j++; +} +if (i!==16) $ERROR('#2.1: i === 16. Actual: i ==='+ i ); +if (j!==4) $ERROR('#2.2: j === 4. Actual: j ==='+ j ); + +//CHECK#3 +var j=0; +for(var i=16;i>1;i=i/2){ + j++; +} +if (i!==1) $ERROR('#3.1: i === 1. Actual: i ==='+ i ); +if (j!==4) $ERROR('#3.2: j === 4. Actual: j ==='+ j ); + +//CHECK#4 +var j=0; +for(var i=10;i>1;i--){ + j++; +} +if (i!==1) $ERROR('#4.1: i === 1. Actual: i ==='+ i ); +if (j!==9) $ERROR('#4.2: j === 9. Actual: j ==='+ j ); + +//CHECK#5 +var j=0; +for(var i=2;i<10;i*=i){ + j++; +} +if (i!==16) $ERROR('#5.1: i === 16. Actual: i ==='+ i ); +if (j!==2) $ERROR('#5.2: j === 2. Actual: j ==='+ j ); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A15.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A15.js new file mode 100644 index 000000000..dc1f1334a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A15.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.3_A15; +* @section: 12.6.3; +* @assertion: The production IterationStatement: "for (var VariableDeclarationListNoIn; Expression; Expression) Statement"; +* @description: Statement must be evaluated before second Expression is evaluated; +*/ + +//CHECK#1 +for(var i=0;i<10;i++){ + i*=2; + break; +} +if (i!==0) $ERROR('#1: i === 0. Actual: i ==='+ i ); + +//CHECK#2 +for(var i=0;i<10;i++){ + i*=2; + if (i===3) $ERROR('#2: i !== 3'); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A2.1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A2.1.js new file mode 100644 index 000000000..fe918cf41 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A2.1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.3_A2.1; +* @section: 12.6.3; +* @assertion: While evaluating "for (ExpressionNoIn ; ; Expression) Statement", Statement is evaulated first; +* @description: Using "(function(){throw "NoInExpression"})()" as ExpressionNoIn; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + for((function(){throw "NoInExpression"})(); ;(function(){throw "SecondExpression"})()) { + throw "Statement"; + } + $ERROR('#1: (function(){throw "NoInExpression"})() lead to throwing exception'); +} catch (e) { + if (e !== "NoInExpression") { + $ERROR('#2: When for (ExpressionNoIn ; ; Expression) Statement is evaluated NoInExpression evaluates first'); + } +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A2.2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A2.2.js new file mode 100644 index 000000000..cb86f7c6e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A2.2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.3_A2.2; +* @section: 12.6.3; +* @assertion: While evaluating "for (ExpressionNoIn;;) Statement", Statement is evaulated first; +* @description: Using "(function(){throw "NoInExpression"})()" as ExpressionNoIn; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + for((function(){throw "NoInExpression"})();;) { + throw "Statement"; + } + $ERROR('#1: (function(){throw "NoInExpression"})() lead to throwing exception'); +} catch (e) { + if (e !== "NoInExpression") { + $ERROR('#1: When for (ExpressionNoIn ; ; ) Statement is evaluated NoInExpression evaluates first'); + } +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A2.js new file mode 100644 index 000000000..4a11b60e9 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A2.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.3_A2; +* @section: 12.6.3; +* @assertion: While evaluating "for (ExpressionNoIn; Expression; Expression) Statement", ExpressionNoIn is evaulated first; +* @description: Using "(function(){throw "NoInExpression"})()" as ExpressionNoIn; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + for((function(){throw "NoInExpression";})(); (function(){throw "FirstExpression";})(); (function(){throw "SecondExpression";})()) { + var in_for = "reached"; + } + $ERROR('#1: (function(){throw "NoInExpression";})() lead to throwing exception'); +} catch (e) { + if (e !== "NoInExpression") { + $ERROR('#1: When for (ExpressionNoIn ; Expression ; Expression) Statement is evaluated ExpressionNoIn evaluates first'); + } +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (in_for !== undefined) { + $ERROR('#2: in_for === undefined. Actual: in_for ==='+ in_for ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A3.js new file mode 100644 index 000000000..eca306838 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A3.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.3_A3; +* @section: 12.6.3; +* @assertion: While evaluating "for (ExpressionNoIn; FirstExpression; SecondExpression) Statement", ExpressionNoIn is evaulated first, FirstExpressoin is evaluated second; +* @description: Using "(function(){throw "FirstExpression"})()" as FirstExpression; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + for((function(){__in__NotInExpression__ = "checked";__in__NotInExpression__2 = "passed";})(); (function(){throw "FirstExpression"})(); (function(){throw "SecondExpression"})()) { + __in__for="reached"; + } + $ERROR('#1: (function(){throw "SecondExpression"} lead to throwing exception'); +} catch (e) { + if (e !== "FirstExpression") { + $ERROR('#1: When for (ExpressionNoIn ; FirstExpression ; SecondExpression) Statement is evaluated first evaluates ExpressionNoIn then FirstExpression'); + } +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if ((__in__NotInExpression__ !== "checked")&(__in__NotInExpression__2!=="passed")) { + $ERROR('#2: (__in__NotInExpression__ === "checked")&(__in__NotInExpression__2==="passed")'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (typeof __in__for !== "undefined") { + $ERROR('#3: typeof __in__for === "undefined". Actual: typeof __in__for ==='+ typeof __in__for ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A4.1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A4.1.js new file mode 100644 index 000000000..d58a2c5c0 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A4.1.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. + +/** +* @name: S12.6.3_A4.1; +* @section: 12.6.3; +* @assertion: "in"-expression is not allowed as a ExpressionNoIn in "for (ExpressionNoIn; FirstExpression; SecondExpression) Statement" IterationStatement; +* @description: Checking if execution of "for (var a in arr;1;){}" fails; +* @negative; +*/ + +arr = [1,2,3,4,5]; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +for (var a in arr;1;){ + break; +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A4_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A4_T1.js new file mode 100644 index 000000000..5edc7abc4 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A4_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.3_A4_T1; +* @section: 12.6.3; +* @assertion: "in"-expression is not allowed as a ExpressionNoIn in "for (ExpressionNoIn; FirstExpression; SecondExpression) Statement" IterationStatement; +* @description: Checking if execution of "for (a in arr;1;){}" fails; +* @negative; +*/ + +arr = [1,2,3,4,5]; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +for (a in arr;1;){ + break; +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A4_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A4_T2.js new file mode 100644 index 000000000..9efa95ab3 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A4_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.3_A4_T2; +* @section: 12.6.3; +* @assertion: "in"-expression is not allowed as a ExpressionNoIn in "for (ExpressionNoIn; FirstExpression; SecondExpression) Statement" IterationStatement; +* @description: Checking if execution of "for (1 in arr;1;){}" fails; +* @negative; +*/ + +arr = [1,2,3,4,5]; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +for(1 in arr;1;) { + break; +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A5.js new file mode 100644 index 000000000..b83bcd6ee --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A5.js @@ -0,0 +1,41 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.3_A5; +* @section: 12.6.3; +* @assertion: "in"-expression wrapped into "eval" statement is allowed as a ExpressionNoIn in "for (ExpressionNoIn; FirstExpression; SecondExpression) Statement" IterationStatement; +* @description: Using eval "for(eval("i in arr");1;)"; +*/ + +arr = [1,2,3,4,5]; +i = 1; +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + for(eval("i in arr");1;) {break;}; +} catch (e) { + $ERROR('#1.1: for(eval("i in arr");1;) {break;}; does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +try { + for(eval("var i = 1 in arr");1;) {break;}; +} catch (e) { + $ERROR('#2.1: for(eval("var i = 1 in arr");1;) {break;}; does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +try { + for(eval("1 in arr");1;) {break;}; +} catch (e) { + $ERROR('#3.1: for(eval("1 in arr");1;) {break;}; does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A6.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A6.js new file mode 100644 index 000000000..b3f3b8140 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A6.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.3_A6; +* @section: 12.6.3; +* @assertion: While evaluating "for ( ; ; Expression) Statement", Statement is evaluated first and then Expression is evaluated; +* @description: Using "(function(){throw "SecondExpression";})()" as an Expression; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + for(;;(function(){throw "SecondExpression";})()){ + var __in__for = "reached"; + } + $ERROR('#1: (function(){throw "SecondExpression"}() lead to throwing exception'); +} catch (e) { + if (e !== "SecondExpression") { + $ERROR('#1: When for ( ; ; Expression) Statement is evaluated Statement evaluates first then Expression evaluates'); + } +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__in__for !== "reached") { + $ERROR('#2: __in__for === "reached". Actual: __in__for ==='+ __in__for ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A7.1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A7.1_T1.js new file mode 100644 index 000000000..6e16d3751 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A7.1_T1.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.3_A7.1_T1; +* @section: 12.6.3; +* @assertion: Only three expressions and two semicolons in "for(with var)" braces are allowed. +* Appearing of for (ExpressionNoIn_opt ; Expression_opt ; Expression_opt; Expression_opt; Expression_opt;) statement leads to SyntaxError; +* @description: Checking if execution of "for(var index=0; index<10; index++; index--)" fails; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +for(var index=0; index<10; index++; index--); +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A7.1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A7.1_T2.js new file mode 100644 index 000000000..99e250cda --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A7.1_T2.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.3_A7.1_T2; +* @section: 12.6.3; +* @assertion: Only three expressions and two semicolons in "for(with var)" braces are allowed. +* Appearing of for (ExpressionNoIn_opt ; Expression_opt ; Expression_opt; Expression_opt; Expression_opt;) statement leads to SyntaxError; +* @description: Checking if execution of "for(var index=0; index<10; index+=4; index++; index--)" fails ; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +for(var index=0; index<10; index+=4; index++; index--) ; +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A7_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A7_T1.js new file mode 100644 index 000000000..10773f81c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A7_T1.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.3_A7_T1; +* @section: 12.6.3; +* @assertion: Only three expressions and two semicolons in "for" braces are allowed. +* Appearing of for (ExpressionNoIn_opt ; Expression_opt ; Expression_opt; Expression_opt; Expression_opt;) statement leads to SyntaxError; +* @description: Checking if execution of "for(index=0; index<10; index++; index--)" fails; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +for(index=0; index<10; index++; index--) ; +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A7_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A7_T2.js new file mode 100644 index 000000000..fe0909232 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A7_T2.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.3_A7_T2; +* @section: 12.6.3; +* @assertion: Only three expressions and two semicolons in "for" braces are allowed. +* Appearing of for (ExpressionNoIn_opt ; Expression_opt ; Expression_opt; Expression_opt; Expression_opt;) statement leads to SyntaxError; +* @description: Checking if execution of "for(index=0; index<10; index+=4; index++; index--)" fails ; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +for(index=0; index<10; index+=4; index++; index--) ; +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A8.1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A8.1_T1.js new file mode 100644 index 000000000..9f41bbabc --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A8.1_T1.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.3_A8.1_T1; +* @section: 12.6.3; +* @assertion: Blocks within "for(with var)" braces are not allowed; +* @description: Checking if execution of "for(var index=0; index<100; {index++; index*2;}) { arr.add(""+index);}" fails; +* @negative; +*/ + +var arr = []; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +for(var index=0; index<100; {index++; index*2;}) { arr.add(""+index);}; +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A8.1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A8.1_T2.js new file mode 100644 index 000000000..0a0b3bb75 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A8.1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.3_A8.1_T2; +* @section: 12.6.3; +* @assertion: Blocks within "for(with var)" braces are not allowed; +* @description: Checking if execution of "for(var index=0; {index++;index<100;}; index*2;) { arr.add(""+index);}" fails; +* @negative; +*/ + +var arr = []; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +for(var index=0; {index++;index<100;}; index*2;) { arr.add(""+index);}; +// +////////////////////////////////////////////////////////////////////////////// + + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A8.1_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A8.1_T3.js new file mode 100644 index 000000000..1d69bbf1a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A8.1_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.3_A8.1_T3; +* @section: 12.6.3; +* @assertion: Blocks within "for(with var)" braces are not allowed; +* @description: Checking if execution of "for({var index=0; index+=1;} index++<=10; index*2;) { arr.add(""+index);}" fails; +* @negative; +*/ + +var arr = []; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +for({var index=0; index+=1;} index++<=10; index*2;) { arr.add(""+index);}; +// +////////////////////////////////////////////////////////////////////////////// + + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A8_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A8_T1.js new file mode 100644 index 000000000..cf797bc5f --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A8_T1.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.3_A8_T1; +* @section: 12.6.3; +* @assertion: Blocks within "for" braces are not allowed; +* @description: Checking if execution of "for(index=0; index<100; {index++; index*2;}) { arr.add(""+index);}" fails; +* @negative; +*/ + +var arr = []; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +for(index=0; index<100; {index++; index*2;}) { arr.add(""+index);}; +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A8_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A8_T2.js new file mode 100644 index 000000000..48ae1831f --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A8_T2.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.3_A8_T2; +* @section: 12.6.3; +* @assertion: Blocks within "for" braces are not allowed; +* @description: Checking if execution of "for(index=0; {index++;index<100;}; index*2;) { arr.add(""+index);}" fails; +* @negative; +*/ + +var arr = []; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +for(index=0; {index++;index<100;}; index*2;) { arr.add(""+index);}; +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A8_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A8_T3.js new file mode 100644 index 000000000..0009790e9 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A8_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.3_A8_T3; +* @section: 12.6.3; +* @assertion: Blocks within "for" braces are not allowed; +* @description: Checking if execution of "for({index=0; index+=1;} index++<=10; index*2;) { arr.add(""+index);}" fails; +* @negative; +*/ + +var arr = []; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +for({index=0; index+=1;} index++<=10; index*2;) { arr.add(""+index);}; +// +////////////////////////////////////////////////////////////////////////////// + + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A9.1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A9.1.js new file mode 100644 index 000000000..2a9598766 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A9.1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.3_A9.1; +* @section: 12.6.3; +* @assertion: The result of evaluating "for( ExpNoIn;Exp;Exp)" loop is returning (normal, evalValue, empty); +* @description: Using eval; +*/ + +supreme=5; + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +try { + var __evaluated = eval("for(count=0;;) {if (count===supreme)break;else count++; }"); + if (__evaluated !== 4) { + $ERROR('#1: __evaluated === 4. Actual: __evaluated ==='+ __evaluated ); + } +} catch (e) { + $ERROR('#1: var __evaluated = eval("for(count=0;;) {if (count===supreme)break;else count++; }"); does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A9.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A9.js new file mode 100644 index 000000000..6bc4b9149 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A9.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.3_A9; +* @section: 12.6.3; +* @assertion: The result of evaluating "for(var ExpNoIn;Exp;Exp)" loop is returning (normal, evalValue, empty); +* @description: Using eval; +*/ + +supreme=5; + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +try { + var __evaluated = eval("for(var count=0;;) {if (count===supreme)break;else count++; }"); + if (__evaluated !== 4) { + $ERROR('#1: __evaluated === 4. Actual: __evaluated ==='+ __evaluated ); + } +} catch (e) { + $ERROR('#1: var __evaluated = eval("for(var count=0;;) {if (count===supreme)break;else count++; }"); does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A1.js new file mode 100644 index 000000000..3d4213e94 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A1.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.4_A1; +* @section: 12.6.4; +* @assertion: "for(key in undefined)" Statement is allowed; +* @description: Checking if execution of "for(key in undefined)" passes; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + for(__key in undefined){ + var key=__key; + }; +} catch (e) { + $ERROR('#1: "for(key in undefined){}" does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (key!==undefined) { + $ERROR('#2: key === undefined. Actual: key === '+key); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A13_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A13_T1.js new file mode 100644 index 000000000..93dbedc7f --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A13_T1.js @@ -0,0 +1,14 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.4_A13_T1; +* @section: 12.6.4; +* @assertion: FunctionDeclaration within a "for-in" Statement is not allowed; +* @description: Declaring function within a "for-in" Statement; +* @negative; +*/ + +for(x in this){ + function __func(){}; +}; diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A13_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A13_T2.js new file mode 100644 index 000000000..c18f21a82 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A13_T2.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.4_A13_T2; +* @section: 12.6.4; +* @assertion: FunctionDeclaration within a "for-in" Statement is not allowed; +* @description: Declaring function within a "for-in" Statement that is within a function call; +* @negative; +*/ + +(function(){ + +for(x in this){ + function __func(){}; +}; + +})(); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A13_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A13_T3.js new file mode 100644 index 000000000..16a0cdcba --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A13_T3.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.4_A13_T3; +* @section: 12.6.4; +* @assertion: FunctionDeclaration within a "for-in" Statement is not allowed; +* @description: Declaring function within a "for-in" Statement that is within function declaration; +* @negative; +*/ + +function(){ + +for(x in this){ + function __func(){}; +}; + +}; diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A14_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A14_T1.js new file mode 100644 index 000000000..8d6cbba07 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A14_T1.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.4_A14_T1; +* @section: 12.6.4; +* @assertion: FunctionExpession within a "for-in" Expression is allowed; +* @description: Using "function __func(){return 0;}" as Expession; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +for(x in function __func(){return 0;}){ + if (x=="prototype") + var __reached = 1; +}; +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__reached !== 1) { + $ERROR('#2: function expession inside of for-in expression is allowed'); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A14_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A14_T2.js new file mode 100644 index 000000000..c8770a059 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A14_T2.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.4_A14_T2; +* @section: 12.6.4; +* @assertion: FunctionExpession within a "for-in" Expression is allowed; +* @description: Using "function __func(){return {a:1};}()" as Expession; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +for(x in function __func(){return {a:1};}()){ + var __reached = x; +}; +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__reached !== "a") { + $ERROR('#2: function expession inside of for-in expression allowed'); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A15.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A15.js new file mode 100644 index 000000000..b0fb4431b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A15.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.4_A15; +* @section: 12.6.4; +* @assertion: Block within a "for-in" Expression is not allowed; +* @description: Using block within "for-in" Expression; +* @negative; +*/ +var __arr=[1,2,3]; + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +for(x in {__arr}){ + break ; +}; +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A2.js new file mode 100644 index 000000000..13981efe8 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A2.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.4_A2; +* @section: 12.6.4; +* @assertion: "for(key in null)" Expression is allowed; +* @description: Checking if execution of "for(key in null)" passes; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +try { + for(__key in null){ + var key=__key; + }; +} catch (e) { + $ERROR('#1: "for(__key in null){}" does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (key!==undefined) { + $ERROR('#2: key === undefined. Actual: key ==='+key); +} +// +////////////////////////////////////////////////////////////////////////////// + + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A3.1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A3.1.js new file mode 100644 index 000000000..01b65dadd --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A3.1.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.4_A3.1; +* @section: 12.6.4; +* @assertion: The production IterationStatement: "for (var VariableDeclarationNoIn in Expression) Statement"; +* @description: Using an array as an Expression is appropriate. Here Expression is an array of numbers; +*/ + +__str=""; + +__evaluated = eval("for(var ind in (arr=[2,1,4,3]))__str+=arr[ind]"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__evaluated !== __str) { + $ERROR('#1: __evaluated === __str. Actual: __evaluated ==='+ __evaluated ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (!( (__str.indexOf("2")!==-1)&&(__str.indexOf("1")!==-1)&&(__str.indexOf("4")!==-1)&&(__str.indexOf("3")!==-1) )) { + $ERROR('#2: (__str.indexOf("2")!==-1)&&(__str.indexOf("1")!==-1)&&(__str.indexOf("4")!==-1)&&(__str.indexOf("3")!==-1)'); +} +// +////////////////////////////////////////////////////////////////////////////// + + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A3.js new file mode 100644 index 000000000..391ec6b57 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A3.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.4_A3; +* @section: 12.6.4; +* @assertion: The production IterationStatement: "for (var VariableDeclarationNoIn in Expression) Statement"; +* @description: Using an array as an Expression is appropriate. Here Expression is an array of numbers. Eval is used; +*/ + +__str=""; + +__evaluated = eval("for(ind in (arr=[2,1,4,3]))__str+=arr[ind]"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__evaluated !== __str) { + $ERROR('#1: __evaluated === __str. Actual: __evaluated ==='+ __evaluated ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (!( (__str.indexOf("2")!==-1)&&(__str.indexOf("1")!==-1)&&(__str.indexOf("4")!==-1)&&(__str.indexOf("3")!==-1) )) { + $ERROR('#2: (__str.indexOf("2")!==-1)&&(__str.indexOf("1")!==-1)&&(__str.indexOf("4")!==-1)&&(__str.indexOf("3")!==-1)'); +} +// +////////////////////////////////////////////////////////////////////////////// + + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A4.1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A4.1.js new file mode 100644 index 000000000..8466cf1e7 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A4.1.js @@ -0,0 +1,33 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.4_A4.1; +* @section: 12.6.4; +* @assertion: The production IterationStatement: "for (var VariableDeclarationNoIn in Expression) Statement"; +* @description: Using Object as an Expression is appropriate. Eval is used; +*/ + +__str=""; + +__evaluated = eval("for(var ind in (hash={2:'b',1:'a',4:'d',3:'c'}))__str+=hash[ind]"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if ( !( (__evaluated.indexOf("a")!==-1)& (__evaluated.indexOf("b")!==-1)& (__evaluated.indexOf("c")!==-1)&(__evaluated.indexOf("d")!==-1) ) ) { + $ERROR('#1: (__evaluated.indexOf("a")!==-1)& (__evaluated.indexOf("b")!==-1)& (__evaluated.indexOf("c")!==-1)&(__evaluated.indexOf("d")!==-1)'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__str !== __evaluated) { + $ERROR('#2: __str === __evaluated. Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + + + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A4.js new file mode 100644 index 000000000..06b7ce12b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A4.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. + +/** +* @name: S12.6.4_A4; +* @section: 12.6.4; +* @assertion: The production IterationStatement: "for (var VariableDeclarationNoIn in Expression) Statement"; +* @description: Using Object as an Expression is appropriate. Eval is used; +*/ + +__str=""; + +__evaluated = eval("for(ind in (hash={2:'b',1:'a',4:'d',3:'c'}))__str+=hash[ind]"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if ( !( (__evaluated.indexOf("a")!==-1)& (__evaluated.indexOf("b")!==-1)& (__evaluated.indexOf("c")!==-1)&(__evaluated.indexOf("d")!==-1) ) ) { + $ERROR('#1: (__evaluated.indexOf("a")!==-1)& (__evaluated.indexOf("b")!==-1)& (__evaluated.indexOf("c")!==-1)&(__evaluated.indexOf("d")!==-1)'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__str !== __evaluated) { + $ERROR('#2: __str === __evaluated. Actual: __str ==='+ __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + + + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A5.1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A5.1.js new file mode 100644 index 000000000..8820bd92a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A5.1.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. + +/** +* @name: S12.6.4_A5.1; +* @section: 12.6.4; +* @assertion: The production IterationStatement: "for (var VariableDeclarationNoIn in Expression) Statement"; +* @description: Using hierarchical Object as an Expression is appropriate. The depth is two; +*/ + + + +__hash__map={a:{aa:1,ab:2,ac:3,ad:4},b:{ba:1,bb:2,bc:3,bd:4},c:{ca:1,cb:2,cc:3,cd:4},d:{da:1,db:2,dc:3,dd:4}}; + +__arr = ""; + +for(var __key in __hash__map){ + for (var __ind in __hash__map[__key]){ + __arr+=("" + __ind + __hash__map[__key][__ind]); + } +} + +if(!( +(__arr.indexOf("aa1")!==-1)& +(__arr.indexOf("ab2")!==-1)& +(__arr.indexOf("ac3")!==-1)& +(__arr.indexOf("ad4")!==-1)& +(__arr.indexOf("ba1")!==-1)& +(__arr.indexOf("bb2")!==-1)& +(__arr.indexOf("bc3")!==-1)& +(__arr.indexOf("bd4")!==-1)& +(__arr.indexOf("ca1")!==-1)& +(__arr.indexOf("cb2")!==-1)& +(__arr.indexOf("cc3")!==-1)& +(__arr.indexOf("cd4")!==-1)& +(__arr.indexOf("da1")!==-1)& +(__arr.indexOf("db2")!==-1)& +(__arr.indexOf("dc3")!==-1)& +(__arr.indexOf("dd4")!==-1) +)) $ERROR('#1: The nested for-in Statement applied to hierarchial object works properly as described in the Standard'); + + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A5.js new file mode 100644 index 000000000..fc7483caa --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A5.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. + +/** +* @name: S12.6.4_A5; +* @section: 12.6.4; +* @assertion: The production IterationStatement: "for (var VariableDeclarationNoIn in Expression) Statement"; +* @description: Using hierarchical Object as an Expression is appropriate. The depth is two; +*/ + + + +__hash__map={a:{aa:1,ab:2,ac:3,ad:4},b:{ba:1,bb:2,bc:3,bd:4},c:{ca:1,cb:2,cc:3,cd:4},d:{da:1,db:2,dc:3,dd:4}}; + +__arr = ""; + +for(__key in __hash__map){ + for (__ind in __hash__map[__key]){ + __arr+=("" + __ind + __hash__map[__key][__ind]); + } +} + +if(!( +(__arr.indexOf("aa1")!==-1)& +(__arr.indexOf("ab2")!==-1)& +(__arr.indexOf("ac3")!==-1)& +(__arr.indexOf("ad4")!==-1)& +(__arr.indexOf("ba1")!==-1)& +(__arr.indexOf("bb2")!==-1)& +(__arr.indexOf("bc3")!==-1)& +(__arr.indexOf("bd4")!==-1)& +(__arr.indexOf("ca1")!==-1)& +(__arr.indexOf("cb2")!==-1)& +(__arr.indexOf("cc3")!==-1)& +(__arr.indexOf("cd4")!==-1)& +(__arr.indexOf("da1")!==-1)& +(__arr.indexOf("db2")!==-1)& +(__arr.indexOf("dc3")!==-1)& +(__arr.indexOf("dd4")!==-1) +)) $ERROR('#1: The nested for-in Statement applied to hierarchial object works properly as described in the Standard'); + + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A6.1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A6.1.js new file mode 100644 index 000000000..66ba609da --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A6.1.js @@ -0,0 +1,37 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.4_A6.1; +* @section: 12.6.4; +* @assertion: The production IterationStatement: "for (var VariableDeclarationNoIn in Expression) Statement"; +* @description: Using Object with custom prototype as an Expression is appropriate. The prototype is "{feat:2,hint:"protohint"}"; +*/ + +function FACTORY(){this.prop=1;this.hint="hinted"}; + +FACTORY.prototype = {feat:2,hint:"protohint"}; + +var __instance = new FACTORY; + +__accum=""; + +for (var key in __instance){ + __accum+=(key + __instance[key]); +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!((__accum.indexOf("prop1")!==-1)&&(__accum.indexOf("feat2")!==-1)&&(__accum.indexOf("hinthinted")!==-1))) { + $ERROR('#1: (__accum.indexOf("prop1")!==-1)&&(__accum.indexOf("feat2")!==-1)&&(__accum.indexOf("hinthinted")!==-1)'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__accum.indexOf("hintprotohint")!==-1) { + $ERROR('#2: __accum.indexOf("hintprotohint") === -1. Actual: __accum.indexOf("hintprotohint") ==='+ __accum.indexOf("hintprotohint") ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A6.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A6.js new file mode 100644 index 000000000..cc5017fcd --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A6.js @@ -0,0 +1,37 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.6.4_A6; +* @section: 12.6.4; +* @assertion: The production IterationStatement: "for (var VariableDeclarationNoIn in Expression) Statement"; +* @description: Using Object with custom prototype as an Expression is appropriate. The prototype is "{feat:2,hint:"protohint"}"; +*/ + +function FACTORY(){this.prop=1;this.hint="hinted"}; + +FACTORY.prototype = {feat:2,hint:"protohint"}; + +var __instance = new FACTORY; + +__accum=""; + +for (key in __instance){ + __accum+=(key + __instance[key]); +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!((__accum.indexOf("prop1")!==-1)&&(__accum.indexOf("feat2")!==-1)&&(__accum.indexOf("hinthinted")!==-1))) { + $ERROR('#1: (__accum.indexOf("prop1")!==-1)&&(__accum.indexOf("feat2")!==-1)&&(__accum.indexOf("hinthinted")!==-1)'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__accum.indexOf("hintprotohint")!==-1) { + $ERROR('#2: __accum.indexOf("hintprotohint") === -1. Actual: __accum.indexOf("hintprotohint") ==='+ __accum.indexOf("hintprotohint") ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A7_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A7_T1.js new file mode 100644 index 000000000..85ab69761 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A7_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. + +/** +* @name: S12.6.4_A7_T1; +* @section: 12.6.4; +* @assertion: Properties of the object being enumerated may be deleted during enumeration; +* @description: Checking "for (LeftHandSideExpression in Expression) Statement" case; +*/ + +__obj={aa:1,ba:2,ca:3}; + +__accum=""; + +for (__key in __obj){ + + erasator_T_1000(__obj,"b"); + + __accum+=(__key+__obj[__key]); + +} + + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!((__accum.indexOf("aa1")!==-1)&&(__accum.indexOf("ca3")!==-1))) { + $ERROR('#1: (__accum.indexOf("aa1")!==-1)&&(__accum.indexOf("ca3")!==-1)'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__accum.indexOf("ba2")!==-1) { + $ERROR('#2: __accum.indexOf("ba2") === -1. Actual: __accum.indexOf("ba2") ==='+ __accum.indexOf("ba2") ); +} +// +////////////////////////////////////////////////////////////////////////////// + + +// erasator is the hash map terminator +function erasator_T_1000(hash_map, charactr){ + for (key in hash_map){ + if (key.indexOf(charactr)===0) { + delete hash_map[key]; + }; + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A7_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A7_T2.js new file mode 100644 index 000000000..7a961149d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A7_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. + +/** +* @name: S12.6.4_A7_T2; +* @section: 12.6.4; +* @assertion: Properties of the object being enumerated may be deleted during enumeration; +* @description: Checking "for (var VariableDeclarationNoIn in Expression) Statement" case; +*/ + +__obj={aa:1,ba:2,ca:3}; + +__accum=""; + +for (var __key in __obj){ + + erasator_T_1000(__obj,"b"); + + __accum+=(__key+__obj[__key]); + +} + + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!((__accum.indexOf("aa1")!==-1)&&(__accum.indexOf("ca3")!==-1))) { + $ERROR('#1: (__accum.indexOf("aa1")!==-1)&&(__accum.indexOf("ca3")!==-1)'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__accum.indexOf("ba2")!==-1) { + $ERROR('#2: __accum.indexOf("ba2") === -1. Actual: __accum.indexOf("ba2") ==='+ __accum.indexOf("ba2") ); +} +// +////////////////////////////////////////////////////////////////////////////// + + +// erasator is the hash map terminator +function erasator_T_1000(hash_map, charactr){ + for (key in hash_map){ + if (key.indexOf(charactr)===0) { + delete hash_map[key]; + }; + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A1_T1.js new file mode 100644 index 000000000..31ffe8f01 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A1_T1.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.7_A1_T1; +* @section: 12.7; +* @assertion: Appearing of continue without an IterationStatement leads to syntax error; +* @description: Checking if execution of single "continue" without any IterationStatement fails; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +var x=1; +continue; +var y=2; +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A1_T2.js new file mode 100644 index 000000000..2524f112f --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A1_T2.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.7_A1_T2; +* @section: 12.7; +* @assertion: Appearing of continue without an IterationStatement leads to syntax error; +* @description: Checking if single "continue" with Label but without any IterationStatement fails; +* @negative; +*/ + +LABEL : x=3.14; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +var x=1; +continue LABEL; +var y=2; +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A1_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A1_T3.js new file mode 100644 index 000000000..3ccd9902a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A1_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.7_A1_T3; +* @section: 12.7; +* @assertion: Appearing of continue without an IterationStatement leads to syntax error; +* @description: Checking if laballed "continue" with no IterationStatement, placed into a block, fails; +* @negative; +*/ + +LABEL : x=3.14; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +{ + var x=1; + continue LABEL; + var y=2; +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A1_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A1_T4.js new file mode 100644 index 000000000..fbde0367c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A1_T4.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. + +/** +* @name: S12.7_A1_T4; +* @section: 12.7; +* @assertion: Appearing of continue without an IterationStatement leads to syntax error; +* @description: Checking if execution of "continue" with no IterationStatement, placed into a block, fails; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +{ + var x=1; + continue; + var y=2; +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A2.js new file mode 100644 index 000000000..2621bec70 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A2.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. + +/** +* @name: S12.7_A2; +* @section: 12.7; +* @assertion: Since LineTerminator between "continue" and Identifier is not allowed, "continue" is evaluated without label; +* @description: Checking by using eval, inserting LineTerminator between continue and Identifier; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try{ + eval("FOR1 : for(var i=1;i<2;i++){FOR1NESTED : for(var j=1;j<2;j++) { continue\u000AFOR1; } while(0);}"); + if (j!==2) { + $ERROR('#1: Since LineTerminator(U-000A) between continue and Identifier not allowed continue evaluates without label'); + } +} catch(e){ + $ERROR('#1.1: eval("FOR1 : for(var i=1;i<2;i++){FOR1NESTED : for(var j=1;j<2;j++) { continue\\u000AFOR1; } while(0);}") does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +try{ + eval("FOR2 : for(var i=1;i<2;i++){FOR2NESTED : for(var j=1;j<2;j++) { continue\u000DFOR2; } while(0);}"); + if (j!==2) { + $ERROR('#2: Since LineTerminator(U-000D) between continue and Identifier not allowed continue evaluates without label'); + } +} catch(e){ + $ERROR('#2.1: eval("FOR2 : for(var i=1;i<2;i++){FOR2NESTED : for(var j=1;j<2;j++) { continue\\u000DFOR2; } while(0);}") does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +try{ + eval("FOR3 : for(var i=1;i<2;i++){FOR3NESTED : for(var j=1;j<2;j++) { continue\u2028FOR3; } while(0);}"); + if (j!==2) { + $ERROR('#3: Since LineTerminator(U-2028) between continue and Identifier not allowed continue evaluates without label'); + } +} catch(e){ + $ERROR('#3.1: eval("FOR3 : for(var i=1;i<2;i++){FOR3NESTED : for(var j=1;j<2;j++) { continue\\u2028FOR3; } while(0);}") does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +try{ + eval("FOR4 : for(var i=1;i<2;i++){FOR4NESTED : for(var j=1;j<2;j++) { continue\u2029FOR4; } while(0);}"); + if (j!==2) { + $ERROR('#4: Since LineTerminator(U-2029) between continue and Identifier not allowed continue evaluates without label'); + } +} catch(e){ + $ERROR('#4.1: eval("FOR4 : for(var i=1;i<2;i++){FOR4NESTED : for(var j=1;j<2;j++) { continue\\u2029FOR4; } while(0);}"); does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A3.js new file mode 100644 index 000000000..b6c2d45de --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A3.js @@ -0,0 +1,33 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.7_A3; +* @section: 12.7; +* @assertion: When "continue Identifier" is evaluated (continue, empty, empty) is returned; +* @description: Simple using continue without Identifier and labeled loop; +*/ + +LABEL_OUT : var x=0, y=0; + +LABEL_DO_LOOP : do { + LABEL_IN : x=2; + continue ; + LABEL_IN_2 : var y=2; + + function IN_DO_FUNC(){} +} while(0); + +LABEL_ANOTHER_LOOP : do { + ; +} while(0); + +function OUT_FUNC(){} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if ((x!==2)&&(y!==0)) { + $ERROR('#1: x === 2 and y === 0. Actual: x ==='+x+' and y ==='+ y ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A4_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A4_T1.js new file mode 100644 index 000000000..388b578e5 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A4_T1.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.7_A4_T1; +* @section: 12.7; +* @assertion: When "continue Identifier" is evaluated (continue, empty, Identifier) is returned; +* @description: Simple using continue Identifier construction; +*/ + +LABEL_OUT : var x=0, y=0; + +LABEL_DO_LOOP : do { + LABEL_IN : x++; + if(x===10)break; + continue LABEL_DO_LOOP; + LABEL_IN_2 : y++; + + function IN_DO_FUNC(){} +} while(0); + +LABEL_ANOTHER_LOOP : do { + ; +} while(0); + +function OUT_FUNC(){} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if ((x!==1)&&(y!==0)) { + $ERROR('#1: x===1 and y === 0. Actual: x==='+x+' and y ==='+y); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A4_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A4_T2.js new file mode 100644 index 000000000..7b5e3c2e0 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A4_T2.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.7_A4_T2; +* @section: 12.7; +* @assertion: When "continue Identifier" is evaluated (continue, empty, Identifier) is returned; +* @description: Using embedded and labeled loops, continue to nested loop; +*/ + +LABEL_OUT : var x=0, y=0, xx=0, yy=0; + +LABEL_DO_LOOP : do { + LABEL_IN : x++; + if(x===10)break; + LABEL_NESTED_LOOP : do { + LABEL_IN_NESTED : xx++; + if(xx===10)break; + continue LABEL_NESTED_LOOP; + LABEL_IN_NESTED_2 : yy++; + } while (0); + + LABEL_IN_2 : y++; + + function IN_DO_FUNC(){} +} while(0); + +LABEL_ANOTHER_LOOP : do { + ; +} while(0); + +function OUT_FUNC(){} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if ((x!==1)&&(y!==1)&&(xx!==1)&(yy!==0)) { + $ERROR('#1: (x===1) and (y===1) and (xx===1) and (yy===0). Actual: x==='+x+' and y==='+y+' and xx==='+xx+' and yy==='+yy ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A4_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A4_T3.js new file mode 100644 index 000000000..b10ddd079 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A4_T3.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.7_A4_T3; +* @section: 12.7; +* @assertion: When "continue Identifier" is evaluated (continue, empty, Identifier) is returned; +* @description: Using embedded and labeled loops, continue to outer loop; +*/ + +LABEL_OUT : var x=0, y=0, xx=0, yy=0; + +LABEL_DO_LOOP : do { + LABEL_IN : x++; + if(x===10)break; + LABEL_NESTED_LOOP : do { + LABEL_IN_NESTED : xx++; + if(xx===10)break; + continue LABEL_DO_LOOP; + LABEL_IN_NESTED_2 : yy++; + } while (0); + + LABEL_IN_2 : y++; + + function IN_DO_FUNC(){} +} while(0); + +LABEL_ANOTHER_LOOP : do { + ; +} while(0); + +function OUT_FUNC(){} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if ((x!==1)&&(y!==0)&&(xx!==1)&(yy!==0)) { + $ERROR('#1: (x===1) and (y===0) and (xx===1) and (yy===0). Actual: x==='+x+' and y==='+y+' and xx==='+xx+' and yy==='+yy ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A5_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A5_T1.js new file mode 100644 index 000000000..45788a280 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A5_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.7_A5_T1; +* @section: 12.7; +* @assertion: When "continue Identifier" is evaluated Identifier must be label in the label set of an enclosing (but not crossing function boundaries) IterationStatement; +* @description: Trying to continue another labeled loop; +* @negative; +*/ + +LABEL_OUT : var x=0, y=0; +LABEL_DO_LOOP : do { + LABEL_IN : x++; + if(x===10)break; + continue LABEL_ANOTHER_LOOP; + LABEL_IN_2 : y++; + function IN_DO_FUNC(){} +} while(0); + +LABEL_ANOTHER_LOOP : do { + ; +} while(0); + +function OUT_FUNC(){} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A5_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A5_T2.js new file mode 100644 index 000000000..a9e5225af --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A5_T2.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.7_A5_T2; +* @section: 12.7; +* @assertion: When "continue Identifier" is evaluated Identifier must be label in the label set of an enclosing (but not crossing function boundaries) IterationStatement; +* @description: Identifier is a function name; +* @negative; +*/ + +LABEL_OUT : var x=0, y=0; +LABEL_DO_LOOP : do { + LABEL_IN : x++; + if(x===10)break; + continue IN_DO_FUNC; + LABEL_IN_2 : y++; + function IN_DO_FUNC(){} +} while(0); + +LABEL_ANOTHER_LOOP : do { + ; +} while(0); + +function OUT_FUNC(){}; diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A5_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A5_T3.js new file mode 100644 index 000000000..a9052bd83 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A5_T3.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.7_A5_T3; +* @section: 12.7; +* @assertion: When "continue Identifier" is evaluated Identifier must be label in the label set of an enclosing (but not crossing function boundaries) IterationStatement; +* @description: Identifier is within loop label; +* @negative; +*/ + +LABEL_OUT : var x=0, y=0; + +LABEL_DO_LOOP : do { + LABEL_IN : x++; + if(x===10)break; + continue LABEL_IN; + LABEL_IN_2 : y++; + function IN_DO_FUNC(){} +} while(0); + +LABEL_ANOTHER_LOOP : do { + ; +} while(0); + +function OUT_FUNC(){} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A6.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A6.js new file mode 100644 index 000000000..572315869 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A6.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.7_A6; +* @section: 12.7; +* @assertion: Appearing of "continue" within a function call that is within an IterationStatement yields SyntaxError; +* @description: Using labaled "continue Identifier" within a function body; +* @negative; +*/ + +var x=0,y=0; + +LABEL1 : do { + x++; + (function(){continue LABEL1;})(); + y++; +} while(0); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A7.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A7.js new file mode 100644 index 000000000..ee74e11b7 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A7.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.7_A7; +* @section: 12.7; +* @assertion: Appearing of continue within eval statement that is within an IterationStatement yields SyntaxError; +* @description: Using eval "eval("continue LABEL1")"; +*/ + +var x=0,y=0; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try{ + LABEL1 : do { + x++; + eval("continue LABEL1"); + y++; + } while(0); + $ERROR('#1: eval("continue LABEL1") does not lead to throwing exception'); +} catch(e){ + if(!(e instanceof SyntaxError)){ + $ERROR("1.1: Appearing of continue within eval statement inside of IterationStatement yields SyntaxError"); + } +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A8_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A8_T1.js new file mode 100644 index 000000000..4432553b4 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A8_T1.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.7_A8_T1; +* @section: 12.7; +* @assertion: Appearing of "continue" within a "try/catch" Block yields SyntaxError; +* @description: Checking if execution of "continue Identifier" within catch Block fails; +* @negative; +*/ + +var x=0,y=0; + +try{ + LABEL1 : do { + x++; + throw "gonna leave it"; + y++; + } while(0); + $ERROR('#1: throw "gonna leave it" lead to throwing exception'); +} catch(e){ + continue LABEL2; + LABEL2 : do { + x++; + y++; + } while(0); +}; diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A8_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A8_T2.js new file mode 100644 index 000000000..9fc2d1c07 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A8_T2.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.7_A8_T2; +* @section: 12.7; +* @assertion: Appearing of "continue" within a "try/catch" Block yields SyntaxError; +* @description: Checking if execution of "continue" within catch Block fails; +* @negative; +*/ + +var x=0,y=0; + +try{ + LABEL1 : do { + x++; + throw "gonna leave it"; + y++; + } while(0); + $ERROR('#1: throw "gonna leave it" lead to throwing exception'); +} catch(e){ + continue; + LABEL2 : do { + x++; + y++; + } while(0); +}; diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A9_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A9_T1.js new file mode 100644 index 000000000..857196ab1 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A9_T1.js @@ -0,0 +1,31 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.7_A9_T1; +* @section: 12.7; +* @assertion: Continue inside of try-catch nested in a loop is allowed; +* @description: Using "continue Identifier" within catch Block that is within a loop; +*/ + +var x=0,y=0; + +(function(){ +FOR : for(;;){ + try{ + x++; + if(x===10)return; + throw 1; + } catch(e){ + continue FOR; + } +} +})(); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (x!==10) { + $ERROR('#1: Continue inside of try-catch nested in loop is allowed'); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A9_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A9_T2.js new file mode 100644 index 000000000..34dfdf6fd --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A9_T2.js @@ -0,0 +1,31 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.7_A9_T2; +* @section: 12.7; +* @assertion: Continue inside of try-catch nested in a loop is allowed; +* @description: Using "continue" within catch Block that is within a loop; +*/ + +var x=0,y=0; + +(function(){ +FOR : for(;;){ + try{ + x++; + if(x===10)return; + throw 1; + } catch(e){ + continue; + } +} +})(); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (x!==10) { + $ERROR('#1: Continue inside of try-catch nested in loop is allowed'); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A1_T1.js new file mode 100644 index 000000000..2c062fe30 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A1_T1.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.8_A1_T1; +* @section: 12.8; +* @assertion: Appearing of break without an IterationStatement leads to syntax error; +* @description: Checking if break statement with no loop fails; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +var x=1; +break; +var y=2; +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A1_T2.js new file mode 100644 index 000000000..1736e724e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A1_T2.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.8_A1_T2; +* @section: 12.8; +* @assertion: Appearing of break without an IterationStatement leads to syntax error; +* @description: Checking if break Identifier with no loop fails; +* @negative; +*/ + +LABEL : x=3.14; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +var x=1; +break LABEL; +var y=2; +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A1_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A1_T3.js new file mode 100644 index 000000000..1e9c923bf --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A1_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.8_A1_T3; +* @section: 12.8; +* @assertion: Appearing of break without an IterationStatement leads to syntax error; +* @description: Checking if break statement with no loop, placed into a block, fails; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +{ + var x=1; + break; + var y=2; +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A1_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A1_T4.js new file mode 100644 index 000000000..ed8a5fae3 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A1_T4.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.8_A1_T4; +* @section: 12.8; +* @assertion: Appearing of break without an IterationStatement leads to syntax error; +* @description: Checking if break Identifier with no loop, placed into a block, fails; +* @negative; +*/ + +LABEL : x=3.14; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +{ + var x=1; + break LABEL; + var y=2; +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A2.js new file mode 100644 index 000000000..87e21e8a2 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A2.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. + +/** +* @name: S12.8_A2; +* @section: 12.8; +* @assertion: Since LineTerminator between "break" and Identifier is not allowed, "break" is evaluated without label; +* @description: Checking by using eval, inserting LineTerminator between break and Identifier; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try{ + eval("FOR1 : for(var i=1;i<2;i++){ LABEL1 : do {var x =1;break\u000AFOR1;var y=2;} while(0);}"); + if (i!==2) { + $ERROR('#1: Since LineTerminator(U-000A) between break and Identifier not allowed break evaluates without label'); + } +} catch(e){ + $ERROR('#1.1: eval("FOR1 : for(var i=1;i<2;i++){ LABEL1 : do {var x =1;break\\u000AFOR1;var y=2;} while(0);}") does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +try{ + eval("FOR2 : for(var i=1;i<2;i++){ LABEL2 : do {var x =1;break\u000DFOR2;var y=2;} while(0);}"); + if (i!==2) { + $ERROR('#2: Since LineTerminator(U-000D) between break and Identifier not allowed break evaluates without label'); + } +} catch(e){ + $ERROR('#2.1: eval("FOR2 : for(var i=1;i<2;i++){ LABEL2 : do {var x =1;break\\u000DFOR2;var y=2;} while(0);}") does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +try{ + eval("FOR3 : for(var i=1;i<2;i++){ LABEL3 : do {var x =1;break\u2028FOR3;var y=2;} while(0);}"); + if (i!==2) { + $ERROR('#3: Since LineTerminator(U-2028) between break and Identifier not allowed break evaluates without label'); + } +} catch(e){ + $ERROR('#3.1: eval("FOR3 : for(var i=1;i<2;i++){ LABEL3 : do {var x =1;break\\u2028FOR3;var y=2;} while(0);}") does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +try{ + eval("FOR4 : for(var i=1;i<2;i++){ LABEL4 : do {var x =1;break\u2029FOR4;var y=2;} while(0);}"); + if (i!==2) { + $ERROR('#4: Since LineTerminator(U-2029) between break and Identifier not allowed break evaluates without label'); + } +} catch(e){ + $ERROR('#4.1: eval("FOR4 : for(var i=1;i<2;i++){ LABEL4 : do {var x =1;break\\u2029FOR4;var y=2;} while(0);}") does not lead to throwing exception'); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A3.js new file mode 100644 index 000000000..0e05eddbe --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A3.js @@ -0,0 +1,33 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.8_A3; +* @section: 12.8; +* @assertion: When "break" is evaluated, (break, empty, empty) is returned; +* @description: Using "break" without Identifier within labeled loop; +*/ + +LABEL_OUT : var x=0, y=0; + +LABEL_DO_LOOP : do { + LABEL_IN : x=2; + break ; + LABEL_IN_2 : var y=2; + + function IN_DO_FUNC(){} +} while(0); + +LABEL_ANOTHER_LOOP : do { + ; +} while(0); + +function OUT_FUNC(){} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if ((x!==2)&&(y!==0)) { + $ERROR('#1: x === 2 and y === 0. Actual: x ==='+x+' and y ==='+y); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A4_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A4_T1.js new file mode 100644 index 000000000..b5af5dad2 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A4_T1.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.8_A4_T1; +* @section: 12.8; +* @assertion: When "break Identifier" is evaluated, (break, empty, Identifier) is returned; +* @description: Using "break Identifier" within labaeled loop; +*/ + +LABEL_OUT : var x=0, y=0; +(function(){ +LABEL_DO_LOOP : do { + LABEL_IN : x++; + if(x===10)return; + break LABEL_DO_LOOP; + LABEL_IN_2 : y++; + + function IN_DO_FUNC(){} +} while(0); + +LABEL_ANOTHER_LOOP : do { + ; +} while(0); + +function OUT_FUNC(){} +})(); +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if ((x!==1)&&(y!==0)) { + $ERROR('#1: x === 1 and y === 0. Actual: x === '+x+' and y ==='+ y ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A4_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A4_T2.js new file mode 100644 index 000000000..f44f1588a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A4_T2.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.8_A4_T2; +* @section: 12.8; +* @assertion: When "break Identifier" is evaluated, (break, empty, Identifier) is returned; +* @description: Using embedded and labeled loops, breaking to nested loop; +*/ + +LABEL_OUT : var x=0, y=0, xx=0, yy=0; +(function(){ +LABEL_DO_LOOP : do { + LABEL_IN : x++; + if(x===10)return; + LABEL_NESTED_LOOP : do { + LABEL_IN_NESTED : xx++; + if(xx===10)return; + break LABEL_NESTED_LOOP; + LABEL_IN_NESTED_2 : yy++; + } while (0); + + LABEL_IN_2 : y++; + + function IN_DO_FUNC(){} +} while(0); + +LABEL_ANOTHER_LOOP : do { + ; +} while(0); + +function OUT_FUNC(){} +})(); +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if ((x!==1)&&(y!==1)&&(xx!==1)&(yy!==0)) { + $ERROR('#1: x === 1 and y === 1 and xx === 1 and yy === 0. Actual: x==='+x+' and y==='+y+' and xx==='+xx+' and yy==='+yy ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A4_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A4_T3.js new file mode 100644 index 000000000..1f4d77daa --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A4_T3.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.8_A4_T3; +* @section: 12.8; +* @assertion: When "break Identifier" is evaluated, (break, empty, Identifier) is returned; +* @description: Using embedded and labeled loops, breaking to outer loop; +*/ + +LABEL_OUT : var x=0, y=0, xx=0, yy=0; +(function(){ +LABEL_DO_LOOP : do { + LABEL_IN : x++; + if(x===10)return; + LABEL_NESTED_LOOP : do { + LABEL_IN_NESTED : xx++; + if(xx===10)return; + break LABEL_DO_LOOP; + LABEL_IN_NESTED_2 : yy++; + } while (0); + + LABEL_IN_2 : y++; + + function IN_DO_FUNC(){} +} while(0); + +LABEL_ANOTHER_LOOP : do { + ; +} while(0); + +function OUT_FUNC(){} +})(); +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if ((x!==1)&&(y!==0)&&(xx!==1)&(yy!==0)) { + $ERROR('#1: x === 1 and y === 0 and xx === 1 and yy === 0. Actual: x==='+x+' and y==='+y+' and xx==='+xx+' and yy==='+yy ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A5_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A5_T1.js new file mode 100644 index 000000000..4fe11a40f --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A5_T1.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.8_A5_T1; +* @section: 12.8; +* @assertion: Identifier must be label in the label set of an enclosing (but not crossing function boundaries) IterationStatement; +* @description: Checking if breaking another labeled loop fails; +* @negative; +*/ + +(function(){ + LABEL_OUT : var x=0, y=0; + LABEL_DO_LOOP : do { + LABEL_IN : x++; + if(x===10) + return; + break LABEL_ANOTHER_LOOP; + LABEL_IN_2 : y++; + function IN_DO_FUNC(){} + } while(0); + + LABEL_ANOTHER_LOOP : do { + ; + } while(0); + + function OUT_FUNC(){} +})(); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A5_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A5_T2.js new file mode 100644 index 000000000..0f59c86cc --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A5_T2.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.8_A5_T2; +* @section: 12.8; +* @assertion: Identifier must be label in the label set of an enclosing (but not crossing function boundaries) IterationStatement; +* @description: Checking if using function name as an Identifier appears to be invalid; +* @negative; +*/ + +(function(){ + LABEL_OUT : var x=0, y=0; + LABEL_DO_LOOP : do { + LABEL_IN : x++; + if(x===10) + return; + break IN_DO_FUNC; + LABEL_IN_2 : y++; + function IN_DO_FUNC(){} + } while(0); + + LABEL_ANOTHER_LOOP : do { + ; + } while(0); + + function OUT_FUNC(){} +})(); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A5_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A5_T3.js new file mode 100644 index 000000000..d3babcfeb --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A5_T3.js @@ -0,0 +1,31 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.8_A5_T3; +* @section: 12.8; +* @assertion: Identifier must be label in the label set of an enclosing (but not crossing function boundaries) IterationStatement; +* @description: Checking if using internal loop label as an Identifier appears to be invalid; +* @negative; +*/ + +(function(){ + LABEL_OUT : var x=0, y=0; + LABEL_DO_LOOP : do { + LABEL_IN : x++; + if(x===10) + return; + break LABEL_IN; + LABEL_IN_2 : y++; + + function IN_DO_FUNC(){} + + } while(0); + + LABEL_ANOTHER_LOOP : do { + ; + } while(0); + + function OUT_FUNC(){} + +})(); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A6.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A6.js new file mode 100644 index 000000000..8dbc7acb2 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A6.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.8_A6; +* @section: 12.8; +* @assertion: Appearing of "break" within a function call that is nested in a IterationStatement yields SyntaxError; +* @description: Checking if using "break Identifier" within a function body appears to be invalid; +* @negative; +*/ + +var x=0,y=0; + +LABEL1 : do { + x++; + (function(){break LABEL1;})(); + y++; +} while(0); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A7.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A7.js new file mode 100644 index 000000000..b900e7664 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A7.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.8_A7; +* @section: 12.8; +* @assertion: Appearing of "break" within eval statement that is nested in an IterationStatement yields SyntaxError; +* @description: Using eval "eval("break LABEL1")"; +*/ + +var x=0,y=0; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try{ + LABEL1 : do { + x++; + eval("break LABEL1"); + y++; + } while(0); + $ERROR('#1: eval("break LABEL1") does not lead to throwing exception'); +} catch(e){ + if(!(e instanceof SyntaxError)){ + $ERROR("1.1: Appearing of break within eval statement inside of IterationStatement yields SyntaxError"); + } +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A8_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A8_T1.js new file mode 100644 index 000000000..7280ee6aa --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A8_T1.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.8_A8_T1; +* @section: 12.8; +* @assertion: Appearing of "break" within "try/catch" Block yields SyntaxError; +* @description: Checking if using "break Identifier" from within catch Block appears to be invalid; +* @negative; +*/ + +var x=0,y=0; + +try{ + LABEL1 : do { + x++; + throw "gonna leave it"; + y++; + } while(0); + $ERROR('#1: throw "gonna leave it" lead to throwing exception'); +} catch(e){ + break LABEL2; + LABEL2 : do { + x++; + y++; + } while(0); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A8_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A8_T2.js new file mode 100644 index 000000000..13811bc2d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A8_T2.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.8_A8_T2; +* @section: 12.8; +* @assertion: Appearing of "break" within "try/catch" Block yields SyntaxError; +* @description: Checking if using "break Identifier" from within catch Block appears to be invalid; +* @negative; +*/ + +var x=0,y=0; + +try{ + LABEL1 : do { + x++; + throw "gonna leave it"; + y++; + } while(0); + $ERROR('#1: throw "gonna leave it" lead to throwing exception'); +} catch(e){ + break; + LABEL2 : do { + x++; + y++; + } while(0); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A9_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A9_T1.js new file mode 100644 index 000000000..9a18da4f4 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A9_T1.js @@ -0,0 +1,31 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.8_A9_T1; +* @section: 12.8; +* @assertion: Using "break" within "try/catch" statement that is nested in a loop is allowed; +* @description: Using "continue Identifier" within "catch" statement; +*/ + +var x=0,y=0; + +(function(){ +FOR : for(;;){ + try{ + x++; + if(x===10)return; + throw 1; + } catch(e){ + break FOR; + } +} +})(); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (x!==1) { + $ERROR('#1: break inside of try-catch nested in loop is allowed'); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A9_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A9_T2.js new file mode 100644 index 000000000..e0d79817c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A9_T2.js @@ -0,0 +1,31 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.8_A9_T2; +* @section: 12.8; +* @assertion: Using "break" within "try/catch" statement that is nested in a loop is allowed; +* @description: Using "continue Identifier" within "catch" statement; +*/ + +var x=0,y=0; + +(function(){ +FOR : for(;;){ + try{ + x++; + if(x===10)return; + throw 1; + } catch(e){ + break ; + } +} +})(); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (x!==1) { + $ERROR('#1: break inside of try-catch nested in loop is allowed'); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T1.js new file mode 100644 index 000000000..ddea210f7 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T1.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.9_A1_T1; +* @section: 12.9; +* @assertion: Appearing of "return" without a function body leads to syntax error; +* @description: Checking if execution of "return" with no function fails; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +var x=1; +return; +var y=2; diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T10.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T10.js new file mode 100644 index 000000000..2c98b7520 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T10.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.9_A1_T10; +* @section: 12.9; +* @assertion: Appearing of "return" without a function body leads to syntax error; +* @description: Checking if execution of "return (0)" with no function fails; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +return (0); +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T2.js new file mode 100644 index 000000000..68a8064ca --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T2.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.9_A1_T2; +* @section: 12.9; +* @assertion: Appearing of "return" without a function body leads to syntax error; +* @description: Checking if execution of "return x" with no function fails; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +var x=1; +return x; +var y=2; +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T3.js new file mode 100644 index 000000000..43b709772 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.9_A1_T3; +* @section: 12.9; +* @assertion: Appearing of "return" without a function body leads to syntax error; +* @description: Checking if execution of "return" within "try" statement fails; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + return 1; +} catch(e){ + return 1; +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T4.js new file mode 100644 index 000000000..bb15c5a0e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T4.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.9_A1_T4; +* @section: 12.9; +* @assertion: Appearing of "return" without a function body leads to syntax error; +* @description: Checking if execution of "return" with no function fails; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +return; +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T5.js new file mode 100644 index 000000000..6027cf802 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T5.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.9_A1_T5; +* @section: 12.9; +* @assertion: Appearing of "return" without a function body leads to syntax error; +* @description: Checking if execution of "return" with no function, placed into a Block, fails; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +{ + var x=1; + return; + var y=2; +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T6.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T6.js new file mode 100644 index 000000000..46a697036 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T6.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.9_A1_T6; +* @section: 12.9; +* @assertion: Appearing of "return" without a function body leads to syntax error; +* @description: Checking if execution of "return" with no function, placed into a loop, fails; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +do { + var x=1; + return; + var y=2; +} while(0); +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T7.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T7.js new file mode 100644 index 000000000..f77868d01 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T7.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.9_A1_T7; +* @section: 12.9; +* @assertion: Appearing of "return" without a function body leads to syntax error; +* @description: Checking if execution of "return x" with no function, placed inside Block, fails; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +{ + var x=1; + return x; + var y=2; +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T8.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T8.js new file mode 100644 index 000000000..509efa7b9 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T8.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.9_A1_T8; +* @section: 12.9; +* @assertion: Appearing of "return" without a function body leads to syntax error; +* @description: Checking if execution of "return x" with no function, placed into a loop, fails; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +do { + var x=1; + return x; + var y=2; +} while(0); +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T9.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T9.js new file mode 100644 index 000000000..80f9e69de --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T9.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.9_A1_T9; +* @section: 12.9; +* @assertion: Appearing of "return" without a function body leads to syntax error; +* @description: Checking if execution of "return", placed into a catch Block, fails; +* @negative; +*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + throw 1; +} catch(e){ + return e; +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A2.js new file mode 100644 index 000000000..9a75efd45 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A2.js @@ -0,0 +1,55 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.9_A2; + * @section: 12.9; + * @assertion: LineTerminator between return and Identifier_opt yields return without Identifier_opt; + * @description: Checking by using eval, inserting LineTerminator between return and Variable; + */ + + +//CHECK#1 +try{ + if (eval("(function(){var x = 1;return\u000Ax;var y=2;})()") !== undefined) { + $ERROR("#1: LineTerminator(U-000A) between return and Identifier_opt yields return without Identifier_opt"); + } +} catch(e){ + $ERROR('#1: eval("(function(){var x = 1;return\\u000Ax;var y=2;})()") does not lead to throwing exception'); +} + + + + +//CHECK#2 +try{ + if (eval("(function(){var x = 1;return\u000Dx;var y=2;})()") !== undefined) { + $ERROR("#1: LineTerminator(U-000D) between return and Identifier_opt yields return without Identifier_opt"); + } +} catch(e){ + $ERROR('#2: eval("(function(){var x = 1;return\\u000Dx;var y=2;})()") does not lead to throwing exception'); +} + + + + +//CHECK#3 +try{ + if (eval("(function(){var x = 1;return\u2028x;var y=2;})()") !== undefined) { + $ERROR("#1: LineTerminator(U-2028) between return and Identifier_opt yields return without Identifier_opt"); + } +} catch(e){ + $ERROR('#3: eval("(function(){var x = 1;return\\u2028x;var y=2;})()") does not lead to throwing exception'); +} + + + + +//CHECK#4 +try{ + if (eval("(function(){var x =1;return\u2029x;var y=2;})()") !== undefined) { + $ERROR("#1: LineTerminator(U-2029) between return and Identifier_opt yields return without Identifier_opt"); + } +} catch(e){ + $ERROR('#4: eval("(function(){var x =1;return\\u2029x;var y=2;})()") does not lead to throwing exception'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A3.js new file mode 100644 index 000000000..f9c64af58 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A3.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.9_A3; +* @section: 12.9; +* @assertion: If Expression is omitted, the return value is undefined; +* @description: Return without Expression; +*/ + +__evaluated = (function (){return;})(); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__evaluated !== undefined) { + $ERROR('#1: If Expression is omitted, the return value is undefined'); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A4.js new file mode 100644 index 000000000..81f0f8c02 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A4.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.9_A4; +* @section: 12.9; +* @assertion: The production ReturnStatement : return Expression; is evaluated as: +* i) Evaluate Expression. +* ii) Call GetValue(Result(2)). +* iii) Return (return, Result(3), empty); +* @description: Return very sophisticated expression and function; +*/ + + +// second derivative +function DD_operator(f, delta){return function(x){return (f(x+delta)-2*f(x)+f(x-delta))/(delta*delta)};} + +DDsin = DD_operator(Math.sin, 0.00001); + + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +// ((sin(x))')' = -sin(x) +if (DDsin( Math.PI/2 ) + Math.sin( Math.PI/2 ) > 0.00001) { + $ERROR('#1: return Expression yields to Return (return, GetValue(Evaluate Expression), empty)'); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A5.js new file mode 100644 index 000000000..693582618 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A5.js @@ -0,0 +1,39 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S12.9_A5; +* @section: 12.9; +* @assertion: Code after ReturnStatement is not evaluated; +* @description: Using code after Return statement; +*/ + +//CHECK#1 +var x1=1; +function myfunc1(){ + x1++; + return; + x1*=2; +} +myfunc1(); +if (x1!==2) $ERROR('#1: x1 === 2. Actual: x1 ==='+ x1 ); + +//CHECK#2 +var x2=1; +function myfunc2(){ + x2++; + return x2; + x2*=2; +} +myfunc2(); +if (x2!==2) $ERROR('#2: x2 === 2. Actual: x2 ==='+ x2 ); + +//CHECK#3 +var x3=1; +function myfunc3(){ + x3++; + return; + return x3; + x3*=2; +} +if (myfunc3()!==undefined) $ERROR('#3: myfunc3() === undefined. Actual: myfunc3() ==='+ myfunc3() ); |