S8.12.7_A2_T2.js (1804B)
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 [[Delete]] method of O is called with property name P, 7 and if O doesn't have a property with name P, return true 8 esid: sec-delete-operator-runtime-semantics-evaluation 9 description: > 10 Try to delete not existent properties of O, but existent property 11 of prototype 12 ---*/ 13 14 function Palette() {} 15 Palette.prototype = { 16 red: 0xff0000, 17 green: 0x00ff00, 18 }; 19 var __palette = new Palette(); 20 21 ////////////////////////////////////////////////////////////////////////////// 22 //CHECK#1 23 if (__palette.red !== 0xff0000) { 24 throw new Test262Error( 25 '#1: function Palette(){}; Palette.prototype = {red:0xFF0000, green:0x00FF00}; __palette = new Palette; __palette.red === 0xFF0000. Actual: ' + 26 __palette.red 27 ); 28 } 29 // 30 ////////////////////////////////////////////////////////////////////////////// 31 32 ////////////////////////////////////////////////////////////////////////////// 33 //CHECK#2 34 if (delete __palette.red !== true) { 35 throw new Test262Error( 36 '#2 function Palette(){}; Palette.prototype = {red:0xFF0000, green:0x00FF00}; __palette = new Palette; delete __palette.red === true. Actual: ' + 37 delete __palette.red 38 ); 39 } 40 // 41 ////////////////////////////////////////////////////////////////////////////// 42 43 ////////////////////////////////////////////////////////////////////////////// 44 //CHECK#3 45 if (__palette.red !== 0xff0000) { 46 throw new Test262Error( 47 '#3: function Palette(){}; Palette.prototype = {red:0xFF0000, green:0x00FF00}; __palette = new Palette; __palette.red === 0xFF0000. Actual: ' + 48 __palette.red 49 ); 50 } 51 // 52 ////////////////////////////////////////////////////////////////////////////// 53 54 reportCompare(0, 0);