Debian Codegraph @

rhino/testsrc/tests/ecma_2/Exceptions/exception-003.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 = 'exception-003.js';
7
8 /**
9 * File Name: exception-003
10 * ECMA Section:
11 * Description: Tests for JavaScript Standard Exceptions
12 *
13 * Target error.
14 *
15 * Author: [email protected]
16 * Date: 31 August 1998
17 */
18 var SECTION = "exception-003";
19 var VERSION = "js1_4";
20 var TITLE = "Tests for JavaScript Standard Exceptions: TargetError";
21
22 startTest();
23 writeHeaderToLog( SECTION + " "+ TITLE);
24
25 Target_1();
26
27 test();
28
29 function Target_1() {
30 result = "failed: no exception thrown";
31 exception = null;
32
33 try {
34 string = new String("hi");
35 string.toString = Boolean.prototype.toString;
36 string.toString();
37 } catch ( e ) {
38 result = "passed: threw exception",
39 exception = e.toString();
40 } finally {
41 new TestCase(
42 SECTION,
43 "string = new String(\"hi\");"+
44 "string.toString = Boolean.prototype.toString" +
45 "string.toString() [ exception is " + exception +" ]",
46 "passed: threw exception",
47 result );
48 }
49 }
50