]>
Commit | Line | Data |
---|---|---|
b37bf2e1 A |
1 | /** |
2 | File Name: expressions-002.js | |
3 | Corresponds to: ecma/Expressions/11.2.1-3-n.js | |
4 | ECMA Section: 11.2.1 Property Accessors | |
5 | Description: | |
6 | ||
7 | Try to access properties of an object whose value is undefined. | |
8 | ||
9 | Author: christine@netscape.com | |
10 | Date: 09 september 1998 | |
11 | */ | |
12 | var SECTION = "expressions-002.js"; | |
13 | var VERSION = "JS1_4"; | |
14 | var TITLE = "Property Accessors"; | |
15 | writeHeaderToLog( SECTION + " "+TITLE ); | |
16 | ||
17 | startTest(); | |
18 | ||
19 | var tc = 0; | |
20 | var testcases = new Array(); | |
21 | ||
22 | // go through all Native Function objects, methods, and properties and get their typeof. | |
23 | ||
24 | var PROPERTY = new Array(); | |
25 | var p = 0; | |
26 | ||
27 | // try to access properties of primitive types | |
28 | ||
29 | OBJECT = new Property( "undefined", void 0, "undefined", NaN ); | |
30 | ||
31 | var result = "Failed"; | |
32 | var exception = "No exception thrown"; | |
33 | var expect = "Passed"; | |
34 | ||
35 | try { | |
36 | result = OBJECT.value.valueOf(); | |
37 | } catch ( e ) { | |
38 | result = expect; | |
39 | exception = e.toString(); | |
40 | } | |
41 | ||
42 | ||
43 | testcases[tc++] = new TestCase( | |
44 | SECTION, | |
45 | "Get the value of an object whose value is undefined "+ | |
46 | "(threw " + exception +")", | |
47 | expect, | |
48 | result ); | |
49 | ||
50 | test(); | |
51 | ||
52 | function Property( object, value, string, number ) { | |
53 | this.object = object; | |
54 | this.string = String(value); | |
55 | this.number = Number(value); | |
56 | this.valueOf = value; | |
57 | } |