Debian Codegraph @

rhino/testsrc/tests/ecma_2/Exceptions/exception-007.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-007.js';
7
8 /**
9 * File Name: exception-007
10 * ECMA Section:
11 * Description: Tests for JavaScript Standard Exceptions
12 *
13 * DefaultValue error.
14 *
15 * Author: [email protected]
16 * Date: 31 August 1998
17 */
18 var SECTION = "exception-007";
19 var VERSION = "js1_4";
20 var TITLE = "Tests for JavaScript Standard Exceptions: TypeError";
21 var BUGNUMBER="318250";
22
23 startTest();
24 writeHeaderToLog( SECTION + " "+ TITLE);
25
26 DefaultValue_1();
27
28 test();
29
30
31 /**
32 * Getting the [[DefaultValue]] of any instances of MyObject
33 * should result in a runtime error in ToPrimitive.
34 */
35
36 function MyObject() {
37 this.toString = void 0;
38 this.valueOf = new Object();
39 }
40
41 function DefaultValue_1() {
42 result = "failed: no exception thrown";
43 exception = null;
44
45 try {
46 result = new MyObject() + new MyObject();
47 } catch ( e ) {
48 result = "passed: threw exception",
49 exception = e.toString();
50 } finally {
51 new TestCase(
52 SECTION,
53 "new MyObject() + new MyObject() [ exception is " + exception +" ]",
54 "passed: threw exception",
55 result );
56 }
57 }
58