Debian Codegraph @

js/src/tests/test262/built-ins/String/S15.5.2.1_A2_T2.js

raw
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 The [[Prototype]] property of the newly constructed object is set to the
7 original String prototype object
8 es5id: 15.5.2.1_A2_T2
9 description: >
10 Creating string object with "new String(string)" adding custom
11 property
12 ---*/
13
14 var __str__obj = new String("shocking blue");
15
16 //////////////////////////////////////////////////////////////////////////////
17 //CHECK#1
18 if (__str__obj["__custom__prop"] !== undefined) {
19 throw new Test262Error('#1: var __str__obj = new String("shocking blue"); __str__obj["__custom__prop"]===undefined. Actual: __str__obj["__custom__prop"]===' + __str__obj["__custom__prop"]);
20 }
21 //
22 //////////////////////////////////////////////////////////////////////////////
23
24 String.prototype.__custom__prop = "bor";
25
26 //////////////////////////////////////////////////////////////////////////////
27 //CHECK#2
28 if (__str__obj["__custom__prop"] !== "bor") {
29 throw new Test262Error('#2: var __str__obj = new String("shocking blue"); String.prototype.__custom__prop = "bor"; __str__obj["__custom__prop"]==="bor". Actual: __str__obj["__custom__prop"]===' + __str__obj["__custom__prop"]);
30 }
31 //
32 //////////////////////////////////////////////////////////////////////////////
33
34 reportCompare(0, 0);