diff options
Diffstat (limited to 'test/suite/ch12/12.6/12.6.4')
-rw-r--r-- | test/suite/ch12/12.6/12.6.4/12.6.4-1.js | 70 | ||||
-rw-r--r-- | test/suite/ch12/12.6/12.6.4/12.6.4-2.js | 75 | ||||
-rw-r--r-- | test/suite/ch12/12.6/12.6.4/S12.6.4_A1.js | 13 | ||||
-rw-r--r-- | test/suite/ch12/12.6/12.6.4/S12.6.4_A14_T2.js | 11 | ||||
-rw-r--r-- | test/suite/ch12/12.6/12.6.4/S12.6.4_A15.js | 13 | ||||
-rw-r--r-- | test/suite/ch12/12.6/12.6.4/S12.6.4_A2.js | 14 | ||||
-rw-r--r-- | test/suite/ch12/12.6/12.6.4/S12.6.4_A3.1.js | 18 | ||||
-rw-r--r-- | test/suite/ch12/12.6/12.6.4/S12.6.4_A3.js | 18 | ||||
-rw-r--r-- | test/suite/ch12/12.6/12.6.4/S12.6.4_A4.1.js | 17 | ||||
-rw-r--r-- | test/suite/ch12/12.6/12.6.4/S12.6.4_A4.js | 17 | ||||
-rw-r--r-- | test/suite/ch12/12.6/12.6.4/S12.6.4_A5.1.js | 18 | ||||
-rw-r--r-- | test/suite/ch12/12.6/12.6.4/S12.6.4_A5.js | 18 | ||||
-rw-r--r-- | test/suite/ch12/12.6/12.6.4/S12.6.4_A6.1.js | 15 | ||||
-rw-r--r-- | test/suite/ch12/12.6/12.6.4/S12.6.4_A6.js | 15 | ||||
-rw-r--r-- | test/suite/ch12/12.6/12.6.4/S12.6.4_A7_T1.js | 15 | ||||
-rw-r--r-- | test/suite/ch12/12.6/12.6.4/S12.6.4_A7_T2.js | 15 |
16 files changed, 168 insertions, 194 deletions
diff --git a/test/suite/ch12/12.6/12.6.4/12.6.4-1.js b/test/suite/ch12/12.6/12.6.4/12.6.4-1.js index 3929b0a23..89037a23f 100644 --- a/test/suite/ch12/12.6/12.6.4/12.6.4-1.js +++ b/test/suite/ch12/12.6/12.6.4/12.6.4-1.js @@ -1,34 +1,36 @@ -/// Copyright (c) 2012 Ecma International. All rights reserved.
-/// Ecma International makes this code available under the terms and conditions set
-/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
-/// "Use Terms"). Any redistribution of this code must retain the above
-/// copyright and this notice and otherwise comply with the Use Terms.
-/**
- * @path ch12/12.6/12.6.4/12.6.4-1.js
- * @description The for-in Statement - a property name must not be visited more than once in any enumeration.
- */
-
-
-function testcase() {
- var obj = { prop1: "abc", prop2: "bbc", prop3: "cnn" };
-
- var countProp1 = 0;
- var countProp2 = 0;
- var countProp3 = 0;
-
- for (var p in obj) {
- if (obj.hasOwnProperty(p)) {
- if (p === "prop1") {
- countProp1++;
- }
- if (p === "prop2") {
- countProp2++;
- }
- if (p === "prop3") {
- countProp3++;
- }
- }
- }
- return countProp1 === 1 && countProp2 === 1 && countProp3 === 1;
- }
-runTestCase(testcase);
+// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +description: > + The for-in Statement - a property name must not be visited more + than once in any enumeration. +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { prop1: "abc", prop2: "bbc", prop3: "cnn" }; + + var countProp1 = 0; + var countProp2 = 0; + var countProp3 = 0; + + for (var p in obj) { + if (obj.hasOwnProperty(p)) { + if (p === "prop1") { + countProp1++; + } + if (p === "prop2") { + countProp2++; + } + if (p === "prop3") { + countProp3++; + } + } + } + return countProp1 === 1 && countProp2 === 1 && countProp3 === 1; + } +runTestCase(testcase); diff --git a/test/suite/ch12/12.6/12.6.4/12.6.4-2.js b/test/suite/ch12/12.6/12.6.4/12.6.4-2.js index ffdd58cdf..36778a3dd 100644 --- a/test/suite/ch12/12.6/12.6.4/12.6.4-2.js +++ b/test/suite/ch12/12.6/12.6.4/12.6.4-2.js @@ -1,36 +1,39 @@ -/// Copyright (c) 2012 Ecma International. All rights reserved.
-/// Ecma International makes this code available under the terms and conditions set
-/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
-/// "Use Terms"). Any redistribution of this code must retain the above
-/// copyright and this notice and otherwise comply with the Use Terms.
-/**
- * @path ch12/12.6/12.6.4/12.6.4-2.js
- * @description The for-in Statement - the values of [[Enumerable]] attributes are not considered when determining if a property of a prototype object is shadowed by a previous object on the prototype chain
- */
-
-
-function testcase() {
- var proto = {
- prop: "enumerableValue"
- };
-
- var ConstructFun = function () { };
- ConstructFun.prototype = proto;
-
- var child = new ConstructFun();
-
- Object.defineProperty(child, "prop", {
- value: "nonEnumerableValue",
- enumerable: false
- });
-
- var accessedProp = false;
-
- for (var p in child) {
- if (p === "prop") {
- accessedProp = true;
- }
- }
- return !accessedProp;
- }
-runTestCase(testcase);
+// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +description: > + The for-in Statement - the values of [[Enumerable]] attributes are + not considered when determining if a property of a prototype + object is shadowed by a previous object on the prototype chain +includes: [runTestCase.js] +---*/ + +function testcase() { + var proto = { + prop: "enumerableValue" + }; + + var ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + + Object.defineProperty(child, "prop", { + value: "nonEnumerableValue", + enumerable: false + }); + + var accessedProp = false; + + for (var p in child) { + if (p === "prop") { + accessedProp = true; + } + } + return !accessedProp; + } +runTestCase(testcase); diff --git a/test/suite/ch12/12.6/12.6.4/S12.6.4_A1.js b/test/suite/ch12/12.6/12.6.4/S12.6.4_A1.js index fd8c754bf..a82fb651a 100644 --- a/test/suite/ch12/12.6/12.6.4/S12.6.4_A1.js +++ b/test/suite/ch12/12.6/12.6.4/S12.6.4_A1.js @@ -1,12 +1,10 @@ // Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. -/** - * "for(key in undefined)" Statement is allowed - * - * @path ch12/12.6/12.6.4/S12.6.4_A1.js - * @description Checking if execution of "for(key in undefined)" passes - */ +/*--- +info: "\"for(key in undefined)\" Statement is allowed" +description: Checking if execution of "for(key in undefined)" passes +---*/ ////////////////////////////////////////////////////////////////////////////// //CHECK#1 @@ -28,6 +26,3 @@ if (key!==undefined) { } // ////////////////////////////////////////////////////////////////////////////// - - - diff --git a/test/suite/ch12/12.6/12.6.4/S12.6.4_A14_T2.js b/test/suite/ch12/12.6/12.6.4/S12.6.4_A14_T2.js index b90e3e99b..be330ce38 100644 --- a/test/suite/ch12/12.6/12.6.4/S12.6.4_A14_T2.js +++ b/test/suite/ch12/12.6/12.6.4/S12.6.4_A14_T2.js @@ -1,12 +1,10 @@ // Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. -/** - * FunctionExpession within a "for-in" Expression is allowed - * - * @path ch12/12.6/12.6.4/S12.6.4_A14_T2.js - * @description Using "function __func(){return {a:1};}()" as Expession - */ +/*--- +info: FunctionExpession within a "for-in" Expression is allowed +description: "Using \"function __func(){return {a:1};}()\" as Expession" +---*/ ////////////////////////////////////////////////////////////////////////////// //CHECK# @@ -23,4 +21,3 @@ if (__reached !== "a") { } // ////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/ch12/12.6/12.6.4/S12.6.4_A15.js b/test/suite/ch12/12.6/12.6.4/S12.6.4_A15.js index c19908904..8ddc81613 100644 --- a/test/suite/ch12/12.6/12.6.4/S12.6.4_A15.js +++ b/test/suite/ch12/12.6/12.6.4/S12.6.4_A15.js @@ -1,13 +1,11 @@ // Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. -/** - * Block within a "for-in" Expression is not allowed - * - * @path ch12/12.6/12.6.4/S12.6.4_A15.js - * @description Using block within "for-in" Expression - * @negative - */ +/*--- +info: Block within a "for-in" Expression is not allowed +description: Using block within "for-in" Expression +flags: [negative] +---*/ var __arr=[1,2,3]; @@ -18,4 +16,3 @@ for(x in {__arr}){ }; // ////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/ch12/12.6/12.6.4/S12.6.4_A2.js b/test/suite/ch12/12.6/12.6.4/S12.6.4_A2.js index e8db640c0..56d980789 100644 --- a/test/suite/ch12/12.6/12.6.4/S12.6.4_A2.js +++ b/test/suite/ch12/12.6/12.6.4/S12.6.4_A2.js @@ -1,12 +1,10 @@ // Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. -/** - * "for(key in null)" Expression is allowed - * - * @path ch12/12.6/12.6.4/S12.6.4_A2.js - * @description Checking if execution of "for(key in null)" passes - */ +/*--- +info: "\"for(key in null)\" Expression is allowed" +description: Checking if execution of "for(key in null)" passes +---*/ ////////////////////////////////////////////////////////////////////////////// //CHECK# @@ -27,7 +25,3 @@ if (key!==undefined) { } // ////////////////////////////////////////////////////////////////////////////// - - - - diff --git a/test/suite/ch12/12.6/12.6.4/S12.6.4_A3.1.js b/test/suite/ch12/12.6/12.6.4/S12.6.4_A3.1.js index d232fe48d..39a41dbc0 100644 --- a/test/suite/ch12/12.6/12.6.4/S12.6.4_A3.1.js +++ b/test/suite/ch12/12.6/12.6.4/S12.6.4_A3.1.js @@ -1,12 +1,14 @@ // Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. -/** - * The production IterationStatement: "for (var VariableDeclarationNoIn in Expression) Statement" - * - * @path ch12/12.6/12.6.4/S12.6.4_A3.1.js - * @description Using an array as an Expression is appropriate. Here Expression is an array of numbers - */ +/*--- +info: > + 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=""; @@ -27,7 +29,3 @@ if (!( (__str.indexOf("2")!==-1)&&(__str.indexOf("1")!==-1)&&(__str.indexOf("4") } // ////////////////////////////////////////////////////////////////////////////// - - - - diff --git a/test/suite/ch12/12.6/12.6.4/S12.6.4_A3.js b/test/suite/ch12/12.6/12.6.4/S12.6.4_A3.js index 2b34c38c7..be542b8bf 100644 --- a/test/suite/ch12/12.6/12.6.4/S12.6.4_A3.js +++ b/test/suite/ch12/12.6/12.6.4/S12.6.4_A3.js @@ -1,12 +1,14 @@ // Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. -/** - * The production IterationStatement: "for (var VariableDeclarationNoIn in Expression) Statement" - * - * @path ch12/12.6/12.6.4/S12.6.4_A3.js - * @description Using an array as an Expression is appropriate. Here Expression is an array of numbers. Eval is used - */ +/*--- +info: > + 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=""; @@ -27,7 +29,3 @@ if (!( (__str.indexOf("2")!==-1)&&(__str.indexOf("1")!==-1)&&(__str.indexOf("4") } // ////////////////////////////////////////////////////////////////////////////// - - - - diff --git a/test/suite/ch12/12.6/12.6.4/S12.6.4_A4.1.js b/test/suite/ch12/12.6/12.6.4/S12.6.4_A4.1.js index a491b3f34..0fd3bb6de 100644 --- a/test/suite/ch12/12.6/12.6.4/S12.6.4_A4.1.js +++ b/test/suite/ch12/12.6/12.6.4/S12.6.4_A4.1.js @@ -1,12 +1,12 @@ // Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. -/** - * The production IterationStatement: "for (var VariableDeclarationNoIn in Expression) Statement" - * - * @path ch12/12.6/12.6.4/S12.6.4_A4.1.js - * @description Using Object as an Expression is appropriate. Eval is used - */ +/*--- +info: > + The production IterationStatement: "for (var VariableDeclarationNoIn in + Expression) Statement" +description: Using Object as an Expression is appropriate. Eval is used +---*/ __str=""; @@ -27,8 +27,3 @@ if (__str !== __evaluated) { } // ////////////////////////////////////////////////////////////////////////////// - - - - - diff --git a/test/suite/ch12/12.6/12.6.4/S12.6.4_A4.js b/test/suite/ch12/12.6/12.6.4/S12.6.4_A4.js index 79f496b8c..2b197dc13 100644 --- a/test/suite/ch12/12.6/12.6.4/S12.6.4_A4.js +++ b/test/suite/ch12/12.6/12.6.4/S12.6.4_A4.js @@ -1,12 +1,12 @@ // Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. -/** - * The production IterationStatement: "for (var VariableDeclarationNoIn in Expression) Statement" - * - * @path ch12/12.6/12.6.4/S12.6.4_A4.js - * @description Using Object as an Expression is appropriate. Eval is used - */ +/*--- +info: > + The production IterationStatement: "for (var VariableDeclarationNoIn in + Expression) Statement" +description: Using Object as an Expression is appropriate. Eval is used +---*/ __str=""; @@ -27,8 +27,3 @@ if (__str !== __evaluated) { } // ////////////////////////////////////////////////////////////////////////////// - - - - - diff --git a/test/suite/ch12/12.6/12.6.4/S12.6.4_A5.1.js b/test/suite/ch12/12.6/12.6.4/S12.6.4_A5.1.js index 37992e1dd..f38cf383f 100644 --- a/test/suite/ch12/12.6/12.6.4/S12.6.4_A5.1.js +++ b/test/suite/ch12/12.6/12.6.4/S12.6.4_A5.1.js @@ -1,12 +1,14 @@ // Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. -/** - * The production IterationStatement: "for (var VariableDeclarationNoIn in Expression) Statement" - * - * @path ch12/12.6/12.6.4/S12.6.4_A5.1.js - * @description Using hierarchical Object as an Expression is appropriate. The depth is two - */ +/*--- +info: > + 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}}; @@ -36,7 +38,3 @@ if(!( (__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/test/suite/ch12/12.6/12.6.4/S12.6.4_A5.js b/test/suite/ch12/12.6/12.6.4/S12.6.4_A5.js index 974659f10..65c7c71d5 100644 --- a/test/suite/ch12/12.6/12.6.4/S12.6.4_A5.js +++ b/test/suite/ch12/12.6/12.6.4/S12.6.4_A5.js @@ -1,12 +1,14 @@ // Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. -/** - * The production IterationStatement: "for (var VariableDeclarationNoIn in Expression) Statement" - * - * @path ch12/12.6/12.6.4/S12.6.4_A5.js - * @description Using hierarchical Object as an Expression is appropriate. The depth is two - */ +/*--- +info: > + 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}}; @@ -36,7 +38,3 @@ if(!( (__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/test/suite/ch12/12.6/12.6.4/S12.6.4_A6.1.js b/test/suite/ch12/12.6/12.6.4/S12.6.4_A6.1.js index 78cc2e842..69d0cdfbf 100644 --- a/test/suite/ch12/12.6/12.6.4/S12.6.4_A6.1.js +++ b/test/suite/ch12/12.6/12.6.4/S12.6.4_A6.1.js @@ -1,12 +1,14 @@ // Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. -/** - * The production IterationStatement: "for (var VariableDeclarationNoIn in Expression) Statement" - * - * @path ch12/12.6/12.6.4/S12.6.4_A6.1.js - * @description Using Object with custom prototype as an Expression is appropriate. The prototype is "{feat:2,hint:"protohint"}" - */ +/*--- +info: > + 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"}; @@ -35,4 +37,3 @@ if (__accum.indexOf("hintprotohint")!==-1) { } // ////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/ch12/12.6/12.6.4/S12.6.4_A6.js b/test/suite/ch12/12.6/12.6.4/S12.6.4_A6.js index 5a1f8d9c2..ffc7babfb 100644 --- a/test/suite/ch12/12.6/12.6.4/S12.6.4_A6.js +++ b/test/suite/ch12/12.6/12.6.4/S12.6.4_A6.js @@ -1,12 +1,14 @@ // Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. -/** - * The production IterationStatement: "for (var VariableDeclarationNoIn in Expression) Statement" - * - * @path ch12/12.6/12.6.4/S12.6.4_A6.js - * @description Using Object with custom prototype as an Expression is appropriate. The prototype is "{feat:2,hint:"protohint"}" - */ +/*--- +info: > + 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"}; @@ -35,4 +37,3 @@ if (__accum.indexOf("hintprotohint")!==-1) { } // ////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/ch12/12.6/12.6.4/S12.6.4_A7_T1.js b/test/suite/ch12/12.6/12.6.4/S12.6.4_A7_T1.js index 1105b7ff2..734c0168c 100644 --- a/test/suite/ch12/12.6/12.6.4/S12.6.4_A7_T1.js +++ b/test/suite/ch12/12.6/12.6.4/S12.6.4_A7_T1.js @@ -1,12 +1,14 @@ // Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. -/** - * Properties of the object being enumerated may be deleted during enumeration - * - * @path ch12/12.6/12.6.4/S12.6.4_A7_T1.js - * @description Checking "for (LeftHandSideExpression in Expression) Statement" case - */ +/*--- +info: > + 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}; @@ -46,4 +48,3 @@ function erasator_T_1000(hash_map, charactr){ }; } } - diff --git a/test/suite/ch12/12.6/12.6.4/S12.6.4_A7_T2.js b/test/suite/ch12/12.6/12.6.4/S12.6.4_A7_T2.js index 48be196ab..0d80694f3 100644 --- a/test/suite/ch12/12.6/12.6.4/S12.6.4_A7_T2.js +++ b/test/suite/ch12/12.6/12.6.4/S12.6.4_A7_T2.js @@ -1,12 +1,14 @@ // Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. -/** - * Properties of the object being enumerated may be deleted during enumeration - * - * @path ch12/12.6/12.6.4/S12.6.4_A7_T2.js - * @description Checking "for (var VariableDeclarationNoIn in Expression) Statement" case - */ +/*--- +info: > + 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}; @@ -46,4 +48,3 @@ function erasator_T_1000(hash_map, charactr){ }; } } - |