Debian Codegraph @

rhino/testsrc/tests/ecma_2/Exceptions/expression-002.js

raw symbols SCIP
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 gTestfile = 'expression-002.js';
7
8 /**
9 File Name: expressions-002.js
10 Corresponds to: ecma/Expressions/11.2.1-3-n.js
11 ECMA Section: 11.2.1 Property Accessors
12 Description:
13
14 Try to access properties of an object whose value is undefined.
15
16 Author: [email protected]
17 Date: 09 september 1998
18 */
19 var SECTION = "expressions-002.js";
20 var VERSION = "JS1_4";
21 var TITLE = "Property Accessors";
22 writeHeaderToLog( SECTION + " "+TITLE );
23
24 startTest();
25
26 // go through all Native Function objects, methods, and properties and get their typeof.
27
28 var PROPERTY = new Array();
29 var p = 0;
30
31 // try to access properties of primitive types
32
33 OBJECT = new Property( "undefined", void 0, "undefined", NaN );
34
35 var result = "Failed";
36 var exception = "No exception thrown";
37 var expect = "Passed";
38
39 try {
40 result = OBJECT.value.valueOf();
41 } catch ( e ) {
42 result = expect;
43 exception = e.toString();
44 }
45
46
47 new TestCase(
48 SECTION,
49 "Get the value of an object whose value is undefined "+
50 "(threw " + exception +")",
51 expect,
52 result );
53
54 test();
55
56 function Property( object, value, string, number ) {
57 this.object = object;
58 this.string = String(value);
59 this.number = Number(value);
60 this.valueOf = value;
61 }