Debian Codegraph @

rhino/testsrc/tests/lc3/ConvertJSObject/ToByte-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 = 'ToByte-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 short";
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_010;
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 -128" );
32
33
34 new TestCase(
35 "TEST_CLASS.ambiguous( new String() ) +''",
36 "BYTE",
37 TEST_CLASS.ambiguous(new String()) +'' );
38
39 new TestCase(
40 "TEST_CLASS.ambiguous( new Boolean() ) +''",
41 "BYTE",
42 TEST_CLASS.ambiguous( new Boolean() )+'' );
43
44 new TestCase(
45 "TEST_CLASS.ambiguous( new Number() ) +''",
46 "BYTE",
47 TEST_CLASS.ambiguous( new Number() )+'' );
48
49 new TestCase(
50 "TEST_CLASS.ambiguous( new Date(99) ) +''",
51 "BYTE",
52 TEST_CLASS.ambiguous( new Date(99) )+'' );
53
54 new TestCase(
55 "TEST_CLASS.ambiguous( new MyObject(127) ) +''",
56 "BYTE",
57 TEST_CLASS.ambiguous( new MyObject(127) )+'' );
58
59 new TestCase(
60 "TEST_CLASS.ambiguous( MyFunction ) +''",
61 "BYTE",
62 TEST_CLASS.ambiguous( MyFunction )+'' );
63
64 test();
65
66