JavaScript Test Library - update test success comparators, bug 349827

This commit is contained in:
bclary%bclary.com 2006-08-23 06:08:50 +00:00
Родитель 69cae3b87b
Коммит a523f0f77d
45 изменённых файлов: 116 добавлений и 368 удалений

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

@ -43,18 +43,24 @@ BUG(277935);
// Check that assignments like "a..b = c" causes proper error
var expect = 'PASS1,PASS2';
var actual = '';
var msg = <foo><bar><s/></bar></foo>;
try {
eval('msg..s = 0');
SHOULD_THROW(1);
} catch (e) {
actual += 'PASS1';
}
try {
eval('msg..s += 0');
SHOULD_THROW(2);
} catch (e) {
actual += ',PASS2';
}
TEST(1, expect, actual);
END();

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

@ -45,7 +45,12 @@ var expect = 'No Crash';
printBugNumber (bug);
printStatus (summary);
if (typeof document == 'undefined')
{
printStatus ("Expect possible out of memory error");
expectExitCode(0);
expectExitCode(3);
}
var str = '<fu>x</fu>';
for (var icount = 0; icount < 20; icount++)

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

@ -46,6 +46,9 @@ var expect = 'No Crash';
printBugNumber (bug);
printStatus (summary);
expectExitCode(0);
expectExitCode(3);
var str = '0123456789';
for (var icount = 0; icount < 24; icount++)

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

@ -106,7 +106,10 @@ new TestCase( SECTION, "String.prototype.indexOf.length = null; String.prototype
new TestCase( SECTION, "delete String.prototype.indexOf.length", false, delete String.prototype.indexOf.length );
new TestCase( SECTION, "delete String.prototype.indexOf.length; String.prototype.indexOf.length", 1, eval("delete String.prototype.indexOf.length; String.prototype.indexOf.length") );
new TestCase( SECTION, "var s = new String(); s.indexOf()", -1, eval("var s = new String(); s.indexOf()") );
new TestCase( SECTION,
"var s = new String(); s.indexOf()",
-1,
eval("var s = new String(); s.indexOf()") );
// some Unicode tests.

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

@ -1,4 +1,6 @@
/* ***** BEGIN LICENSE BLOCK *****
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
@ -38,26 +40,30 @@
var bug = '58946';
var stat = 'Testing a return statement inside a catch statement inside a function';
test();
function test() {
enterFunc ("test");
printBugNumber (bug);
printStatus (stat);
expect = 'PASS';
try
function f()
{
throw 'PASS';
}
catch(e)
{
return e;
try
{
throw 'PASS';
}
catch(e)
{
return e;
}
}
actual = f();
reportCompare(expect, actual, stat);
exitFunc ("test");
}
}

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

@ -50,11 +50,18 @@
variable object and using empty property attributes.
*/
var bug = '(none)';
var summary = '10.1.4.1 Entering An Execution Context';
var actual = '';
var expect = '';
test();
function test()
{
enterFunc ("test");
printBugNumber (bug);
printStatus (summary);
var y;
eval("var x = 1");
@ -70,5 +77,7 @@ function test()
if (!delete x)
reportFailure ("Expected to be able to delete x");
reportCompare('PASS', 'PASS', '10.1.4.1 Entering An Execution Context');
exitFunc("test");
}

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

@ -56,6 +56,7 @@ function test()
printBugNumber (bug);
printStatus (summary);
tryThis();
reportCompare('No Crash', 'No Crash', 'Should not crash');
exitFunc ('test');
}

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

@ -104,13 +104,7 @@ function test()
obj1 = new RegExp(s);
obj2 = new RegExp(obj1);
for (prop in obj2)
{
msg = status + quote(prop);
actual = obj2[prop];
expect = obj1[prop];
reportCompare (expect, actual, msg);
}
reportCompare (obj1 + '', obj2 + '', status);
}
exitFunc ('test');

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

@ -110,13 +110,7 @@ function test()
obj1 = new RegExp(s);
obj2 = new RegExp(obj1, undefined); // see introduction to bug
for (prop in obj2)
{
msg = status + quote(prop);
actual = obj2[prop];
expect = obj1[prop];
reportCompare (expect, actual, msg);
}
reportCompare (obj1 + '', obj2 + '', status);
}
exitFunc ('test');

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

@ -116,13 +116,7 @@ function test()
obj1 = new RegExp(s, f);
obj2 = new RegExp(obj1);
for (prop in obj2)
{
msg = status + quote(prop);
actual = obj2[prop];
expect = obj1[prop];
reportCompare (expect, actual, msg);
}
reportCompare (obj1 + '', obj2 + '', status);
}
}

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

@ -122,13 +122,7 @@ function test()
obj1 = new RegExp(s, f);
obj2 = new RegExp(obj1, undefined); // see introduction to bug
for (prop in obj2)
{
msg = status + quote(prop);
actual = obj2[prop];
expect = obj1[prop];
reportCompare (expect, actual, msg);
}
reportCompare (obj1 + '', obj2 + '', status);
}
}

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

@ -161,6 +161,8 @@ function test()
getResults();
}
reportCompare('No Crash', 'No Crash', '');
exitFunc ('test');
}

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

@ -62,6 +62,8 @@ function test()
testThis(500, NO_BACKREFS, 'hello', 'goodbye');
testThis(500, DO_BACKREFS, 'hello', 'goodbye');
reportCompare('No Crash', 'No Crash', '');
exitFunc('test');
}

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

@ -103,3 +103,5 @@ for (var i=0; i<STRESS; i++)
{
}
}
reportCompare('No Crash', 'No Crash', '');

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

@ -47,10 +47,9 @@ function test()
printBugNumber (24712);
var re = /([\S]+([ \t]+[\S]+)*)[ \t]*=[ \t]*[\S]+/;
var result = re.exec("Course_Creator = Test");
var result = re.exec("Course_Creator = Test") + '';
if (!result)
reportFailure ("exec() returned null.");
reportCompare('Course_Creator = Test,Course_Creator,', result, 'exec() returned null');
exitFunc ("test");

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

@ -73,6 +73,7 @@ function test()
s = 're = /[//]/';
tryThis(s);
reportCompare('No Crash', 'No Crash', '');
exitFunc ('test');
}

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

@ -62,5 +62,7 @@ function test()
f();
g();
h();
reportCompare('No Crash', 'No Crash', '');
exitFunc ('test');
}

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

@ -65,5 +65,7 @@ function test()
sToEval += 'h();';
eval(sToEval);
reportCompare('No Crash', 'No Crash', '');
exitFunc ('test');
}

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

@ -76,3 +76,6 @@ s += ' case MinBound :';
s += ' }';
s += '}';
eval(s);
AddTestCase('Do not crash', 'No Crash', 'No Crash');
test();

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

@ -103,3 +103,5 @@ try
catch(e)
{
}
reportCompare('No Crash', 'No Crash', '');

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

@ -42,9 +42,12 @@ var expect = 'No Crash';
printBugNumber (bug);
printStatus (summary);
expectExitCode(0);
expectExitCode(3);
printStatus('This test passes if the browser does not hang or crash');
printStatus('This test expects exit code 0 or 3 to indicate out of memory');
var result = Array(1 << 29).sort();

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

@ -1,80 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Rob Ginda rginda@netscape.com
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
test();
function test()
{
enterFunc ("test");
var EXCEPTION_DATA = "String exception";
var e = "foo";
var caught = false;
printStatus ("Basic catchguard test.");
try
{
throw EXCEPTION_DATA;
}
catch (e if true)
{
caught = true;
e = "this change should not propagate outside of this scope";
}
catch (e if false)
{
reportFailure ("Catch block (e if false) should not have executed.");
}
catch (e)
{
reportFailure ("Catch block (e) should not have executed.");
}
if (!caught)
reportFailure ("Exception was never caught.");
if (e != "foo")
reportFailure ("Exception data modified inside catch() scope should " +
"not be visible in the function scope (e = '" +
e + "'.)");
exitFunc ("test");
}

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

@ -1,76 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Rob Ginda rginda@netscape.com
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
test();
function test()
{
enterFunc ("test");
var EXCEPTION_DATA = "String exception";
var e;
var caught = false;
printStatus ("Basic catchguard test.");
try
{
throw EXCEPTION_DATA;
}
catch (e if true)
{
caught = true;
}
catch (e if true)
{
reportFailure ("Second (e if true) catch block should not have " +
"executed.");
}
catch (e)
{
reportFailure ("Catch block (e) should not have executed.");
}
if (!caught)
reportFailure ("Exception was never caught.");
exitFunc ("test");
}

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

@ -1,85 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Rob Ginda rginda@netscape.com
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
test();
function test()
{
enterFunc ("test");
var EXCEPTION_DATA = "String exception";
var e = "foo", x = "foo";
var caught = false;
printStatus ("Catchguard 'Common Scope' test.");
try
{
throw EXCEPTION_DATA;
}
catch (e if ((x = 1) && false))
{
reportFailure ("Catch block (e if ((x = 1) && false) should not " +
"have executed.");
}
catch (e if (x == 1))
{
caught = true;
}
catch (e)
{
reportFailure ("Same scope should be used across all catchguards.");
}
if (!caught)
reportFailure ("Exception was never caught.");
if (e != "foo")
reportFailure ("Exception data modified inside catch() scope should " +
"not be visible in the function scope (e ='" +
e + "'.)");
if (x != 1)
reportFailure ("Data modified in 'catchguard expression' should " +
"be visible in the function scope (x = '" +
x + "'.)");
exitFunc ("test");
}

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

@ -64,7 +64,11 @@ catch (e)
printStatus('UTF-8 is ' + (utf8Enabled?'':'not ') + 'enabled');
if (utf8Enabled)
if (!utf8Enabled)
{
reportCompare('Not run', 'Not run', 'utf8 is not enabled');
}
else
{
status = summary + ': Throw Error with Unicode message';
expect = 'test \u0440\u0441';

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

@ -104,6 +104,7 @@ function test()
throw e;
}
writeLineToLog('Done');
expect = true;
actual = true;
reportCompare(expect, true, summary);

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

@ -55,6 +55,8 @@ printStatus (summary);
F();
G();
reportCompare('No Crash', 'No Crash', '');
function F(obj)
{
if(!obj)

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

@ -10960,4 +10960,4 @@ if (currentLevel > 1) currentLevel--
if (currentLevel > 1) currentLevel--
reportCompare('No Crash', 'No Crash', '');

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

@ -84,6 +84,10 @@ if (typeof clone == 'function')
expect = '5,6';
addThis();
}
else
{
reportCompare('Test not run', 'Test not run', 'shell only test requires clone()');
}

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

@ -68,3 +68,4 @@ eval(s);
s = 'function g() { function f() {var arguments;}; f();}; g();';
eval(s);
reportCompare('No Crash', 'No Crash', '');

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

@ -143,3 +143,5 @@ function h()
eval(s);
}
h();
reportCompare('No Crash', 'No Crash', '');

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

@ -1034,3 +1034,5 @@ function putVal2ck()
function setValuesFromCookie()
{
}
reportCompare('No Crash', 'No Crash', '');

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

@ -43,6 +43,9 @@ var expect = 'No Crash';
printBugNumber (bug);
printStatus (summary);
expectExitCode(0);
expectExitCode(3);
var nestingLevel = 1000;
function buildTestFunction(N) {

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

@ -43,6 +43,9 @@ var expect = 'No Crash';
printBugNumber (bug);
printStatus (summary);
expectExitCode(0);
expectExitCode(3);
if ("AB".match(/(.*?)*?B/))
{
printStatus(RegExp.lastMatch);

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

@ -48,6 +48,9 @@ EXPECTED = expect;
printBugNumber (bug);
printStatus (summary);
expectExitCode(0);
expectExitCode(3);
var s = "";
s = "abcd";
for (i = 0; i < 100000; i++) {

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

@ -1,81 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* pschwartau@netscape.com
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK *****
*
* Date: 26 Feb 2001
* See http://bugzilla.mozilla.org/show_bug.cgi?id=44009
*
* SUMMARY: Testing that we don't crash on obj.toSource()
*/
//-------------------------------------------------------------------------------------------------
var bug = 44009;
var summary = "Testing that we don't crash on obj.toSource()";
var obj1 = {};
var sToSource = '';
var self = this; //capture a reference to the global JS object -
//-------------------------------------------------------------------------------------------------
test();
//-------------------------------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber (bug);
printStatus (summary);
var obj2 = {};
// test various objects and scopes -
testThis(self);
testThis(this);
testThis(obj1);
testThis(obj2);
exitFunc ('test');
}
// We're just testing that we don't crash by doing this -
function testThis(obj)
{
sToSource = obj.toSource();
obj.prop = obj;
sToSource = obj.toSource();
}

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

@ -69,3 +69,5 @@ if(false)
var3 = 0;
}
reportCompare('No Crash', 'No Crash', '');

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

@ -3137,3 +3137,5 @@ function b_after()
{
writeLineToLog('Visited b_after');
}
reportCompare('No Error', 'No Error', '');

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

@ -73,5 +73,7 @@ function test()
// Just testing that we don't crash on this
encodeURI(URI);
reportCompare('No Crash', 'No Crash', '');
exitFunc ('test');
}

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

@ -2146,3 +2146,5 @@ return "PROXY proxy.hclib.org:80";
else
return "PROXY 172.16.100.20:8080";
}
reportCompare('No Crash', 'No Crash', '');

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

@ -63,6 +63,8 @@ function test()
tryThis(cnTest); // Just testing that we don't crash on this
reportCompare('No Crash', 'No Crash', '');
exitFunc ('test');
}

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

@ -322,3 +322,5 @@ function compte() {
}
}
}
reportCompare('No Crash', 'No Crash', '');

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

@ -530,3 +530,5 @@ function setaction(jumpto)
else if (jumpto == [474]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wiweswolfrom.jpg";
else if (jumpto == [475]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wvdannorby.jpg";
}
reportCompare('No Crash', 'No Crash', '');

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

@ -56,3 +56,5 @@ for(i=0;i<20000;i++)
s += a;
try {eval(s);}
catch (e) {};
reportCompare('No Crash', 'No Crash', '');

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

@ -4431,3 +4431,5 @@ else {
}
}
reportCompare('No Crash', 'No Crash', '');