Debian Codegraph @

rhino/testsrc/tests/lc3/JSUndefined/undefined-010-n.js

raw symbols SCIP
1 /* -*- Mode: java; tab-width: 8 -*-
2 * Copyright (C) 1997, 1998 Netscape Communications Corporation,
3 * All Rights Reserved.
4 */
5 /* This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8
9 gTestfile = 'undefined-010-n.js';
10
11 /**
12 * JavaScript to Java type conversion.
13 *
14 * This test passes the JavaScript "undefined" value to several Java methods
15 * that expect arguments of various types, and verifies that the value is
16 * converted to the correct value and type.
17 *
18 * This tests instance methods, and not static methods.
19 *
20 * Running these tests successfully requires you to have
21 * com.netscape.javascript.qa.liveconnect.DataTypeClass on your classpath.
22 *
23 * Specification: Method Overloading Proposal for Liveconnect 3.0
24 *
25 * @author: [email protected]
26 *
27 */
28 var SECTION = "undefined conversion";
29 var VERSION = "1_4";
30 var TITLE = "LiveConnect 3.0 JavaScript to Java Data Type Conversion " +
31 SECTION;
32 startTest();
33
34 var dt = new DT();
35
36 var a = new Array();
37 var i = 0;
38
39
40 // passing undefined to a java method that expects a boolean be an error
41
42 DESCRIPTION = "dt.setBoolean( undefined )";
43 EXPECTED = "error";
44
45 a[i++] = new TestObject(
46 "dt.setBoolean( undefined )",
47 "dt.PUB_BOOLEAN",
48 "dt.getBoolean()",
49 "typeof dt.getBoolean()",
50 "error",
51 "error" );
52
53 for ( i = 0; i < a.length; i++ ) {
54 new TestCase(
55 a[i].description +"; "+ a[i].javaFieldName,
56 a[i].jsValue,
57 a[i].javaFieldValue );
58
59 new TestCase(
60 a[i].description +"; " + a[i].javaMethodName,
61 a[i].jsValue,
62 a[i].javaMethodValue );
63
64 new TestCase(
65 a[i].javaTypeName,
66 a[i].jsType,
67 a[i].javaTypeValue );
68 }
69
70 test();
71
72 function TestObject( description, javaField, javaMethod, javaType,
73 jsValue, jsType )
74 {
75 eval (description );
76
77 this.description = description;
78 this.javaFieldName = javaField;
79 this.javaFieldValue = eval( javaField );
80 this.javaMethodName = javaMethod;
81 this.javaMethodValue = eval( javaMethod );
82 this.javaTypeName = javaType,
83 this.javaTypeValue = eval( javaType );
84
85 this.jsValue = jsValue;
86 this.jsType = jsType;
87 }