This commit is contained in:
pschwartau%netscape.com 2001-08-07 19:45:15 +00:00
Родитель cbd97d1ef0
Коммит 22a4e8c2e1
18 изменённых файлов: 2504 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,94 @@
/*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (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.org code.
*
* 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.
*
* Contributor(s): pschwartau@netscape.com
* Date: 2001-06-18
*
* SUMMARY: Testing basic properties of classes -
*/
//-------------------------------------------------------------------------------------------------
var UBound = 0;
var bug = '(none)';
var summary = 'Testing basic properties of classes';
var status = '';
var statusitems = [];
var actual = '';
var actualvalues = [];
var expect= '';
var expectedvalues = [];
class C
{
var x:Integer = 3;
function m() {return x}
function n(x) {return x+4}
}
var c = new C;
status = inSection(1);
actual = c.m();
expect = 3;
addThis();
status = inSection(2);
actual = c.n(7);
expect = 11;
addThis();
status = inSection(3);
var f:Function = c.m;
actual = f();
expect = 3;
addThis();
status = inSection(4);
c.x = 8;
actual = f();
expect = 8;
addThis();
//-------------------------------------------------------------------------------------------------
test();
//-------------------------------------------------------------------------------------------------
function addThis()
{
statusitems[UBound] = status;
actualvalues[UBound] = actual;
expectedvalues[UBound] = expect;
UBound++;
}
function test()
{
enterFunc ('test');
printBugNumber (bug);
printStatus (summary);
for (var i = 0; i < UBound; i++)
{
reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
}
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,92 @@
/*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (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.org code.
*
* 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.
*
* Contributor(s): pschwartau@netscape.com
* Date: 2001-06-18
*
* SUMMARY: Testing basic properties of classes -
*/
//-------------------------------------------------------------------------------------------------
var UBound = 0;
var bug = '(none)';
var summary = 'Testing basic properties of classes';
var status = '';
var statusitems = [];
var actual = '';
var actualvalues = [];
var expect= '';
var expectedvalues = [];
class C1
{
var prop1 = 111;
}
var c1 = new C1;
status = inSection(1);
actual = c1.prop1;
expect = 111;
addThis();
class C2 extends C1
{
var prop2 = 222;
}
var c2 = new C2;
status = inSection(2);
actual = c2.prop2;
expect = 222;
addThis();
status = inSection(3);
actual = c2.prop1;
expect = 111;
addThis();
//-------------------------------------------------------------------------------------------------
test();
//-------------------------------------------------------------------------------------------------
function addThis()
{
statusitems[UBound] = status;
actualvalues[UBound] = actual;
expectedvalues[UBound] = expect;
UBound++;
}
function test()
{
enterFunc ('test');
printBugNumber (bug);
printStatus (summary);
for (var i = 0; i < UBound; i++)
{
reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
}
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,133 @@
/*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (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.org code.
*
* 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.
*
* Contributor(s): pschwartau@netscape.com
* Date: 2001-06-19
*
* SUMMARY: Basic test of classes: defining/invoking a method
*
* No expected vs. actual values are checked in the test() function here.
* Test is designed only to see that properties can be defined and invoked.
*/
//-------------------------------------------------------------------------------------------------
var UBound = 0;
var bug = '(none)';
var summary = 'Basic test of classes: defining/invoking a method';
var cnHELLO = 'HELLO';
// First, let the method have no arguments -
//-------------------------------------------------------------------------------------------------
class C1 {function myMethod1(){}}
var c1 = new C1;
c1.myMethod1();
class C2 {var myMethod2 = function(){}}
var c2 = new C2;
c2.myMethod2();
// without the 'var', myMethod should end up on the global object -
class C3 {myMethod3 = function(){}}
var c3 = new C3;
myMethod3();
class C4 {var myMethod4 = function XYZ(){}}
var c4 = new C4;
c4.myMethod4();
// without the 'var', myMethod should end up on the global object -
class C5 {myMethod5 = function XYZ(){}}
var c5 = new C5;
myMethod5();
//-------------------------------------------------------------------------------------------------
// Let the method have one argument but do nothing with it -
//-------------------------------------------------------------------------------------------------
class C6 {function myMethod6(msg){}}
var c6 = new C6;
c6.myMethod6(cnHELLO);
class C7 {var myMethod7 = function(msg){}}
var c7 = new C7;
c7.myMethod7(cnHELLO);
// without the 'var', myMethod should end up on the global object -
class C8 {myMethod8 = function(msg){}}
var c8 = new C8;
myMethod8(cnHELLO);
class C9 {var myMethod9 = function XYZ(msg){}}
var c9 = new C9;
c9.myMethod9(cnHELLO);
// without the 'var', myMethod should end up on the global object -
class C10 {myMethod10 = function XYZ(msg){}}
var c10 = new C10;
myMethod10(cnHELLO);
//-------------------------------------------------------------------------------------------------
// Let the method have one argument and do something with it -
//-------------------------------------------------------------------------------------------------
class C11 {function myMethod11(msg){print(msg);}}
var c11 = new C11;
c11.myMethod11(cnHELLO);
class C12 {var myMethod12 = function(msg){print(msg);}}
var c12 = new C12;
c12.myMethod12(cnHELLO);
// without the 'var', myMethod should end up on the global object -
class C13 {myMethod13 = function(msg){print(msg);}}
var c13 = new C13;
myMethod13(cnHELLO);
class C14 {var myMethod14 = function XYZ(msg){print(msg);}}
var c14 = new C14;
c14.myMethod14(cnHELLO);
// without the 'var', myMethod should end up on the global object -
class C15 {myMethod15 = function XYZ(msg){print(msg);}}
var c15 = new C15;
myMethod15(cnHELLO);
//-----------------------------------------------------------------------------
/*
* No values are checked, and nothing interesting happens below. The test
* is designed to see simply that properties can be defined and invoked.
*/
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber (bug);
printStatus (summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,100 @@
/*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (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 expressed
* or implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* 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.
*
* Contributor(s): pschwartau@netscape.com
* Date: 2001-06-24
*
* SUMMARY: Negative test: a class method may not change the value of this.
*/
//-------------------------------------------------------------------------------------------------
var bug = '(none)';
var summary = 'Negative test: a class method may not change the value of this';
var self = this; // capture a reference to the global object
class A
{
}
class B
{
function changeThis()
{
this = new Object();
}
}
class C
{
function changeThis()
{
this = self;
}
}
class CC extends C
{
var m = changeThis;
}
class D
{
function changeThis()
{
this = objA;
}
}
class E
{
function E (obj:B)
{
this = obj;
}
}
var objA = new A;
var objB = new B;
var objC = new C;
var objCC = new CC;
var objD = new D;
var objE = new E(objB);
objB.changeThis();
objC.changeThis();
objCC.m();
objD.changeThis();
//-------------------------------------------------------------------------------------------------
test();
//-------------------------------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber (bug);
printStatus (summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,77 @@
/*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (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 expressed
* or implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* 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.
*
* Contributor(s): pschwartau@netscape.com
* Date: 2001-06-24
*
* SUMMARY: Should not get 'duplicate class definition' warning
* if the second definition is commented out -
*/
//-------------------------------------------------------------------------------------------------
var bug = '(none)';
var summary = "Don't give 'duplicate class definition' warning if 2nd definition is commented out";
class A {} // class A{}
var a = new A;
class B {} /* class B {} */
var b = new B;
class C
{
}
var c = new C;
/*********************************************************
class C
{
}
var c = new C;
*********************************************************/
class D
{
function m() {return 1111;}
}
/*********************************************************
class D
{
function m() {return 22222;}
}
var d = new D;
*********************************************************/
var d = new D;
//-------------------------------------------------------------------------------------------------
test();
//-------------------------------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber (bug);
printStatus (summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,95 @@
/*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (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 expressed
* or implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* 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.
*
* Contributor(s): pschwartau@netscape.com
* Date: 2001-06-25
*
* SUMMARY: Negative test: a class method may not change the value of this.
*/
//-------------------------------------------------------------------------------------------------
var bug = '(none)';
var summary = 'Negative test: a class method may not change the value of this';
var self = this; // capture a reference to the global object
class A
{
function changeThis()
{
this = self;
}
}
class AA extends A
{
var m1:Function = changeThis;
function m2()
{
return typeof changeThis;
}
function m3()
{
return typeof m1;
}
}
var objA = new A;
var objAA = new AA;
status = inSection(1);
actual = typeof objAA.m1;
expect = TYPE_FUNCTION;
addThis();
status = inSection(2);
actual = objAA.m2();
expect = TYPE_FUNCTION;
addThis();
status = inSection(3);
actual = objAA.m3();
expect = TYPE_FUNCTION;
addThis();
//-------------------------------------------------------------------------------------------------
test();
//-------------------------------------------------------------------------------------------------
function addThis()
{
statusitems[UBound] = status;
actualvalues[UBound] = actual;
expectedvalues[UBound] = expect;
UBound++;
}
function test()
{
enterFunc ('test');
printBugNumber (bug);
printStatus (summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,208 @@
/*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (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 expressed
* or implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* 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.
*
* Contributor(s): waldemar@netscape.com,pschwartau@netscape.com
* Date: 2001-06-25
*
* SUMMARY: Testing static members of classes
*
*/
//-------------------------------------------------------------------------------------------------
var UBound = 0;
var bug = '(none)';
var summary = 'Testing static members of classes';
var cnERROR = 'ERROR!!!';
var cnNOERROR = 'NO ERRROR WAS THROWN -';
var status = '';
var statusitems = [];
var actual = '';
var actualvalues = [];
var expect= '';
var expectedvalues = [];
class C
{
static var v = "Cv";
static var x = "Cx";
static var y = "Cy";
static var z = "Cz";
}
interface A
{
static var x = "Ax";
static var i = "Ai";
static var j = "Aj";
}
interface B
{
static var x = "Bx";
static var y = "By";
static var j = "Bj";
}
class D extends C implements A, B
{
static var v = "Dv";
}
status = inSection(1);
actual = C.v;
expect = "Cv";
addThis();
status = inSection(2);
actual = C.x;
expect = "Cx";
addThis();
status = inSection(3);
actual = C.y;
expect = "Cy";
addThis();
status = inSection(4);
actual = C.z;
expect = "Cz";
addThis();
status = inSection(5);
actual = A.x;
expect = "Ax";
addThis();
status = inSection(6);
actual = B.y;
expect = "By";
addThis();
status = inSection(7);
actual = D.v;
expect = "Dv";
addThis();
status = inSection(8);
actual = D.x;
expect = "Cx"; //(superclass preferred over "Ax" or "Bx")
addThis();
status = inSection(9);
actual = D.y;
expect = "Cy"; //(superclass preferred over "By")
addThis();
status = inSection(10);
actual = D.z;
expect = "Cz";
addThis();
status = inSection(11);
actual = D.i;
expect = "Ai";
addThis();
status = inSection(12);
actual = cnNOERROR;
try
{
D.j;
}
catch (e)
{
actual = cnERROR;
}
expect = cnERROR; /// error because of ambiguity: "Aj" or "Bj"?
addThis();
status = inSection(13);
actual = D.A::j;
expect = "Aj";
addThis();
status = inSection(14);
actual = D.B::j;
expect = "Bj";
addThis();
status = inSection(15);
actual = D.A::x;
expect = "Ax";
addThis();
status = inSection(16);
actual = D.A::i;
expect = "Ai";
addThis();
status = inSection(17);
D.x = 5;
actual = C.x;
expect = 5; //(same variable)
addThis();
status = inSection(18);
C.v = 7;
actual = D.v;
expect = "Dv"; //(different variables)
addThis();
status = inSection(19);
actual = C.v;
expect = 7;
addThis();
//-------------------------------------------------------------------------------------------------
test();
//-------------------------------------------------------------------------------------------------
function addThis()
{
statusitems[UBound] = status;
actualvalues[UBound] = actual;
expectedvalues[UBound] = expect;
UBound++;
}
function test()
{
enterFunc ('test');
printBugNumber (bug);
printStatus (summary);
for (var i = 0; i < UBound; i++)
{
reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
}
exitFunc ('test');
}
function getStatus(i)
{
return statusitems[i];
}

Просмотреть файл

@ -0,0 +1,171 @@
/*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (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 expressed
* or implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* 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.
*
* Contributor(s): pschwartau@netscape.com
* Date: 2001-06-25
*
*
* SUMMARY: Testing access of class methods from within class block.
* We'll test the syntax both with and without using 'this'.
*
*/
//-------------------------------------------------------------------------------------------------
var UBound = 0;
var bug = '(none)';
var summary = 'Testing access of class methods from within class block';
var status = '';
var statusitems = [];
var actual = '';
var actualvalues = [];
var expect= '';
var expectedvalues = [];
/*
* Try to capture the method 'm' in the variable 'M'.
* Test the syntax with and without using the keyword 'this'.
* Test with and without a return value in the method.
*/
class A
{
function m(){}
var M = m;
}
class B
{
function m(){}
var M = this.m;
}
class C
{
function m(){return 'Output defined in class C method "m"';}
var M = m;
}
class D
{
function m(){return 'Output defined in class D method "m"';}
var M = this.m;
}
var objA = new A;
var objB = new B;
var objC = new C;
var objD = new D;
// --------- objA ----------------
status = inSection(1);
actual = typeof objA.m;
expect = TYPE_FUNCTION;
addThis();
status = inSection(2);
actual = typeof objA.M;
expect = TYPE_FUNCTION;
addThis();
// --------- objB ----------------
status = inSection(3);
actual = typeof objB.m;
expect = TYPE_FUNCTION;
addThis();
status = inSection(4);
actual = typeof objB.M;
expect = TYPE_FUNCTION;
addThis();
// --------- objC ----------------
status = inSection(5);
actual = typeof objC.m;
expect = TYPE_FUNCTION;
addThis();
status = inSection(6);
actual = typeof objC.m(); // testing the return value
expect = TYPE_STRING;
addThis();
status = inSection(7);
actual = typeof objC.M;
expect = TYPE_FUNCTION;
addThis();
status = inSection(8);
actual = typeof objC.M();
expect = TYPE_STRING;
addThis();
// --------- objD ----------------
status = inSection(9);
actual = typeof objD.m;
expect = TYPE_FUNCTION;
addThis();
status = inSection(10);
actual = typeof objD.m();
expect = TYPE_STRING;
addThis();
status = inSection(11);
actual = typeof objD.M;
expect = TYPE_FUNCTION;
addThis();
status = inSection(12);
actual = typeof objD.M();
expect = TYPE_STRING;
addThis();
//-------------------------------------------------------------------------------------------------
test();
//-------------------------------------------------------------------------------------------------
function addThis()
{
statusitems[UBound] = status;
actualvalues[UBound] = actual;
expectedvalues[UBound] = expect;
UBound++;
}
function test()
{
enterFunc ('test');
printBugNumber (bug);
printStatus (summary);
for (var i = 0; i < UBound; i++)
{
reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
}
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,190 @@
/*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (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 expressed
* or implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* 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.
*
* Contributor(s): pschwartau@netscape.com
* Date: 2001-06-25
*
*
* SUMMARY: Testing access of a class method defined in a superclass.
* We'll test the syntax both with and without using 'this'.
*
*/
//-------------------------------------------------------------------------------------------------
var UBound = 0;
var bug = '(none)';
var summary = 'Testing access of a class method defined in a superclass';
var status = '';
var statusitems = [];
var actual = '';
var actualvalues = [];
var expect= '';
var expectedvalues = [];
/*
* Try to capture the method 'm' in the variable 'M'.
* Test the syntax with and without using the keyword 'this'.
* Test with and without a return value in the method.
*/
class A
{
function m(){}
}
class AA extends A
{
var M = m;
}
class B
{
function m(){}
}
class BB extends B
{
var M = this.m;
}
class C
{
function m(){return 'Output defined in class C method "m"';}
}
class CC extends C
{
var M = m;
}
class D
{
function m(){return 'Output defined in class D method "m"';}
}
class DD extends D
{
var M = this.m;
}
var objAA = new AA;
var objBB = new BB;
var objCC = new CC;
var objDD = new DD;
// --------- objAA ----------------
status = inSection(1);
actual = typeof objAA.m;
expect = TYPE_FUNCTION;
addThis();
status = inSection(2);
actual = typeof objAA.M;
expect = TYPE_FUNCTION;
addThis();
// --------- objBB ----------------
status = inSection(3);
actual = typeof objBB.m;
expect = TYPE_FUNCTION;
addThis();
status = inSection(4);
actual = typeof objBB.M;
expect = TYPE_FUNCTION;
addThis();
// --------- objCC ----------------
status = inSection(5);
actual = typeof objCC.m;
expect = TYPE_FUNCTION;
addThis();
status = inSection(6);
actual = typeof objCC.m(); // testing the return value
expect = TYPE_STRING;
addThis();
status = inSection(7);
actual = typeof objCC.M;
expect = TYPE_FUNCTION;
addThis();
status = inSection(8);
actual = typeof objCC.M();
expect = TYPE_STRING;
addThis();
// --------- objDD ----------------
status = inSection(9);
actual = typeof objDD.m;
expect = TYPE_FUNCTION;
addThis();
status = inSection(10);
actual = typeof objDD.m();
expect = TYPE_STRING;
addThis();
status = inSection(11);
actual = typeof objDD.M;
expect = TYPE_FUNCTION;
addThis();
status = inSection(12);
actual = typeof objDD.M();
expect = TYPE_STRING;
addThis();
//-------------------------------------------------------------------------------------------------
test();
//-------------------------------------------------------------------------------------------------
function addThis()
{
statusitems[UBound] = status;
actualvalues[UBound] = actual;
expectedvalues[UBound] = expect;
UBound++;
}
function test()
{
enterFunc ('test');
printBugNumber (bug);
printStatus (summary);
for (var i = 0; i < UBound; i++)
{
reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
}
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,129 @@
/*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (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 expressed
* or implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* 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.
*
* Contributor(s): pschwartau@netscape.com
* Date: 2001-06-26
*
* SUMMARY: Testing that classes can see global variables
*/
//-------------------------------------------------------------------------------------------------
var UBound = 0;
var bug = '(none)';
var summary = 'Testing that classes can see global variables';
var status = '';
var statusitems = [];
var actual = '';
var actualvalues = [];
var expect= '';
var expectedvalues = [];
var self = this; // capture a reference to the global object
var objX = {};
var objY = {}
class A
{
}
class B
{
function B()
{
objX = objA; // global variable defined below -
}
}
status = inSection(1);
actual = objX;
expect = self;
addThis();
/******************************************************
class C
{
function changeX()
{
objX = self;
}
}
class CC extends C
{
var m = test;
}
class D
{
function changeX()
{
objX = objA;
}
}
class E
{
function E (obj:B)
{
objX = obj;
}
}
******************************************************/
var objA = new A;
var objB = new B;
/******************************************************
var objC = new C;
var objCC = new CC;
var objD = new D;
var objE = new E(objB);
objB.changeX();
objC.changeX();
objCC.m();
objD.changeX();
******************************************************/
//-------------------------------------------------------------------------------------------------
test();
//-------------------------------------------------------------------------------------------------
function addThis()
{
statusitems[UBound] = status;
actualvalues[UBound] = actual;
expectedvalues[UBound] = expect;
UBound++;
}
function test()
{
enterFunc ('test');
printBugNumber (bug);
printStatus (summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,109 @@
/*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (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 expressed
* or implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* 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.
*
* Contributor(s): pschwartau@netscape.com
* Date: 2001-06-27
*
* SUMMARY: Accessing static class methods via C or instances of C
*
*/
//-------------------------------------------------------------------------------------------------
var UBound = 0;
var bug = '(none)';
var summary = 'Accessing static class methods via C or instances of C';
var cnReturn = 'Return value of static method m of class C';
var status = '';
var statusitems = [];
var actual = '';
var actualvalues = [];
var expect= '';
var expectedvalues = [];
class C
{
static function m()
{
return cnReturn;
}
}
var c1 = new C;
var c2 = new C;
status = inSection(1);
actual = C.m;
expect = c1.m;
addThis();
status = inSection(2);
actual = C.m;
expect = (new C).m;
addThis();
status = inSection(3);
actual = C.m();
expect = c1.m();
addThis();
status = inSection(4);
actual = C.m();
expect = (new C).m();
addThis();
status = inSection(5);
actual = c1.m;
expect = c2.m;
addThis();
status = inSection(6);
actual = c1.m();
expect = c2.m();
addThis();
//-------------------------------------------------------------------------------------------------
test();
//-------------------------------------------------------------------------------------------------
function addThis()
{
statusitems[UBound] = status;
actualvalues[UBound] = actual;
expectedvalues[UBound] = expect;
UBound++;
}
function test()
{
enterFunc ('test');
printBugNumber (bug);
printStatus (summary);
for (var i = 0; i < UBound; i++)
{
reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
}
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,202 @@
/*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (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 expressed
* or implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* 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.
*
* Contributor(s): pschwartau@netscape.com
* Date: 2001-07-02
*
* SUMMARY: An instance of a class C should have type 'object'
* Waldemar answered a few questions on this as follows :
*
* >Given user defined classes C, & 'D extends C'
* >
* >var c:C;
* >
* >Does 'typeof c' return "C" or "undefined"?
*
* typeof operates on whatever the current value in c is,
* which will be null if you haven't initialized the variable
* (null instead of undefined because undefined is not a valid value
* of type C). The type of the variable c is irrelevant here
* except to the extent it affects the value that is in c.
* Since c is null, typeof c is "object".
*
*
* >c = new D;
* >
* >How about 'typeof c' now?
* >
*
* It's still "object" for compatibility with ECMA Edition 3.
* We might want to deprecate typeof.
*
* The Edition 4 operator that returns the class of something is c.class.
* In your first example c.class will be the class Null,
* while in the second example c.class will be D.
*
*/
//-------------------------------------------------------------------------------------------------
var UBound = 0;
var bug = '(none)';
var summary = 'An instance of a class C should have type "object"';
var status = '';
var statusitems = [];
var actual = '';
var actualvalues = [];
var expect= '';
var expectedvalues = [];
class C1
{
}
class C2 extends C1
{
}
static class C3
{
this.texture = 'smooth';
this.width = 0;
}
class C4 extends C3
{
}
dynamic class C5
{
this.texture = 'smooth';
this.width = 0;
}
class C6 extends C5
{
}
// Define all our objects -
var m1:C1;
var n1 = new C1;
var m2:C2;
var n2 = new C2;
var m3:C3;
var n3 = new C3;
var m4:C4;
var n4 = new C4;
var m5:C5;
var n5 = new C5;
var m6:C6;
var n6 = new C6;
// Test typeof for each -
status = 'Section m1 of test';
actual = typeof m1;
expect = TYPE_OBJECT;
addThis();
status = 'Section n1 of test';
actual = typeof n1;
expect = TYPE_OBJECT;
addThis();
status = 'Section m2 of test';
actual = typeof m2;
expect = TYPE_OBJECT;
addThis();
status = 'Section n2 of test';
actual = typeof n2;
expect = TYPE_OBJECT;
addThis();
status = 'Section m3 of test';
actual = typeof m3;
expect = TYPE_OBJECT;
addThis();
status = 'Section n3 of test';
actual = typeof n3;
expect = TYPE_OBJECT;
addThis();
status = 'Section m4 of test';
actual = typeof m4;
expect = TYPE_OBJECT;
addThis();
status = 'Section n4 of test';
actual = typeof n4;
expect = TYPE_OBJECT;
addThis();
status = 'Section m5 of test';
actual = typeof m5;
expect = TYPE_OBJECT;
addThis();
status = 'Section n5 of test';
actual = typeof n5;
expect = TYPE_OBJECT;
addThis();
status = 'Section m6 of test';
actual = typeof m6;
expect = TYPE_OBJECT;
addThis();
status = 'Section n6 of test';
actual = typeof n6;
expect = TYPE_OBJECT;
addThis();
//-------------------------------------------------------------------------------------------------
test();
//-------------------------------------------------------------------------------------------------
function addThis()
{
statusitems[UBound] = status;
actualvalues[UBound] = actual;
expectedvalues[UBound] = expect;
UBound++;
}
function test()
{
enterFunc ('test');
printBugNumber (bug);
printStatus (summary);
for (var i=0; i<UBound; i++)
{
reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
}
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,183 @@
/*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (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 expressed
* or implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* 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.
*
* Contributor(s): pschwartau@netscape.com
* Date: 2001-07-02
*
* SUMMARY: Testing is operator on user-defined classes
*
*/
//-----------------------------------------------------------------------------
var UBound = 0;
var bug = '(none)';
var summary = 'Testing is operator on user-defined classes';
var cnYES = 'given obj is given Class == true';
var cnNO = 'given obj is given Class == false';
var cnRED = 'red';
var status = '';
var statusitems = [];
var actual = '';
var actualvalues = [];
var expect= '';
var expectedvalues = [];
class A
{
}
class B extends A
{
}
class C
{
function C ()
{
this.color = cnRED;
}
}
class D
{
static function D()
{
this.color = cnRED;
}
}
var objA1 = new A;
var objA2 : A = new A;
var objA3 : A = (new A);
var objB1 = new B;
var objB2 : B = new B;
var objB3 : B = (new B);
var objC1 = new C;
var objC2 : C = new C;
var objC3 : C = (new C);
var objD1 = new D;
var objD2 : D = new D;
var objD3 : D = (new D);
status = 'Section A1 of test';
actual = objA1 is A;
expect = true;
addThis();
status = 'Section A2 of test';
actual = objA2 is A;
expect = true;
addThis();
status = 'Section A3 of test';
actual = objA3 is A;
expect = true;
addThis();
status = 'Section B1 of test';
actual = objB1 is B;
expect = true;
addThis();
status = 'Section B2 of test';
actual = objB2 is B;
expect = true;
addThis();
status = 'Section B3 of test';
actual = objB3 is B;
expect = true;
addThis();
status = 'Section C1 of test';
actual = objC1 is C;
expect = true;
addThis();
status = 'Section C2 of test';
actual = objC2 is C;
expect = true;
addThis();
status = 'Section C3 of test';
actual = objC3 is C;
expect = true;
addThis();
status = 'Section D1 of test';
actual = objD1 is D;
expect = true;
addThis();
status = 'Section D2 of test';
actual = objD2 is D;
expect = true;
addThis();
status = 'Section D3 of test';
actual = objD3 is D;
expect = true;
addThis();
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function addThis()
{
statusitems[UBound] = status;
actualvalues[UBound] = isOfClass(actual);
expectedvalues[UBound] = isOfClass(expect);
UBound++;
}
function test()
{
enterFunc ('test');
printBugNumber (bug);
printStatus (summary);
for (var i=0; i<UBound; i++)
{
reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
}
exitFunc ('test');
}
function isOfClass(bAnswer)
{
return bAnswer? cnYES : cnNO;
}

Просмотреть файл

@ -0,0 +1,183 @@
/*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (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 expressed
* or implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* 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.
*
* Contributor(s): pschwartau@netscape.com
* Date: 2001-07-02
*
* SUMMARY: Testing is operator on user-defined classes
*
*/
//-------------------------------------------------------------------------------------------------
var UBound = 0;
var bug = '(none)';
var summary = 'Testing is operator on user-defined classes';
var cnYes = 'objC is C == true';
var cnNo = 'objC is C == false';
var cnRed = 'red';
var status = '';
var statusitems = [];
var actual = '';
var actualvalues = [];
var expect= '';
var expectedvalues = [];
class A
{
}
class B extends A
{
}
class C
{
function C ()
{
this.color = cnRed;
}
}
class D
{
static function D()
{
this.color = cnRed;
}
}
var objA1 = new A;
var objA2 : A = new A;
var objA3 : A = (new A);
var objB1 = new B;
var objB2 : B = new B;
var objB3 : B = (new B);
var objC1 = new C;
var objC2 : C = new C;
var objC3 : C = (new C);
var objD1 = new D;
var objD2 : D = new D;
var objD3 : D = (new D);
status = 'Section A1 of test';
actual = objA1 is A;
expect = true;
addThis();
status = 'Section A2 of test';
actual = objA2 is A;
expect = true;
addThis();
status = 'Section A3 of test';
actual = objA3 is A;
expect = true;
addThis();
status = 'Section B1 of test';
actual = objB1 is B;
expect = true;
addThis();
status = 'Section B2 of test';
actual = objB2 is B;
expect = true;
addThis();
status = 'Section B3 of test';
actual = objB3 is B;
expect = true;
addThis();
status = 'Section C1 of test';
actual = objC1 is C;
expect = true;
addThis();
status = 'Section C2 of test';
actual = objC2 is C;
expect = true;
addThis();
status = 'Section C3 of test';
actual = objC3 is C;
expect = true;
addThis();
status = 'Section D1 of test';
actual = objD1 is D;
expect = true;
addThis();
status = 'Section D2 of test';
actual = objD2 is D;
expect = true;
addThis();
status = 'Section D3 of test';
actual = objD3 is D;
expect = true;
addThis();
//-------------------------------------------------------------------------------------------------
test();
//-------------------------------------------------------------------------------------------------
function addThis()
{
statusitems[UBound] = status;
actualvalues[UBound] = isClass(actual);
expectedvalues[UBound] = isClass(expect);
UBound++;
}
function test()
{
enterFunc ('test');
printBugNumber (bug);
printStatus (summary);
for (var i=0; i<UBound; i++)
{
reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
}
exitFunc ('test');
}
function isClass(yes)
{
return yes? cnYes : cnNo;
}

Просмотреть файл

@ -0,0 +1,101 @@
/*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (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 expressed
* or implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* 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.
*
* Contributor(s): coliver@mminternet.com, pschwartau@netscape.com
* Date: 2001-07-03
*
* SUMMARY: Testing scope with nested functions
*
* From correspondence with Christopher Oliver <coliver@mminternet.com>:
*
* Note the results should be:
*
* [object global]
* [object Object]
* [object global]
*
* This is what we are checking for in this testcase -
*/
//-------------------------------------------------------------------------------------------------
var UBound = 0;
var bug = '(none)';
var summary = 'Testing scope with nested functions';
var self = this; // capture a reference to the global object;
var cnGlobal = self.toString();
var cnObject = (new Object).toString();
var statusitems = [];
var actualvalues = [];
var expectedvalues = [];
// JS 1.5 - style constructor
prototype function a()
{
function b()
{
capture(this.toString());
}
this.c = function()
{
capture(this.toString());
b();
}
b();
}
var obj = new a(); // captures actualvalues[0]
obj.c(); // captures actualvalues[1], actualvalues[2]
// The values we expect - see introduction above -
expectedvalues[0] = cnGlobal;
expectedvalues[1] = cnObject;
expectedvalues[2] = cnGlobal;
//-------------------------------------------------------------------------------------------------
test();
//-------------------------------------------------------------------------------------------------
function capture(val)
{
actualvalues[UBound] = val;
statusitems[UBound] = inSection(UBound);
UBound++;
}
function test()
{
enterFunc ('test');
printBugNumber (bug);
printStatus (summary);
for (var i=0; i<UBound; i++)
{
reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
}
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,103 @@
/*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (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 expressed
* or implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* 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.
*
* Contributor(s): coliver@mminternet.com, pschwartau@netscape.com
* Date: 2001-07-03
*
* SUMMARY: Testing scope with nested objects
*
* From correspondence with Christopher Oliver <coliver@mminternet.com>:
*
* Note the results should be:
*
* [object global]
* [object Object]
* [object global]
*
* This is what we are checking for in this testcase -
*/
//-------------------------------------------------------------------------------------------------
var UBound = 0;
var bug = '(none)';
var summary = 'Testing scope with nested objects';
var self = this; // capture a reference to the global object;
var cnGlobal = self.toString();
var cnObject = (new Object).toString();
var statusitems = [];
var actualvalues = [];
var expectedvalues = [];
class A
{
function b()
{
capture(this.toString());
}
function c()
{
capture(this.toString());
b();
}
constructor function A()
{
b();
}
}
var a = new A; // captures actualvalues[0]
a.c(); // captures actualvalues[1], actualvalues[2]
// The values we expect - see introduction above -
expectedvalues[0] = cnGlobal;
expectedvalues[1] = cnObject;
expectedvalues[2] = cnGlobal;
//-------------------------------------------------------------------------------------------------
test();
//-------------------------------------------------------------------------------------------------
function capture(val)
{
actualvalues[UBound] = val;
statusitems[UBound] = inSection(UBound);
UBound++;
}
function test()
{
enterFunc ('test');
printBugNumber (bug);
printStatus (summary);
for (var i=0; i<UBound; i++)
{
reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
}
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,296 @@
/*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (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 expressed
* or implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* 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.
*
* Contributor(s): pschwartau@netscape.com
* Date: 2001-07-23
*
* SUMMARY: Testing class inheritance
*
*/
//-------------------------------------------------------------------------------------------------
var UBound:Integer = 0;
var bug:String = '(none)';
var summary:String = 'Testing class inheritance';
var propNAME:String = 'name';
var propMOTHER:String = 'mother';
var propFATHER:String = 'father';
var propNONEXIST:String = '@#$%@#^';
var nameUNINIT:String = '(NO NAME HAS BEEN ASSIGNED)';
var nameMOTHER:String = 'Bessie';
var nameFATHER:String = 'Red';
var nameCHILD:String = 'Junior';
var status:String = '';
var statusitems:Array = [];
var actual:String = '';
var actualvalues:Array = [];
var expect:String= '';
var expectedvalues:Array = [];
class Cow
{
static var count:Integer = 0;
var name:String = nameUNINIT;
constructor function Cow(sName:String)
{
count++;
name = sName;
}
}
class Calf extends Cow
{
var mother:Cow;
var father:Cow;
constructor function Calf(sName:String, objMother:Cow, objFather:Cow)
{
Cow(sName);
mother = objMother;
father = objFather;
}
}
var cowMOTHER = new Cow(nameMOTHER);
status = inSection(1);
actual = Cow.count;
expect = 1;
addThis();
status = inSection(2);
actual = typeof cowMOTHER;
expect = TYPE_OBJECT;
addThis();
status = inSection(3);
actual = cowMOTHER is Cow;
expect = true;
addThis();
status = inSection(4);
actual = cowMOTHER is Object;
expect = true;
addThis();
status = inSection(5);
actual = cowMOTHER.name;
expect = nameMOTHER;
addThis();
status = inSection(6);
actual = cowMOTHER[propNAME];
expect = nameMOTHER;
addThis();
status = inSection(7);
actual = cowMOTHER[propNONEXIST];
expect = undefined;
addThis();
var cowFATHER = new Cow(nameFATHER);
status = inSection(8);
actual = Cow.count;
expect = 2;
addThis();
status = inSection(9);
actual = typeof cowFATHER;
expect = TYPE_OBJECT;
addThis();
status = inSection(10);
actual = cowFATHER is Cow
expect = true;
addThis();
status = inSection(11);
actual = cowFATHER is Object;
expect = true;
addThis();
status = inSection(12);
actual = cowFATHER.name;
expect = nameFATHER;
addThis();
status = inSection(13);
actual = cowFATHER[propNAME];
expect = nameFATHER;
addThis();
status = inSection(14);
actual = cowFATHER[propNONEXIST];
expect = undefined;
addThis();
var cowCHILD = new Calf(nameCHILD, cowMOTHER, cowFATHER);
status = inSection(15);
actual = Cow.count;
expect = 3;
addThis();
status = inSection(16);
actual = Calf.count;
expect = Cow.count;
addThis();
status = inSection(17);
actual = typeof cowCHILD;
expect = TYPE_OBJECT;
addThis();
status = inSection(18);
actual = cowCHILD is Calf;
expect = true;
addThis();
status = inSection(19);
actual = cowCHILD is Cow;
expect = true;
addThis();
status = inSection(20);
actual = cowCHILD is Object;
expect = true;
addThis();
status = inSection(21);
actual = cowCHILD.mother;
expect = cowMOTHER;
addThis();
status = inSection(22);
actual = cowCHILD[propMOTHER];
expect = cowMOTHER;
addThis();
status = inSection(23);
actual = cowCHILD.mother.name;
expect = nameMOTHER;
addThis();
status = inSection(24);
actual = cowCHILD.mother[propNAME];
expect = nameMOTHER;
addThis();
status = inSection(25);
actual = cowCHILD[propMOTHER].name;
expect = nameMOTHER;
addThis();
status = inSection(26);
actual = cowCHILD[propMOTHER][propNAME];
expect = nameMOTHER;
addThis();
status = inSection(27);
actual = cowCHILD.father;
expect = cowFATHER;
addThis();
status = inSection(28);
actual = cowCHILD[propFATHER];
expect = cowFATHER;
addThis();
status = inSection(29);
actual = cowCHILD.father.name;
expect = nameFATHER;
addThis();
status = inSection(30);
actual = cowCHILD.father[propNAME];
expect = nameFATHER;
addThis();
status = inSection(31);
actual = cowCHILD[propFATHER].name;
expect = nameFATHER;
addThis();
status = inSection(32);
actual = cowCHILD[propFATHER][propNAME];
expect = nameFATHER;
addThis();
status = inSection(33);
actual = cowCHILD.name;
expect = nameCHILD;
addThis();
status = inSection(34);
actual = cowCHILD[propNAME];
expect = nameCHILD;
addThis();
status = inSection(35);
actual = cowCHILD[propNONEXIST];
expect = undefined;
addThis();
cowCHILD.name = nameCHILD;
status = inSection(36);
actual = cowCHILD.name;
expect = nameCHILD;
addThis();
status = inSection(37);
actual = cowCHILD[propNAME];
expect = nameCHILD;
addThis();
//-------------------------------------------------------------------------------------------------
test();
//-------------------------------------------------------------------------------------------------
function addThis()
{
statusitems[UBound] = status;
actualvalues[UBound] = actual;
expectedvalues[UBound] = expect;
UBound++;
}
function test()
{
enterFunc ('test');
printBugNumber (bug);
printStatus (summary);
for (var i=0; i<UBound; i++)
{
reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
}
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,38 @@
/*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (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.org code.
*
* 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.
*
* Contributor(s): pschwartau@netscape.com
* Date: 2001-06-24
*
* SUMMARY: Utilities
*
*/
//-------------------------------------------------------------------------------------------------
var TYPE_NEVER = 'never';
var TYPE_VOID = 'void';
var TYPE_NULL = 'null';
var TYPE_BOOLEAN = 'boolean';
var TYPE_INTEGER = 'integer';
var TYPE_NUMBER = 'number';
var TYPE_CHARACTER = 'character';
var TYPE_STRING = 'string';
var TYPE_FUNCTION = 'function';
var TYPE_ARRAY = 'array';
var TYPE_ARRAY_CONST = 'const array';
var TYPE_TYPE = 'type';
var TYPE_OBJECT ='object';