Debian Codegraph @

rhino/testsrc/tests/lc3/ConvertJSObject/ToLong-001.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 = 'ToLong-001.js';
7
8 /**
9 * Preferred Argument Conversion.
10 *
11 * Passing a JavaScript boolean to a Java method should prefer to call
12 * a Java method of the same name that expects a Java boolean.
13 *
14 */
15 var SECTION = "Preferred argument conversion: JavaScript Object to Long";
16 var VERSION = "1_4";
17 var TITLE = "LiveConnect 3.0 JavaScript to Java Data Type Conversion " +
18 SECTION;
19 startTest();
20
21 var TEST_CLASS = new Packages.com.netscape.javascript.qa.lc3.jsobject.JSObject_006;
22
23 function MyObject( value ) {
24 this.value = value;
25 this.valueOf = new Function( "return this.value" );
26 }
27
28 function MyFunction() {
29 return;
30 }
31 MyFunction.valueOf = new Function( "return 6060842" );
32
33 new TestCase(
34 "TEST_CLASS.ambiguous( new String() ) +''",
35 "LONG",
36 TEST_CLASS.ambiguous(new String()) +'' );
37
38 new TestCase(
39 "TEST_CLASS.ambiguous( new Boolean() ) +''",
40 "LONG",
41 TEST_CLASS.ambiguous( new Boolean() )+'' );
42
43 new TestCase(
44 "TEST_CLASS.ambiguous( new Number() ) +''",
45 "LONG",
46 TEST_CLASS.ambiguous( new Number() )+'' );
47
48 new TestCase(
49 "TEST_CLASS.ambiguous( new Date(0) ) +''",
50 "LONG",
51 TEST_CLASS.ambiguous( new Date(0) )+'' );
52
53 new TestCase(
54 "TEST_CLASS.ambiguous( new MyObject(999) ) +''",
55 "LONG",
56 TEST_CLASS.ambiguous( new MyObject(999) )+'' );
57
58 new TestCase(
59 "TEST_CLASS.ambiguous( MyFunction ) +''",
60 "LONG",
61 TEST_CLASS.ambiguous( MyFunction )+'' );
62
63 test();
64
65