Check in modifications to allow lc2 tests to be run in the browser, no bug
git-svn-id: svn://10.0.0.236/trunk@179379 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
0
mozilla/js/tests/lc2/Methods/browser.js
Executable file
0
mozilla/js/tests/lc2/Methods/browser.js
Executable file
@@ -1,3 +1,4 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
@@ -34,82 +35,81 @@
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
File Name: method-001.js
|
||||
Description:
|
||||
File Name: method-001.js
|
||||
Description:
|
||||
|
||||
Call a static method of an object and verify return value.
|
||||
This is covered more thoroughly in the type conversion test cases.
|
||||
This only covers cases in which JavaObjects are returned.
|
||||
Call a static method of an object and verify return value.
|
||||
This is covered more thoroughly in the type conversion test cases.
|
||||
This only covers cases in which JavaObjects are returned.
|
||||
|
||||
@author christine@netscape.com
|
||||
@version 1.00
|
||||
@author christine@netscape.com
|
||||
@version 1.00
|
||||
*/
|
||||
var SECTION = "LiveConnect Objects";
|
||||
var VERSION = "1_3";
|
||||
var TITLE = "Calling Static Methods";
|
||||
var SECTION = "LiveConnect Objects";
|
||||
var VERSION = "1_3";
|
||||
var TITLE = "Calling Static Methods";
|
||||
|
||||
var testcases = new Array();
|
||||
startTest();
|
||||
writeHeaderToLog( SECTION + " "+ TITLE);
|
||||
|
||||
startTest();
|
||||
writeHeaderToLog( SECTION + " "+ TITLE);
|
||||
// All JavaObjects are of the type "object"
|
||||
|
||||
// All JavaObjects are of the type "object"
|
||||
var E_TYPE = "object";
|
||||
|
||||
var E_TYPE = "object";
|
||||
// All JavaObjects [[Class]] property is JavaObject
|
||||
var E_JSCLASS = "[object JavaObject]";
|
||||
|
||||
// All JavaObjects [[Class]] property is JavaObject
|
||||
var E_JSCLASS = "[object JavaObject]";
|
||||
// Create arrays of actual results (java_array) and
|
||||
// expected results (test_array).
|
||||
|
||||
// Create arrays of actual results (java_array) and
|
||||
// expected results (test_array).
|
||||
var java_array = new Array();
|
||||
var test_array = new Array();
|
||||
|
||||
var java_array = new Array();
|
||||
var test_array = new Array();
|
||||
var i = 0;
|
||||
|
||||
var i = 0;
|
||||
java_array[i] = new JavaValue( java.lang.String.valueOf(true) );
|
||||
test_array[i] = new TestValue( "java.lang.String.valueOf(true)",
|
||||
"object", "java.lang.String", "true" );
|
||||
|
||||
java_array[i] = new JavaValue( java.lang.String.valueOf(true) );
|
||||
test_array[i] = new TestValue( "java.lang.String.valueOf(true)",
|
||||
"object", "java.lang.String", "true" );
|
||||
i++;
|
||||
|
||||
i++;
|
||||
java_array[i] = new JavaValue( java.awt.Color.getHSBColor(0.0, 0.0, 0.0) );
|
||||
test_array[i] = new TestValue( "java.awt.Color.getHSBColor(0.0, 0.0, 0.0)",
|
||||
"object", "java.awt.Color", "java.awt.Color[r=0,g=0,b=0]" );
|
||||
|
||||
java_array[i] = new JavaValue( java.awt.Color.getHSBColor(0.0, 0.0, 0.0) );
|
||||
test_array[i] = new TestValue( "java.awt.Color.getHSBColor(0.0, 0.0, 0.0)",
|
||||
"object", "java.awt.Color", "java.awt.Color[r=0,g=0,b=0]" );
|
||||
|
||||
i++;
|
||||
i++;
|
||||
|
||||
|
||||
for ( i = 0; i < java_array.length; i++ ) {
|
||||
CompareValues( java_array[i], test_array[i] );
|
||||
}
|
||||
for ( i = 0; i < java_array.length; i++ ) {
|
||||
CompareValues( java_array[i], test_array[i] );
|
||||
}
|
||||
|
||||
test();
|
||||
test();
|
||||
|
||||
function CompareValues( javaval, testval ) {
|
||||
// Check type, which should be E_TYPE
|
||||
testcases[testcases.length] = new TestCase( SECTION,
|
||||
"typeof (" + testval.description +" )",
|
||||
testval.type,
|
||||
javaval.type );
|
||||
new TestCase( SECTION,
|
||||
"typeof (" + testval.description +" )",
|
||||
testval.type,
|
||||
javaval.type );
|
||||
/*
|
||||
// Check JavaScript class, which should be E_JSCLASS
|
||||
testcases[testcases.length] = new TestCase( SECTION,
|
||||
"(" + testval.description +" ).getJSClass()",
|
||||
E_JSCLASS,
|
||||
javaval.jsclass );
|
||||
// Check JavaScript class, which should be E_JSCLASS
|
||||
new TestCase( SECTION,
|
||||
"(" + testval.description +" ).getJSClass()",
|
||||
E_JSCLASS,
|
||||
javaval.jsclass );
|
||||
*/
|
||||
// Check the JavaClass, which should be the same as the result as Class.forName(description).
|
||||
testcases[testcases.length] = new TestCase( SECTION,
|
||||
"("+testval.description +").getClass().equals( " +
|
||||
"java.lang.Class.forName( '" + testval.classname +
|
||||
"' ) )",
|
||||
true,
|
||||
(javaval.javaclass).equals( testval.javaclass ) );
|
||||
new TestCase( SECTION,
|
||||
"("+testval.description +").getClass().equals( " +
|
||||
"java.lang.Class.forName( '" + testval.classname +
|
||||
"' ) )",
|
||||
true,
|
||||
(javaval.javaclass).equals( testval.javaclass ) );
|
||||
// check the string value
|
||||
testcases[testcases.length] = new TestCase(
|
||||
new TestCase(
|
||||
SECTION,
|
||||
"("+testval.description+") +''",
|
||||
testval.stringval,
|
||||
@@ -135,16 +135,3 @@ function TestValue( description, type, classname, stringval ) {
|
||||
|
||||
return this;
|
||||
}
|
||||
function test() {
|
||||
for ( tc=0; tc < testcases.length; tc++ ) {
|
||||
testcases[tc].passed = writeTestCaseResult(
|
||||
testcases[tc].expect,
|
||||
testcases[tc].actual,
|
||||
testcases[tc].description +" = "+
|
||||
testcases[tc].actual );
|
||||
|
||||
testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
|
||||
}
|
||||
stopTest();
|
||||
return ( testcases );
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
@@ -34,80 +35,79 @@
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
File Name: method-002.js
|
||||
Description:
|
||||
File Name: method-002.js
|
||||
Description:
|
||||
|
||||
Call a method of a JavaObject instance and verify that return value.
|
||||
This is covered more thouroughly in the type conversion test cases.
|
||||
Call a method of a JavaObject instance and verify that return value.
|
||||
This is covered more thouroughly in the type conversion test cases.
|
||||
|
||||
@author christine@netscape.com
|
||||
@version 1.00
|
||||
@author christine@netscape.com
|
||||
@version 1.00
|
||||
*/
|
||||
var SECTION = "LiveConnect Objects";
|
||||
var VERSION = "1_3";
|
||||
var TITLE = "Invoking Java Methods";
|
||||
var SECTION = "LiveConnect Objects";
|
||||
var VERSION = "1_3";
|
||||
var TITLE = "Invoking Java Methods";
|
||||
|
||||
var testcases = new Array();
|
||||
startTest();
|
||||
writeHeaderToLog( SECTION + " "+ TITLE);
|
||||
|
||||
startTest();
|
||||
writeHeaderToLog( SECTION + " "+ TITLE);
|
||||
// All JavaObjects are of the type "object"
|
||||
|
||||
// All JavaObjects are of the type "object"
|
||||
var E_TYPE = "object";
|
||||
|
||||
var E_TYPE = "object";
|
||||
// All JavaObjects [[Class]] property is JavaObject
|
||||
var E_JSCLASS = "[object JavaObject]";
|
||||
|
||||
// All JavaObjects [[Class]] property is JavaObject
|
||||
var E_JSCLASS = "[object JavaObject]";
|
||||
// Create arrays of actual results (java_array) and
|
||||
// expected results (test_array).
|
||||
|
||||
// Create arrays of actual results (java_array) and
|
||||
// expected results (test_array).
|
||||
var java_array = new Array();
|
||||
var test_array = new Array();
|
||||
|
||||
var java_array = new Array();
|
||||
var test_array = new Array();
|
||||
var i = 0;
|
||||
|
||||
var i = 0;
|
||||
// method returns an object
|
||||
|
||||
// method returns an object
|
||||
var rect = new java.awt.Rectangle(1,2,3,4);
|
||||
var size = rect.getSize();
|
||||
|
||||
var rect = new java.awt.Rectangle(1,2,3,4);
|
||||
var size = rect.getSize();
|
||||
new TestCase(
|
||||
SECTION,
|
||||
"var size = (new java.awt.Rectangle(1,2,3,4)).getSize(); "+
|
||||
"size.getClass().equals(java.lang.Class.forName(\""+
|
||||
"java.awt.Dimension\"))",
|
||||
true,
|
||||
size.getClass().equals(java.lang.Class.forName("java.awt.Dimension")));
|
||||
|
||||
testcases[testcases.length] = new TestCase(
|
||||
SECTION,
|
||||
"var size = (new java.awt.Rectangle(1,2,3,4)).getSize(); "+
|
||||
"size.getClass().equals(java.lang.Class.forName(\""+
|
||||
"java.awt.Dimension\"))",
|
||||
true,
|
||||
size.getClass().equals(java.lang.Class.forName("java.awt.Dimension")));
|
||||
new TestCase(
|
||||
SECTION,
|
||||
"size.width",
|
||||
3,
|
||||
size.width );
|
||||
|
||||
testcases[testcases.length] = new TestCase(
|
||||
SECTION,
|
||||
"size.width",
|
||||
3,
|
||||
size.width );
|
||||
new TestCase(
|
||||
SECTION,
|
||||
"size.height",
|
||||
4,
|
||||
size.height );
|
||||
|
||||
testcases[testcases.length] = new TestCase(
|
||||
SECTION,
|
||||
"size.height",
|
||||
4,
|
||||
size.height );
|
||||
// method returns void
|
||||
var r = rect.setSize(5,6);
|
||||
|
||||
// method returns void
|
||||
var r = rect.setSize(5,6);
|
||||
new TestCase(
|
||||
SECTION,
|
||||
"var r = rect.setSize(5,6); r",
|
||||
void 0,
|
||||
r );
|
||||
|
||||
testcases[testcases.length] = new TestCase(
|
||||
SECTION,
|
||||
"var r = rect.setSize(5,6); r",
|
||||
void 0,
|
||||
r );
|
||||
// method returns a string
|
||||
|
||||
// method returns a string
|
||||
var string = new java.lang.String( " hello " );
|
||||
s = string.trim()
|
||||
|
||||
var string = new java.lang.String( " hello " );
|
||||
s = string.trim()
|
||||
|
||||
testcases[testcases.length] = new TestCase(
|
||||
new TestCase(
|
||||
SECTION,
|
||||
"var string = new java.lang.String(\" hello \"); "+
|
||||
"var s = string.trim(); s.getClass().equals("+
|
||||
@@ -115,34 +115,34 @@
|
||||
true,
|
||||
s.getClass().equals(java.lang.Class.forName("java.lang.String")) );
|
||||
|
||||
// method returns an int
|
||||
testcases[testcases.length] = new TestCase(
|
||||
SECTION,
|
||||
"s.length()",
|
||||
5,
|
||||
s.length() );
|
||||
// method returns an int
|
||||
new TestCase(
|
||||
SECTION,
|
||||
"s.length()",
|
||||
5,
|
||||
s.length() );
|
||||
|
||||
test();
|
||||
test();
|
||||
|
||||
function CompareValues( javaval, testval ) {
|
||||
// Check type, which should be E_TYPE
|
||||
testcases[testcases.length] = new TestCase( SECTION,
|
||||
"typeof (" + testval.description +" )",
|
||||
testval.type,
|
||||
javaval.type );
|
||||
new TestCase( SECTION,
|
||||
"typeof (" + testval.description +" )",
|
||||
testval.type,
|
||||
javaval.type );
|
||||
|
||||
// Check JavaScript class, which should be E_JSCLASS
|
||||
testcases[testcases.length] = new TestCase( SECTION,
|
||||
"(" + testval.description +" ).getJSClass()",
|
||||
testval.jsclass,
|
||||
javaval.jsclass );
|
||||
new TestCase( SECTION,
|
||||
"(" + testval.description +" ).getJSClass()",
|
||||
testval.jsclass,
|
||||
javaval.jsclass );
|
||||
// Check the JavaClass, which should be the same as the result as Class.forName(description).
|
||||
testcases[testcases.length] = new TestCase( SECTION,
|
||||
testval.description +".getClass().equals( " +
|
||||
"java.lang.Class.forName( '" + testval.classname +
|
||||
"' ) )",
|
||||
true,
|
||||
javaval.javaclass.equals( testval.javaclass ) );
|
||||
new TestCase( SECTION,
|
||||
testval.description +".getClass().equals( " +
|
||||
"java.lang.Class.forName( '" + testval.classname +
|
||||
"' ) )",
|
||||
true,
|
||||
javaval.javaclass.equals( testval.javaclass ) );
|
||||
}
|
||||
function JavaValue( value ) {
|
||||
this.type = typeof value;
|
||||
@@ -160,16 +160,3 @@ function TestValue( description, classname ) {
|
||||
this.javaclass = java.lang.Class.forName( classname );
|
||||
return this;
|
||||
}
|
||||
function test() {
|
||||
for ( tc=0; tc < testcases.length; tc++ ) {
|
||||
testcases[tc].passed = writeTestCaseResult(
|
||||
testcases[tc].expect,
|
||||
testcases[tc].actual,
|
||||
testcases[tc].description +" = "+
|
||||
testcases[tc].actual );
|
||||
|
||||
testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
|
||||
}
|
||||
stopTest();
|
||||
return ( testcases );
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
@@ -34,62 +35,61 @@
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
File Name: method-003.js
|
||||
Description:
|
||||
File Name: method-003.js
|
||||
Description:
|
||||
|
||||
JavaMethod objects are of the type "function" since they implement the
|
||||
[[Call]] method.
|
||||
JavaMethod objects are of the type "function" since they implement the
|
||||
[[Call]] method.
|
||||
|
||||
|
||||
@author christine@netscape.com
|
||||
@version 1.00
|
||||
@author christine@netscape.com
|
||||
@version 1.00
|
||||
*/
|
||||
var SECTION = "LiveConnect Objects";
|
||||
var VERSION = "1_3";
|
||||
var TITLE = "Type and Class of Java Methods";
|
||||
var SECTION = "LiveConnect Objects";
|
||||
var VERSION = "1_3";
|
||||
var TITLE = "Type and Class of Java Methods";
|
||||
|
||||
var testcases = new Array();
|
||||
startTest();
|
||||
writeHeaderToLog( SECTION + " "+ TITLE);
|
||||
|
||||
startTest();
|
||||
writeHeaderToLog( SECTION + " "+ TITLE);
|
||||
// All JavaMethods are of the type "function"
|
||||
var E_TYPE = "function";
|
||||
|
||||
// All JavaMethods are of the type "function"
|
||||
var E_TYPE = "function";
|
||||
// All JavaMethods [[Class]] property is Function
|
||||
var E_JSCLASS = "[object Function]";
|
||||
|
||||
// All JavaMethods [[Class]] property is Function
|
||||
var E_JSCLASS = "[object Function]";
|
||||
// Create arrays of actual results (java_array) and
|
||||
// expected results (test_array).
|
||||
|
||||
// Create arrays of actual results (java_array) and
|
||||
// expected results (test_array).
|
||||
var java_array = new Array();
|
||||
var test_array = new Array();
|
||||
|
||||
var java_array = new Array();
|
||||
var test_array = new Array();
|
||||
var i = 0;
|
||||
|
||||
var i = 0;
|
||||
java_array[i] = new JavaValue( java.lang.System.out.println );
|
||||
test_array[i] = new TestValue( "java.lang.System.out.println" );
|
||||
i++;
|
||||
|
||||
java_array[i] = new JavaValue( java.lang.System.out.println );
|
||||
test_array[i] = new TestValue( "java.lang.System.out.println" );
|
||||
i++;
|
||||
for ( i = 0; i < java_array.length; i++ ) {
|
||||
CompareValues( java_array[i], test_array[i] );
|
||||
}
|
||||
|
||||
for ( i = 0; i < java_array.length; i++ ) {
|
||||
CompareValues( java_array[i], test_array[i] );
|
||||
}
|
||||
|
||||
test();
|
||||
test();
|
||||
|
||||
function CompareValues( javaval, testval ) {
|
||||
// Check type, which should be E_TYPE
|
||||
testcases[testcases.length] = new TestCase( SECTION,
|
||||
"typeof (" + testval.description +" )",
|
||||
testval.type,
|
||||
javaval.type );
|
||||
new TestCase( SECTION,
|
||||
"typeof (" + testval.description +" )",
|
||||
testval.type,
|
||||
javaval.type );
|
||||
|
||||
// Check JavaScript class, which should be E_JSCLASS
|
||||
testcases[testcases.length] = new TestCase( SECTION,
|
||||
"(" + testval.description +" ).getJSClass()",
|
||||
testval.jsclass,
|
||||
javaval.jsclass );
|
||||
new TestCase( SECTION,
|
||||
"(" + testval.description +" ).getJSClass()",
|
||||
testval.jsclass,
|
||||
javaval.jsclass );
|
||||
}
|
||||
function JavaValue( value ) {
|
||||
this.type = typeof value;
|
||||
@@ -104,16 +104,3 @@ function TestValue( description ) {
|
||||
this.jsclass = E_JSCLASS;
|
||||
return this;
|
||||
}
|
||||
function test() {
|
||||
for ( tc=0; tc < testcases.length; tc++ ) {
|
||||
testcases[tc].passed = writeTestCaseResult(
|
||||
testcases[tc].expect,
|
||||
testcases[tc].actual,
|
||||
testcases[tc].description +" = "+
|
||||
testcases[tc].actual );
|
||||
|
||||
testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
|
||||
}
|
||||
stopTest();
|
||||
return ( testcases );
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
@@ -34,45 +35,34 @@
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
File Name: method-004-n.js
|
||||
Description:
|
||||
File Name: method-004-n.js
|
||||
Description:
|
||||
|
||||
Passing arguments of the wrong type, or the wrong number of arguments,
|
||||
should cause a runtime error.
|
||||
Passing arguments of the wrong type, or the wrong number of arguments,
|
||||
should cause a runtime error.
|
||||
|
||||
@author christine@netscape.com
|
||||
@version 1.00
|
||||
@author christine@netscape.com
|
||||
@version 1.00
|
||||
*/
|
||||
var SECTION = "LiveConnect Objects";
|
||||
var VERSION = "1_3";
|
||||
var TITLE = "Passing bad arguments to a method";
|
||||
var SECTION = "LiveConnect Objects";
|
||||
var VERSION = "1_3";
|
||||
var TITLE = "Passing bad arguments to a method";
|
||||
|
||||
var testcases = new Array();
|
||||
startTest();
|
||||
writeHeaderToLog( SECTION + " "+ TITLE);
|
||||
|
||||
startTest();
|
||||
writeHeaderToLog( SECTION + " "+ TITLE);
|
||||
DESCRIPTION = "var string = new java.lang.String(\"\"); string.charAt(\"foo\")";
|
||||
EXPECTED = "error";
|
||||
|
||||
var string = new java.lang.String("");
|
||||
var string = new java.lang.String("");
|
||||
|
||||
testcases[testcases.length] = new TestCase(
|
||||
SECTION,
|
||||
"var string = new java.lang.String(\"\"); string.charAt(\"foo\")",
|
||||
"error",
|
||||
string.charAt("foo") );
|
||||
new TestCase(
|
||||
SECTION,
|
||||
"var string = new java.lang.String(\"\"); string.charAt(\"foo\")",
|
||||
"error",
|
||||
string.charAt("foo") );
|
||||
|
||||
test();
|
||||
test();
|
||||
|
||||
function test() {
|
||||
for ( tc=0; tc < testcases.length; tc++ ) {
|
||||
testcases[tc].passed = writeTestCaseResult(
|
||||
testcases[tc].expect,
|
||||
testcases[tc].actual,
|
||||
testcases[tc].description +" = "+
|
||||
testcases[tc].actual );
|
||||
|
||||
testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
|
||||
}
|
||||
stopTest();
|
||||
return ( testcases );
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
@@ -34,55 +35,54 @@
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
File Name: method-005.js
|
||||
Description:
|
||||
File Name: method-005.js
|
||||
Description:
|
||||
|
||||
Assigning a Java method to a JavaScript object should not change the
|
||||
context associated with the Java method -- its this object should
|
||||
be the Java object, not the JavaScript object.
|
||||
Assigning a Java method to a JavaScript object should not change the
|
||||
context associated with the Java method -- its this object should
|
||||
be the Java object, not the JavaScript object.
|
||||
|
||||
@author christine@netscape.com
|
||||
@version 1.00
|
||||
@author christine@netscape.com
|
||||
@version 1.00
|
||||
*/
|
||||
var SECTION = "LiveConnect Objects";
|
||||
var VERSION = "1_3";
|
||||
var TITLE = "Assigning a Static Java Method to a JavaScript object";
|
||||
var SECTION = "LiveConnect Objects";
|
||||
var VERSION = "1_3";
|
||||
var TITLE = "Assigning a Static Java Method to a JavaScript object";
|
||||
|
||||
var testcases = new Array();
|
||||
startTest();
|
||||
writeHeaderToLog( SECTION + " "+ TITLE);
|
||||
|
||||
startTest();
|
||||
writeHeaderToLog( SECTION + " "+ TITLE);
|
||||
var java_string = new java.lang.String("LiveConnect");
|
||||
var js_string = "JavaScript";
|
||||
|
||||
var java_string = new java.lang.String("LiveConnect");
|
||||
var js_string = "JavaScript";
|
||||
|
||||
js_string.startsWith = java_string.startsWith;
|
||||
js_string.startsWith = java_string.startsWith;
|
||||
/*
|
||||
testcases[testcases.length] = new TestCase(
|
||||
SECTION,
|
||||
"var java_string = new java.lang.String(\"LiveConnect\");" +
|
||||
"var js_string = \"JavaScript\"" +
|
||||
"js_string.startsWith = java_string.startsWith"+
|
||||
"js_string.startsWith(\"J\")",
|
||||
false,
|
||||
js_string.startsWith("J") );
|
||||
new TestCase(
|
||||
SECTION,
|
||||
"var java_string = new java.lang.String(\"LiveConnect\");" +
|
||||
"var js_string = \"JavaScript\"" +
|
||||
"js_string.startsWith = java_string.startsWith"+
|
||||
"js_string.startsWith(\"J\")",
|
||||
false,
|
||||
js_string.startsWith("J") );
|
||||
*/
|
||||
var mo = new MyObject();
|
||||
var mo = new MyObject();
|
||||
|
||||
var c = mo.classForName( "java.lang.String" );
|
||||
var c = mo.classForName( "java.lang.String" );
|
||||
|
||||
testcases[testcases.length] = new TestCase(
|
||||
SECTION,
|
||||
"var mo = new MyObject(); "+
|
||||
"var c = mo.classForName(\"java.lang.String\");" +
|
||||
"c.equals(java.lang.Class.forName(\"java.lang.String\))",
|
||||
true,
|
||||
c.equals(java.lang.Class.forName("java.lang.String")) );
|
||||
new TestCase(
|
||||
SECTION,
|
||||
"var mo = new MyObject(); "+
|
||||
"var c = mo.classForName(\"java.lang.String\");" +
|
||||
"c.equals(java.lang.Class.forName(\"java.lang.String\))",
|
||||
true,
|
||||
c.equals(java.lang.Class.forName("java.lang.String")) );
|
||||
|
||||
|
||||
|
||||
test();
|
||||
test();
|
||||
|
||||
function MyObject() {
|
||||
this.println = java.lang.System.out.println;
|
||||
@@ -90,16 +90,3 @@ function MyObject() {
|
||||
return this;
|
||||
}
|
||||
|
||||
function test() {
|
||||
for ( tc=0; tc < testcases.length; tc++ ) {
|
||||
testcases[tc].passed = writeTestCaseResult(
|
||||
testcases[tc].expect,
|
||||
testcases[tc].actual,
|
||||
testcases[tc].description +" = "+
|
||||
testcases[tc].actual );
|
||||
|
||||
testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
|
||||
}
|
||||
stopTest();
|
||||
return ( testcases );
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
@@ -34,43 +35,49 @@
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
File Name: method-006-n.js
|
||||
Description:
|
||||
File Name: method-006-n.js
|
||||
Description:
|
||||
|
||||
Assigning a Java method to a JavaScript object should not change the
|
||||
context associated with the Java method -- its this object should
|
||||
be the Java object, not the JavaScript object.
|
||||
Assigning a Java method to a JavaScript object should not change the
|
||||
context associated with the Java method -- its this object should
|
||||
be the Java object, not the JavaScript object.
|
||||
|
||||
That is from Flanagan. In practice, this fails all implementations.
|
||||
That is from Flanagan. In practice, this fails all implementations.
|
||||
|
||||
@author christine@netscape.com
|
||||
@version 1.00
|
||||
@author christine@netscape.com
|
||||
@version 1.00
|
||||
*/
|
||||
var SECTION = "LiveConnect Objects";
|
||||
var VERSION = "1_3";
|
||||
var TITLE = "Assigning a Non-Static Java Method to a JavaScript Object";
|
||||
var SECTION = "LiveConnect Objects";
|
||||
var VERSION = "1_3";
|
||||
var TITLE = "Assigning a Non-Static Java Method to a JavaScript Object";
|
||||
|
||||
var testcases = new Array();
|
||||
startTest();
|
||||
writeHeaderToLog( SECTION + " "+ TITLE);
|
||||
|
||||
startTest();
|
||||
writeHeaderToLog( SECTION + " "+ TITLE);
|
||||
var java_string = new java.lang.String("LiveConnect");
|
||||
var js_string = "JavaScript";
|
||||
|
||||
var java_string = new java.lang.String("LiveConnect");
|
||||
var js_string = "JavaScript";
|
||||
DESCRIPTION = "var java_string = new java.lang.String(\"LiveConnect\");" +
|
||||
"var js_string = \"JavaScript\"" +
|
||||
"js_string.startsWith = java_string.startsWith"+
|
||||
"js_string.startsWith(\"J\")";
|
||||
|
||||
js_string.startsWith = java_string.startsWith;
|
||||
EXPECTED = "error";
|
||||
|
||||
testcases[testcases.length] = new TestCase(
|
||||
SECTION,
|
||||
"var java_string = new java.lang.String(\"LiveConnect\");" +
|
||||
"var js_string = \"JavaScript\"" +
|
||||
"js_string.startsWith = java_string.startsWith"+
|
||||
"js_string.startsWith(\"J\")",
|
||||
false,
|
||||
js_string.startsWith("J") );
|
||||
js_string.startsWith = java_string.startsWith;
|
||||
|
||||
test();
|
||||
new TestCase(
|
||||
SECTION,
|
||||
"var java_string = new java.lang.String(\"LiveConnect\");" +
|
||||
"var js_string = \"JavaScript\"" +
|
||||
"js_string.startsWith = java_string.startsWith"+
|
||||
"js_string.startsWith(\"J\")",
|
||||
false,
|
||||
js_string.startsWith("J") );
|
||||
|
||||
test();
|
||||
|
||||
function MyObject() {
|
||||
this.println = java.lang.System.out.println;
|
||||
@@ -78,16 +85,3 @@ function MyObject() {
|
||||
return this;
|
||||
}
|
||||
|
||||
function test() {
|
||||
for ( tc=0; tc < testcases.length; tc++ ) {
|
||||
testcases[tc].passed = writeTestCaseResult(
|
||||
testcases[tc].expect,
|
||||
testcases[tc].actual,
|
||||
testcases[tc].description +" = "+
|
||||
testcases[tc].actual );
|
||||
|
||||
testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
|
||||
}
|
||||
stopTest();
|
||||
return ( testcases );
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
@@ -34,47 +35,33 @@
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
File Name: println-001.js
|
||||
Section: LiveConnect
|
||||
Description:
|
||||
File Name: println-001.js
|
||||
Section: LiveConnect
|
||||
Description:
|
||||
|
||||
Regression test for
|
||||
http://scopus.mcom.com/bugsplat/show_bug.cgi?id=114820
|
||||
Regression test for
|
||||
http://scopus.mcom.com/bugsplat/show_bug.cgi?id=114820
|
||||
|
||||
Verify that java.lang.System.out.println does not cause an error.
|
||||
Not sure how to get to the error any other way.
|
||||
Verify that java.lang.System.out.println does not cause an error.
|
||||
Not sure how to get to the error any other way.
|
||||
|
||||
Author: christine@netscape.com
|
||||
Date: 12 november 1997
|
||||
Author: christine@netscape.com
|
||||
Date: 12 november 1997
|
||||
*/
|
||||
var SECTION = "println-001.js";
|
||||
var VERSION = "JS1_3";
|
||||
var TITLE = "java.lang.System.out.println";
|
||||
var SECTION = "println-001.js";
|
||||
var VERSION = "JS1_3";
|
||||
var TITLE = "java.lang.System.out.println";
|
||||
|
||||
startTest();
|
||||
writeHeaderToLog( SECTION + " "+ TITLE);
|
||||
startTest();
|
||||
writeHeaderToLog( SECTION + " "+ TITLE);
|
||||
|
||||
var testcases = new Array();
|
||||
new TestCase(
|
||||
SECTION,
|
||||
"java.lang.System.out.println( \"output from test live/Methods/println-001.js\")",
|
||||
void 0,
|
||||
java.lang.System.out.println( "output from test live/Methods/println-001.js" ) );
|
||||
|
||||
testcases[testcases.length] = new TestCase(
|
||||
SECTION,
|
||||
"java.lang.System.out.println( \"output from test live/Methods/println-001.js\")",
|
||||
void 0,
|
||||
java.lang.System.out.println( "output from test live/Methods/println-001.js" ) );
|
||||
test();
|
||||
|
||||
test();
|
||||
|
||||
function test() {
|
||||
for ( tc=0; tc < testcases.length; tc++ ) {
|
||||
testcases[tc].passed = writeTestCaseResult(
|
||||
testcases[tc].expect,
|
||||
testcases[tc].actual,
|
||||
testcases[tc].description +" = "+
|
||||
testcases[tc].actual );
|
||||
|
||||
testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
|
||||
}
|
||||
stopTest();
|
||||
return ( testcases );
|
||||
}
|
||||
|
||||
0
mozilla/js/tests/lc2/Methods/shell.js
Executable file
0
mozilla/js/tests/lc2/Methods/shell.js
Executable file
Reference in New Issue
Block a user