diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /js/src/tests/test262/ch12/12.6/12.6.2 | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/tests/test262/ch12/12.6/12.6.2')
25 files changed, 618 insertions, 0 deletions
diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A1.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A1.js new file mode 100644 index 000000000..cb7fff722 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A1.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Expression from "while" IterationStatement is evaluated first; "false", "0", "null", "undefined" and "empty" strings used as the Expression are evaluated to "false" + * + * @path ch12/12.6/12.6.2/S12.6.2_A1.js + * @description Evaluating various Expressions + */ + +var __in__do; + +while ( false ) __in__do=1; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__in__do !== undefined) { + $ERROR('#1: false evaluates to false'); +} +// +////////////////////////////////////////////////////////////////////////////// + +while ( 0 ) __in__do=2; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__in__do !== undefined) { + $ERROR('#2: 0 evaluates to false'); +} +// +////////////////////////////////////////////////////////////////////////////// + +while ( "" ) __in__do=3; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (__in__do !== undefined) { + $ERROR('#3: empty string evaluates to false'); +} +// +////////////////////////////////////////////////////////////////////////////// + +while ( null ) __in__do=4; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if (__in__do !== undefined) { + $ERROR('#4: null evaluates to false'); +} +// +////////////////////////////////////////////////////////////////////////////// + +while ( undefined ) __in__do=35; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#5 +if (__in__do !== undefined) { + $ERROR('#5: undefined evaluates to false'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A10.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A10.js new file mode 100644 index 000000000..9a05fe317 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A10.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * FunctionExpression within a "while" IterationStatement is allowed, but no function with the given name will appear in the global context + * + * @path ch12/12.6/12.6.2/S12.6.2_A10.js + * @description Testing FunctionExpression too + */ + +var check=0; +while(function f(){}){ + if(typeof(f) === "function") { + check = -1; + break; + } else { + check = 1; + break; + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (check !== 1) { + $ERROR('#1: FunctionExpression inside while construction expression allowed but function not declare'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A11.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A11.js new file mode 100644 index 000000000..6ff4c779c --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A11.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * "{}" Block within a "while" Expression is evaluated to true + * + * @path ch12/12.6/12.6.2/S12.6.2_A11.js + * @description Checking if execution of "while({}){}" passes + */ + +while({}){ + var __in__do=1; + if(__in__do)break; +}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__in__do !== 1) { + $ERROR('#1: "{}" in while expression evaluates to true'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A14_T1.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A14_T1.js new file mode 100644 index 000000000..f27b9df26 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A14_T1.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * FunctionExpression within a "while" Expression is allowed + * + * @path ch12/12.6/12.6.2/S12.6.2_A14_T1.js + * @description Using "function __func(){return 0;}" as an Expression + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +while(function __func(){return 0;}){ + var __reached = 1; + break; +}; +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__reached !== 1) { + $ERROR('#2: function expression inside of while expression is allowed'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A14_T2.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A14_T2.js new file mode 100644 index 000000000..cd867ea97 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A14_T2.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * FunctionExpression within a "while" Expression is allowed + * + * @path ch12/12.6/12.6.2/S12.6.2_A14_T2.js + * @description Using function call as an Expression + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +while(function __func(){return 1;}()){ + var __reached = 1; + break; +}; +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__reached !== 1) { + $ERROR('#2: function expression inside of while expression is allowed'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A15.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A15.js new file mode 100644 index 000000000..e1e231dd4 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A15.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Block within a "while" Expression is not allowed + * + * @path ch12/12.6/12.6.2/S12.6.2_A15.js + * @description Expression is "{0}" + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +while({1}){ + break ; +}; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A2.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A2.js new file mode 100644 index 000000000..e3994d474 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A2.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * While evaluating The production IterationStatement: "while ( Expression ) Statement", Expression is evaluated first + * + * @path ch12/12.6/12.6.2/S12.6.2_A2.js + * @description Evaluating Statement with error Expression + */ + +try { + while ((function(){throw 1})()) __in__while = "reached"; + $ERROR('#1: \'while ((function(){throw 1})()) __in__while = "reached"\' lead to throwing exception'); +} catch (e) { + if (e !== 1) { + $ERROR('#1: Exception === 1. Actual: Exception ==='+e); + } +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof __in__while !== "undefined") { + $ERROR('#1.1: typeof __in__while === "undefined". Actual: typeof __in__while ==='+typeof __in__while); +} +// +////////////////////////////////////////////////////////////////////////////// + + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A3.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A3.js new file mode 100644 index 000000000..ec8934e8e --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A3.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * When "while" IterationStatement is evaluated, (normal, V, empty) is returned + * + * @path ch12/12.6/12.6.2/S12.6.2_A3.js + * @description Using eval + */ + +var __in__do; + +__evaluated = eval("while (false) __in__do=1;"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +if (__in__do !== undefined) { + $ERROR('#1: __in__do === undefined. Actual: __in__do ==='+ __in__do ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__evaluated !== undefined) { + $ERROR('#2: __evaluated === undefined. Actual: __evaluated ==='+ __evaluated ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A4_T1.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A4_T1.js new file mode 100644 index 000000000..5e20d53ba --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A4_T1.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * "break" within a "while" Statement is allowed and performed as described in 12.8 + * + * @path ch12/12.6/12.6.2/S12.6.2_A4_T1.js + * @description "break" within a "while" Statement + */ + +while(1===1){ + __in__do__before__break="reached"; + break; + __in__do__after__break="where am i"; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__in__do__before__break !== "reached") { + $ERROR('#1: __in__do__before__break === "reached". Actual: __in__do__before__break ==='+ __in__do__before__break ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (typeof __in__do__after__break !== "undefined") { + $ERROR('#2: typeof __in__do__after__break === "undefined". Actual: typeof __in__do__after__break ==='+ typeof __in__do__after__break ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A4_T2.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A4_T2.js new file mode 100644 index 000000000..616145c02 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A4_T2.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * "break" within a "while" Statement is allowed and performed as described in 12.8 + * + * @path ch12/12.6/12.6.2/S12.6.2_A4_T2.js + * @description "break" and VariableDeclaration within a "while" Statement + */ + +do_out : while(1===1) { + if (__in__do__before__break) break; + var __in__do__before__break="black"; + do_in : while (1) { + var __in__do__IN__before__break="hole"; + break do_in; + var __in__do__IN__after__break="sun"; + } ; + var __in__do__after__break="won't you come"; +}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!(__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break)) { + $ERROR('#1: Break inside do-while is allowed as its described at standard'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A4_T3.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A4_T3.js new file mode 100644 index 000000000..a86e95705 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A4_T3.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * "break" within a "while" Statement is allowed and performed as described in 12.8 + * + * @path ch12/12.6/12.6.2/S12.6.2_A4_T3.js + * @description "break" and VariableDeclaration within a "while" Statement + */ + +do_out : while(1===1) { + if (__in__do__before__break) break; + var __in__do__before__break="once"; + do_in : while (1) { + var __in__do__IN__before__break="in"; + break do_out; + var __in__do__IN__after__break="the"; + } ; + var __in__do__after__break="lifetime"; +} ; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!(__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&!__in__do__after__break)) { + $ERROR('#1: Break inside do-while is allowed as its described at standard'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A4_T4.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A4_T4.js new file mode 100644 index 000000000..4dc75f137 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A4_T4.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * "break" within a "while" Statement is allowed and performed as described in 12.8 + * + * @path ch12/12.6/12.6.2/S12.6.2_A4_T4.js + * @description "break" and VariableDeclaration within a "while" Statement + */ + +do_out : while(1===1) { + if(__in__do__before__break)break; + var __in__do__before__break="can't"; + do_in : while (1) { + var __in__do__IN__before__break="get"; + break; + var __in__do__IN__after__break="no"; + } ; + var __in__do__after__break="Satisfaction"; +} ; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!(__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break)) { + $ERROR('#1: Break inside do-while is allowed as its described at standard'); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A4_T5.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A4_T5.js new file mode 100644 index 000000000..46e5b95c7 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A4_T5.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * "break" within a "while" Statement is allowed and performed as described in 12.8 + * + * @path ch12/12.6/12.6.2/S12.6.2_A4_T5.js + * @description Using labeled "break" in order to continue a "while" loop + */ + +//CHECK#1 +var i=0; +woohoo:{ + while(true){ + i++; + if ( ! (i < 10) ) { + break woohoo; + $ERROR('#1.1: "break woohoo" must break loop'); + } + } + if (i!==10) $ERROR('#1.2: i===10. Actual: i==='+ i ); +} + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A5.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A5.js new file mode 100644 index 000000000..899837466 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A5.js @@ -0,0 +1,36 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * While using "while" within an eval statement, source "break" is allowed and (normal, V, empty) is returned + * + * @path ch12/12.6/12.6.2/S12.6.2_A5.js + * @description Using eval + */ + +__evaluated = eval("while(1) {__in__do__before__break=1; break; __in__do__after__break=2;}"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__in__do__before__break !== 1) { + $ERROR('#1: __in__do__before__break === 1. Actual: __in__do__before__break ==='+ __in__do__before__break ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (typeof __in__do__after__break !== "undefined") { + $ERROR('#2: typeof __in__do__after__break === "undefined". Actual: typeof __in__do__after__break ==='+ typeof __in__do__after__break ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (__evaluated !== 1) { + $ERROR('#3: __evaluated === 1. Actual: __evaluated ==='+ __evaluated ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T1.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T1.js new file mode 100644 index 000000000..f9a4e9744 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T1.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Expression in "while" IterationStatement is bracketed with braces + * + * @path ch12/12.6/12.6.2/S12.6.2_A6_T1.js + * @description Checking if execution of "while 1 break" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +while 1 break; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T2.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T2.js new file mode 100644 index 000000000..b7f61b8b4 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T2.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Expression in "while" IterationStatement is bracketed with braces + * + * @path ch12/12.6/12.6.2/S12.6.2_A6_T2.js + * @description Checking if execution of "while 0 break" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +while 0 break; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T3.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T3.js new file mode 100644 index 000000000..4b0eaea03 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T3.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Expression in "while" IterationStatement is bracketed with braces + * + * @path ch12/12.6/12.6.2/S12.6.2_A6_T3.js + * @description Checking if execution of "while true break" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +while true break; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T4.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T4.js new file mode 100644 index 000000000..8d17ce8f1 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T4.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Expression in "while" IterationStatement is bracketed with braces + * + * @path ch12/12.6/12.6.2/S12.6.2_A6_T4.js + * @description Checking if execution of "while false break" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +while false break; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T5.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T5.js new file mode 100644 index 000000000..e1b677741 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T5.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Expression in "while" IterationStatement is bracketed with braces + * + * @path ch12/12.6/12.6.2/S12.6.2_A6_T5.js + * @description Checking if execution of "while '' break" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +while '' break; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T6.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T6.js new file mode 100644 index 000000000..78ce3abdb --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A6_T6.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Expression in "while" IterationStatement is bracketed with braces + * + * @path ch12/12.6/12.6.2/S12.6.2_A6_T6.js + * @description Checking if execution of "while 'hood' break" fails + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +while 'hood' break; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A7.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A7.js new file mode 100644 index 000000000..5743cd6d4 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A7.js @@ -0,0 +1,31 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The "while" Statement is evaluted according to 12.6.2 and returns (normal, V, empty) + * + * @path ch12/12.6/12.6.2/S12.6.2_A7.js + * @description using eval + */ + +var __condition=0 + +__evaluated = eval("while (__condition<5) eval(\"__condition++\");"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__condition !== 5) { + $ERROR('#1: The "while" statement is evaluated as described in the Standard'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__evaluated !== 4) { + $ERROR('#2: The "while" statement returns (normal, V, empty)'); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A8.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A8.js new file mode 100644 index 000000000..a5af5748d --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A8.js @@ -0,0 +1,31 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * "continue" statement within a "while" Statement is allowed + * + * @path ch12/12.6/12.6.2/S12.6.2_A8.js + * @description using eval + */ + +var __condition = 0, __odds=0; + +__evaluated = eval("while(__condition < 10) { __condition++; if (((''+__condition/2).split('.')).length>1) continue; __odds++;}"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__odds !== 5) { + $ERROR('#1: __odds === 5. Actual: __odds ==='+ __odds ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__evaluated !== 4) { + $ERROR('#2: __evaluated === 4. Actual: __evaluated ==='+ __evaluated ); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A9.js b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A9.js new file mode 100644 index 000000000..f8cbed0a1 --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/S12.6.2_A9.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * "while" Statement is evaluated without syntax checks + * + * @path ch12/12.6/12.6.2/S12.6.2_A9.js + * @description Throwing system exception inside "while" loop + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + while(x!=1) { + var x = 1; + abaracadabara; + }; + $ERROR('#1: "abbracadabra" lead to throwing exception');
+
+} catch (e) {
+ if (e instanceof Test262Error) throw e; +} + +if (x !== 1) { + $ERROR('#1.1: while statement evaluates as is, without syntax checks'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/browser.js b/js/src/tests/test262/ch12/12.6/12.6.2/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/browser.js diff --git a/js/src/tests/test262/ch12/12.6/12.6.2/shell.js b/js/src/tests/test262/ch12/12.6/12.6.2/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch12/12.6/12.6.2/shell.js |