S8.12.6_A2_T2.js (1819B)
1 // Copyright 2009 the Sputnik authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 info: | 6 When the [[HasProperty]] method of O is called with property name P and if O has not a property with name P 7 then If the [[Prototype]] of O is null, return false or call the [[HasProperty]] method of [[Prototype]] with property name P 8 es5id: 8.12.6_A2_T2 9 description: > 10 Try find not existent property of any Object, but existent 11 property of this Object prototype 12 ---*/ 13 14 var __proto={phylum:"avis"}; 15 16 17 ////////////////////////////////////////////////////////////////////////////// 18 //CHECK#1 19 if (!("valueOf" in __proto)) { 20 throw new Test262Error('#1: var __proto={phylum:"avis"}; "valueOf" in __proto'); 21 } 22 // 23 ////////////////////////////////////////////////////////////////////////////// 24 25 function Robin(){this.name="robin"}; 26 Robin.prototype=__proto; 27 28 var __my__robin = new Robin; 29 30 ////////////////////////////////////////////////////////////////////////////// 31 //CHECK#2 32 if (!("phylum" in __my__robin)) { 33 throw new Test262Error('#2: var __proto={phylum:"avis"}; function Robin(){this.name="robin"}; Robin.prototype=__proto; var __my__robin = new Robin; "phylum" in __my__robin'); 34 } 35 // 36 ////////////////////////////////////////////////////////////////////////////// 37 38 ////////////////////////////////////////////////////////////////////////////// 39 //CHECK#3 40 if (__my__robin.hasOwnProperty("phylum")) { 41 throw new Test262Error('#3: var __proto={phylum:"avis"}; function Robin(){this.name="robin"}; Robin.prototype=__proto; var __my__robin = new Robin; __my__robin.hasOwnProperty("phylum") === false. Actual: ' + (__my__robin.hasOwnProperty("phylum"))); 42 } 43 // 44 ////////////////////////////////////////////////////////////////////////////// 45 46 reportCompare(0, 0);