]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma_2/Exceptions/expression-003.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / mozilla / ecma_2 / Exceptions / expression-003.js
1 /**
2 File Name: expressions-003.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-003.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 // try to access properties of primitive types
23
24 OBJECT = new Property( "undefined", void 0, "undefined", NaN );
25
26 var result = "Failed";
27 var exception = "No exception thrown";
28 var expect = "Passed";
29
30 try {
31 result = OBJECT.value.toString();
32 } catch ( e ) {
33 result = expect;
34 exception = e.toString();
35 }
36
37
38 testcases[tc++] = new TestCase(
39 SECTION,
40 "Get the toString value of an object whose value is undefined "+
41 "(threw " + exception +")",
42 expect,
43 result );
44
45 test();
46
47 function Property( object, value, string, number ) {
48 this.object = object;
49 this.string = String(value);
50 this.number = Number(value);
51 this.value = value;
52 }