adding more javascript language tests to the repository.

git-svn-id: svn://10.0.0.236/trunk@32723 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
cbegle%netscape.com
1999-05-26 21:37:13 +00:00
parent bfc1a2bd1b
commit 1bf49d671c
190 changed files with 20400 additions and 0 deletions

View File

@@ -0,0 +1,84 @@
/* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Mozilla Communicator client code, released March
* 31, 1998.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*
*/
/**
* Preferred Argument Conversion.
*
* Passing a JavaScript boolean to a Java method should prefer to call
* a Java method of the same name that expects a Java boolean.
*
*/
var SECTION = "Preferred argument conversion: boolean";
var VERSION = "1_4";
var TITLE = "LiveConnect 3.0 JavaScript to Java Data Type Conversion " +
SECTION;
startTest();
var TEST_CLASS = new Packages.com.netscape.javascript.qa.lc3.jsobject.JSObject_004;
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new String() ) +''",
"DOUBLE",
TEST_CLASS.ambiguous(new String()) +'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Boolean() ) +''",
"DOUBLE",
TEST_CLASS.ambiguous( new Boolean() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Number() ) +''",
"DOUBLE",
TEST_CLASS.ambiguous( new Number() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Date() ) +''",
"DOUBLE",
TEST_CLASS.ambiguous( new Date() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Function() ) +''",
"DOUBLE",
TEST_CLASS.ambiguous( new Function() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Array() ) +''",
"DOUBLE",
TEST_CLASS.ambiguous( new Array() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( this ) +''",
"DOUBLE",
TEST_CLASS.ambiguous( this )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new RegExp() ) +''",
"DOUBLE",
TEST_CLASS.ambiguous( new RegExp() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( Math ) +''",
"DOUBLE",
TEST_CLASS.ambiguous( Math )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Object() ) +''",
"DOUBLE",
TEST_CLASS.ambiguous( new Object() )+'' );
test();

View File

@@ -0,0 +1,82 @@
/* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Mozilla Communicator client code, released March
* 31, 1998.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*
*/
/**
* Preferred Argument Conversion.
*
* Passing a JavaScript boolean to a Java method should prefer to call
* a Java method of the same name that expects a Java boolean.
*
*/
var SECTION = "Preferred argument conversion: JavaScript Object to short";
var VERSION = "1_4";
var TITLE = "LiveConnect 3.0 JavaScript to Java Data Type Conversion " +
SECTION;
startTest();
var TEST_CLASS = new Packages.com.netscape.javascript.qa.lc3.jsobject.JSObject_010;
function MyObject( value ) {
this.value = value;
this.valueOf = new Function( "return this.value" );
}
function MyFunction() {
return;
}
MyFunction.valueOf = new Function( "return -128" );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new String() ) +''",
"BYTE",
TEST_CLASS.ambiguous(new String()) +'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Boolean() ) +''",
"BYTE",
TEST_CLASS.ambiguous( new Boolean() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Number() ) +''",
"BYTE",
TEST_CLASS.ambiguous( new Number() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Date(99) ) +''",
"BYTE",
TEST_CLASS.ambiguous( new Date(99) )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Array() ) +''",
"BYTE",
TEST_CLASS.ambiguous( new Array() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new MyObject(127) ) +''",
"BYTE",
TEST_CLASS.ambiguous( new MyObject(127) )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( MyFunction ) +''",
"BYTE",
TEST_CLASS.ambiguous( MyFunction )+'' );
test();

View File

@@ -0,0 +1,98 @@
/* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Mozilla Communicator client code, released March
* 31, 1998.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*
*/
/**
* Preferred Argument Conversion.
*
* Passing a JavaScript boolean to a Java method should prefer to call
* a Java method of the same name that expects a Java boolean.
*
*/
var SECTION = "Preferred argument conversion: JavaScript Object to int";
var VERSION = "1_4";
var TITLE = "LiveConnect 3.0 JavaScript to Java Data Type Conversion " +
SECTION;
startTest();
var TEST_CLASS = new Packages.com.netscape.javascript.qa.lc3.jsobject.JSObject_010;
function MyFunction() {
return "hello";
}
MyFunction.valueOf = new Function( "return 99" );
function MyOtherFunction() {
return "goodbye";
}
MyOtherFunction.valueOf = null;
MyOtherFunction.toString = new Function( "return 99" );
function MyObject(value) {
this.value = value;
this.valueOf = new Function("return this.value");
}
function MyOtherObject(stringValue) {
this.stringValue = String( stringValue );
this.toString = new Function( "return this.stringValue" );
this.valueOf = null;
}
function AnotherObject( value ) {
this.value = value;
this.valueOf = new Function( "return this.value" );
this.toString = new Function( "return 666" );
}
// should pass MyFunction.valueOf() to ambiguous
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( MyFunction ) +''",
"BYTE",
TEST_CLASS.ambiguous( MyFunction )+'' );
// should pass MyOtherFunction.toString() to ambiguous
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( MyOtherFunction ) +''",
"BYTE",
TEST_CLASS.ambiguous( MyOtherFunction )+'' );
// should pass MyObject.valueOf() to ambiguous
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new MyObject(123) ) +''",
"BYTE",
TEST_CLASS.ambiguous( new MyObject(123) )+'' );
// should pass MyOtherObject.toString() to ambiguous
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new MyOtherObject(\"123\") ) +''",
"BYTE",
TEST_CLASS.ambiguous( new MyOtherObject("123") )+'' );
// should pass AnotherObject.valueOf() to ambiguous
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new AnotherObject(\"123\") ) +''",
"BYTE",
TEST_CLASS.ambiguous( new AnotherObject("123") )+'' );
test();

View File

@@ -0,0 +1,61 @@
/* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Mozilla Communicator client code, released March
* 31, 1998.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*
*/
/**
* Preferred Argument Conversion.
*
* Passing a JavaScript boolean to a Java method should prefer to call
* a Java method of the same name that expects a Java boolean.
*
*/
var SECTION = "Preferred argument conversion: JavaScript Object to short";
var VERSION = "1_4";
var TITLE = "LiveConnect 3.0 JavaScript to Java Data Type Conversion " +
SECTION;
startTest();
var TEST_CLASS = new Packages.com.netscape.javascript.qa.lc3.jsobject.JSObject_009;
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new String() ) +''",
"CHAR",
TEST_CLASS.ambiguous(new String()) +'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Boolean() ) +''",
"CHAR",
TEST_CLASS.ambiguous( new Boolean() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Number() ) +''",
"CHAR",
TEST_CLASS.ambiguous( new Number() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Date(999) ) +''",
"CHAR",
TEST_CLASS.ambiguous( new Date(999) )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Array() ) +''",
"CHAR",
TEST_CLASS.ambiguous( new Array() )+'' );
test();

View File

@@ -0,0 +1,98 @@
/* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Mozilla Communicator client code, released March
* 31, 1998.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*
*/
/**
* Preferred Argument Conversion.
*
* Passing a JavaScript boolean to a Java method should prefer to call
* a Java method of the same name that expects a Java boolean.
*
*/
var SECTION = "Preferred argument conversion: JavaScript Object to int";
var VERSION = "1_4";
var TITLE = "LiveConnect 3.0 JavaScript to Java Data Type Conversion " +
SECTION;
startTest();
var TEST_CLASS = new Packages.com.netscape.javascript.qa.lc3.jsobject.JSObject_009;
function MyFunction() {
return "hello";
}
MyFunction.valueOf = new Function( "return 999" );
function MyOtherFunction() {
return "goodbye";
}
MyOtherFunction.valueOf = null;
MyOtherFunction.toString = new Function( "return 999" );
function MyObject(value) {
this.value = value;
this.valueOf = new Function("return this.value");
}
function MyOtherObject(stringValue) {
this.stringValue = String( stringValue );
this.toString = new Function( "return this.stringValue" );
this.valueOf = null;
}
function AnotherObject( value ) {
this.value = value;
this.valueOf = new Function( "return this.value" );
this.toString = new Function( "return 666" );
}
// should pass MyFunction.valueOf() to ambiguous
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( MyFunction ) +''",
"CHAR",
TEST_CLASS.ambiguous( MyFunction )+'' );
// should pass MyOtherFunction.toString() to ambiguous
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( MyOtherFunction ) +''",
"CHAR",
TEST_CLASS.ambiguous( MyOtherFunction )+'' );
// should pass MyObject.valueOf() to ambiguous
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new MyObject(12345) ) +''",
"CHAR",
TEST_CLASS.ambiguous( new MyObject(12345) )+'' );
// should pass MyOtherObject.toString() to ambiguous
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new MyOtherObject(\"12345\") ) +''",
"CHAR",
TEST_CLASS.ambiguous( new MyOtherObject("12345") )+'' );
// should pass AnotherObject.valueOf() to ambiguous
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new AnotherObject(\"12345\") ) +''",
"CHAR",
TEST_CLASS.ambiguous( new AnotherObject("12345") )+'' );
test();

View File

@@ -0,0 +1,84 @@
/* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Mozilla Communicator client code, released March
* 31, 1998.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*
*/
/**
* Preferred Argument Conversion.
*
* Passing a JavaScript boolean to a Java method should prefer to call
* a Java method of the same name that expects a Java boolean.
*
*/
var SECTION = "Preferred argument conversion: JavaScript object to double";
var VERSION = "1_4";
var TITLE = "LiveConnect 3.0 JavaScript to Java Data Type Conversion " +
SECTION;
startTest();
var TEST_CLASS = new Packages.com.netscape.javascript.qa.lc3.jsobject.JSObject_004;
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new String() ) +''",
"DOUBLE",
TEST_CLASS.ambiguous(new String()) +'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Boolean() ) +''",
"DOUBLE",
TEST_CLASS.ambiguous( new Boolean() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Number() ) +''",
"DOUBLE",
TEST_CLASS.ambiguous( new Number() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Date() ) +''",
"DOUBLE",
TEST_CLASS.ambiguous( new Date() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Function() ) +''",
"DOUBLE",
TEST_CLASS.ambiguous( new Function() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Array() ) +''",
"DOUBLE",
TEST_CLASS.ambiguous( new Array() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( this ) +''",
"DOUBLE",
TEST_CLASS.ambiguous( this )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new RegExp() ) +''",
"DOUBLE",
TEST_CLASS.ambiguous( new RegExp() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( Math ) +''",
"DOUBLE",
TEST_CLASS.ambiguous( Math )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Object() ) +''",
"DOUBLE",
TEST_CLASS.ambiguous( new Object() )+'' );
test();

View File

@@ -0,0 +1,84 @@
/* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Mozilla Communicator client code, released March
* 31, 1998.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*
*/
/**
* Preferred Argument Conversion.
*
* Passing a JavaScript boolean to a Java method should prefer to call
* a Java method of the same name that expects a Java boolean.
*
*/
var SECTION = "Preferred argument conversion: boolean";
var VERSION = "1_4";
var TITLE = "LiveConnect 3.0 JavaScript to Java Data Type Conversion " +
SECTION;
startTest();
var TEST_CLASS = new Packages.com.netscape.javascript.qa.lc3.jsobject.JSObject_005;
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new String() ) +''",
"FLOAT",
TEST_CLASS.ambiguous(new String()) +'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Boolean() ) +''",
"FLOAT",
TEST_CLASS.ambiguous( new Boolean() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Number() ) +''",
"FLOAT",
TEST_CLASS.ambiguous( new Number() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Date() ) +''",
"FLOAT",
TEST_CLASS.ambiguous( new Date() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Function() ) +''",
"FLOAT",
TEST_CLASS.ambiguous( new Function() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Array() ) +''",
"FLOAT",
TEST_CLASS.ambiguous( new Array() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( this ) +''",
"FLOAT",
TEST_CLASS.ambiguous( this )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new RegExp() ) +''",
"FLOAT",
TEST_CLASS.ambiguous( new RegExp() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( Math ) +''",
"FLOAT",
TEST_CLASS.ambiguous( Math )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Object() ) +''",
"FLOAT",
TEST_CLASS.ambiguous( new Object() )+'' );
test();

View File

@@ -0,0 +1,61 @@
/* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Mozilla Communicator client code, released March
* 31, 1998.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*
*/
/**
* Preferred Argument Conversion.
*
* Passing a JavaScript boolean to a Java method should prefer to call
* a Java method of the same name that expects a Java boolean.
*
*/
var SECTION = "Preferred argument conversion: JavaScript Object to int";
var VERSION = "1_4";
var TITLE = "LiveConnect 3.0 JavaScript to Java Data Type Conversion " +
SECTION;
startTest();
var TEST_CLASS = new Packages.com.netscape.javascript.qa.lc3.jsobject.JSObject_007;
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new String() ) +''",
"INT",
TEST_CLASS.ambiguous(new String()) +'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Boolean() ) +''",
"INT",
TEST_CLASS.ambiguous( new Boolean() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Number() ) +''",
"INT",
TEST_CLASS.ambiguous( new Number() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Date(0) ) +''",
"INT",
TEST_CLASS.ambiguous( new Date(0) )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Array() ) +''",
"INT",
TEST_CLASS.ambiguous( new Array() )+'' );
test();

View File

@@ -0,0 +1,98 @@
/* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Mozilla Communicator client code, released March
* 31, 1998.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*
*/
/**
* Preferred Argument Conversion.
*
* Passing a JavaScript boolean to a Java method should prefer to call
* a Java method of the same name that expects a Java boolean.
*
*/
var SECTION = "Preferred argument conversion: JavaScript Object to int";
var VERSION = "1_4";
var TITLE = "LiveConnect 3.0 JavaScript to Java Data Type Conversion " +
SECTION;
startTest();
var TEST_CLASS = new Packages.com.netscape.javascript.qa.lc3.jsobject.JSObject_007;
function MyFunction() {
return "hello";
}
MyFunction.valueOf = new Function( "return 999" );
function MyOtherFunction() {
return "goodbye";
}
MyOtherFunction.valueOf = null;
MyOtherFunction.toString = new Function( "return 999" );
function MyObject(value) {
this.value = value;
this.valueOf = new Function("return this.value");
}
function MyOtherObject(stringValue) {
this.stringValue = String( stringValue );
this.toString = new Function( "return this.stringValue" );
this.valueOf = null;
}
function AnotherObject( value ) {
this.value = value;
this.valueOf = new Function( "return this.value" );
this.toString = new Function( "return 666" );
}
// should pass MyFunction.valueOf() to ambiguous
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( MyFunction ) +''",
"INT",
TEST_CLASS.ambiguous( MyFunction )+'' );
// should pass MyOtherFunction.toString() to ambiguous
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( MyOtherFunction ) +''",
"INT",
TEST_CLASS.ambiguous( MyOtherFunction )+'' );
// should pass MyObject.valueOf() to ambiguous
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new MyObject(12345) ) +''",
"INT",
TEST_CLASS.ambiguous( new MyObject(12345) )+'' );
// should pass MyOtherObject.toString() to ambiguous
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new MyOtherObject(\"12345\") ) +''",
"INT",
TEST_CLASS.ambiguous( new MyOtherObject("12345") )+'' );
// should pass AnotherObject.valueOf() to ambiguous
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new AnotherObject(\"12345\") ) +''",
"INT",
TEST_CLASS.ambiguous( new AnotherObject("12345") )+'' );
test();

View File

@@ -0,0 +1,85 @@
/* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Mozilla Communicator client code, released March
* 31, 1998.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*
*/
/**
* Preferred Argument Conversion.
*
* Passing a JavaScript boolean to a Java method should prefer to call
* a Java method of the same name that expects a Java boolean.
*
*/
var SECTION = "Preferred argument conversion: boolean";
var VERSION = "1_4";
var TITLE = "LiveConnect 3.0 JavaScript to Java Data Type Conversion " +
SECTION;
startTest();
var TEST_CLASS = new
Packages.com.netscape.javascript.qa.lc3.jsobject.JSObject_001;
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new String() ) +''",
"JSOBJECT",
TEST_CLASS.ambiguous(new String()) +'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Boolean() ) +''",
"JSOBJECT",
TEST_CLASS.ambiguous( new Boolean() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Number() ) +''",
"JSOBJECT",
TEST_CLASS.ambiguous( new Number() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Date() ) +''",
"JSOBJECT",
TEST_CLASS.ambiguous( new Date() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Function() ) +''",
"JSOBJECT",
TEST_CLASS.ambiguous( new Function() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Array() ) +''",
"JSOBJECT",
TEST_CLASS.ambiguous( new Array() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( this ) +''",
"JSOBJECT",
TEST_CLASS.ambiguous( this )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new RegExp() ) +''",
"JSOBJECT",
TEST_CLASS.ambiguous( new RegExp() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( Math ) +''",
"JSOBJECT",
TEST_CLASS.ambiguous( Math )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Object() ) +''",
"JSOBJECT",
TEST_CLASS.ambiguous( new Object() )+'' );
test();

View File

@@ -0,0 +1,81 @@
/* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Mozilla Communicator client code, released March
* 31, 1998.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*
*/
/**
* Preferred Argument Conversion.
*
* Passing a JavaScript boolean to a Java method should prefer to call
* a Java method of the same name that expects a Java boolean.
*
*/
var SECTION = "Preferred argument conversion: JavaScript Object to Long";
var VERSION = "1_4";
var TITLE = "LiveConnect 3.0 JavaScript to Java Data Type Conversion " +
SECTION;
startTest();
var TEST_CLASS = new Packages.com.netscape.javascript.qa.lc3.jsobject.JSObject_006;
function MyObject( value ) {
this.value = value;
this.valueOf = new Function( "return this.value" );
}
function MyFunction() {
return;
}
MyFunction.valueOf = new Function( "return 6060842" );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new String() ) +''",
"LONG",
TEST_CLASS.ambiguous(new String()) +'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Boolean() ) +''",
"LONG",
TEST_CLASS.ambiguous( new Boolean() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Number() ) +''",
"LONG",
TEST_CLASS.ambiguous( new Number() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Date(0) ) +''",
"LONG",
TEST_CLASS.ambiguous( new Date(0) )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Array() ) +''",
"LONG",
TEST_CLASS.ambiguous( new Array() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new MyObject(999) ) +''",
"LONG",
TEST_CLASS.ambiguous( new MyObject(999) )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( MyFunction ) +''",
"LONG",
TEST_CLASS.ambiguous( MyFunction )+'' );
test();

View File

@@ -0,0 +1,98 @@
/* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Mozilla Communicator client code, released March
* 31, 1998.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*
*/
/**
* Preferred Argument Conversion.
*
* Passing a JavaScript boolean to a Java method should prefer to call
* a Java method of the same name that expects a Java boolean.
*
*/
var SECTION = "Preferred argument conversion: JavaScript Object to Long";
var VERSION = "1_4";
var TITLE = "LiveConnect 3.0 JavaScript to Java Data Type Conversion " +
SECTION;
startTest();
var TEST_CLASS = new Packages.com.netscape.javascript.qa.lc3.jsobject.JSObject_006;
function MyFunction() {
return "hello";
}
MyFunction.valueOf = new Function( "return 999" );
function MyOtherFunction() {
return "goodbye";
}
MyOtherFunction.valueOf = null;
MyOtherFunction.toString = new Function( "return 999" );
function MyObject(value) {
this.value = value;
this.valueOf = new Function("return this.value");
}
function MyOtherObject(stringValue) {
this.stringValue = String( stringValue );
this.toString = new Function( "return this.stringValue" );
this.valueOf = null;
}
function AnotherObject( value ) {
this.value = value;
this.valueOf = new Function( "return this.value" );
this.toString = new Function( "return 666" );
}
// should pass MyFunction.valueOf() to ambiguous
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( MyFunction ) +''",
"LONG",
TEST_CLASS.ambiguous( MyFunction )+'' );
// should pass MyOtherFunction.toString() to ambiguous
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( MyOtherFunction ) +''",
"LONG",
TEST_CLASS.ambiguous( MyOtherFunction )+'' );
// should pass MyObject.valueOf() to ambiguous
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new MyObject(12345) ) +''",
"LONG",
TEST_CLASS.ambiguous( new MyObject(12345) )+'' );
// should pass MyOtherObject.toString() to ambiguous
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new MyOtherObject(\"12345\") ) +''",
"LONG",
TEST_CLASS.ambiguous( new MyOtherObject("12345") )+'' );
// should pass AnotherObject.valueOf() to ambiguous
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new AnotherObject(\"12345\") ) +''",
"LONG",
TEST_CLASS.ambiguous( new AnotherObject("12345") )+'' );
test();

View File

@@ -0,0 +1,84 @@
/* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Mozilla Communicator client code, released March
* 31, 1998.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*
*/
/**
* Preferred Argument Conversion.
*
* Passing a JavaScript boolean to a Java method should prefer to call
* a Java method of the same name that expects a Java boolean.
*
*/
var SECTION = "Preferred argument conversion: boolean";
var VERSION = "1_4";
var TITLE = "LiveConnect 3.0 JavaScript to Java Data Type Conversion " +
SECTION;
startTest();
var TEST_CLASS = new Packages.com.netscape.javascript.qa.lc3.jsobject.JSObject_002;
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new String() ) +''",
"OBJECT",
TEST_CLASS.ambiguous(new String()) +'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Boolean() ) +''",
"OBJECT",
TEST_CLASS.ambiguous( new Boolean() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Number() ) +''",
"OBJECT",
TEST_CLASS.ambiguous( new Number() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Date() ) +''",
"OBJECT",
TEST_CLASS.ambiguous( new Date() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Function() ) +''",
"OBJECT",
TEST_CLASS.ambiguous( new Function() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Array() ) +''",
"OBJECT",
TEST_CLASS.ambiguous( new Array() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( this ) +''",
"OBJECT",
TEST_CLASS.ambiguous( this )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new RegExp() ) +''",
"OBJECT",
TEST_CLASS.ambiguous( new RegExp() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( Math ) +''",
"OBJECT",
TEST_CLASS.ambiguous( Math )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Object() ) +''",
"OBJECT",
TEST_CLASS.ambiguous( new Object() )+'' );
test();

View File

@@ -0,0 +1,61 @@
/* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Mozilla Communicator client code, released March
* 31, 1998.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*
*/
/**
* Preferred Argument Conversion.
*
* Passing a JavaScript boolean to a Java method should prefer to call
* a Java method of the same name that expects a Java boolean.
*
*/
var SECTION = "Preferred argument conversion: JavaScript Object to short";
var VERSION = "1_4";
var TITLE = "LiveConnect 3.0 JavaScript to Java Data Type Conversion " +
SECTION;
startTest();
var TEST_CLASS = new Packages.com.netscape.javascript.qa.lc3.jsobject.JSObject_008;
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new String() ) +''",
"SHORT",
TEST_CLASS.ambiguous(new String()) +'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Boolean() ) +''",
"SHORT",
TEST_CLASS.ambiguous( new Boolean() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Number() ) +''",
"SHORT",
TEST_CLASS.ambiguous( new Number() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Date(999) ) +''",
"SHORT",
TEST_CLASS.ambiguous( new Date(999) )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Array() ) +''",
"SHORT",
TEST_CLASS.ambiguous( new Array() )+'' );
test();

View File

@@ -0,0 +1,98 @@
/* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Mozilla Communicator client code, released March
* 31, 1998.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*
*/
/**
* Preferred Argument Conversion.
*
* Passing a JavaScript boolean to a Java method should prefer to call
* a Java method of the same name that expects a Java boolean.
*
*/
var SECTION = "Preferred argument conversion: JavaScript Object to int";
var VERSION = "1_4";
var TITLE = "LiveConnect 3.0 JavaScript to Java Data Type Conversion " +
SECTION;
startTest();
var TEST_CLASS = new Packages.com.netscape.javascript.qa.lc3.jsobject.JSObject_008;
function MyFunction() {
return "hello";
}
MyFunction.valueOf = new Function( "return 999" );
function MyOtherFunction() {
return "goodbye";
}
MyOtherFunction.valueOf = null;
MyOtherFunction.toString = new Function( "return 999" );
function MyObject(value) {
this.value = value;
this.valueOf = new Function("return this.value");
}
function MyOtherObject(stringValue) {
this.stringValue = String( stringValue );
this.toString = new Function( "return this.stringValue" );
this.valueOf = null;
}
function AnotherObject( value ) {
this.value = value;
this.valueOf = new Function( "return this.value" );
this.toString = new Function( "return 666" );
}
// should pass MyFunction.valueOf() to ambiguous
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( MyFunction ) +''",
"SHORT",
TEST_CLASS.ambiguous( MyFunction )+'' );
// should pass MyOtherFunction.toString() to ambiguous
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( MyOtherFunction ) +''",
"SHORT",
TEST_CLASS.ambiguous( MyOtherFunction )+'' );
// should pass MyObject.valueOf() to ambiguous
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new MyObject(12345) ) +''",
"SHORT",
TEST_CLASS.ambiguous( new MyObject(12345) )+'' );
// should pass MyOtherObject.toString() to ambiguous
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new MyOtherObject(\"12345\") ) +''",
"SHORT",
TEST_CLASS.ambiguous( new MyOtherObject("12345") )+'' );
// should pass AnotherObject.valueOf() to ambiguous
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new AnotherObject(\"12345\") ) +''",
"SHORT",
TEST_CLASS.ambiguous( new AnotherObject("12345") )+'' );
test();

View File

@@ -0,0 +1,84 @@
/* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Mozilla Communicator client code, released March
* 31, 1998.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*
*/
/**
* Preferred Argument Conversion.
*
* Passing a JavaScript boolean to a Java method should prefer to call
* a Java method of the same name that expects a Java boolean.
*
*/
var SECTION = "Preferred argument conversion: boolean";
var VERSION = "1_4";
var TITLE = "LiveConnect 3.0 JavaScript to Java Data Type Conversion " +
SECTION;
startTest();
var TEST_CLASS = new Packages.com.netscape.javascript.qa.lc3.jsobject.JSObject_003;
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new String() ) +''",
"STRING",
TEST_CLASS.ambiguous(new String()) +'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Boolean() ) +''",
"STRING",
TEST_CLASS.ambiguous( new Boolean() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Number() ) +''",
"STRING",
TEST_CLASS.ambiguous( new Number() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Date() ) +''",
"STRING",
TEST_CLASS.ambiguous( new Date() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Function() ) +''",
"STRING",
TEST_CLASS.ambiguous( new Function() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Array() ) +''",
"STRING",
TEST_CLASS.ambiguous( new Array() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( this ) +''",
"STRING",
TEST_CLASS.ambiguous( this )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new RegExp() ) +''",
"STRING",
TEST_CLASS.ambiguous( new RegExp() )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( Math ) +''",
"STRING",
TEST_CLASS.ambiguous( Math )+'' );
testcases[testcases.length] = new TestCase(
"TEST_CLASS.ambiguous( new Object() ) +''",
"STRING",
TEST_CLASS.ambiguous( new Object() )+'' );
test();