diff options
| author | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 18:28:41 -0800 |
|---|---|---|
| committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 18:28:41 -0800 |
| commit | 648161bb0edfc3d43db63caed5cc5213bc6cb78f (patch) | |
| tree | 4b825dc642cb6eb9a060e54bf8d69288fbee4904 /JavaScriptCore/tests/mozilla/ecma_3/Exceptions | |
| parent | a65af38181ac7d34544586bdb5cd004de93897ad (diff) | |
| download | external_webkit-648161bb0edfc3d43db63caed5cc5213bc6cb78f.zip external_webkit-648161bb0edfc3d43db63caed5cc5213bc6cb78f.tar.gz external_webkit-648161bb0edfc3d43db63caed5cc5213bc6cb78f.tar.bz2 | |
auto import from //depot/cupcake/@135843
Diffstat (limited to 'JavaScriptCore/tests/mozilla/ecma_3/Exceptions')
10 files changed, 0 insertions, 1264 deletions
diff --git a/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.1.1.js b/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.1.1.js deleted file mode 100644 index 3aab137..0000000 --- a/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.1.1.js +++ /dev/null @@ -1,132 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** -* Version: NPL 1.1/GPL 2.0/LGPL 2.1 -* -* 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 JavaScript Engine testing utilities. -* -* The Initial Developer of the Original Code is Netscape Communications Corp. -* Portions created by the Initial Developer are Copyright (C) 2002 -* the Initial Developer. All Rights Reserved. -* -* Contributor(s): joerg.schaible@gmx.de -* -* 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 NPL, 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 NPL, the GPL or the LGPL. -* -* ***** END LICENSE BLOCK ***** -* -* -* Date: 27 Nov 2002 -* SUMMARY: Ensuring normal function call of Error (ECMA-262 Ed.3 15.11.1.1). -*/ -//----------------------------------------------------------------------------- -var UBound = 0; -var bug = ''; -var summary = 'Ensuring normal function call of Error (ECMA-262 Ed.3 15.11.1.1)'; -var status = ''; -var statusitems = []; -var actual = ''; -var actualvalues = []; -var expect= ''; -var expectedvalues = []; -var EMPTY_STRING = ''; -var EXPECTED_FORMAT = 0; - - -function otherScope(msg) -{ - return Error(msg); -} - - -status = inSection(1); -var err1 = Error('msg1'); -actual = examineThis(err1, 'msg1'); -expect = EXPECTED_FORMAT; -addThis(); - -status = inSection(2); -var err2 = otherScope('msg2'); -actual = examineThis(err2, 'msg2'); -expect = EXPECTED_FORMAT; -addThis(); - -status = inSection(3); -var err3 = otherScope(); -actual = examineThis(err3, EMPTY_STRING); -expect = EXPECTED_FORMAT; -addThis(); - -status = inSection(4); -var err4 = eval("Error('msg4')"); -actual = examineThis(err4, 'msg4'); -expect = EXPECTED_FORMAT; -addThis(); - - - -//----------------------------------------------------------------------------- -test(); -//----------------------------------------------------------------------------- - - - -/* - * Searches err.toString() for err.name + ':' + err.message, - * with possible whitespace on each side of the colon sign. - * - * We allow for no colon in case err.message was not provided by the user. - * In such a case, SpiderMonkey and Rhino currently set err.message = '', - * as allowed for by ECMA 15.11.4.3. This makes |pattern| work in this case. - * - * If this is ever changed to a non-empty string, e.g. 'undefined', - * you may have to modify |pattern| to take that into account - - * - */ -function examineThis(err, msg) -{ - var pattern = err.name + '\\s*:?\\s*' + msg; - return err.toString().search(RegExp(pattern)); -} - - -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'); -} diff --git a/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.4.4-1.js b/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.4.4-1.js deleted file mode 100644 index ca05e7e..0000000 --- a/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.4.4-1.js +++ /dev/null @@ -1,169 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** -* Version: NPL 1.1/GPL 2.0/LGPL 2.1 -* -* 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 JavaScript Engine testing utilities. -* -* The Initial Developer of the Original Code is Netscape Communications Corp. -* Portions created by the Initial Developer are Copyright (C) 2001 -* the Initial Developer. All Rights Reserved. -* -* Contributors: d-russo@ti.com, pschwartau@netscape.com, joerg.schaible@gmx.de -* -* 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 NPL, 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 NPL, the GPL or the LGPL. -* -* ***** END LICENSE BLOCK ***** -* -* -* Date: 22 Jan 2002 -* SUMMARY: Testing Error.prototype.toString() -* -* Revised: 25 Nov 2002 -* See http://bugzilla.mozilla.org/show_bug.cgi?id=181909 -* -* Note that ECMA-262 3rd Edition Final, Section 15.11.4.4 states that -* Error.prototype.toString() returns an implementation-dependent string. -* Therefore any testcase on this property is somewhat arbitrary. -* -* However, d-russo@ti.com pointed out that Rhino was returning this: -* -* js> err = new Error() -* undefined: undefined -* -* js> err = new Error("msg") -* undefined: msg -* -* -* We expect Rhino to return what SpiderMonkey currently does: -* -* js> err = new Error() -* Error -* -* js> err = new Error("msg") -* Error: msg -* -* -* i.e. we expect err.toString() === err.name if err.message is not defined; -* otherwise, we expect err.toString() === err.name + ': ' + err.message. -* -* See also ECMA 15.11.4.2, 15.11.4.3 -*/ -//----------------------------------------------------------------------------- -var UBound = 0; -var bug = '(none)'; -var summary = 'Testing Error.prototype.toString()'; -var status = ''; -var statusitems = []; -var actual = ''; -var actualvalues = []; -var expect= ''; -var expectedvalues = []; -var EMPTY_STRING = ''; -var EXPECTED_FORMAT = 0; - - -status = inSection(1); -var err1 = new Error('msg1'); -actual = examineThis(err1, 'msg1'); -expect = EXPECTED_FORMAT; -addThis(); - -status = inSection(2); -var err2 = new Error(err1); -actual = examineThis(err2, err1); -expect = EXPECTED_FORMAT; -addThis(); - -status = inSection(3); -var err3 = new Error(); -actual = examineThis(err3, EMPTY_STRING); -expect = EXPECTED_FORMAT; -addThis(); - -status = inSection(4); -var err4 = new Error(EMPTY_STRING); -actual = examineThis(err4, EMPTY_STRING); -expect = EXPECTED_FORMAT; -addThis(); - -// now generate a run-time error - -status = inSection(5); -try -{ - eval('1=2'); -} -catch(err5) -{ - actual = examineThis(err5, '.*'); -} -expect = EXPECTED_FORMAT; -addThis(); - - - -//----------------------------------------------------------------------------- -test(); -//----------------------------------------------------------------------------- - - - -/* - * Searches err.toString() for err.name + ':' + err.message, - * with possible whitespace on each side of the colon sign. - * - * We allow for no colon in case err.message was not provided by the user. - * In such a case, SpiderMonkey and Rhino currently set err.message = '', - * as allowed for by ECMA 15.11.4.3. This makes |pattern| work in this case. - * - * If this is ever changed to a non-empty string, e.g. 'undefined', - * you may have to modify |pattern| to take that into account - - * - */ -function examineThis(err, msg) -{ - var pattern = err.name + '\\s*:?\\s*' + msg; - return err.toString().search(RegExp(pattern)); -} - - -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'); -} diff --git a/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-001.js b/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-001.js deleted file mode 100644 index a8097f5..0000000 --- a/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-001.js +++ /dev/null @@ -1,125 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** -* Version: NPL 1.1/GPL 2.0/LGPL 2.1 -* -* 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 JavaScript Engine testing utilities. -* -* The Initial Developer of the Original Code is Netscape Communications Corp. -* Portions created by the Initial Developer are Copyright (C) 2003 -* the Initial Developer. All Rights Reserved. -* -* Contributor(s): igor@fastmail.fm, 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 NPL, 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 NPL, the GPL or the LGPL. -* -* ***** END LICENSE BLOCK ***** -* -* -* Date: 14 April 2003 -* SUMMARY: Prototype of predefined error objects should be DontEnum -* See http://bugzilla.mozilla.org/show_bug.cgi?id=201989 -* -*/ -//----------------------------------------------------------------------------- -var UBound = 0; -var bug = 201989; -var summary = 'Prototype of predefined error objects should be DontEnum'; -var status = ''; -var statusitems = []; -var actual = ''; -var actualvalues = []; -var expect= ''; -var expectedvalues = []; - - -/* - * Tests that |F.prototype| is not enumerable in |F| - */ -function testDontEnum(F) -{ - var proto = F.prototype; - - for (var prop in F) - { - if (F[prop] === proto) - return false; - } - return true; -} - - -var list = [ - "Error", - "ConversionError", - "EvalError", - "RangeError", - "ReferenceError", - "SyntaxError", - "TypeError", - "URIError" -]; - - -for (i in list) -{ - var F = this[list[i]]; - - // Test for |F|; e.g. Rhino defines |ConversionError| while SM does not. - if (F) - { - status = 'Testing DontEnum attribute of |' + list[i] + '.prototype|'; - actual = testDontEnum(F); - expect = true; - 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'); -} diff --git a/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-002.js b/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-002.js deleted file mode 100644 index f0fae24..0000000 --- a/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-002.js +++ /dev/null @@ -1,120 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** -* Version: NPL 1.1/GPL 2.0/LGPL 2.1 -* -* 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 JavaScript Engine testing utilities. -* -* The Initial Developer of the Original Code is Netscape Communications Corp. -* Portions created by the Initial Developer are Copyright (C) 2003 -* the Initial Developer. All Rights Reserved. -* -* Contributor(s): igor@fastmail.fm, 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 NPL, 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 NPL, the GPL or the LGPL. -* -* ***** END LICENSE BLOCK ***** -* -* -* Date: 14 April 2003 -* SUMMARY: Prototype of predefined error objects should be DontDelete -* See http://bugzilla.mozilla.org/show_bug.cgi?id=201989 -* -*/ -//----------------------------------------------------------------------------- -var UBound = 0; -var bug = 201989; -var summary = 'Prototype of predefined error objects should be DontDelete'; -var status = ''; -var statusitems = []; -var actual = ''; -var actualvalues = []; -var expect= ''; -var expectedvalues = []; - - -/* - * Tests that |F.prototype| is DontDelete - */ -function testDontDelete(F) -{ - var orig = F.prototype; - delete F.prototype; - return F.prototype === orig; -} - - -var list = [ - "Error", - "ConversionError", - "EvalError", - "RangeError", - "ReferenceError", - "SyntaxError", - "TypeError", - "URIError" -]; - - -for (i in list) -{ - var F = this[list[i]]; - - // Test for |F|; e.g. Rhino defines |ConversionError| while SM does not. - if (F) - { - status = 'Testing DontDelete attribute of |' + list[i] + '.prototype|'; - actual = testDontDelete(F); - expect = true; - 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'); -} diff --git a/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-003.js b/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-003.js deleted file mode 100644 index 5840427..0000000 --- a/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-003.js +++ /dev/null @@ -1,120 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** -* Version: NPL 1.1/GPL 2.0/LGPL 2.1 -* -* 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 JavaScript Engine testing utilities. -* -* The Initial Developer of the Original Code is Netscape Communications Corp. -* Portions created by the Initial Developer are Copyright (C) 2003 -* the Initial Developer. All Rights Reserved. -* -* Contributor(s): igor@fastmail.fm, 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 NPL, 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 NPL, the GPL or the LGPL. -* -* ***** END LICENSE BLOCK ***** -* -* -* Date: 14 April 2003 -* SUMMARY: Prototype of predefined error objects should be ReadOnly -* See http://bugzilla.mozilla.org/show_bug.cgi?id=201989 -* -*/ -//----------------------------------------------------------------------------- -var UBound = 0; -var bug = 201989; -var summary = 'Prototype of predefined error objects should be ReadOnly'; -var status = ''; -var statusitems = []; -var actual = ''; -var actualvalues = []; -var expect= ''; -var expectedvalues = []; - - -/* - * Tests that |F.prototype| is ReadOnly - */ -function testReadOnly(F) -{ - var orig = F.prototype; - F.prototype = new Object(); - return F.prototype === orig; -} - - -var list = [ - "Error", - "ConversionError", - "EvalError", - "RangeError", - "ReferenceError", - "SyntaxError", - "TypeError", - "URIError" -]; - - -for (i in list) -{ - var F = this[list[i]]; - - // Test for |F|; e.g. Rhino defines |ConversionError| while SM does not. - if (F) - { - status = 'Testing ReadOnly attribute of |' + list[i] + '.prototype|'; - actual = testReadOnly(F); - expect = true; - 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'); -} diff --git a/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/binding-001.js b/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/binding-001.js deleted file mode 100644 index 72ff55e..0000000 --- a/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/binding-001.js +++ /dev/null @@ -1,106 +0,0 @@ -/* -* 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): brendan@mozilla.org, pschwartau@netscape.com -* Date: 2001-08-27 -* -* SUMMARY: Testing binding of function names -* -* Brendan: -* -* "... the question is, does Rhino bind 'sum' in the global object -* for the following test? If it does, it's buggy. -* -* var f = function sum(){}; -* print(sum); // should fail with 'sum is not defined' " -* -*/ -//----------------------------------------------------------------------------- -var UBound = 0; -var bug = '(none)'; -var summary = 'Testing binding of function names'; -var ERR_REF_YES = 'ReferenceError'; -var ERR_REF_NO = 'did NOT generate a ReferenceError'; -var statusitems = []; -var actualvalues = []; -var expectedvalues = []; -var status = summary; -var actual = ERR_REF_NO; -var expect= ERR_REF_YES; - - -try -{ - var f = function sum(){}; - print(sum); -} -catch (e) -{ - status = 'Section 1 of test'; - actual = e instanceof ReferenceError; - expect = true; - addThis(); - - - /* - * This test is more literal, and one day may not be valid. - * Searching for literal string "ReferenceError" in e.toString() - */ - status = 'Section 2 of test'; - var match = e.toString().search(/ReferenceError/); - actual = (match > -1); - expect = true; - addThis(); -} - - - -//----------------------------------------------------------------------------- -test(); -//----------------------------------------------------------------------------- - - -function addThis() -{ - statusitems[UBound] = status; - actualvalues[UBound] = isReferenceError(actual); - expectedvalues[UBound] = isReferenceError(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'); -} - - -// converts a Boolean result into a textual result - -function isReferenceError(bResult) -{ - return bResult? ERR_REF_YES : ERR_REF_NO; -} diff --git a/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-181654.js b/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-181654.js deleted file mode 100644 index d65efff..0000000 --- a/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-181654.js +++ /dev/null @@ -1,150 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** -* Version: NPL 1.1/GPL 2.0/LGPL 2.1 -* -* 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 JavaScript Engine testing utilities. -* -* The Initial Developer of the Original Code is Netscape Communications Corp. -* Portions created by the Initial Developer are Copyright (C) 2002 -* the Initial Developer. All Rights Reserved. -* -* Contributor(s): joerg.schaible@gmx.de -* -* 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 NPL, 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 NPL, the GPL or the LGPL. -* -* ***** END LICENSE BLOCK ***** -* -* -* Date: 23 Nov 2002 -* SUMMARY: Calling toString for an object derived from the Error class -* results in an TypeError (Rhino only) -* See http://bugzilla.mozilla.org/show_bug.cgi?id=181654 -*/ -//----------------------------------------------------------------------------- -var UBound = 0; -var bug = '181654'; -var summary = 'Calling toString for an object derived from the Error class should be possible.'; -var status = ''; -var statusitems = []; -var actual = ''; -var actualvalues = []; -var expect= ''; -var expectedvalues = []; -var EMPTY_STRING = ''; -var EXPECTED_FORMAT = 0; - - -// derive MyError from Error -function MyError( msg ) -{ - this.message = msg; -} -MyError.prototype = new Error(); -MyError.prototype.name = "MyError"; - - -status = inSection(1); -var err1 = new MyError('msg1'); -actual = examineThis(err1, 'msg1'); -expect = EXPECTED_FORMAT; -addThis(); - -status = inSection(2); -var err2 = new MyError(err1); -actual = examineThis(err2, err1); -expect = EXPECTED_FORMAT; -addThis(); - -status = inSection(3); -var err3 = new MyError(); -actual = examineThis(err3, EMPTY_STRING); -expect = EXPECTED_FORMAT; -addThis(); - -status = inSection(4); -var err4 = new MyError(EMPTY_STRING); -actual = examineThis(err4, EMPTY_STRING); -expect = EXPECTED_FORMAT; -addThis(); - -// now generate an error - -status = inSection(5); -try -{ - throw new MyError("thrown"); -} -catch(err5) -{ - actual = examineThis(err5, "thrown"); -} -expect = EXPECTED_FORMAT; -addThis(); - - - -//----------------------------------------------------------------------------- -test(); -//----------------------------------------------------------------------------- - - - -/* - * Searches err.toString() for err.name + ':' + err.message, - * with possible whitespace on each side of the colon sign. - * - * We allow for no colon in case err.message was not provided by the user. - * In such a case, SpiderMonkey and Rhino currently set err.message = '', - * as allowed for by ECMA 15.11.4.3. This makes |pattern| work in this case. - * - * If this is ever changed to a non-empty string, e.g. 'undefined', - * you may have to modify |pattern| to take that into account - - * - */ -function examineThis(err, msg) -{ - var pattern = err.name + '\\s*:?\\s*' + msg; - return err.toString().search(RegExp(pattern)); -} - - -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'); -} diff --git a/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-181914.js b/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-181914.js deleted file mode 100644 index adf0b46..0000000 --- a/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-181914.js +++ /dev/null @@ -1,189 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** -* Version: NPL 1.1/GPL 2.0/LGPL 2.1 -* -* 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 JavaScript Engine testing utilities. -* -* The Initial Developer of the Original Code is Netscape Communications Corp. -* Portions created by the Initial Developer are Copyright (C) 2002 -* the Initial Developer. All Rights Reserved. -* -* Contributor(s): joerg.schaible@gmx.de, 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 NPL, 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 NPL, the GPL or the LGPL. -* -* ***** END LICENSE BLOCK ***** -* -* -* Date: 25 Nov 2002 -* SUMMARY: Calling a user-defined superconstructor -* See http://bugzilla.mozilla.org/show_bug.cgi?id=181914, esp. Comment 10. -* -*/ -//----------------------------------------------------------------------------- -var UBound = 0; -var bug = '181914'; -var summary = 'Calling a user-defined superconstructor'; -var status = ''; -var statusitems = []; -var actual = ''; -var actualvalues = []; -var expect= ''; -var expectedvalues = []; -var EMPTY_STRING = ''; -var EXPECTED_FORMAT = 0; - - -// make a user-defined version of the Error constructor -function _Error(msg) -{ - this.message = msg; -} -_Error.prototype = new Error(); -_Error.prototype.name = '_Error'; - - -// derive MyApplyError from _Error -function MyApplyError(msg) -{ - if(this instanceof MyApplyError) - _Error.apply(this, arguments); - else - return new MyApplyError(msg); -} -MyApplyError.prototype = new _Error(); -MyApplyError.prototype.name = "MyApplyError"; - - -// derive MyCallError from _Error -function MyCallError(msg) -{ - if(this instanceof MyCallError) - _Error.call(this, msg); - else - return new MyCallError(msg); -} -MyCallError.prototype = new _Error(); -MyCallError.prototype.name = "MyCallError"; - - -function otherScope(msg) -{ - return MyApplyError(msg); -} - - -status = inSection(1); -var err1 = new MyApplyError('msg1'); -actual = examineThis(err1, 'msg1'); -expect = EXPECTED_FORMAT; -addThis(); - -status = inSection(2); -var err2 = new MyCallError('msg2'); -actual = examineThis(err2, 'msg2'); -expect = EXPECTED_FORMAT; -addThis(); - -status = inSection(3); -var err3 = MyApplyError('msg3'); -actual = examineThis(err3, 'msg3'); -expect = EXPECTED_FORMAT; -addThis(); - -status = inSection(4); -var err4 = MyCallError('msg4'); -actual = examineThis(err4, 'msg4'); -expect = EXPECTED_FORMAT; -addThis(); - -status = inSection(5); -var err5 = otherScope('msg5'); -actual = examineThis(err5, 'msg5'); -expect = EXPECTED_FORMAT; -addThis(); - -status = inSection(6); -var err6 = otherScope(); -actual = examineThis(err6, EMPTY_STRING); -expect = EXPECTED_FORMAT; -addThis(); - -status = inSection(7); -var err7 = eval("MyApplyError('msg7')"); -actual = examineThis(err7, 'msg7'); -expect = EXPECTED_FORMAT; -addThis(); - -status = inSection(8); -var err8; -try -{ - throw MyApplyError('msg8'); -} -catch(e) -{ - if(e instanceof Error) - err8 = e; -} -actual = examineThis(err8, 'msg8'); -expect = EXPECTED_FORMAT; -addThis(); - - - -//----------------------------------------------------------------------------- -test(); -//----------------------------------------------------------------------------- - - - -// Searches |err.toString()| for |err.name + ':' + err.message| -function examineThis(err, msg) -{ - var pattern = err.name + '\\s*:?\\s*' + msg; - return err.toString().search(RegExp(pattern)); -} - - -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'); -} diff --git a/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-58946.js b/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-58946.js deleted file mode 100644 index e2fc798..0000000 --- a/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-58946.js +++ /dev/null @@ -1,56 +0,0 @@ -/* -* 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 -* -* -*This test arose from Bugzilla bug 58946. -*The bug was filed when we got the following error (see code below): -* -* "ReferenceError: e is not defined" -* -*There was no error if we replaced "return e" in the code below with "print(e)". -*There should be no error with "return e", either - -*/ -//------------------------------------------------------------------------------------------------- -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); - - - try - { - throw 'PASS'; - } - - catch(e) - { - return e; - } - - - exitFunc ("test"); -}
\ No newline at end of file diff --git a/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-95101.js b/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-95101.js deleted file mode 100644 index 59b5209..0000000 --- a/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-95101.js +++ /dev/null @@ -1,97 +0,0 @@ -/* -* 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: 13 August 2001 -* -* SUMMARY: Invoking an undefined function should produce a ReferenceError -* See http://bugzilla.mozilla.org/show_bug.cgi?id=95101 -*/ -//----------------------------------------------------------------------------- -var UBound = 0; -var bug = 95101; -var summary = 'Invoking an undefined function should produce a ReferenceError'; -var msgERR_REF_YES = 'ReferenceError'; -var msgERR_REF_NO = 'did NOT generate a ReferenceError'; -var status = ''; -var statusitems = []; -var actual = ''; -var actualvalues = []; -var expect= ''; -var expectedvalues = []; - - -try -{ - xxxyyyzzz(); -} -catch (e) -{ - status = 'Section 1 of test'; - actual = e instanceof ReferenceError; - expect = true; - addThis(); - - - /* - * This test is more literal, and may one day be invalid. - * Searching for literal string "ReferenceError" in e.toString() - */ - status = 'Section 2 of test'; - var match = e.toString().search(/ReferenceError/); - actual = (match > -1); - expect = true; - addThis(); -} - - - -//----------------------------------------------------------------------------- -test(); -//----------------------------------------------------------------------------- - - -function addThis() -{ - statusitems[UBound] = status; - actualvalues[UBound] = isReferenceError(actual); - expectedvalues[UBound] = isReferenceError(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'); -} - - -// converts a Boolean result into a textual result - -function isReferenceError(bResult) -{ - return bResult? msgERR_REF_YES : msgERR_REF_NO; -} |
