JavaScript Tests - standardize test reporting for shell and browser, bug 380257

git-svn-id: svn://10.0.0.236/trunk@227049 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bclary%bclary.com
2007-05-26 00:19:49 +00:00
parent 86376b8166
commit 046573bad4
2514 changed files with 83977 additions and 75356 deletions

View File

@@ -36,6 +36,8 @@
*
* ***** END LICENSE BLOCK ***** */
gTestfile = 'boolean-005.js';
/**
File Name: boolean-005.js
Description:
@@ -87,23 +89,23 @@ test_array[i] = new TestValue( "java.lang.Boolean.TRUE",
i++;
for ( i = 0; i < java_array.length; i++ ) {
CompareValues( java_array[i], test_array[i] );
CompareValues( java_array[i], test_array[i] );
}
test();
function CompareValues( javaval, testval ) {
// Check booleanValue()
new TestCase( SECTION,
"("+testval.description+").booleanValue()",
testval.value,
javaval.value );
// Check typeof, which should be E_TYPE
new TestCase( SECTION,
"typeof (" + testval.description +")",
testval.type,
javaval.type );
// Check booleanValue()
new TestCase( SECTION,
"("+testval.description+").booleanValue()",
testval.value,
javaval.value );
// Check typeof, which should be E_TYPE
new TestCase( SECTION,
"typeof (" + testval.description +")",
testval.type,
javaval.type );
/*
// Check JavaScript class, which should be E_JSCLASS
new TestCase( SECTION,
@@ -111,21 +113,21 @@ new TestCase( SECTION,
testval.jsclass,
javaval.jsclass );
*/
// Check Java class, which should equal() E_JAVACLASS
new TestCase( SECTION,
"(" + testval.description +").getClass().equals( " + E_JAVACLASS +" )",
true,
javaval.javaclass.equals( testval.javaclass ) );
// Check Java class, which should equal() E_JAVACLASS
new TestCase( SECTION,
"(" + testval.description +").getClass().equals( " + E_JAVACLASS +" )",
true,
javaval.javaclass.equals( testval.javaclass ) );
// Check string representation
new TestCase( SECTION,
"("+ testval.description+") + ''",
testval.string,
javaval.string );
// Check string representation
new TestCase( SECTION,
"("+ testval.description+") + ''",
testval.string,
javaval.string );
}
function JavaValue( value ) {
// java.lang.Object.getClass() returns the Java Object's class.
this.javaclass = value.getClass();
// java.lang.Object.getClass() returns the Java Object's class.
this.javaclass = value.getClass();
// __proto__ of Java objects is not supported in LC2.
@@ -133,19 +135,19 @@ function JavaValue( value ) {
// value.__proto__.getJSClass = Object.prototype.toString;
// this.jsclass = value.getJSClass();
this.string = value + "";
print( this.string );
this.value = value.booleanValue();
this.type = typeof value;
this.string = value + "";
print( this.string );
this.value = value.booleanValue();
this.type = typeof value;
return this;
return this;
}
function TestValue( description, value ) {
this.description = description;
this.string = String( value );
this.value = value;
this.type = E_TYPE;
this.javaclass = E_JAVACLASS;
this.jsclass = E_JSCLASS;
return this;
this.description = description;
this.string = String( value );
this.value = value;
this.type = E_TYPE;
this.javaclass = E_JAVACLASS;
this.jsclass = E_JSCLASS;
return this;
}