initial import
[vuplus_webkit] / Source / JavaScriptCore / tests / mozilla / ecma_2 / Exceptions / exception-004.js
1 /**
2  *  File Name:          exception-004
3  *  ECMA Section:
4  *  Description:        Tests for JavaScript Standard Exceptions
5  *
6  *  ToObject error.
7  *
8  *  Author:             christine@netscape.com
9  *  Date:               31 August 1998
10  */
11     var SECTION = "exception-004";
12     var VERSION = "js1_4";
13     var TITLE   = "Tests for JavaScript Standard Exceptions: ToObjectError";
14
15     startTest();
16     writeHeaderToLog( SECTION + " "+ TITLE);
17
18     var tc = 0;
19     var testcases = new Array();
20
21     ToObject_1();
22
23     test();
24
25     function ToObject_1() {
26         result = "failed: no exception thrown";
27         exception = null;
28
29         try {
30            result = foo["bar"];
31         } catch ( e ) {
32             result = "passed:  threw exception",
33             exception = e.toString();
34         } finally {
35             testcases[tc++] = new TestCase(
36                 SECTION,
37                 "foo[\"bar\"] [ exception is " + exception +" ]",
38                 "passed:  threw exception",
39                 result );
40         }
41     }
42