From cad810f21b803229eb11403f9209855525a25d57 Mon Sep 17 00:00:00 2001 From: Steve Block Date: Fri, 6 May 2011 11:45:16 +0100 Subject: Merge WebKit at r75315: Initial merge by git. Change-Id: I570314b346ce101c935ed22a626b48c2af266b84 --- .../tests/mozilla/ecma_3/Array/15.4.4.3-1.js | 66 + .../tests/mozilla/ecma_3/Array/15.4.4.4-001.js | 148 + .../tests/mozilla/ecma_3/Array/regress-101488.js | 151 + .../tests/mozilla/ecma_3/Array/regress-130451.js | 214 + .../tests/mozilla/ecma_3/Date/15.9.5.3.js | 149 + .../tests/mozilla/ecma_3/Date/15.9.5.4.js | 194 + .../tests/mozilla/ecma_3/Date/15.9.5.5.js | 94 + .../tests/mozilla/ecma_3/Date/15.9.5.6.js | 149 + .../tests/mozilla/ecma_3/Date/15.9.5.7.js | 211 + .../tests/mozilla/ecma_3/Date/shell.js | 676 ++ .../tests/mozilla/ecma_3/Exceptions/15.11.1.1.js | 132 + .../tests/mozilla/ecma_3/Exceptions/15.11.4.4-1.js | 169 + .../mozilla/ecma_3/Exceptions/15.11.7.6-001.js | 125 + .../mozilla/ecma_3/Exceptions/15.11.7.6-002.js | 120 + .../mozilla/ecma_3/Exceptions/15.11.7.6-003.js | 120 + .../tests/mozilla/ecma_3/Exceptions/binding-001.js | 106 + .../mozilla/ecma_3/Exceptions/regress-181654.js | 150 + .../mozilla/ecma_3/Exceptions/regress-181914.js | 189 + .../mozilla/ecma_3/Exceptions/regress-58946.js | 56 + .../mozilla/ecma_3/Exceptions/regress-95101.js | 97 + .../mozilla/ecma_3/ExecutionContexts/10.1.3-1.js | 196 + .../mozilla/ecma_3/ExecutionContexts/10.1.3-2.js | 157 + .../mozilla/ecma_3/ExecutionContexts/10.1.3.js | 55 + .../mozilla/ecma_3/ExecutionContexts/10.1.4-1.js | 58 + .../ecma_3/ExecutionContexts/regress-23346.js | 53 + .../tests/mozilla/ecma_3/Expressions/11.6.1-1.js | 171 + .../tests/mozilla/ecma_3/Expressions/11.9.6-1.js | 208 + .../tests/mozilla/ecma_3/FunExpr/fe-001-n.js | 37 + .../tests/mozilla/ecma_3/FunExpr/fe-001.js | 39 + .../tests/mozilla/ecma_3/FunExpr/fe-002.js | 43 + .../tests/mozilla/ecma_3/Function/15.3.4.3-1.js | 205 + .../tests/mozilla/ecma_3/Function/15.3.4.4-1.js | 180 + .../tests/mozilla/ecma_3/Function/arguments-001.js | 148 + .../tests/mozilla/ecma_3/Function/call-001.js | 131 + .../mozilla/ecma_3/Function/regress-104584.js | 56 + .../mozilla/ecma_3/Function/regress-131964.js | 191 + .../mozilla/ecma_3/Function/regress-137181.js | 108 + .../mozilla/ecma_3/Function/regress-193555.js | 131 + .../tests/mozilla/ecma_3/Function/regress-49286.js | 116 + .../tests/mozilla/ecma_3/Function/regress-58274.js | 221 + .../tests/mozilla/ecma_3/Function/regress-85880.js | 152 + .../tests/mozilla/ecma_3/Function/regress-94506.js | 142 + .../tests/mozilla/ecma_3/Function/regress-97921.js | 131 + .../tests/mozilla/ecma_3/Function/scope-001.js | 249 + .../tests/mozilla/ecma_3/Function/scope-002.js | 224 + .../tests/mozilla/ecma_3/Number/15.7.4.5-1.js | 124 + .../tests/mozilla/ecma_3/Number/15.7.4.6-1.js | 113 + .../tests/mozilla/ecma_3/Number/15.7.4.7-1.js | 118 + .../ecma_3/NumberFormatting/tostring-001.js | 42 + .../tests/mozilla/ecma_3/Object/8.6.2.6-001.js | 108 + .../tests/mozilla/ecma_3/Object/class-001.js | 128 + .../tests/mozilla/ecma_3/Object/class-002.js | 124 + .../tests/mozilla/ecma_3/Object/class-003.js | 118 + .../tests/mozilla/ecma_3/Object/class-004.js | 117 + .../tests/mozilla/ecma_3/Object/class-005.js | 102 + .../tests/mozilla/ecma_3/Object/regress-72773.js | 75 + .../mozilla/ecma_3/Object/regress-79129-001.js | 58 + .../tests/mozilla/ecma_3/Object/shell.js | 81 + .../tests/mozilla/ecma_3/Operators/11.13.1-001.js | 147 + .../tests/mozilla/ecma_3/Operators/11.4.1-001.js | 115 + .../tests/mozilla/ecma_3/RegExp/15.10.2-1.js | 176 + .../tests/mozilla/ecma_3/RegExp/15.10.3.1-1.js | 115 + .../tests/mozilla/ecma_3/RegExp/15.10.3.1-2.js | 123 + .../tests/mozilla/ecma_3/RegExp/15.10.4.1-1.js | 111 + .../tests/mozilla/ecma_3/RegExp/15.10.4.1-2.js | 117 + .../tests/mozilla/ecma_3/RegExp/15.10.4.1-3.js | 124 + .../tests/mozilla/ecma_3/RegExp/15.10.4.1-4.js | 130 + .../tests/mozilla/ecma_3/RegExp/15.10.4.1-5-n.js | 113 + .../tests/mozilla/ecma_3/RegExp/15.10.6.2-1.js | 119 + .../tests/mozilla/ecma_3/RegExp/15.10.6.2-2.js | 362 + .../tests/mozilla/ecma_3/RegExp/octal-001.js | 131 + .../tests/mozilla/ecma_3/RegExp/octal-002.js | 213 + .../tests/mozilla/ecma_3/RegExp/perlstress-001.js | 3225 +++++++ .../tests/mozilla/ecma_3/RegExp/perlstress-002.js | 1837 ++++ .../tests/mozilla/ecma_3/RegExp/regress-100199.js | 286 + .../tests/mozilla/ecma_3/RegExp/regress-103087.js | 155 + .../tests/mozilla/ecma_3/RegExp/regress-105972.js | 136 + .../tests/mozilla/ecma_3/RegExp/regress-119909.js | 86 + .../tests/mozilla/ecma_3/RegExp/regress-122076.js | 103 + .../tests/mozilla/ecma_3/RegExp/regress-123437.js | 107 + .../tests/mozilla/ecma_3/RegExp/regress-165353.js | 117 + .../tests/mozilla/ecma_3/RegExp/regress-169497.js | 100 + .../tests/mozilla/ecma_3/RegExp/regress-169534.js | 90 + .../tests/mozilla/ecma_3/RegExp/regress-187133.js | 137 + .../tests/mozilla/ecma_3/RegExp/regress-188206.js | 282 + .../tests/mozilla/ecma_3/RegExp/regress-191479.js | 193 + .../tests/mozilla/ecma_3/RegExp/regress-202564.js | 96 + .../tests/mozilla/ecma_3/RegExp/regress-209067.js | 1101 +++ .../tests/mozilla/ecma_3/RegExp/regress-209919.js | 169 + .../tests/mozilla/ecma_3/RegExp/regress-216591.js | 112 + .../mozilla/ecma_3/RegExp/regress-220367-001.js | 99 + .../mozilla/ecma_3/RegExp/regress-220367-002.js | 107 + .../tests/mozilla/ecma_3/RegExp/regress-24712.js | 42 + .../tests/mozilla/ecma_3/RegExp/regress-28686.js | 39 + .../tests/mozilla/ecma_3/RegExp/regress-31316.js | 75 + .../tests/mozilla/ecma_3/RegExp/regress-57572.js | 129 + .../tests/mozilla/ecma_3/RegExp/regress-57631.js | 128 + .../tests/mozilla/ecma_3/RegExp/regress-67773.js | 190 + .../tests/mozilla/ecma_3/RegExp/regress-72964.js | 100 + .../tests/mozilla/ecma_3/RegExp/regress-76683.js | 93 + .../tests/mozilla/ecma_3/RegExp/regress-78156.js | 102 + .../tests/mozilla/ecma_3/RegExp/regress-85721.js | 271 + .../tests/mozilla/ecma_3/RegExp/regress-87231.js | 124 + .../tests/mozilla/ecma_3/RegExp/regress-98306.js | 77 + .../tests/mozilla/ecma_3/RegExp/shell.js | 230 + .../mozilla/ecma_3/Statements/regress-121744.js | 212 + .../mozilla/ecma_3/Statements/regress-131348.js | 179 + .../mozilla/ecma_3/Statements/regress-157509.js | 106 + .../mozilla/ecma_3/Statements/regress-194364.js | 134 + .../mozilla/ecma_3/Statements/regress-74474-001.js | 118 + .../mozilla/ecma_3/Statements/regress-74474-002.js | 9076 +++++++++++++++++++ .../mozilla/ecma_3/Statements/regress-74474-003.js | 9078 ++++++++++++++++++++ .../mozilla/ecma_3/Statements/regress-83532-001.js | 48 + .../mozilla/ecma_3/Statements/regress-83532-002.js | 51 + .../tests/mozilla/ecma_3/Statements/switch-001.js | 122 + .../tests/mozilla/ecma_3/String/regress-104375.js | 95 + .../tests/mozilla/ecma_3/String/regress-189898.js | 152 + .../tests/mozilla/ecma_3/String/regress-83293.js | 193 + .../tests/mozilla/ecma_3/Unicode/uc-001-n.js | 44 + .../tests/mozilla/ecma_3/Unicode/uc-001.js | 38 + .../tests/mozilla/ecma_3/Unicode/uc-002-n.js | 38 + .../tests/mozilla/ecma_3/Unicode/uc-002.js | 42 + .../tests/mozilla/ecma_3/Unicode/uc-003.js | 53 + .../tests/mozilla/ecma_3/Unicode/uc-004.js | 47 + .../tests/mozilla/ecma_3/Unicode/uc-005.js | 271 + .../JavaScriptCore/tests/mozilla/ecma_3/shell.js | 180 + 126 files changed, 40537 insertions(+) create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Array/15.4.4.3-1.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Array/15.4.4.4-001.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Array/regress-101488.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Array/regress-130451.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.3.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.4.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.5.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.6.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.7.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Date/shell.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.1.1.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.4.4-1.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-001.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-002.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-003.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/binding-001.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-181654.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-181914.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-58946.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-95101.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.3-1.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.3-2.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.3.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.4-1.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/regress-23346.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Expressions/11.6.1-1.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Expressions/11.9.6-1.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/FunExpr/fe-001-n.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/FunExpr/fe-001.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/FunExpr/fe-002.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Function/15.3.4.3-1.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Function/15.3.4.4-1.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Function/arguments-001.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Function/call-001.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-104584.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-131964.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-137181.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-193555.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-49286.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-58274.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-85880.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-94506.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-97921.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Function/scope-001.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Function/scope-002.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Number/15.7.4.5-1.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Number/15.7.4.6-1.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Number/15.7.4.7-1.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/NumberFormatting/tostring-001.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Object/8.6.2.6-001.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-001.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-002.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-003.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-004.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-005.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Object/regress-72773.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Object/regress-79129-001.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Object/shell.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Operators/11.13.1-001.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Operators/11.4.1-001.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.2-1.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.3.1-1.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.3.1-2.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-1.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-2.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-3.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-4.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-5-n.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.6.2-1.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.6.2-2.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/octal-001.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/octal-002.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/perlstress-001.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/perlstress-002.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-100199.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-103087.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-105972.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-119909.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-122076.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-123437.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-165353.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-169497.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-169534.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-187133.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-188206.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-191479.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-202564.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-209067.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-209919.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-216591.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-220367-001.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-220367-002.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-24712.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-28686.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-31316.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-57572.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-57631.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-67773.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-72964.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-76683.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-78156.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-85721.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-87231.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-98306.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/shell.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-121744.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-131348.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-157509.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-194364.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-74474-001.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-74474-002.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-74474-003.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-83532-001.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-83532-002.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/switch-001.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/String/regress-104375.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/String/regress-189898.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/String/regress-83293.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-001-n.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-001.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-002-n.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-002.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-003.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-004.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-005.js create mode 100644 Source/JavaScriptCore/tests/mozilla/ecma_3/shell.js (limited to 'Source/JavaScriptCore/tests/mozilla/ecma_3') diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/15.4.4.3-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/15.4.4.3-1.js new file mode 100644 index 0000000..7b5fdbd --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/15.4.4.3-1.js @@ -0,0 +1,66 @@ +/* +* 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: 12 Mar 2001 +* +* +* SUMMARY: Testing Array.prototype.toLocaleString() +* See http://bugzilla.mozilla.org/show_bug.cgi?id=56883 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=58031 +* +* By ECMA3 15.4.4.3, myArray.toLocaleString() means that toLocaleString() +* should be applied to each element of the array, and the results should be +* concatenated with an implementation-specific delimiter. For example: +* +* myArray[0].toLocaleString() + ',' + myArray[1].toLocaleString() + etc. +* +* In this testcase toLocaleString is a user-defined property of each array element; +* therefore it is the function that should be invoked. This function increments a +* global variable. Therefore the end value of this variable should be myArray.length. +*/ +//------------------------------------------------------------------------------------------------- +var bug = 56883; +var summary = 'Testing Array.prototype.toLocaleString() -'; +var actual = ''; +var expect = ''; +var n = 0; +var obj = {toLocaleString: function() {n++}}; +var myArray = [obj, obj, obj]; + + +myArray.toLocaleString(); +actual = n; +expect = 3; // (see explanation above) + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/15.4.4.4-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/15.4.4.4-001.js new file mode 100644 index 0000000..6d99159 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/15.4.4.4-001.js @@ -0,0 +1,148 @@ +/* ***** 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): george@vanous.com, igor@icesoft.no, 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: 19 September 2002 +* SUMMARY: Testing Array.prototype.concat() +* See http://bugzilla.mozilla.org/show_bug.cgi?id=169795 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 169795; +var summary = 'Testing Array.prototype.concat()'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var x; + + +status = inSection(1); +x = "Hello"; +actual = [].concat(x).toString(); +expect = x.toString(); +addThis(); + +status = inSection(2); +x = 999; +actual = [].concat(x).toString(); +expect = x.toString(); +addThis(); + +status = inSection(3); +x = /Hello/g; +actual = [].concat(x).toString(); +expect = x.toString(); +addThis(); + +status = inSection(4); +x = new Error("Hello"); +actual = [].concat(x).toString(); +expect = x.toString(); +addThis(); + +status = inSection(5); +x = function() {return "Hello";}; +actual = [].concat(x).toString(); +expect = x.toString(); +addThis(); + +status = inSection(6); +x = [function() {return "Hello";}]; +actual = [].concat(x).toString(); +expect = x.toString(); +addThis(); + +status = inSection(7); +x = [1,2,3].concat([4,5,6]); +actual = [].concat(x).toString(); +expect = x.toString(); +addThis(); + +status = inSection(8); +x = eval('this'); +actual = [].concat(x).toString(); +expect = x.toString(); +addThis(); + +/* + * The next two sections are by igor@icesoft.no; see + * http://bugzilla.mozilla.org/show_bug.cgi?id=169795#c3 + */ +status = inSection(9); +x={length:0}; +actual = [].concat(x).toString(); +expect = x.toString(); +addThis(); + +status = inSection(10); +x={length:2, 0:0, 1:1}; +actual = [].concat(x).toString(); +expect = x.toString(); +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 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=101488 +* +* Without the "new" keyword, assigning arr.length = Number(n) worked. +* But with it, Rhino was giving an error "Inappropriate array length" +* and SpiderMonkey was exiting without giving any error or return value - +* +* Comments on the Rhino code by igor@icesoft.no: +* +* jsSet_length requires that the new length value should be an instance +* of Number. But according to Ecma 15.4.5.1, item 12-13, an error should +* be thrown only if ToUint32(length_value) != ToNumber(length_value) +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 101488; +var summary = 'Try assigning arr.length = new Number(n)'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var arr = []; + + +status = inSection(1); +arr = Array(); +tryThis('arr.length = new Number(1);'); +actual = arr.length; +expect = 1; +addThis(); + +status = inSection(2); +arr = Array(5); +tryThis('arr.length = new Number(1);'); +actual = arr.length; +expect = 1; +addThis(); + +status = inSection(3); +arr = Array(); +tryThis('arr.length = new Number(17);'); +actual = arr.length; +expect = 17; +addThis(); + +status = inSection(4); +arr = Array(5); +tryThis('arr.length = new Number(17);'); +actual = arr.length; +expect = 17; +addThis(); + + +/* + * Also try the above with the "new" keyword before Array(). + * Array() and new Array() should be equivalent, by ECMA 15.4.1.1 + */ +status = inSection(5); +arr = new Array(); +tryThis('arr.length = new Number(1);'); +actual = arr.length; +expect = 1; +addThis(); + +status = inSection(6); +arr = new Array(5); +tryThis('arr.length = new Number(1);'); +actual = arr.length; +expect = 1; +addThis(); + +arr = new Array(); +tryThis('arr.length = new Number(17);'); +actual = arr.length; +expect = 17; +addThis(); + +status = inSection(7); +arr = new Array(5); +tryThis('arr.length = new Number(17);'); +actual = arr.length; +expect = 17; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function tryThis(s) +{ + try + { + eval(s); + } + catch(e) + { + // keep going + } +} + + +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= dst_start && t < dst_end ) {return msPerHour;} + else {return 0;} + + // Daylight Savings Time starts on the first Sunday in April at 2:00AM in PST. + // Other time zones will need to override this function. + +print( new Date( UTC(dst_start + LocalTZA())) ); +return UTC(dst_start + LocalTZA()); +} + +function GetFirstSundayInApril( t ) { + var year = YearFromTime(t); + var leap = InLeapYear(t); + + var april = TimeFromYear(year) + TimeInMonth(0, leap) + TimeInMonth(1,leap) + + TimeInMonth(2,leap); + + for ( var first_sunday = april; WeekDay(first_sunday) > 0; + first_sunday += msPerDay ) + { + ; + } + + return first_sunday; +} +function GetLastSundayInOctober( t ) { + var year = YearFromTime(t); + var leap = InLeapYear(t); + + for ( var oct = TimeFromYear(year), m = 0; m < 9; m++ ) { + oct += TimeInMonth(m, leap); + } + for ( var last_sunday = oct + 30*msPerDay; WeekDay(last_sunday) > 0; + last_sunday -= msPerDay ) + { + ; + } + return last_sunday; +} + +// Added these two functions because DST rules changed for the US. +function GetSecondSundayInMarch( t ) { + var year = YearFromTime(t); + var leap = InLeapYear(t); + + var march = TimeFromYear(year) + TimeInMonth(0, leap) + TimeInMonth(1,leap); + + var sundayCount = 0; + var flag = true; + for ( var second_sunday = march; flag; second_sunday += msPerDay ) + { + if (WeekDay(second_sunday) == 0) { + if(++sundayCount == 2) + flag = false; + } + } + + return second_sunday; +} +function GetFirstSundayInNovember( t ) { + var year = YearFromTime(t); + var leap = InLeapYear(t); + + for ( var nov = TimeFromYear(year), m = 0; m < 10; m++ ) { + nov += TimeInMonth(m, leap); + } + for ( var first_sunday = nov; WeekDay(first_sunday) > 0; + first_sunday += msPerDay ) + { + ; + } + return first_sunday; +} + + +function LocalTime( t ) +{ + return ( t + LocalTZA() + DaylightSavingTA(t) ); +} + + +function MakeTime( hour, min, sec, ms ) +{ + if ( isNaN(hour) || isNaN(min) || isNaN(sec) || isNaN(ms) ){return Number.NaN;} + + hour = ToInteger(hour); + min = ToInteger( min); + sec = ToInteger( sec); + ms = ToInteger( ms ); + + return( (hour*msPerHour) + (min*msPerMinute) + (sec*msPerSecond) + ms ); +} + + +function MakeDay( year, month, date ) +{ + if ( isNaN(year) || isNaN(month) || isNaN(date)) {return Number.NaN;} + + year = ToInteger(year); + month = ToInteger(month); + date = ToInteger(date ); + + var sign = ( year < 1970 ) ? -1 : 1; + var t = ( year < 1970 ) ? 1 : 0; + var y = ( year < 1970 ) ? 1969 : 1970; + + var result5 = year + Math.floor( month/12 ); + var result6= month%12; + + if ( year < 1970 ) + { + for ( y = 1969; y >= year; y += sign ) + { + t += sign * TimeInYear(y); + } + } + else + { + for ( y = 1970 ; y < year; y += sign ) + { + t += sign * TimeInYear(y); + } + } + + var leap = InLeapYear( t ); + + for ( var m = 0; m < month; m++) + { + t += TimeInMonth( m, leap ); + } + + if ( YearFromTime(t) != result5 ) {return Number.NaN;} + if ( MonthFromTime(t) != result6 ) {return Number.NaN;} + if ( DateFromTime(t) != 1 ){return Number.NaN;} + + return ( (Day(t)) + date - 1 ); +} + + +function TimeInMonth( month, leap ) +{ + // Jan 0 Feb 1 Mar 2 Apr 3 May 4 June 5 Jul 6 Aug 7 Sep 8 Oct 9 Nov 10 Dec11 + + // April June September November + if ( month == 3 || month == 5 || month == 8 || month == 10 ) {return ( 30*msPerDay );} + + // all the rest + if ( month == 0 || month == 2 || month == 4 || month == 6 || + month == 7 || month == 9 || month == 11 ) {return ( 31*msPerDay );} + + // save February + return ( (leap == 0) ? 28*msPerDay : 29*msPerDay ); +} + + +function MakeDate( day, time ) +{ + if (day == Number.POSITIVE_INFINITY || + day == Number.NEGATIVE_INFINITY || + day == Number.NaN ) + { + return Number.NaN; + } + + if ( time == Number.POSITIVE_INFINITY || + time == Number.POSITIVE_INFINITY || + day == Number.NaN) + { + return Number.NaN; + } + + return ( day * msPerDay ) + time; +} + + +function TimeClip( t ) +{ + if ( isNaN( t )) {return ( Number.NaN);} + if ( Math.abs( t ) > 8.64e15 ) {return ( Number.NaN);} + + return ( ToInteger( t ) ); +} + + +function ToInteger( t ) +{ + t = Number( t ); + + if ( isNaN( t )) {return ( Number.NaN);} + + if ( t == 0 || t == -0 || + t == Number.POSITIVE_INFINITY || + t == Number.NEGATIVE_INFINITY) + { + return 0; + } + + var sign = ( t < 0 ) ? -1 : 1; + + return ( sign * Math.floor( Math.abs( t ) ) ); +} + + +function Enumerate( o ) +{ + var p; + for ( p in o ) {print( p + ": " + o[p] );} +} + + +/* these functions are useful for running tests manually in Rhino */ + +function GetContext() +{ + return Packages.com.netscape.javascript.Context.getCurrentContext(); +} + + +function OptLevel( i ) +{ + i = Number(i); + var cx = GetContext(); + cx.setOptimizationLevel(i); +} + +/* end of Rhino functions */ + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.1.1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.1.1.js new file mode 100644 index 0000000..3aab137 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.1.1.js @@ -0,0 +1,132 @@ +/* ***** 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/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.4.4-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.4.4-1.js new file mode 100644 index 0000000..ca05e7e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.4.4-1.js @@ -0,0 +1,169 @@ +/* ***** 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/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-001.js new file mode 100644 index 0000000..a8097f5 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-001.js @@ -0,0 +1,125 @@ +/* ***** 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 -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/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-181654.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-181654.js new file mode 100644 index 0000000..d65efff --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-181654.js @@ -0,0 +1,150 @@ +/* ***** 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/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-181914.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-181914.js new file mode 100644 index 0000000..adf0b46 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-181914.js @@ -0,0 +1,189 @@ +/* ***** 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/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-58946.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-58946.js new file mode 100644 index 0000000..e2fc798 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-58946.js @@ -0,0 +1,56 @@ +/* +* 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/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-95101.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-95101.js new file mode 100644 index 0000000..59b5209 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-95101.js @@ -0,0 +1,97 @@ +/* +* 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; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.3-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.3-1.js new file mode 100644 index 0000000..a29d2a4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.3-1.js @@ -0,0 +1,196 @@ +/* ***** 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): 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: 11 Feb 2002 +* SUMMARY: Testing functions having duplicate formal parameter names +* +* Note: given function f(x,x,x,x) {return x;}; f(1,2,3,4) should return 4. +* See ECMA-262 3rd Edition Final Section 10.1.3: Variable Instantiation +* +* Also see http://bugzilla.mozilla.org/show_bug.cgi?id=124900 +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 124900; +var summary = 'Testing functions having duplicate formal parameter names'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +function f1(x,x) +{ + return x; +} +status = inSection(1); +actual = f1(1,2); +expect = 2; +addThis(); + + +function f2(x,x,x) +{ + return x*x*x; +} +status = inSection(2); +actual = f2(1,2,3); +expect = 27; +addThis(); + + +function f3(x,x,x,x) +{ + return 'a' + x + 'b' + x + 'c' + x ; +} +status = inSection(3); +actual = f3(1,2,3,4); +expect = 'a4b4c4'; +addThis(); + + +/* + * If the value of the last duplicate parameter is not provided by + * the function caller, the value of this parameter is undefined + */ +function f4(x,a,b,x,z) +{ + return x; +} +status = inSection(4); +actual = f4(1,2); +expect = undefined; +addThis(); + + +/* + * f.toString() should preserve any duplicate formal parameter names that exist + */ +function f5(x,x,x,x) +{ +} +status = inSection(5); +actual = f5.toString().match(/\((.*)\)/)[1]; +actual = actual.replace(/\s/g, ''); // for definiteness, remove any white space +expect = 'x,x,x,x'; +addThis(); + + +function f6(x,x,x,x) +{ + var ret = []; + + for (var i=0; i function f\u02B1 () {} +* +* js> f\u02B1.toSource(); +* function f¦() {} +* +* js> f\u02B1.toSource().toSource(); +* (new String("function f\xB1() {}")) +* +* +* See how the high-byte information (the 02) has been lost? +* The same thing was happening with the toString() method: +* +* js> f\u02B1.toString(); +* +* function f¦() { +* } +* +* js> f\u02B1.toString().toSource(); +* (new String("\nfunction f\xB1() {\n}\n")) +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 58274; +var summary = 'Testing functions with double-byte names'; +var ERR = 'UNEXPECTED ERROR! \n'; +var ERR_MALFORMED_NAME = ERR + 'Could not find function name in: \n\n'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var sEval; +var sName; + + +sEval = "function f\u02B2() {return 42;}"; +eval(sEval); +sName = getFunctionName(f\u02B2); + +// Test function call - +status = inSection(1); +actual = f\u02B2(); +expect = 42; +addThis(); + +// Test both characters of function name - +status = inSection(2); +actual = sName[0]; +expect = sEval[9]; +addThis(); + +status = inSection(3); +actual = sName[1]; +expect = sEval[10]; +addThis(); + + + +sEval = "function f\u02B2\u0AAA () {return 84;}"; +eval(sEval); +sName = getFunctionName(f\u02B2\u0AAA); + +// Test function call - +status = inSection(4); +actual = f\u02B2\u0AAA(); +expect = 84; +addThis(); + +// Test all three characters of function name - +status = inSection(5); +actual = sName[0]; +expect = sEval[9]; +addThis(); + +status = inSection(6); +actual = sName[1]; +expect = sEval[10]; +addThis(); + +status = inSection(7); +actual = sName[2]; +expect = sEval[11]; +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +/* + * Goal: test that f.toString() contains the proper function name. + * + * Note, however, f.toString() is implementation-independent. For example, + * it may begin with '\nfunction' instead of 'function'. Therefore we use + * a regexp to make sure we extract the name properly. + * + * Here we assume that f has been defined by means of a function statement, + * and not a function expression (where it wouldn't have to have a name). + * + * Rhino uses a Unicode representation for f.toString(); whereas + * SpiderMonkey uses an ASCII representation, putting escape sequences + * for non-ASCII characters. For example, if a function is called f\u02B1, + * then in Rhino the toString() method will present a 2-character Unicode + * string for its name, whereas SpiderMonkey will present a 7-character + * ASCII string for its name: the string literal 'f\u02B1'. + * + * So we force the lexer to condense the string before using it. + * This will give uniform results in Rhino and SpiderMonkey. + */ +function getFunctionName(f) +{ + var s = condenseStr(f.toString()); + var re = /\s*function\s+(\S+)\s*\(/; + var arr = s.match(re); + + if (!(arr && arr[1])) + return ERR_MALFORMED_NAME + s; + return arr[1]; +} + + +/* + * This function is the opposite of functions like escape(), which take + * Unicode characters and return escape sequences for them. Here, we force + * the lexer to turn escape sequences back into single characters. + * + * Note we can't simply do |eval(str)|, since in practice |str| will be an + * identifier somewhere in the program (e.g. a function name); thus |eval(str)| + * would return the object that the identifier represents: not what we want. + * + * So we surround |str| lexicographically with quotes to force the lexer to + * evaluate it as a string. Have to strip out any linefeeds first, however - + */ +function condenseStr(str) +{ + /* + * You won't be able to do the next step if |str| has + * any carriage returns or linefeeds in it. For example: + * + * js> eval("'" + '\nHello' + "'"); + * 1: SyntaxError: unterminated string literal: + * 1: ' + * 1: ^ + * + * So replace them with the empty string - + */ + str = str.replace(/[\r\n]/g, '') + return eval("'" + str + "'"); +} + + +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 length then set lastIndex to 0 and return null. +* 7. Call [[Match]], giving it the arguments S and i. +* If [[Match]] returned failure, go to step 8; +* otherwise let r be its State result and go to step 10. +* 8. Let i = i+1. +* 9. Go to step 6. +* 10. Let e be r's endIndex value. +* 11. If the global property is true, set lastIndex to e. +* +* etc. +* +* +* So when the global flag is set, |lastIndex| is incremented every time +* there is a match; not from i to i+1, but from i to "endIndex" e: +* +* e = (index of last input character matched so far by the pattern) + 1 +* +* Thus in the example below, the first endIndex e occurs after the +* first match 'a b'. The next match will begin AFTER this, and so +* will NOT be 'b c', but rather 'c d'. Similarly, 'd e' won't be matched. +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = '(none)'; +var summary = 'Testing regexps with the global flag set'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +status = inSection(1); +string = 'a b c d e'; +pattern = /\w\s\w/g; +actualmatch = string.match(pattern); +expectedmatch = ['a b','c d']; // see above explanation - +addThis(); + + +status = inSection(2); +string = '12345678'; +pattern = /\d\d\d/g; +actualmatch = string.match(pattern); +expectedmatch = ['123','456']; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.6.2-2.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.6.2-2.js new file mode 100644 index 0000000..cce4c2c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.6.2-2.js @@ -0,0 +1,362 @@ +/* ***** 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): 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: 18 Feb 2002 +* SUMMARY: Testing re.exec(str) when re.lastIndex is < 0 or > str.length +* +* Case 1: If re has the global flag set, then re(str) should be null +* Case 2: If re doesn't have this set, then re(str) should be unaffected +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=76717 +* +* +* From the ECMA-262 Final spec: +* +* 15.10.6.2 RegExp.prototype.exec(string) +* Performs a regular expression match of string against the regular +* expression and returns an Array object containing the results of +* the match, or null if the string did not match. +* +* The string ToString(string) is searched for an occurrence of the +* regular expression pattern as follows: +* +* 1. Let S be the value of ToString(string). +* 2. Let length be the length of S. +* 3. Let lastIndex be the value of the lastIndex property. +* 4. Let i be the value of ToInteger(lastIndex). +* 5. If the global property is false, let i = 0. +* 6. If i < 0 or i > length then set lastIndex to 0 and return null. +* 7. Call [[Match]], giving it the arguments S and i. +* If [[Match]] returned failure, go to step 8; +* otherwise let r be its State result and go to step 10. +* 8. Let i = i+1. +* 9. Go to step 6. +* 10. Let e be r's endIndex value. +* 11. If the global property is true, set lastIndex to e. +* +* etc. +* +* +* So: +* +* A. If the global flag is not set, |lastIndex| is set to 0 +* before the match is attempted; thus the match is unaffected. +* +* B. If the global flag IS set and re.lastIndex is >= 0 and <= str.length, +* |lastIndex| is incremented every time there is a match; not from +* i to i+1, but from i to "endIndex" e: +* +* e = (index of last input character matched so far by the pattern) + 1 +* +* The match is then attempted from this position in the string (Step 7). +* +* C. When the global flag IS set and re.lastIndex is < 0 or > str.length, +* |lastIndex| is set to 0 and the match returns null. +* +* +* Note the |lastIndex| property is writeable, and may be set arbitrarily +* by the programmer - and we will do that below. +* +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 76717; +var summary = 'Testing re.exec(str) when re.lastIndex is < 0 or > str.length'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +/****************************************************************************** + * + * Case 1 : when the global flag is set - + * + *****************************************************************************/ +pattern = /abc/gi; +string = 'AbcaBcabC'; + + status = inSection(1); + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc'); + addThis(); + + status = inSection(2); + actualmatch = pattern.exec(string); + expectedmatch = Array('aBc'); + addThis(); + + status = inSection(3); + actualmatch = pattern.exec(string); + expectedmatch = Array('abC'); + addThis(); + + /* + * At this point |lastIndex| is > string.length, so the match should be null - + */ + status = inSection(4); + actualmatch = pattern.exec(string); + expectedmatch = null; + addThis(); + + /* + * Now let's set |lastIndex| to -1, so the match should again be null - + */ + status = inSection(5); + pattern.lastIndex = -1; + actualmatch = pattern.exec(string); + expectedmatch = null; + addThis(); + + /* + * Now try some edge-case values. Thanks to the work done in + * http://bugzilla.mozilla.org/show_bug.cgi?id=124339, |lastIndex| + * is now stored as a double instead of a uint32 (unsigned integer). + * + * Note 2^32 -1 is the upper bound for uint32's, but doubles can go + * all the way up to Number.MAX_VALUE. So that's why we need cases + * between those two numbers. + */ + status = inSection(6); + pattern.lastIndex = Math.pow(2,32); + actualmatch = pattern.exec(string); + expectedmatch = null; + addThis(); + + status = inSection(7); + pattern.lastIndex = -Math.pow(2,32); + actualmatch = pattern.exec(string); + expectedmatch = null; + addThis(); + + status = inSection(8); + pattern.lastIndex = Math.pow(2,32) + 1; + actualmatch = pattern.exec(string); + expectedmatch = null; + addThis(); + + status = inSection(9); + pattern.lastIndex = -(Math.pow(2,32) + 1); + actualmatch = pattern.exec(string); + expectedmatch = null; + addThis(); + + status = inSection(10); + pattern.lastIndex = Math.pow(2,32) * 2; + actualmatch = pattern.exec(string); + expectedmatch = null; + addThis(); + + status = inSection(11); + pattern.lastIndex = -Math.pow(2,32) * 2; + actualmatch = pattern.exec(string); + expectedmatch = null; + addThis(); + + status = inSection(12); + pattern.lastIndex = Math.pow(2,40); + actualmatch = pattern.exec(string); + expectedmatch = null; + addThis(); + + status = inSection(13); + pattern.lastIndex = -Math.pow(2,40); + actualmatch = pattern.exec(string); + expectedmatch = null; + addThis(); + + status = inSection(14); + pattern.lastIndex = Number.MAX_VALUE; + actualmatch = pattern.exec(string); + expectedmatch = null; + addThis(); + + status = inSection(15); + pattern.lastIndex = -Number.MAX_VALUE; + actualmatch = pattern.exec(string); + expectedmatch = null; + addThis(); + + + +/****************************************************************************** + * + * Case 2: repeat all the above cases WITHOUT the global flag set. + * According to EMCA. |lastIndex| should get set to 0 before the match. + * + * Therefore re.exec(str) should be unaffected; thus our expected values + * below are now DIFFERENT when |lastIndex| is < 0 or > str.length + * + *****************************************************************************/ + +pattern = /abc/i; +string = 'AbcaBcabC'; + + status = inSection(16); + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc'); + addThis(); + + status = inSection(17); + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc'); // NOT Array('aBc') as before - + addThis(); + + status = inSection(18); + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc'); // NOT Array('abC') as before - + addThis(); + + /* + * At this point above, |lastIndex| WAS > string.length, but not here - + */ + status = inSection(19); + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc') // NOT null as before - + addThis(); + + /* + * Now let's set |lastIndex| to -1 + */ + status = inSection(20); + pattern.lastIndex = -1; + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc') // NOT null as before - + addThis(); + + /* + * Now try some edge-case values. Thanks to the work done in + * http://bugzilla.mozilla.org/show_bug.cgi?id=124339, |lastIndex| + * is now stored as a double instead of a uint32 (unsigned integer). + * + * Note 2^32 -1 is the upper bound for uint32's, but doubles can go + * all the way up to Number.MAX_VALUE. So that's why we need cases + * between those two numbers. + */ + status = inSection(21); + pattern.lastIndex = Math.pow(2,32); + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc') // NOT null as before - + addThis(); + + status = inSection(22); + pattern.lastIndex = -Math.pow(2,32); + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc') // NOT null as before - + addThis(); + + status = inSection(23); + pattern.lastIndex = Math.pow(2,32) + 1; + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc') // NOT null as before - + addThis(); + + status = inSection(24); + pattern.lastIndex = -(Math.pow(2,32) + 1); + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc') // NOT null as before - + addThis(); + + status = inSection(25); + pattern.lastIndex = Math.pow(2,32) * 2; + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc') // NOT null as before - + addThis(); + + status = inSection(26); + pattern.lastIndex = -Math.pow(2,32) * 2; + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc') // NOT null as before - + addThis(); + + status = inSection(27); + pattern.lastIndex = Math.pow(2,40); + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc') // NOT null as before -; + addThis(); + + status = inSection(28); + pattern.lastIndex = -Math.pow(2,40); + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc') // NOT null as before - + addThis(); + + status = inSection(29); + pattern.lastIndex = Number.MAX_VALUE; + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc') // NOT null as before - + addThis(); + + status = inSection(30); + pattern.lastIndex = -Number.MAX_VALUE; + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc') // NOT null as before - + addThis(); + + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/octal-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/octal-001.js new file mode 100644 index 0000000..34b3e34 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/octal-001.js @@ -0,0 +1,131 @@ +/* ***** 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): 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: 18 July 2002 +* SUMMARY: Testing octal sequences in regexps +* See http://bugzilla.mozilla.org/show_bug.cgi?id=141078 +* +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 141078; +var summary = 'Testing octal sequences in regexps'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +status = inSection(1); +pattern = /\240/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +/* + * In the following sections, we test the octal escape sequence '\052'. + * This is character code 42, representing the asterisk character '*'. + * The Unicode escape for it would be '\u002A', the hex escape '\x2A'. + */ +status = inSection(2); +pattern = /ab\052c/; +string = 'ab*c'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab*c'); +addThis(); + +status = inSection(3); +pattern = /ab\052*c/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(4); +pattern = /ab(\052)+c/; +string = 'ab****c'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab****c', '*'); +addThis(); + +status = inSection(5); +pattern = /ab((\052)+)c/; +string = 'ab****c'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab****c', '****', '*'); +addThis(); + +status = inSection(6); +pattern = /(?:\052)c/; +string = 'ab****c'; +actualmatch = string.match(pattern); +expectedmatch = Array('*c'); +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/octal-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/octal-002.js new file mode 100644 index 0000000..6d75e48 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/octal-002.js @@ -0,0 +1,213 @@ +/* ***** 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): 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: 31 July 2002 +* SUMMARY: Testing regexps containing octal escape sequences +* This is an elaboration of mozilla/js/tests/ecma_2/RegExp/octal-003.js +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=141078 +* for a reference on octal escape sequences in regexps. +* +* NOTE: +* We will use the identities '\011' === '\u0009' === '\x09' === '\t' +* +* The first is an octal escape sequence (\(0-3)OO; O an octal digit). +* See ECMA-262 Edition 2, Section 7.7.4 "String Literals". These were +* dropped in Edition 3 but we support them for backward compatibility. +* +* The second is a Unicode escape sequence (\uHHHH; H a hex digit). +* Since octal 11 = hex 9, the two escapes define the same character. +* +* The third is a hex escape sequence (\xHH; H a hex digit). +* Since hex 09 = hex 0009, this defines the same character. +* +* The fourth is the familiar escape sequence for a horizontal tab, +* defined in the ECMA spec as having Unicode value \u0009. +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 141078; +var summary = 'Testing regexps containing octal escape sequences'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +/* + * Test a string containing the null character '\0' followed by the string '11' + * + * 'a' + String.fromCharCode(0) + '11'; + * + * Note we can't simply write 'a\011', because '\011' would be interpreted + * as the octal escape sequence for the tab character (see above). + * + * We should get no match from the regexp /.\011/, because it should be + * looking for the octal escape sequence \011, i.e. the tab character - + * + */ +status = inSection(1); +pattern = /.\011/; +string = 'a' + String.fromCharCode(0) + '11'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + + +/* + * Try same thing with 'xx' in place of '11'. + * + * Should get a match now, because the octal escape sequence in the regexp + * has been reduced from \011 to \0, and '\0' is present in the string - + */ +status = inSection(2); +pattern = /.\0xx/; +string = 'a' + String.fromCharCode(0) + 'xx'; +actualmatch = string.match(pattern); +expectedmatch = Array(string); +addThis(); + + +/* + * Same thing; don't use |String.fromCharCode(0)| this time. + * There is no ambiguity in '\0xx': it is the null character + * followed by two x's, no other interpretation is possible. + */ +status = inSection(3); +pattern = /.\0xx/; +string = 'a\0xx'; +actualmatch = string.match(pattern); +expectedmatch = Array(string); +addThis(); + + +/* + * This one should produce a match. The two-character string + * 'a' + '\011' is duplicated in the pattern and test string: + */ +status = inSection(4); +pattern = /.\011/; +string = 'a\011'; +actualmatch = string.match(pattern); +expectedmatch = Array(string); +addThis(); + + +/* + * Same as above, only now, for the second character of the string, + * use the Unicode escape '\u0009' instead of the octal escape '\011' + */ +status = inSection(5); +pattern = /.\011/; +string = 'a\u0009'; +actualmatch = string.match(pattern); +expectedmatch = Array(string); +addThis(); + + +/* + * Same as above, only now for the second character of the string, + * use the hex escape '\x09' instead of the octal escape '\011' + */ +status = inSection(6); +pattern = /.\011/; +string = 'a\x09'; +actualmatch = string.match(pattern); +expectedmatch = Array(string); +addThis(); + + +/* + * Same as above, only now for the second character of the string, + * use the escape '\t' instead of the octal escape '\011' + */ +status = inSection(7); +pattern = /.\011/; +string = 'a\t'; +actualmatch = string.match(pattern); +expectedmatch = Array(string); +addThis(); + + +/* + * Return to the string from Section 1. + * + * Unlike Section 1, use the RegExp() function to create the + * regexp pattern: null character followed by the string '11'. + * + * Since this is exactly what the string is, we should get a match - + */ +status = inSection(8); +string = 'a' + String.fromCharCode(0) + '11'; +pattern = RegExp(string); +actualmatch = string.match(pattern); +expectedmatch = Array(string); +addThis(); + + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/perlstress-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/perlstress-001.js new file mode 100644 index 0000000..fd544c2 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/perlstress-001.js @@ -0,0 +1,3225 @@ +/* ***** 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): pschwartau@netscape.com, rogerl@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: 2002-07-07 +* SUMMARY: Testing JS RegExp engine against Perl 5 RegExp engine. +* Adjust cnLBOUND, cnUBOUND below to restrict which sections are tested. +* +* This test was created by running various patterns and strings through the +* Perl 5 RegExp engine. We saved the results below to test the JS engine. +* +* NOTE: ECMA/JS and Perl do differ on certain points. We have either commented +* out such sections altogether, or modified them to fit what we expect from JS. +* +* EXAMPLES: +* +* - In JS, regexp captures (/(a) etc./) must hold |undefined| if not used. +* See http://bugzilla.mozilla.org/show_bug.cgi?id=123437. +* By contrast, in Perl, unmatched captures hold the empty string. +* We have modified such sections accordingly. Example: + + pattern = /^([^a-z])|(\^)$/; + string = '.'; + actualmatch = string.match(pattern); + //expectedmatch = Array('.', '.', ''); <<<--- Perl + expectedmatch = Array('.', '.', undefined); <<<--- JS + addThis(); + + +* - In JS, you can't refer to a capture before it's encountered & completed +* +* - Perl supports ] & ^] inside a [], ECMA does not +* +* - ECMA does support (?: (?= and (?! operators, but doesn't support (?< etc. +* +* - ECMA doesn't support (?imsx or (?-imsx +* +* - ECMA doesn't support (?(condition) +* +* - Perl has \Z has end-of-line, ECMA doesn't +* +* - In ECMA, ^ matches only the empty string before the first character +* +* - In ECMA, $ matches only the empty string at end of input (unless multiline) +* +* - ECMA spec says that each atom in a range must be a single character +* +* - ECMA doesn't support \A +* +* - ECMA doesn't have rules for [: +* +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 85721; +var summary = 'Testing regular expression edge cases'; +var cnSingleSpace = ' '; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); +var cnLBOUND = 1; +var cnUBOUND = 1000; + + +status = inSection(1); +pattern = /abc/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(2); +pattern = /abc/; +string = 'xabcy'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(3); +pattern = /abc/; +string = 'ababc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(4); +pattern = /ab*c/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(5); +pattern = /ab*bc/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(6); +pattern = /ab*bc/; +string = 'abbc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abbc'); +addThis(); + +status = inSection(7); +pattern = /ab*bc/; +string = 'abbbbc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abbbbc'); +addThis(); + +status = inSection(8); +pattern = /.{1}/; +string = 'abbbbc'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(9); +pattern = /.{3,4}/; +string = 'abbbbc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abbb'); +addThis(); + +status = inSection(10); +pattern = /ab{0,}bc/; +string = 'abbbbc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abbbbc'); +addThis(); + +status = inSection(11); +pattern = /ab+bc/; +string = 'abbc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abbc'); +addThis(); + +status = inSection(12); +pattern = /ab+bc/; +string = 'abbbbc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abbbbc'); +addThis(); + +status = inSection(13); +pattern = /ab{1,}bc/; +string = 'abbbbc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abbbbc'); +addThis(); + +status = inSection(14); +pattern = /ab{1,3}bc/; +string = 'abbbbc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abbbbc'); +addThis(); + +status = inSection(15); +pattern = /ab{3,4}bc/; +string = 'abbbbc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abbbbc'); +addThis(); + +status = inSection(16); +pattern = /ab?bc/; +string = 'abbc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abbc'); +addThis(); + +status = inSection(17); +pattern = /ab?bc/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(18); +pattern = /ab{0,1}bc/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(19); +pattern = /ab?c/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(20); +pattern = /ab{0,1}c/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(21); +pattern = /^abc$/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(22); +pattern = /^abc/; +string = 'abcc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(23); +pattern = /abc$/; +string = 'aabc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(24); +pattern = /^/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +status = inSection(25); +pattern = /$/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +status = inSection(26); +pattern = /a.c/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(27); +pattern = /a.c/; +string = 'axc'; +actualmatch = string.match(pattern); +expectedmatch = Array('axc'); +addThis(); + +status = inSection(28); +pattern = /a.*c/; +string = 'axyzc'; +actualmatch = string.match(pattern); +expectedmatch = Array('axyzc'); +addThis(); + +status = inSection(29); +pattern = /a[bc]d/; +string = 'abd'; +actualmatch = string.match(pattern); +expectedmatch = Array('abd'); +addThis(); + +status = inSection(30); +pattern = /a[b-d]e/; +string = 'ace'; +actualmatch = string.match(pattern); +expectedmatch = Array('ace'); +addThis(); + +status = inSection(31); +pattern = /a[b-d]/; +string = 'aac'; +actualmatch = string.match(pattern); +expectedmatch = Array('ac'); +addThis(); + +status = inSection(32); +pattern = /a[-b]/; +string = 'a-'; +actualmatch = string.match(pattern); +expectedmatch = Array('a-'); +addThis(); + +status = inSection(33); +pattern = /a[b-]/; +string = 'a-'; +actualmatch = string.match(pattern); +expectedmatch = Array('a-'); +addThis(); + +status = inSection(34); +pattern = /a]/; +string = 'a]'; +actualmatch = string.match(pattern); +expectedmatch = Array('a]'); +addThis(); + +/* Perl supports ] & ^] inside a [], ECMA does not +pattern = /a[]]b/; +status = inSection(35); +string = 'a]b'; +actualmatch = string.match(pattern); +expectedmatch = Array('a]b'); +addThis(); +*/ + +status = inSection(36); +pattern = /a[^bc]d/; +string = 'aed'; +actualmatch = string.match(pattern); +expectedmatch = Array('aed'); +addThis(); + +status = inSection(37); +pattern = /a[^-b]c/; +string = 'adc'; +actualmatch = string.match(pattern); +expectedmatch = Array('adc'); +addThis(); + +/* Perl supports ] & ^] inside a [], ECMA does not +status = inSection(38); +pattern = /a[^]b]c/; +string = 'adc'; +actualmatch = string.match(pattern); +expectedmatch = Array('adc'); +addThis(); +*/ + +status = inSection(39); +pattern = /\ba\b/; +string = 'a-'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(40); +pattern = /\ba\b/; +string = '-a'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(41); +pattern = /\ba\b/; +string = '-a-'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(42); +pattern = /\By\b/; +string = 'xy'; +actualmatch = string.match(pattern); +expectedmatch = Array('y'); +addThis(); + +status = inSection(43); +pattern = /\by\B/; +string = 'yz'; +actualmatch = string.match(pattern); +expectedmatch = Array('y'); +addThis(); + +status = inSection(44); +pattern = /\By\B/; +string = 'xyz'; +actualmatch = string.match(pattern); +expectedmatch = Array('y'); +addThis(); + +status = inSection(45); +pattern = /\w/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(46); +pattern = /\W/; +string = '-'; +actualmatch = string.match(pattern); +expectedmatch = Array('-'); +addThis(); + +status = inSection(47); +pattern = /a\Sb/; +string = 'a-b'; +actualmatch = string.match(pattern); +expectedmatch = Array('a-b'); +addThis(); + +status = inSection(48); +pattern = /\d/; +string = '1'; +actualmatch = string.match(pattern); +expectedmatch = Array('1'); +addThis(); + +status = inSection(49); +pattern = /\D/; +string = '-'; +actualmatch = string.match(pattern); +expectedmatch = Array('-'); +addThis(); + +status = inSection(50); +pattern = /[\w]/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(51); +pattern = /[\W]/; +string = '-'; +actualmatch = string.match(pattern); +expectedmatch = Array('-'); +addThis(); + +status = inSection(52); +pattern = /a[\S]b/; +string = 'a-b'; +actualmatch = string.match(pattern); +expectedmatch = Array('a-b'); +addThis(); + +status = inSection(53); +pattern = /[\d]/; +string = '1'; +actualmatch = string.match(pattern); +expectedmatch = Array('1'); +addThis(); + +status = inSection(54); +pattern = /[\D]/; +string = '-'; +actualmatch = string.match(pattern); +expectedmatch = Array('-'); +addThis(); + +status = inSection(55); +pattern = /ab|cd/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); + +status = inSection(56); +pattern = /ab|cd/; +string = 'abcd'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); + +status = inSection(57); +pattern = /()ef/; +string = 'def'; +actualmatch = string.match(pattern); +expectedmatch = Array('ef', ''); +addThis(); + +status = inSection(58); +pattern = /a\(b/; +string = 'a(b'; +actualmatch = string.match(pattern); +expectedmatch = Array('a(b'); +addThis(); + +status = inSection(59); +pattern = /a\(*b/; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); + +status = inSection(60); +pattern = /a\(*b/; +string = 'a((b'; +actualmatch = string.match(pattern); +expectedmatch = Array('a((b'); +addThis(); + +status = inSection(61); +pattern = /a\\b/; +string = 'a\\b'; +actualmatch = string.match(pattern); +expectedmatch = Array('a\\b'); +addThis(); + +status = inSection(62); +pattern = /((a))/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('a', 'a', 'a'); +addThis(); + +status = inSection(63); +pattern = /(a)b(c)/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc', 'a', 'c'); +addThis(); + +status = inSection(64); +pattern = /a+b+c/; +string = 'aabbabc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(65); +pattern = /a{1,}b{1,}c/; +string = 'aabbabc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(66); +pattern = /a.+?c/; +string = 'abcabc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(67); +pattern = /(a+|b)*/; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab', 'b'); +addThis(); + +status = inSection(68); +pattern = /(a+|b){0,}/; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab', 'b'); +addThis(); + +status = inSection(69); +pattern = /(a+|b)+/; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab', 'b'); +addThis(); + +status = inSection(70); +pattern = /(a+|b){1,}/; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab', 'b'); +addThis(); + +status = inSection(71); +pattern = /(a+|b)?/; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('a', 'a'); +addThis(); + +status = inSection(72); +pattern = /(a+|b){0,1}/; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('a', 'a'); +addThis(); + +status = inSection(73); +pattern = /[^ab]*/; +string = 'cde'; +actualmatch = string.match(pattern); +expectedmatch = Array('cde'); +addThis(); + +status = inSection(74); +pattern = /([abc])*d/; +string = 'abbbcd'; +actualmatch = string.match(pattern); +expectedmatch = Array('abbbcd', 'c'); +addThis(); + +status = inSection(75); +pattern = /([abc])*bcd/; +string = 'abcd'; +actualmatch = string.match(pattern); +expectedmatch = Array('abcd', 'a'); +addThis(); + +status = inSection(76); +pattern = /a|b|c|d|e/; +string = 'e'; +actualmatch = string.match(pattern); +expectedmatch = Array('e'); +addThis(); + +status = inSection(77); +pattern = /(a|b|c|d|e)f/; +string = 'ef'; +actualmatch = string.match(pattern); +expectedmatch = Array('ef', 'e'); +addThis(); + +status = inSection(78); +pattern = /abcd*efg/; +string = 'abcdefg'; +actualmatch = string.match(pattern); +expectedmatch = Array('abcdefg'); +addThis(); + +status = inSection(79); +pattern = /ab*/; +string = 'xabyabbbz'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); + +status = inSection(80); +pattern = /ab*/; +string = 'xayabbbz'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(81); +pattern = /(ab|cd)e/; +string = 'abcde'; +actualmatch = string.match(pattern); +expectedmatch = Array('cde', 'cd'); +addThis(); + +status = inSection(82); +pattern = /[abhgefdc]ij/; +string = 'hij'; +actualmatch = string.match(pattern); +expectedmatch = Array('hij'); +addThis(); + +status = inSection(83); +pattern = /(abc|)ef/; +string = 'abcdef'; +actualmatch = string.match(pattern); +expectedmatch = Array('ef', ''); +addThis(); + +status = inSection(84); +pattern = /(a|b)c*d/; +string = 'abcd'; +actualmatch = string.match(pattern); +expectedmatch = Array('bcd', 'b'); +addThis(); + +status = inSection(85); +pattern = /(ab|ab*)bc/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc', 'a'); +addThis(); + +status = inSection(86); +pattern = /a([bc]*)c*/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc', 'bc'); +addThis(); + +status = inSection(87); +pattern = /a([bc]*)(c*d)/; +string = 'abcd'; +actualmatch = string.match(pattern); +expectedmatch = Array('abcd', 'bc', 'd'); +addThis(); + +status = inSection(88); +pattern = /a([bc]+)(c*d)/; +string = 'abcd'; +actualmatch = string.match(pattern); +expectedmatch = Array('abcd', 'bc', 'd'); +addThis(); + +status = inSection(89); +pattern = /a([bc]*)(c+d)/; +string = 'abcd'; +actualmatch = string.match(pattern); +expectedmatch = Array('abcd', 'b', 'cd'); +addThis(); + +status = inSection(90); +pattern = /a[bcd]*dcdcde/; +string = 'adcdcde'; +actualmatch = string.match(pattern); +expectedmatch = Array('adcdcde'); +addThis(); + +status = inSection(91); +pattern = /(ab|a)b*c/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc', 'ab'); +addThis(); + +status = inSection(92); +pattern = /((a)(b)c)(d)/; +string = 'abcd'; +actualmatch = string.match(pattern); +expectedmatch = Array('abcd', 'abc', 'a', 'b', 'd'); +addThis(); + +status = inSection(93); +pattern = /[a-zA-Z_][a-zA-Z0-9_]*/; +string = 'alpha'; +actualmatch = string.match(pattern); +expectedmatch = Array('alpha'); +addThis(); + +status = inSection(94); +pattern = /^a(bc+|b[eh])g|.h$/; +string = 'abh'; +actualmatch = string.match(pattern); +expectedmatch = Array('bh', undefined); +addThis(); + +status = inSection(95); +pattern = /(bc+d$|ef*g.|h?i(j|k))/; +string = 'effgz'; +actualmatch = string.match(pattern); +expectedmatch = Array('effgz', 'effgz', undefined); +addThis(); + +status = inSection(96); +pattern = /(bc+d$|ef*g.|h?i(j|k))/; +string = 'ij'; +actualmatch = string.match(pattern); +expectedmatch = Array('ij', 'ij', 'j'); +addThis(); + +status = inSection(97); +pattern = /(bc+d$|ef*g.|h?i(j|k))/; +string = 'reffgz'; +actualmatch = string.match(pattern); +expectedmatch = Array('effgz', 'effgz', undefined); +addThis(); + +status = inSection(98); +pattern = /((((((((((a))))))))))/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = Array('a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a'); +addThis(); + +status = inSection(99); +pattern = /((((((((((a))))))))))\10/; +string = 'aa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aa', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a'); +addThis(); + +status = inSection(100); +pattern = /((((((((((a))))))))))/; +string = 'a!'; +actualmatch = string.match(pattern); +expectedmatch = Array('a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a'); +addThis(); + +status = inSection(101); +pattern = /(((((((((a)))))))))/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = Array('a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a'); +addThis(); + +status = inSection(102); +pattern = /(.*)c(.*)/; +string = 'abcde'; +actualmatch = string.match(pattern); +expectedmatch = Array('abcde', 'ab', 'de'); +addThis(); + +status = inSection(103); +pattern = /abcd/; +string = 'abcd'; +actualmatch = string.match(pattern); +expectedmatch = Array('abcd'); +addThis(); + +status = inSection(104); +pattern = /a(bc)d/; +string = 'abcd'; +actualmatch = string.match(pattern); +expectedmatch = Array('abcd', 'bc'); +addThis(); + +status = inSection(105); +pattern = /a[-]?c/; +string = 'ac'; +actualmatch = string.match(pattern); +expectedmatch = Array('ac'); +addThis(); + +status = inSection(106); +pattern = /(abc)\1/; +string = 'abcabc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abcabc', 'abc'); +addThis(); + +status = inSection(107); +pattern = /([a-c]*)\1/; +string = 'abcabc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abcabc', 'abc'); +addThis(); + +status = inSection(108); +pattern = /(a)|\1/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = Array('a', 'a'); +addThis(); + +status = inSection(109); +pattern = /(([a-c])b*?\2)*/; +string = 'ababbbcbc'; +actualmatch = string.match(pattern); +expectedmatch = Array('ababb', 'bb', 'b'); +addThis(); + +status = inSection(110); +pattern = /(([a-c])b*?\2){3}/; +string = 'ababbbcbc'; +actualmatch = string.match(pattern); +expectedmatch = Array('ababbbcbc', 'cbc', 'c'); +addThis(); + +/* Can't refer to a capture before it's encountered & completed +status = inSection(111); +pattern = /((\3|b)\2(a)x)+/; +string = 'aaaxabaxbaaxbbax'; +actualmatch = string.match(pattern); +expectedmatch = Array('bbax', 'bbax', 'b', 'a'); +addThis(); + +status = inSection(112); +pattern = /((\3|b)\2(a)){2,}/; +string = 'bbaababbabaaaaabbaaaabba'; +actualmatch = string.match(pattern); +expectedmatch = Array('bbaaaabba', 'bba', 'b', 'a'); +addThis(); +*/ + +status = inSection(113); +pattern = /abc/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(114); +pattern = /abc/i; +string = 'XABCY'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(115); +pattern = /abc/i; +string = 'ABABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(116); +pattern = /ab*c/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(117); +pattern = /ab*bc/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(118); +pattern = /ab*bc/i; +string = 'ABBC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABBC'); +addThis(); + +status = inSection(119); +pattern = /ab*?bc/i; +string = 'ABBBBC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABBBBC'); +addThis(); + +status = inSection(120); +pattern = /ab{0,}?bc/i; +string = 'ABBBBC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABBBBC'); +addThis(); + +status = inSection(121); +pattern = /ab+?bc/i; +string = 'ABBC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABBC'); +addThis(); + +status = inSection(122); +pattern = /ab+bc/i; +string = 'ABBBBC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABBBBC'); +addThis(); + +status = inSection(123); +pattern = /ab{1,}?bc/i; +string = 'ABBBBC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABBBBC'); +addThis(); + +status = inSection(124); +pattern = /ab{1,3}?bc/i; +string = 'ABBBBC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABBBBC'); +addThis(); + +status = inSection(125); +pattern = /ab{3,4}?bc/i; +string = 'ABBBBC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABBBBC'); +addThis(); + +status = inSection(126); +pattern = /ab??bc/i; +string = 'ABBC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABBC'); +addThis(); + +status = inSection(127); +pattern = /ab??bc/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(128); +pattern = /ab{0,1}?bc/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(129); +pattern = /ab??c/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(130); +pattern = /ab{0,1}?c/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(131); +pattern = /^abc$/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(132); +pattern = /^abc/i; +string = 'ABCC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(133); +pattern = /abc$/i; +string = 'AABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(134); +pattern = /^/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +status = inSection(135); +pattern = /$/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +status = inSection(136); +pattern = /a.c/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(137); +pattern = /a.c/i; +string = 'AXC'; +actualmatch = string.match(pattern); +expectedmatch = Array('AXC'); +addThis(); + +status = inSection(138); +pattern = /a.*?c/i; +string = 'AXYZC'; +actualmatch = string.match(pattern); +expectedmatch = Array('AXYZC'); +addThis(); + +status = inSection(139); +pattern = /a[bc]d/i; +string = 'ABD'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABD'); +addThis(); + +status = inSection(140); +pattern = /a[b-d]e/i; +string = 'ACE'; +actualmatch = string.match(pattern); +expectedmatch = Array('ACE'); +addThis(); + +status = inSection(141); +pattern = /a[b-d]/i; +string = 'AAC'; +actualmatch = string.match(pattern); +expectedmatch = Array('AC'); +addThis(); + +status = inSection(142); +pattern = /a[-b]/i; +string = 'A-'; +actualmatch = string.match(pattern); +expectedmatch = Array('A-'); +addThis(); + +status = inSection(143); +pattern = /a[b-]/i; +string = 'A-'; +actualmatch = string.match(pattern); +expectedmatch = Array('A-'); +addThis(); + +status = inSection(144); +pattern = /a]/i; +string = 'A]'; +actualmatch = string.match(pattern); +expectedmatch = Array('A]'); +addThis(); + +/* Perl supports ] & ^] inside a [], ECMA does not +status = inSection(145); +pattern = /a[]]b/i; +string = 'A]B'; +actualmatch = string.match(pattern); +expectedmatch = Array('A]B'); +addThis(); +*/ + +status = inSection(146); +pattern = /a[^bc]d/i; +string = 'AED'; +actualmatch = string.match(pattern); +expectedmatch = Array('AED'); +addThis(); + +status = inSection(147); +pattern = /a[^-b]c/i; +string = 'ADC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ADC'); +addThis(); + +/* Perl supports ] & ^] inside a [], ECMA does not +status = inSection(148); +pattern = /a[^]b]c/i; +string = 'ADC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ADC'); +addThis(); +*/ + +status = inSection(149); +pattern = /ab|cd/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('AB'); +addThis(); + +status = inSection(150); +pattern = /ab|cd/i; +string = 'ABCD'; +actualmatch = string.match(pattern); +expectedmatch = Array('AB'); +addThis(); + +status = inSection(151); +pattern = /()ef/i; +string = 'DEF'; +actualmatch = string.match(pattern); +expectedmatch = Array('EF', ''); +addThis(); + +status = inSection(152); +pattern = /a\(b/i; +string = 'A(B'; +actualmatch = string.match(pattern); +expectedmatch = Array('A(B'); +addThis(); + +status = inSection(153); +pattern = /a\(*b/i; +string = 'AB'; +actualmatch = string.match(pattern); +expectedmatch = Array('AB'); +addThis(); + +status = inSection(154); +pattern = /a\(*b/i; +string = 'A((B'; +actualmatch = string.match(pattern); +expectedmatch = Array('A((B'); +addThis(); + +status = inSection(155); +pattern = /a\\b/i; +string = 'A\\B'; +actualmatch = string.match(pattern); +expectedmatch = Array('A\\B'); +addThis(); + +status = inSection(156); +pattern = /((a))/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('A', 'A', 'A'); +addThis(); + +status = inSection(157); +pattern = /(a)b(c)/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC', 'A', 'C'); +addThis(); + +status = inSection(158); +pattern = /a+b+c/i; +string = 'AABBABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(159); +pattern = /a{1,}b{1,}c/i; +string = 'AABBABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(160); +pattern = /a.+?c/i; +string = 'ABCABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(161); +pattern = /a.*?c/i; +string = 'ABCABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(162); +pattern = /a.{0,5}?c/i; +string = 'ABCABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(163); +pattern = /(a+|b)*/i; +string = 'AB'; +actualmatch = string.match(pattern); +expectedmatch = Array('AB', 'B'); +addThis(); + +status = inSection(164); +pattern = /(a+|b){0,}/i; +string = 'AB'; +actualmatch = string.match(pattern); +expectedmatch = Array('AB', 'B'); +addThis(); + +status = inSection(165); +pattern = /(a+|b)+/i; +string = 'AB'; +actualmatch = string.match(pattern); +expectedmatch = Array('AB', 'B'); +addThis(); + +status = inSection(166); +pattern = /(a+|b){1,}/i; +string = 'AB'; +actualmatch = string.match(pattern); +expectedmatch = Array('AB', 'B'); +addThis(); + +status = inSection(167); +pattern = /(a+|b)?/i; +string = 'AB'; +actualmatch = string.match(pattern); +expectedmatch = Array('A', 'A'); +addThis(); + +status = inSection(168); +pattern = /(a+|b){0,1}/i; +string = 'AB'; +actualmatch = string.match(pattern); +expectedmatch = Array('A', 'A'); +addThis(); + +status = inSection(169); +pattern = /(a+|b){0,1}?/i; +string = 'AB'; +actualmatch = string.match(pattern); +expectedmatch = Array('', undefined); +addThis(); + +status = inSection(170); +pattern = /[^ab]*/i; +string = 'CDE'; +actualmatch = string.match(pattern); +expectedmatch = Array('CDE'); +addThis(); + +status = inSection(171); +pattern = /([abc])*d/i; +string = 'ABBBCD'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABBBCD', 'C'); +addThis(); + +status = inSection(172); +pattern = /([abc])*bcd/i; +string = 'ABCD'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABCD', 'A'); +addThis(); + +status = inSection(173); +pattern = /a|b|c|d|e/i; +string = 'E'; +actualmatch = string.match(pattern); +expectedmatch = Array('E'); +addThis(); + +status = inSection(174); +pattern = /(a|b|c|d|e)f/i; +string = 'EF'; +actualmatch = string.match(pattern); +expectedmatch = Array('EF', 'E'); +addThis(); + +status = inSection(175); +pattern = /abcd*efg/i; +string = 'ABCDEFG'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABCDEFG'); +addThis(); + +status = inSection(176); +pattern = /ab*/i; +string = 'XABYABBBZ'; +actualmatch = string.match(pattern); +expectedmatch = Array('AB'); +addThis(); + +status = inSection(177); +pattern = /ab*/i; +string = 'XAYABBBZ'; +actualmatch = string.match(pattern); +expectedmatch = Array('A'); +addThis(); + +status = inSection(178); +pattern = /(ab|cd)e/i; +string = 'ABCDE'; +actualmatch = string.match(pattern); +expectedmatch = Array('CDE', 'CD'); +addThis(); + +status = inSection(179); +pattern = /[abhgefdc]ij/i; +string = 'HIJ'; +actualmatch = string.match(pattern); +expectedmatch = Array('HIJ'); +addThis(); + +status = inSection(180); +pattern = /(abc|)ef/i; +string = 'ABCDEF'; +actualmatch = string.match(pattern); +expectedmatch = Array('EF', ''); +addThis(); + +status = inSection(181); +pattern = /(a|b)c*d/i; +string = 'ABCD'; +actualmatch = string.match(pattern); +expectedmatch = Array('BCD', 'B'); +addThis(); + +status = inSection(182); +pattern = /(ab|ab*)bc/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC', 'A'); +addThis(); + +status = inSection(183); +pattern = /a([bc]*)c*/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC', 'BC'); +addThis(); + +status = inSection(184); +pattern = /a([bc]*)(c*d)/i; +string = 'ABCD'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABCD', 'BC', 'D'); +addThis(); + +status = inSection(185); +pattern = /a([bc]+)(c*d)/i; +string = 'ABCD'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABCD', 'BC', 'D'); +addThis(); + +status = inSection(186); +pattern = /a([bc]*)(c+d)/i; +string = 'ABCD'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABCD', 'B', 'CD'); +addThis(); + +status = inSection(187); +pattern = /a[bcd]*dcdcde/i; +string = 'ADCDCDE'; +actualmatch = string.match(pattern); +expectedmatch = Array('ADCDCDE'); +addThis(); + +status = inSection(188); +pattern = /(ab|a)b*c/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC', 'AB'); +addThis(); + +status = inSection(189); +pattern = /((a)(b)c)(d)/i; +string = 'ABCD'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABCD', 'ABC', 'A', 'B', 'D'); +addThis(); + +status = inSection(190); +pattern = /[a-zA-Z_][a-zA-Z0-9_]*/i; +string = 'ALPHA'; +actualmatch = string.match(pattern); +expectedmatch = Array('ALPHA'); +addThis(); + +status = inSection(191); +pattern = /^a(bc+|b[eh])g|.h$/i; +string = 'ABH'; +actualmatch = string.match(pattern); +expectedmatch = Array('BH', undefined); +addThis(); + +status = inSection(192); +pattern = /(bc+d$|ef*g.|h?i(j|k))/i; +string = 'EFFGZ'; +actualmatch = string.match(pattern); +expectedmatch = Array('EFFGZ', 'EFFGZ', undefined); +addThis(); + +status = inSection(193); +pattern = /(bc+d$|ef*g.|h?i(j|k))/i; +string = 'IJ'; +actualmatch = string.match(pattern); +expectedmatch = Array('IJ', 'IJ', 'J'); +addThis(); + +status = inSection(194); +pattern = /(bc+d$|ef*g.|h?i(j|k))/i; +string = 'REFFGZ'; +actualmatch = string.match(pattern); +expectedmatch = Array('EFFGZ', 'EFFGZ', undefined); +addThis(); + +status = inSection(195); +pattern = /((((((((((a))))))))))/i; +string = 'A'; +actualmatch = string.match(pattern); +expectedmatch = Array('A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A'); +addThis(); + +status = inSection(196); +pattern = /((((((((((a))))))))))\10/i; +string = 'AA'; +actualmatch = string.match(pattern); +expectedmatch = Array('AA', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A'); +addThis(); + +status = inSection(197); +pattern = /((((((((((a))))))))))/i; +string = 'A!'; +actualmatch = string.match(pattern); +expectedmatch = Array('A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A'); +addThis(); + +status = inSection(198); +pattern = /(((((((((a)))))))))/i; +string = 'A'; +actualmatch = string.match(pattern); +expectedmatch = Array('A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A'); +addThis(); + +status = inSection(199); +pattern = /(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))/i; +string = 'A'; +actualmatch = string.match(pattern); +expectedmatch = Array('A', 'A'); +addThis(); + +status = inSection(200); +pattern = /(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))/i; +string = 'C'; +actualmatch = string.match(pattern); +expectedmatch = Array('C', 'C'); +addThis(); + +status = inSection(201); +pattern = /(.*)c(.*)/i; +string = 'ABCDE'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABCDE', 'AB', 'DE'); +addThis(); + +status = inSection(202); +pattern = /abcd/i; +string = 'ABCD'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABCD'); +addThis(); + +status = inSection(203); +pattern = /a(bc)d/i; +string = 'ABCD'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABCD', 'BC'); +addThis(); + +status = inSection(204); +pattern = /a[-]?c/i; +string = 'AC'; +actualmatch = string.match(pattern); +expectedmatch = Array('AC'); +addThis(); + +status = inSection(205); +pattern = /(abc)\1/i; +string = 'ABCABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABCABC', 'ABC'); +addThis(); + +status = inSection(206); +pattern = /([a-c]*)\1/i; +string = 'ABCABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABCABC', 'ABC'); +addThis(); + +status = inSection(207); +pattern = /a(?!b)./; +string = 'abad'; +actualmatch = string.match(pattern); +expectedmatch = Array('ad'); +addThis(); + +status = inSection(208); +pattern = /a(?=d)./; +string = 'abad'; +actualmatch = string.match(pattern); +expectedmatch = Array('ad'); +addThis(); + +status = inSection(209); +pattern = /a(?=c|d)./; +string = 'abad'; +actualmatch = string.match(pattern); +expectedmatch = Array('ad'); +addThis(); + +status = inSection(210); +pattern = /a(?:b|c|d)(.)/; +string = 'ace'; +actualmatch = string.match(pattern); +expectedmatch = Array('ace', 'e'); +addThis(); + +status = inSection(211); +pattern = /a(?:b|c|d)*(.)/; +string = 'ace'; +actualmatch = string.match(pattern); +expectedmatch = Array('ace', 'e'); +addThis(); + +status = inSection(212); +pattern = /a(?:b|c|d)+?(.)/; +string = 'ace'; +actualmatch = string.match(pattern); +expectedmatch = Array('ace', 'e'); +addThis(); + +status = inSection(213); +pattern = /a(?:b|c|d)+?(.)/; +string = 'acdbcdbe'; +actualmatch = string.match(pattern); +expectedmatch = Array('acd', 'd'); +addThis(); + +status = inSection(214); +pattern = /a(?:b|c|d)+(.)/; +string = 'acdbcdbe'; +actualmatch = string.match(pattern); +expectedmatch = Array('acdbcdbe', 'e'); +addThis(); + +status = inSection(215); +pattern = /a(?:b|c|d){2}(.)/; +string = 'acdbcdbe'; +actualmatch = string.match(pattern); +expectedmatch = Array('acdb', 'b'); +addThis(); + +status = inSection(216); +pattern = /a(?:b|c|d){4,5}(.)/; +string = 'acdbcdbe'; +actualmatch = string.match(pattern); +expectedmatch = Array('acdbcdb', 'b'); +addThis(); + +status = inSection(217); +pattern = /a(?:b|c|d){4,5}?(.)/; +string = 'acdbcdbe'; +actualmatch = string.match(pattern); +expectedmatch = Array('acdbcd', 'd'); +addThis(); + +// MODIFIED - ECMA has different rules for paren contents +status = inSection(218); +pattern = /((foo)|(bar))*/; +string = 'foobar'; +actualmatch = string.match(pattern); +//expectedmatch = Array('foobar', 'bar', 'foo', 'bar'); +expectedmatch = Array('foobar', 'bar', undefined, 'bar'); +addThis(); + +status = inSection(219); +pattern = /a(?:b|c|d){6,7}(.)/; +string = 'acdbcdbe'; +actualmatch = string.match(pattern); +expectedmatch = Array('acdbcdbe', 'e'); +addThis(); + +status = inSection(220); +pattern = /a(?:b|c|d){6,7}?(.)/; +string = 'acdbcdbe'; +actualmatch = string.match(pattern); +expectedmatch = Array('acdbcdbe', 'e'); +addThis(); + +status = inSection(221); +pattern = /a(?:b|c|d){5,6}(.)/; +string = 'acdbcdbe'; +actualmatch = string.match(pattern); +expectedmatch = Array('acdbcdbe', 'e'); +addThis(); + +status = inSection(222); +pattern = /a(?:b|c|d){5,6}?(.)/; +string = 'acdbcdbe'; +actualmatch = string.match(pattern); +expectedmatch = Array('acdbcdb', 'b'); +addThis(); + +status = inSection(223); +pattern = /a(?:b|c|d){5,7}(.)/; +string = 'acdbcdbe'; +actualmatch = string.match(pattern); +expectedmatch = Array('acdbcdbe', 'e'); +addThis(); + +status = inSection(224); +pattern = /a(?:b|c|d){5,7}?(.)/; +string = 'acdbcdbe'; +actualmatch = string.match(pattern); +expectedmatch = Array('acdbcdb', 'b'); +addThis(); + +status = inSection(225); +pattern = /a(?:b|(c|e){1,2}?|d)+?(.)/; +string = 'ace'; +actualmatch = string.match(pattern); +expectedmatch = Array('ace', 'c', 'e'); +addThis(); + +status = inSection(226); +pattern = /^(.+)?B/; +string = 'AB'; +actualmatch = string.match(pattern); +expectedmatch = Array('AB', 'A'); +addThis(); + +/* MODIFIED - ECMA has different rules for paren contents */ +status = inSection(227); +pattern = /^([^a-z])|(\^)$/; +string = '.'; +actualmatch = string.match(pattern); +//expectedmatch = Array('.', '.', ''); +expectedmatch = Array('.', '.', undefined); +addThis(); + +status = inSection(228); +pattern = /^[<>]&/; +string = '<&OUT'; +actualmatch = string.match(pattern); +expectedmatch = Array('<&'); +addThis(); + +/* Can't refer to a capture before it's encountered & completed +status = inSection(229); +pattern = /^(a\1?){4}$/; +string = 'aaaaaaaaaa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaaaaaaaaa', 'aaaa'); +addThis(); + +status = inSection(230); +pattern = /^(a(?(1)\1)){4}$/; +string = 'aaaaaaaaaa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaaaaaaaaa', 'aaaa'); +addThis(); +*/ + +status = inSection(231); +pattern = /((a{4})+)/; +string = 'aaaaaaaaa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaaaaaaa', 'aaaaaaaa', 'aaaa'); +addThis(); + +status = inSection(232); +pattern = /(((aa){2})+)/; +string = 'aaaaaaaaaa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaaaaaaa', 'aaaaaaaa', 'aaaa', 'aa'); +addThis(); + +status = inSection(233); +pattern = /(((a{2}){2})+)/; +string = 'aaaaaaaaaa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaaaaaaa', 'aaaaaaaa', 'aaaa', 'aa'); +addThis(); + +status = inSection(234); +pattern = /(?:(f)(o)(o)|(b)(a)(r))*/; +string = 'foobar'; +actualmatch = string.match(pattern); +//expectedmatch = Array('foobar', 'f', 'o', 'o', 'b', 'a', 'r'); +expectedmatch = Array('foobar', undefined, undefined, undefined, 'b', 'a', 'r'); +addThis(); + +/* ECMA supports (?: (?= and (?! but doesn't support (?< etc. +status = inSection(235); +pattern = /(?<=a)b/; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('b'); +addThis(); + +status = inSection(236); +pattern = /(? +status = inSection(311); +pattern = /(?>a+)b/; +string = 'aaab'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaab'); +addThis(); +*/ + +status = inSection(312); +pattern = /([[:]+)/; +string = 'a:[b]:'; +actualmatch = string.match(pattern); +expectedmatch = Array(':[', ':['); +addThis(); + +status = inSection(313); +pattern = /([[=]+)/; +string = 'a=[b]='; +actualmatch = string.match(pattern); +expectedmatch = Array('=[', '=['); +addThis(); + +status = inSection(314); +pattern = /([[.]+)/; +string = 'a.[b].'; +actualmatch = string.match(pattern); +expectedmatch = Array('.[', '.['); +addThis(); + +/* ECMA doesn't have rules for [: +status = inSection(315); +pattern = /[a[:]b[:c]/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); +*/ + +/* ECMA doesn't support (?> +status = inSection(316); +pattern = /((?>a+)b)/; +string = 'aaab'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaab', 'aaab'); +addThis(); + +status = inSection(317); +pattern = /(?>(a+))b/; +string = 'aaab'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaab', 'aaa'); +addThis(); + +status = inSection(318); +pattern = /((?>[^()]+)|\([^()]*\))+/; +string = '((abc(ade)ufh()()x'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc(ade)ufh()()x', 'x'); +addThis(); +*/ + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(319); +pattern = /\Z/; +string = 'a\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +status = inSection(320); +pattern = /\z/; +string = 'a\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); +*/ + +status = inSection(321); +pattern = /$/; +string = 'a\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(322); +pattern = /\Z/; +string = 'b\na\n'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +status = inSection(323); +pattern = /\z/; +string = 'b\na\n'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); +*/ + +status = inSection(324); +pattern = /$/; +string = 'b\na\n'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(325); +pattern = /\Z/; +string = 'b\na'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +status = inSection(326); +pattern = /\z/; +string = 'b\na'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); +*/ + +status = inSection(327); +pattern = /$/; +string = 'b\na'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(328); +pattern = /\Z/m; +string = 'a\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +status = inSection(329); +pattern = /\z/m; +string = 'a\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); +*/ + +status = inSection(330); +pattern = /$/m; +string = 'a\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(331); +pattern = /\Z/m; +string = 'b\na\n'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +status = inSection(332); +pattern = /\z/m; +string = 'b\na\n'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); +*/ + +status = inSection(333); +pattern = /$/m; +string = 'b\na\n'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(334); +pattern = /\Z/m; +string = 'b\na'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +status = inSection(335); +pattern = /\z/m; +string = 'b\na'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); +*/ + +status = inSection(336); +pattern = /$/m; +string = 'b\na'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(337); +pattern = /a\Z/; +string = 'b\na\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); +*/ + +/* $ only matches end of input unless multiline +status = inSection(338); +pattern = /a$/; +string = 'b\na\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); +*/ + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(339); +pattern = /a\Z/; +string = 'b\na'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(340); +pattern = /a\z/; +string = 'b\na'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); +*/ + +status = inSection(341); +pattern = /a$/; +string = 'b\na'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(342); +pattern = /a$/m; +string = 'a\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(343); +pattern = /a\Z/m; +string = 'b\na\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); +*/ + +status = inSection(344); +pattern = /a$/m; +string = 'b\na\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(345); +pattern = /a\Z/m; +string = 'b\na'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(346); +pattern = /a\z/m; +string = 'b\na'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); +*/ + +status = inSection(347); +pattern = /a$/m; +string = 'b\na'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(348); +pattern = /aa\Z/; +string = 'b\naa\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('aa'); +addThis(); +*/ + +/* $ only matches end of input unless multiline +status = inSection(349); +pattern = /aa$/; +string = 'b\naa\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('aa'); +addThis(); +*/ + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(350); +pattern = /aa\Z/; +string = 'b\naa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aa'); +addThis(); + +status = inSection(351); +pattern = /aa\z/; +string = 'b\naa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aa'); +addThis(); +*/ + +status = inSection(352); +pattern = /aa$/; +string = 'b\naa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aa'); +addThis(); + +status = inSection(353); +pattern = /aa$/m; +string = 'aa\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('aa'); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(354); +pattern = /aa\Z/m; +string = 'b\naa\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('aa'); +addThis(); +*/ + +status = inSection(355); +pattern = /aa$/m; +string = 'b\naa\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('aa'); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(356); +pattern = /aa\Z/m; +string = 'b\naa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aa'); +addThis(); + +status = inSection(357); +pattern = /aa\z/m; +string = 'b\naa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aa'); +addThis(); +*/ + +status = inSection(358); +pattern = /aa$/m; +string = 'b\naa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aa'); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(359); +pattern = /ab\Z/; +string = 'b\nab\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); +*/ + +/* $ only matches end of input unless multiline +status = inSection(360); +pattern = /ab$/; +string = 'b\nab\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); +*/ + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(361); +pattern = /ab\Z/; +string = 'b\nab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); + +status = inSection(362); +pattern = /ab\z/; +string = 'b\nab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); +*/ + +status = inSection(363); +pattern = /ab$/; +string = 'b\nab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); + +status = inSection(364); +pattern = /ab$/m; +string = 'ab\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(365); +pattern = /ab\Z/m; +string = 'b\nab\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); +*/ + +status = inSection(366); +pattern = /ab$/m; +string = 'b\nab\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(367); +pattern = /ab\Z/m; +string = 'b\nab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); + +status = inSection(368); +pattern = /ab\z/m; +string = 'b\nab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); +*/ + +status = inSection(369); +pattern = /ab$/m; +string = 'b\nab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(370); +pattern = /abb\Z/; +string = 'b\nabb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('abb'); +addThis(); +*/ + +/* $ only matches end of input unless multiline +status = inSection(371); +pattern = /abb$/; +string = 'b\nabb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('abb'); +addThis(); +*/ + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(372); +pattern = /abb\Z/; +string = 'b\nabb'; +actualmatch = string.match(pattern); +expectedmatch = Array('abb'); +addThis(); + +status = inSection(373); +pattern = /abb\z/; +string = 'b\nabb'; +actualmatch = string.match(pattern); +expectedmatch = Array('abb'); +addThis(); +*/ + +status = inSection(374); +pattern = /abb$/; +string = 'b\nabb'; +actualmatch = string.match(pattern); +expectedmatch = Array('abb'); +addThis(); + +status = inSection(375); +pattern = /abb$/m; +string = 'abb\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('abb'); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(376); +pattern = /abb\Z/m; +string = 'b\nabb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('abb'); +addThis(); +*/ + +status = inSection(377); +pattern = /abb$/m; +string = 'b\nabb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('abb'); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(378); +pattern = /abb\Z/m; +string = 'b\nabb'; +actualmatch = string.match(pattern); +expectedmatch = Array('abb'); +addThis(); + +status = inSection(379); +pattern = /abb\z/m; +string = 'b\nabb'; +actualmatch = string.match(pattern); +expectedmatch = Array('abb'); +addThis(); +*/ + +status = inSection(380); +pattern = /abb$/m; +string = 'b\nabb'; +actualmatch = string.match(pattern); +expectedmatch = Array('abb'); +addThis(); + +status = inSection(381); +pattern = /(^|x)(c)/; +string = 'ca'; +actualmatch = string.match(pattern); +expectedmatch = Array('c', '', 'c'); +addThis(); + +status = inSection(382); +pattern = /foo.bart/; +string = 'foo.bart'; +actualmatch = string.match(pattern); +expectedmatch = Array('foo.bart'); +addThis(); + +status = inSection(383); +pattern = /^d[x][x][x]/m; +string = 'abcd\ndxxx'; +actualmatch = string.match(pattern); +expectedmatch = Array('dxxx'); +addThis(); + +status = inSection(384); +pattern = /tt+$/; +string = 'xxxtt'; +actualmatch = string.match(pattern); +expectedmatch = Array('tt'); +addThis(); + +/* ECMA spec says that each atom in a range must be a single character +status = inSection(385); +pattern = /([a-\d]+)/; +string = 'za-9z'; +actualmatch = string.match(pattern); +expectedmatch = Array('9', '9'); +addThis(); + +status = inSection(386); +pattern = /([\d-z]+)/; +string = 'a0-za'; +actualmatch = string.match(pattern); +expectedmatch = Array('0-z', '0-z'); +addThis(); +*/ + +/* ECMA doesn't support [: +status = inSection(387); +pattern = /([a-[:digit:]]+)/; +string = 'za-9z'; +actualmatch = string.match(pattern); +expectedmatch = Array('a-9', 'a-9'); +addThis(); + +status = inSection(388); +pattern = /([[:digit:]-z]+)/; +string = '=0-z='; +actualmatch = string.match(pattern); +expectedmatch = Array('0-z', '0-z'); +addThis(); + +status = inSection(389); +pattern = /([[:digit:]-[:alpha:]]+)/; +string = '=0-z='; +actualmatch = string.match(pattern); +expectedmatch = Array('0-z', '0-z'); +addThis(); +*/ + +status = inSection(390); +pattern = /(\d+\.\d+)/; +string = '3.1415926'; +actualmatch = string.match(pattern); +expectedmatch = Array('3.1415926', '3.1415926'); +addThis(); + +status = inSection(391); +pattern = /\.c(pp|xx|c)?$/i; +string = 'IO.c'; +actualmatch = string.match(pattern); +expectedmatch = Array('.c', undefined); +addThis(); + +status = inSection(392); +pattern = /(\.c(pp|xx|c)?$)/i; +string = 'IO.c'; +actualmatch = string.match(pattern); +expectedmatch = Array('.c', '.c', undefined); +addThis(); + +status = inSection(393); +pattern = /(^|a)b/; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab', 'a'); +addThis(); + +status = inSection(394); +pattern = /^([ab]*?)(b)?(c)$/; +string = 'abac'; +actualmatch = string.match(pattern); +expectedmatch = Array('abac', 'aba', undefined, 'c'); +addThis(); + +status = inSection(395); +pattern = /^(?:.,){2}c/i; +string = 'a,b,c'; +actualmatch = string.match(pattern); +expectedmatch = Array('a,b,c'); +addThis(); + +status = inSection(396); +pattern = /^(.,){2}c/i; +string = 'a,b,c'; +actualmatch = string.match(pattern); +expectedmatch = Array('a,b,c', 'b,'); +addThis(); + +status = inSection(397); +pattern = /^(?:[^,]*,){2}c/; +string = 'a,b,c'; +actualmatch = string.match(pattern); +expectedmatch = Array('a,b,c'); +addThis(); + +status = inSection(398); +pattern = /^([^,]*,){2}c/; +string = 'a,b,c'; +actualmatch = string.match(pattern); +expectedmatch = Array('a,b,c', 'b,'); +addThis(); + +status = inSection(399); +pattern = /^([^,]*,){3}d/; +string = 'aaa,b,c,d'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaa,b,c,d', 'c,'); +addThis(); + +status = inSection(400); +pattern = /^([^,]*,){3,}d/; +string = 'aaa,b,c,d'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaa,b,c,d', 'c,'); +addThis(); + +status = inSection(401); +pattern = /^([^,]*,){0,3}d/; +string = 'aaa,b,c,d'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaa,b,c,d', 'c,'); +addThis(); + +status = inSection(402); +pattern = /^([^,]{1,3},){3}d/i; +string = 'aaa,b,c,d'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaa,b,c,d', 'c,'); +addThis(); + +status = inSection(403); +pattern = /^([^,]{1,3},){3,}d/; +string = 'aaa,b,c,d'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaa,b,c,d', 'c,'); +addThis(); + +status = inSection(404); +pattern = /^([^,]{1,3},){0,3}d/; +string = 'aaa,b,c,d'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaa,b,c,d', 'c,'); +addThis(); + +status = inSection(405); +pattern = /^([^,]{1,},){3}d/; +string = 'aaa,b,c,d'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaa,b,c,d', 'c,'); +addThis(); + +status = inSection(406); +pattern = /^([^,]{1,},){3,}d/; +string = 'aaa,b,c,d'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaa,b,c,d', 'c,'); +addThis(); + +status = inSection(407); +pattern = /^([^,]{1,},){0,3}d/; +string = 'aaa,b,c,d'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaa,b,c,d', 'c,'); +addThis(); + +status = inSection(408); +pattern = /^([^,]{0,3},){3}d/i; +string = 'aaa,b,c,d'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaa,b,c,d', 'c,'); +addThis(); + +status = inSection(409); +pattern = /^([^,]{0,3},){3,}d/; +string = 'aaa,b,c,d'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaa,b,c,d', 'c,'); +addThis(); + +status = inSection(410); +pattern = /^([^,]{0,3},){0,3}d/; +string = 'aaa,b,c,d'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaa,b,c,d', 'c,'); +addThis(); + +/* ECMA doesn't support \A +status = inSection(411); +pattern = /(?!\A)x/m; +string = 'a\nxb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('\n'); +addThis(); +*/ + +status = inSection(412); +pattern = /^(a(b)?)+$/; +string = 'aba'; +actualmatch = string.match(pattern); +expectedmatch = Array('aba', 'a', undefined); +addThis(); + +status = inSection(413); +pattern = /^(aa(bb)?)+$/; +string = 'aabbaa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aabbaa', 'aa', undefined); +addThis(); + +status = inSection(414); +pattern = /^.{9}abc.*\n/m; +string = '123\nabcabcabcabc\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('abcabcabcabc\n'); +addThis(); + +status = inSection(415); +pattern = /^(a)?a$/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = Array('a', undefined); +addThis(); + +status = inSection(416); +pattern = /^(a\1?)(a\1?)(a\2?)(a\3?)$/; +string = 'aaaaaa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaaaaa', 'a', 'aa', 'a', 'aa'); +addThis(); + +/* Can't refer to a capture before it's encountered & completed +status = inSection(417); +pattern = /^(a\1?){4}$/; +string = 'aaaaaa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaaaaa', 'aaa'); +addThis(); +*/ + +status = inSection(418); +pattern = /^(0+)?(?:x(1))?/; +string = 'x1'; +actualmatch = string.match(pattern); +expectedmatch = Array('x1', undefined, '1'); +addThis(); + +status = inSection(419); +pattern = /^([0-9a-fA-F]+)(?:x([0-9a-fA-F]+)?)(?:x([0-9a-fA-F]+))?/; +string = '012cxx0190'; +actualmatch = string.match(pattern); +expectedmatch = Array('012cxx0190', '012c', undefined, '0190'); +addThis(); + +status = inSection(420); +pattern = /^(b+?|a){1,2}c/; +string = 'bbbac'; +actualmatch = string.match(pattern); +expectedmatch = Array('bbbac', 'a'); +addThis(); + +status = inSection(421); +pattern = /^(b+?|a){1,2}c/; +string = 'bbbbac'; +actualmatch = string.match(pattern); +expectedmatch = Array('bbbbac', 'a'); +addThis(); + +status = inSection(422); +pattern = /((?:aaaa|bbbb)cccc)?/; +string = 'aaaacccc'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaaacccc', 'aaaacccc'); +addThis(); + +status = inSection(423); +pattern = /((?:aaaa|bbbb)cccc)?/; +string = 'bbbbcccc'; +actualmatch = string.match(pattern); +expectedmatch = Array('bbbbcccc', 'bbbbcccc'); +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + if(omitCurrentSection()) + return; + + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function omitCurrentSection() +{ + try + { + // current section number is in global status variable + var n = status.match(/(\d+)/)[1]; + return ((n < cnLBOUND) || (n > cnUBOUND)); + } + catch(e) + { + return false; + } +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/perlstress-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/perlstress-002.js new file mode 100644 index 0000000..44cfbb5 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/perlstress-002.js @@ -0,0 +1,1837 @@ +/* ***** 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): pschwartau@netscape.com, rogerl@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: 2002-07-07 +* SUMMARY: Testing JS RegExp engine against Perl 5 RegExp engine. +* Adjust cnLBOUND, cnUBOUND below to restrict which sections are tested. +* +* This test was created by running various patterns and strings through the +* Perl 5 RegExp engine. We saved the results below to test the JS engine. +* +* Each of the examples below is a negative test; that is, each produces a +* null match in Perl. Thus we set |expectedmatch| = |null| in each section. +* +* NOTE: ECMA/JS and Perl do differ on certain points. We have either commented +* out such sections altogether, or modified them to fit what we expect from JS. +* +* EXAMPLES: +* +* - ECMA does support (?: (?= and (?! operators, but doesn't support (?< etc. +* +* - ECMA doesn't support (?(condition) +* +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 85721; +var summary = 'Testing regular expression edge cases'; +var cnSingleSpace = ' '; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); +var cnLBOUND = 0; +var cnUBOUND = 1000; + + +status = inSection(1); +pattern = /abc/; +string = 'xbc'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(2); +pattern = /abc/; +string = 'axc'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(3); +pattern = /abc/; +string = 'abx'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(4); +pattern = /ab+bc/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(5); +pattern = /ab+bc/; +string = 'abq'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(6); +pattern = /ab{1,}bc/; +string = 'abq'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(7); +pattern = /ab{4,5}bc/; +string = 'abbbbc'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(8); +pattern = /ab?bc/; +string = 'abbbbc'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(9); +pattern = /^abc$/; +string = 'abcc'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(10); +pattern = /^abc$/; +string = 'aabc'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(11); +pattern = /abc$/; +string = 'aabcd'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(12); +pattern = /a.*c/; +string = 'axyzd'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(13); +pattern = /a[bc]d/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(14); +pattern = /a[b-d]e/; +string = 'abd'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(15); +pattern = /a[^bc]d/; +string = 'abd'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(16); +pattern = /a[^-b]c/; +string = 'a-c'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(17); +pattern = /a[^]b]c/; +string = 'a]c'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(18); +pattern = /\by\b/; +string = 'xy'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(19); +pattern = /\by\b/; +string = 'yz'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(20); +pattern = /\by\b/; +string = 'xyz'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(21); +pattern = /\Ba\B/; +string = 'a-'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(22); +pattern = /\Ba\B/; +string = '-a'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(23); +pattern = /\Ba\B/; +string = '-a-'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(24); +pattern = /\w/; +string = '-'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(25); +pattern = /\W/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(26); +pattern = /a\sb/; +string = 'a-b'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(27); +pattern = /\d/; +string = '-'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(28); +pattern = /\D/; +string = '1'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(29); +pattern = /[\w]/; +string = '-'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(30); +pattern = /[\W]/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(31); +pattern = /a[\s]b/; +string = 'a-b'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(32); +pattern = /[\d]/; +string = '-'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(33); +pattern = /[\D]/; +string = '1'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(34); +pattern = /$b/; +string = 'b'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(35); +pattern = /^(ab|cd)e/; +string = 'abcde'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(36); +pattern = /a[bcd]+dcdcde/; +string = 'adcdcde'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(37); +pattern = /(bc+d$|ef*g.|h?i(j|k))/; +string = 'effg'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(38); +pattern = /(bc+d$|ef*g.|h?i(j|k))/; +string = 'bcdd'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(39); +pattern = /[k]/; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +// MODIFIED - ECMA has different rules for paren contents. +status = inSection(40); +pattern = /(a)|\1/; +string = 'x'; +actualmatch = string.match(pattern); +//expectedmatch = null; +expectedmatch = Array("", undefined); +addThis(); + +// MODIFIED - ECMA has different rules for paren contents. +status = inSection(41); +pattern = /((\3|b)\2(a)x)+/; +string = 'aaxabxbaxbbx'; +actualmatch = string.match(pattern); +//expectedmatch = null; +expectedmatch = Array("ax", "ax", "", "a"); +addThis(); + +status = inSection(42); +pattern = /abc/i; +string = 'XBC'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(43); +pattern = /abc/i; +string = 'AXC'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(44); +pattern = /abc/i; +string = 'ABX'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(45); +pattern = /ab+bc/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(46); +pattern = /ab+bc/i; +string = 'ABQ'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(47); +pattern = /ab{1,}bc/i; +string = 'ABQ'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(48); +pattern = /ab{4,5}?bc/i; +string = 'ABBBBC'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(49); +pattern = /ab??bc/i; +string = 'ABBBBC'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(50); +pattern = /^abc$/i; +string = 'ABCC'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(51); +pattern = /^abc$/i; +string = 'AABC'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(52); +pattern = /a.*c/i; +string = 'AXYZD'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(53); +pattern = /a[bc]d/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(54); +pattern = /a[b-d]e/i; +string = 'ABD'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(55); +pattern = /a[^bc]d/i; +string = 'ABD'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(56); +pattern = /a[^-b]c/i; +string = 'A-C'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(57); +pattern = /a[^]b]c/i; +string = 'A]C'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(58); +pattern = /$b/i; +string = 'B'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(59); +pattern = /^(ab|cd)e/i; +string = 'ABCDE'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(60); +pattern = /a[bcd]+dcdcde/i; +string = 'ADCDCDE'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(61); +pattern = /(bc+d$|ef*g.|h?i(j|k))/i; +string = 'EFFG'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(62); +pattern = /(bc+d$|ef*g.|h?i(j|k))/i; +string = 'BCDD'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(63); +pattern = /[k]/i; +string = 'AB'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(64); +pattern = /^(a\1?){4}$/; +string = 'aaaaaaaaa'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(65); +pattern = /^(a\1?){4}$/; +string = 'aaaaaaaaaaa'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +/* ECMA doesn't support (?( +status = inSection(66); +pattern = /^(a(?(1)\1)){4}$/; +string = 'aaaaaaaaa'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(67); +pattern = /^(a(?(1)\1)){4}$/; +string = 'aaaaaaaaaaa'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); +*/ + +/* ECMA doesn't support (?< +status = inSection(68); +pattern = /(?<=a)b/; +string = 'cb'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(69); +pattern = /(?<=a)b/; +string = 'b'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(70); +pattern = /(?a+)ab/; +string = 'aaab'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(106); +pattern = /a\Z/; +string = 'a\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(107); +pattern = /a\z/; +string = 'a\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(108); +pattern = /a$/; +string = 'a\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(109); +pattern = /a\z/; +string = 'b\na\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(110); +pattern = /a\z/m; +string = 'a\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(111); +pattern = /a\z/m; +string = 'b\na\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(112); +pattern = /aa\Z/; +string = 'aa\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(113); +pattern = /aa\z/; +string = 'aa\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(114); +pattern = /aa$/; +string = 'aa\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(115); +pattern = /aa\z/; +string = 'b\naa\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(116); +pattern = /aa\z/m; +string = 'aa\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(117); +pattern = /aa\z/m; +string = 'b\naa\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(118); +pattern = /aa\Z/; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(119); +pattern = /aa\z/; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(120); +pattern = /aa$/; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(121); +pattern = /aa\Z/; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(122); +pattern = /aa\z/; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(123); +pattern = /aa$/; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(124); +pattern = /aa\Z/; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(125); +pattern = /aa\z/; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(126); +pattern = /aa$/; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(127); +pattern = /aa\Z/m; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(128); +pattern = /aa\z/m; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(129); +pattern = /aa$/m; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(130); +pattern = /aa\Z/m; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(131); +pattern = /aa\z/m; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(132); +pattern = /aa$/m; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(133); +pattern = /aa\Z/m; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(134); +pattern = /aa\z/m; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(135); +pattern = /aa$/m; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(136); +pattern = /aa\Z/; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(137); +pattern = /aa\z/; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(138); +pattern = /aa$/; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(139); +pattern = /aa\Z/; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(140); +pattern = /aa\z/; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(141); +pattern = /aa$/; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(142); +pattern = /aa\Z/; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(143); +pattern = /aa\z/; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(144); +pattern = /aa$/; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(145); +pattern = /aa\Z/m; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(146); +pattern = /aa\z/m; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(147); +pattern = /aa$/m; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(148); +pattern = /aa\Z/m; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(149); +pattern = /aa\z/m; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(150); +pattern = /aa$/m; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(151); +pattern = /aa\Z/m; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(152); +pattern = /aa\z/m; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(153); +pattern = /aa$/m; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(154); +pattern = /ab\Z/; +string = 'ab\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(155); +pattern = /ab\z/; +string = 'ab\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(156); +pattern = /ab$/; +string = 'ab\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(157); +pattern = /ab\z/; +string = 'b\nab\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(158); +pattern = /ab\z/m; +string = 'ab\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(159); +pattern = /ab\z/m; +string = 'b\nab\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(160); +pattern = /ab\Z/; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(161); +pattern = /ab\z/; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(162); +pattern = /ab$/; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(163); +pattern = /ab\Z/; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(164); +pattern = /ab\z/; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(165); +pattern = /ab$/; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(166); +pattern = /ab\Z/; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(167); +pattern = /ab\z/; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(168); +pattern = /ab$/; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(169); +pattern = /ab\Z/m; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(170); +pattern = /ab\z/m; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(171); +pattern = /ab$/m; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(172); +pattern = /ab\Z/m; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(173); +pattern = /ab\z/m; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(174); +pattern = /ab$/m; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(175); +pattern = /ab\Z/m; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(176); +pattern = /ab\z/m; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(177); +pattern = /ab$/m; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(178); +pattern = /ab\Z/; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(179); +pattern = /ab\z/; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(180); +pattern = /ab$/; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(181); +pattern = /ab\Z/; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(182); +pattern = /ab\z/; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(183); +pattern = /ab$/; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(184); +pattern = /ab\Z/; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(185); +pattern = /ab\z/; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(186); +pattern = /ab$/; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(187); +pattern = /ab\Z/m; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(188); +pattern = /ab\z/m; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(189); +pattern = /ab$/m; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(190); +pattern = /ab\Z/m; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(191); +pattern = /ab\z/m; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(192); +pattern = /ab$/m; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(193); +pattern = /ab\Z/m; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(194); +pattern = /ab\z/m; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(195); +pattern = /ab$/m; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(196); +pattern = /abb\Z/; +string = 'abb\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(197); +pattern = /abb\z/; +string = 'abb\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(198); +pattern = /abb$/; +string = 'abb\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(199); +pattern = /abb\z/; +string = 'b\nabb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(200); +pattern = /abb\z/m; +string = 'abb\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(201); +pattern = /abb\z/m; +string = 'b\nabb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(202); +pattern = /abb\Z/; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(203); +pattern = /abb\z/; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(204); +pattern = /abb$/; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(205); +pattern = /abb\Z/; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(206); +pattern = /abb\z/; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(207); +pattern = /abb$/; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(208); +pattern = /abb\Z/; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(209); +pattern = /abb\z/; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(210); +pattern = /abb$/; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(211); +pattern = /abb\Z/m; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(212); +pattern = /abb\z/m; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(213); +pattern = /abb$/m; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(214); +pattern = /abb\Z/m; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(215); +pattern = /abb\z/m; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(216); +pattern = /abb$/m; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(217); +pattern = /abb\Z/m; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(218); +pattern = /abb\z/m; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(219); +pattern = /abb$/m; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(220); +pattern = /abb\Z/; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(221); +pattern = /abb\z/; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(222); +pattern = /abb$/; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(223); +pattern = /abb\Z/; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(224); +pattern = /abb\z/; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(225); +pattern = /abb$/; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(226); +pattern = /abb\Z/; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(227); +pattern = /abb\z/; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(228); +pattern = /abb$/; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(229); +pattern = /abb\Z/m; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(230); +pattern = /abb\z/m; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(231); +pattern = /abb$/m; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(232); +pattern = /abb\Z/m; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(233); +pattern = /abb\z/m; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(234); +pattern = /abb$/m; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(235); +pattern = /abb\Z/m; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(236); +pattern = /abb\z/m; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(237); +pattern = /abb$/m; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(238); +pattern = /a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz/; +string = 'x'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(239); +pattern = /\GX.*X/; +string = 'aaaXbX'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(240); +pattern = /\.c(pp|xx|c)?$/i; +string = 'Changes'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(241); +pattern = /^([a-z]:)/; +string = 'C:/'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(242); +pattern = /(\w)?(abc)\1b/; +string = 'abcab'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +/* ECMA doesn't support (?( +status = inSection(243); +pattern = /^(a)?(?(1)a|b)+$/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); +*/ + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + if(omitCurrentSection()) + return; + + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function omitCurrentSection() +{ + try + { + // current section number is in global status variable + var n = status.match(/(\d+)/)[1]; + return ((n < cnLBOUND) || (n > cnUBOUND)); + } + catch(e) + { + return false; + } +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-100199.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-100199.js new file mode 100644 index 0000000..8380499 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-100199.js @@ -0,0 +1,286 @@ +/* +* 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: 17 September 2001 +* +* SUMMARY: Regression test for Bugzilla bug 100199 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=100199 +* +* The empty character class [] is a valid RegExp construct: the condition +* that a given character belong to a set containing no characters. As such, +* it can never be met and is always FALSE. Similarly, [^] is a condition +* that matches any given character and is always TRUE. +* +* Neither one of these conditions should cause syntax errors in a RegExp. +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 100199; +var summary = '[], [^] are valid RegExp conditions. Should not cause errors -'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +pattern = /[]/; + string = 'abc'; + status = inSection(1); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = ''; + status = inSection(2); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = '['; + status = inSection(3); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = '/'; + status = inSection(4); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = '['; + status = inSection(5); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = ']'; + status = inSection(6); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = '[]'; + status = inSection(7); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = '[ ]'; + status = inSection(8); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = ']['; + status = inSection(9); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + +pattern = /a[]/; + string = 'abc'; + status = inSection(10); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = ''; + status = inSection(11); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = 'a['; + status = inSection(12); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = 'a[]'; + status = inSection(13); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = '['; + status = inSection(14); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = ']'; + status = inSection(15); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = '[]'; + status = inSection(16); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = '[ ]'; + status = inSection(17); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = ']['; + status = inSection(18); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + +pattern = /[^]/; + string = 'abc'; + status = inSection(19); + actualmatch = string.match(pattern); + expectedmatch = Array('a'); + addThis(); + + string = ''; + status = inSection(20); + actualmatch = string.match(pattern); + expectedmatch = null; //there are no characters to test against the condition + addThis(); + + string = '\/'; + status = inSection(21); + actualmatch = string.match(pattern); + expectedmatch = Array('/'); + addThis(); + + string = '\['; + status = inSection(22); + actualmatch = string.match(pattern); + expectedmatch = Array('['); + addThis(); + + string = '['; + status = inSection(23); + actualmatch = string.match(pattern); + expectedmatch = Array('['); + addThis(); + + string = ']'; + status = inSection(24); + actualmatch = string.match(pattern); + expectedmatch = Array(']'); + addThis(); + + string = '[]'; + status = inSection(25); + actualmatch = string.match(pattern); + expectedmatch = Array('['); + addThis(); + + string = '[ ]'; + status = inSection(26); + actualmatch = string.match(pattern); + expectedmatch = Array('['); + addThis(); + + string = ']['; + status = inSection(27); + actualmatch = string.match(pattern); + expectedmatch = Array(']'); + addThis(); + + +pattern = /a[^]/; + string = 'abc'; + status = inSection(28); + actualmatch = string.match(pattern); + expectedmatch = Array('ab'); + addThis(); + + string = ''; + status = inSection(29); + actualmatch = string.match(pattern); + expectedmatch = null; //there are no characters to test against the condition + addThis(); + + string = 'a['; + status = inSection(30); + actualmatch = string.match(pattern); + expectedmatch = Array('a['); + addThis(); + + string = 'a]'; + status = inSection(31); + actualmatch = string.match(pattern); + expectedmatch = Array('a]'); + addThis(); + + string = 'a[]'; + status = inSection(32); + actualmatch = string.match(pattern); + expectedmatch = Array('a['); + addThis(); + + string = 'a[ ]'; + status = inSection(33); + actualmatch = string.match(pattern); + expectedmatch = Array('a['); + addThis(); + + string = 'a]['; + status = inSection(34); + actualmatch = string.match(pattern); + expectedmatch = Array('a]'); + addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-103087.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-103087.js new file mode 100644 index 0000000..8cfc662 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-103087.js @@ -0,0 +1,155 @@ +/* +* 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): bedney@technicalpursuit.com, pschwartau@netscape.com +* Date: 04 October 2001 +* +* SUMMARY: Arose from Bugzilla bug 103087: +* "The RegExp MarkupSPE in demo crashes Mozilla" +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=103087 +* The SpiderMonkey shell crashed on some of these regexps. +* +* The reported crash was on i=24 below ('MarkupSPE' regexp) +* I crashed on that, and also on i=43 ('XML_SPE' regexp) +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 103087; +var summary = "Testing that we don't crash on any of these regexps -"; +var re = ''; +var lm = ''; +var lc = ''; +var rc = ''; + + +// the regexps are built in pieces - +var NameStrt = "[A-Za-z_:]|[^\\x00-\\x7F]"; +var NameChar = "[A-Za-z0-9_:.-]|[^\\x00-\\x7F]"; +var Name = "(" + NameStrt + ")(" + NameChar + ")*"; +var TextSE = "[^<]+"; +var UntilHyphen = "[^-]*-"; +var Until2Hyphens = UntilHyphen + "([^-]" + UntilHyphen + ")*-"; +var CommentCE = Until2Hyphens + ">?"; +var UntilRSBs = "[^]]*]([^]]+])*]+"; +var CDATA_CE = UntilRSBs + "([^]>]" + UntilRSBs + ")*>"; +var S = "[ \\n\\t\\r]+"; +var QuoteSE = '"[^"]' + "*" + '"' + "|'[^']*'"; +var DT_IdentSE = S + Name + "(" + S + "(" + Name + "|" + QuoteSE + "))*"; +var MarkupDeclCE = "([^]\"'><]+|" + QuoteSE + ")*>"; +var S1 = "[\\n\\r\\t ]"; +var UntilQMs = "[^?]*\\?+"; +var PI_Tail = "\\?>|" + S1 + UntilQMs + "([^>?]" + UntilQMs + ")*>"; +var DT_ItemSE = "<(!(--" + Until2Hyphens + ">|[^-]" + MarkupDeclCE + ")|\\?" + Name + "(" + PI_Tail + "))|%" + Name + ";|" + S; +var DocTypeCE = DT_IdentSE + "(" + S + ")?(\\[(" + DT_ItemSE + ")*](" + S + ")?)?>?"; +var DeclCE = "--(" + CommentCE + ")?|\\[CDATA\\[(" + CDATA_CE + ")?|DOCTYPE(" + DocTypeCE + ")?"; +var PI_CE = Name + "(" + PI_Tail + ")?"; +var EndTagCE = Name + "(" + S + ")?>?"; +var AttValSE = '"[^<"]' + "*" + '"' + "|'[^<']*'"; +var ElemTagCE = Name + "(" + S + Name + "(" + S + ")?=(" + S + ")?(" + AttValSE + "))*(" + S + ")?/?>?"; +var MarkupSPE = "<(!(" + DeclCE + ")?|\\?(" + PI_CE + ")?|/(" + EndTagCE + ")?|(" + ElemTagCE + ")?)"; +var XML_SPE = TextSE + "|" + MarkupSPE; +var CommentRE = "'; +s += ''; +s += ''; +s += ''; +s += ''; +s += ' '; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += 'Click here to skip to main content.'; +s += ''; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ''; +s += ''; +s += '
'; +s += '
CNN.com'; +s += ' '; +s += ''; +s += ' '; +s += ''; +s += ''; +s += ''; +s += ''; +s += '
'; +s += '
'; +s += ''; +s += ''; +s += ' '; +s += ''; +s += ''; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += '
SEARCH
'; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += '
  The Web  CNN.com   
enhanced by Google
'; +s += '
'; +s += ''; +s += ''; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ''; +s += ' '; +s += ' '; +s += ''; +s += '
'; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += '
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
'; +s += '
SERVICES
 
 
 
SEARCH
'; +s += ''; +s += '
'; +s += ' '; +s += ' '; +s += ' '; +s += ''; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += '
'; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += '
WebCNN.com
enhanced by Google
'; +s += ''; +s += ''; +s += ''; +s += '
'; +s += ''; +s += '
'; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += '
Updated: 05:53 p.m. EDT (2153 GMT) June 12, 2003
'; +s += '
'; +s += ''; +s += ''; +s += ' '; +s += ' Oscar-winner Peck dies'; +s += ''; +s += '
'; +s += '

Oscar-winner Peck dies

'; +s += '

'; +s += 'Actor Gregory Peck, who won an Oscar for his portrayal of upstanding lawyer Atticus Finch in 1962s "To Kill a Mockingbird," has died at age 87. Peck was best known for roles of dignified statesmen and people who followed a strong code of ethics. But he also could play against type. All told, Peck was nominated for five Academy Awards.'; +s += '

'; +s += '

'; +s += ' FULL STORY'; +s += '

'; +s += ''; +s += ''; +s += ''; +s += '• Video: premium content A leading mans leading man
'; +s += ''; +s += ''; +s += ''; +s += ' '; +s += '• Interactive: Gregory Peck through the years
'; +s += ''; +s += ' '; +s += '• Gregory Peck filmographyexternal link
'; +s += ''; +s += ' '; +s += '• Pecks Finch chararcter AFIs top heroexternal link
'; +s += '
'; +s += ''; +s += ''; +s += '
'; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += '
'; +s += ''; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += '
MORE TOP STORIES Hot Stories
'; +s += '
'; +s += ''; +s += ' '; +s += ''; +s += ''; +s += ' '; +s += ''; +s += ''; +s += ' '; +s += ''; +s += ''; +s += ' '; +s += ''; +s += ''; +s += ' '; +s += ''; +s += ''; +s += ' '; +s += ''; +s += ''; +s += ' '; +s += ''; +s += '
'; +s += ''; +s += ''; +s += '
'; +s += ''; +s += ''; +s += ''; +s += ' '; +s += '
'; +s += ''; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ''; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ''; +s += ' '; +s += ' '; +s += '
'; +s += ' CNNRADIO'; +s += '
Listen to latest updates'; +s += '
'; +s += ''; +s += '
'; +s += ' '; +s += ''; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += '
VIDEOMORE VIDEO
'; +s += ' Soldier broke dozens of hearts over e-mail
'; +s += ' premium content PLAY VIDEO
'; +s += '
'; +s += ' '; +s += '
'; +s += ' '; +s += '
'; +s += ''; +s += ''; +s += '
'; +s += ''; +s += ''; +s += ''; +s += '
'; +s += '
'; +s += ''; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += '
ON THE SCENEmore reports
'; +s += ''; +s += ''; +s += ' '; +s += ' '; +s += ''; +s += ''; +s += ' '; +s += '
Jeffrey Toobin: "It takes guts" for Peterson defense to subpoena judge over wiretap issue.'; +s += 'Full Storyimage
'; +s += '
'; +s += '
'; +s += ''; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += '
BUSINESS'; +s += '  at CNN/Money  Business News
'; +s += ''; +s += ''; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += '
'; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += '
STOCK/FUND QUOTES:
enter symbol
'; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += '
sponsored by:Click Here
'; +s += '
'; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ''; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ''; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ''; +s += ' '; +s += '
MARKETS: '; +s += ''; +s += '4:30pm ET, 6/12
DJIA+13.309196.50+ 0.14%
NAS+ 7.601653.62+ 0.46%
S&P+ 1.03998.51+ 0.10%
'; +s += '
'; +s += ''; +s += '
'; +s += ''; +s += ''; +s += '
'; +s += ''; +s += ''; +s += ''; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += '
'; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += '
'; +s += '
'; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += '
MORE REAL TVMore Entertainment
'; +s += '
'; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += '
'; +s += ' '; +s += ' Go ahead, follow me
'; +s += 'New reality series and the movie debut of "Idol" finalists'; +s += '
Go ahead, follow me
'; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ' '; +s += '
'; +s += ''; +s += '
'; +s += '
'; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += '
GIFT IDEASBusiness News
'; +s += '
'; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += '
'; +s += ''; +s += ''; +s += 'CNN/Money: Fathers Day
'; +s += 'Smaller is better --from digital cameras to iPod'; +s += '
Fathers Day
'; +s += '
'; +s += '
'; +s += ''; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += '

U.S. News:
'; +s += ''; +s += ' '; +s += '• Miami police link 4 rapes to serial rapist
'; +s += ''; +s += ' '; +s += '• Woman mistaken for fugitive jailed
'; +s += ''; +s += ' '; +s += '• Pregnant woman impaled on mic stand
'; +s += '
World News:
'; +s += ''; +s += ' '; +s += '• NATO reshapes for new era
'; +s += ''; +s += ' '; +s += '• U.N. reviews Bunia peace force
'; +s += ''; +s += ''; +s += ''; +s += '• TIME.com: Saddams curtain trailexternal link
'; +s += '
Sci-Tech News:
'; +s += ''; +s += ' '; +s += '• Another reason to throw out your VCR
'; +s += ''; +s += ' '; +s += '• Flat screen TV prices dropping
'; +s += '
Entertainment News:
'; +s += ''; +s += ' '; +s += '• CNN hires Soledad OBrien for "AM"
'; +s += ''; +s += ' '; +s += '• Dating show star let go by law firm
'; +s += '
Politics News:
'; +s += ''; +s += ' '; +s += '• Schwarzenegger on California politics
'; +s += ''; +s += ' '; +s += '• House approves extension on child tax credit
'; +s += '
Law News:
'; +s += ''; +s += ' '; +s += '• Court bars cash advances to plaintiffs
'; +s += ''; +s += ' '; +s += '• Lawsuit against Jackson settled
'; +s += '
Health News:
'; +s += ''; +s += ' '; +s += '• Monkeypox spreading person-to-person?
'; +s += ''; +s += ' '; +s += '• A full body X-ray in 13 seconds
'; +s += '
Space News:
'; +s += ''; +s += ' '; +s += '• Hydrogen fuel may disturb ozone layer
'; +s += ''; +s += ' '; +s += '• New threat found for shuttle launches
'; +s += '
Travel News:
'; +s += ''; +s += ' '; +s += '• Walking America from coast to coast
'; +s += ''; +s += ' '; +s += '• Airline execs not seeing sunny skies yet
'; +s += '
Education News:
'; +s += ''; +s += ' '; +s += '• Arab students seek prom balance
'; +s += ''; +s += ' '; +s += '• Public schools turn to upscale fundraising
'; +s += '
Sports News:
Business News:
'; +s += '• Here come the "Duppies"
'; +s += '• Oracle beats estimates
'; +s += '
'; +s += '
'; +s += '
'; +s += ' '; +s += ''; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += '
WATCH CNN TV
On CNN TV
'; +s += ''; +s += ' '; +s += ' '; +s += ' '; +s += '
American Morning, 7 a.m. ETAmerican Morning (7 a.m. ET): Tomorrow, singer Carnie Wilson talks about her new book, "Im Still Hungry."'; +s += '
'; +s += ''; +s += ''; +s += ''; +s += '
'; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += '
'; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += '
ANALYSIS
U.S. News
'; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += '
'; +s += 'Fight It, Martha'; +s += ''; +s += ''; +s += 'NYTimes: Fight It, Martha
'; +s += 'William Safire: I hope Martha Stewart beats this bum rap'; +s += ''; +s += ''; +s += ''; +s += ''; +s += '
'; +s += '
'; +s += '
'; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += '
OFFBEAT
more offbeat
'; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += '
'; +s += 'Waiting list'; +s += ' '; +s += ' Waiting list
'; +s += 'Chinas "smart sperm" bank needs donors'; +s += '
'; +s += '
'; +s += ''; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += '
'; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += '
'; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ' '; +s += ' '; +s += ' '; +s += ''; +s += '
'; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += '
 WEATHER
Get your hometown weather on the home page! Enter city name or U.S. Zip Code:
Or select location from a list
'; +s += ''; +s += ''; +s += ''; +s += '
'; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += '
Quick Vote'; +s += ''; +s += 'Click Here'; +s += '
'; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += '
Should an international peacekeeping force be sent to the Mideast?
Yes'; +s += '
No'; +s += '
'; +s += ''; +s += '
VIEW RESULTS
'; +s += ''; +s += '
'; +s += ''; +s += '
'; +s += '
'; +s += ''; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ''; +s += '
From our Partners'; +s += '  External site icon
'; +s += 'Time:
  Subscribe to TIME  

'; +s += 'CNNsi.com:
'; +s += '• Marty Burns: Nets pull out all stops
'; +s += '• Michael Farber: Sens look good for "04
'; +s += '• Tim Layden: NFL or bust for Neuheisel
'; +s += '
'; +s += '
  Subscribe to Sports Illustrated  
'; +s += '

'; +s += 'New York Times:
  Get 50% OFF the NY Times  
'; +s += '
'; +s += ''; +s += ''; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += '
'; +s += ''; +s += ''; +s += '
'; +s += ''; +s += '
'; +s += ''; +s += ''; +s += ' '; +s += ' '; +s += ' '; +s += ''; +s += ' '; +s += ''; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += '
International Edition
CNN TVCNN InternationalHeadline NewsTranscriptsPreferencesAbout CNN.com
'; +s += ''; +s += '
'; +s += ''; +s += ''; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += '
'; +s += '© 2003 Cable News Network LP, LLLP.
'; +s += 'An AOL Time Warner Company. All Rights Reserved.
'; +s += 'Terms under which this service is provided to you.
'; +s += 'Read our privacy guidelines. Contact us.'; +s += '
'; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += ' '; +s += '
external link
All external sites will open in a new browser.
'; +s += ' CNN.com does not endorse external sites.
'; +s += ''; +s += '
 Premium content icon Denotes premium content.
'; +s += ''; +s += '
'; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ' '; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; + +return s; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-209919.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-209919.js new file mode 100644 index 0000000..e1bb76c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-209919.js @@ -0,0 +1,169 @@ +/* ***** 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): sagdjb@softwareag.com, 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: 19 June 2003 +* SUMMARY: Testing regexp submatches with quantifiers +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=209919 +* +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 209919; +var summary = 'Testing regexp submatches with quantifiers'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +/* + * Waldemar: "ECMA-262 15.10.2.5, third algorithm, step 2.1 states that + * once the minimum repeat count (which is 0 for *, 1 for +, etc.) has + * been satisfied, an atom being repeated must not match the empty string." + * + * In this example, the minimum repeat count is 0, so the last thing the + * capturing parens is permitted to contain is the 'a'. It may NOT go on + * to capture the '' at the $ position of 'a', even though '' satifies + * the condition b* + * + */ +status = inSection(1); +string = 'a'; +pattern = /(a|b*)*/; +actualmatch = string.match(pattern); +expectedmatch = Array(string, 'a'); +addThis(); + + +/* + * In this example, the minimum repeat count is 5, so the capturing parens + * captures the 'a', then goes on to capture the '' at the $ position of 'a' + * 4 times before it has to stop. Therefore the last thing it contains is ''. + */ +status = inSection(2); +string = 'a'; +pattern = /(a|b*){5,}/; +actualmatch = string.match(pattern); +expectedmatch = Array(string, ''); +addThis(); + + +/* + * Reduction of the above examples to contain only the condition b* + * inside the capturing parens. This can be even harder to grasp! + * + * The global match is the '' at the ^ position of 'a', but the parens + * is NOT permitted to capture it since the minimum repeat count is 0! + */ +status = inSection(3); +string = 'a'; +pattern = /(b*)*/; +actualmatch = string.match(pattern); +expectedmatch = Array('', undefined); +addThis(); + + +/* + * Here we have used the + quantifier (repeat count 1) outside the parens. + * Therefore the parens must capture at least once before stopping, so it + * does capture the '' this time - + */ +status = inSection(4); +string = 'a'; +pattern = /(b*)+/; +actualmatch = string.match(pattern); +expectedmatch = Array('', ''); +addThis(); + + +/* + * More complex examples - + */ +pattern = /^\-?(\d{1,}|\.{0,})*(\,\d{1,})?$/; + + status = inSection(5); + string = '100.00'; + actualmatch = string.match(pattern); + expectedmatch = Array(string, '00', undefined); + addThis(); + + status = inSection(6); + string = '100,00'; + actualmatch = string.match(pattern); + expectedmatch = Array(string, '100', ',00'); + addThis(); + + status = inSection(7); + string = '1.000,00'; + actualmatch = string.match(pattern); + expectedmatch = Array(string, '000', ',00'); + addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-216591.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-216591.js new file mode 100644 index 0000000..cc86d73 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-216591.js @@ -0,0 +1,112 @@ +/* ***** 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): okin7@yahoo.fr, 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: 19 August 2003 +* SUMMARY: Regexp conformance test +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=216591 +* +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 216591; +var summary = 'Regexp conformance test'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +status = inSection(1); +string = 'a {result.data.DATA} b'; +pattern = /\{(([a-z0-9\-_]+?\.)+?)([a-z0-9\-_]+?)\}/i; +actualmatch = string.match(pattern); +expectedmatch = Array('{result.data.DATA}', 'result.data.', 'data.', 'DATA'); +addThis(); + +/* + * Add a global flag to the regexp. In Perl 5, this gives the same results as above. Compare: + * + * [ ] perl -e '"a {result.data.DATA} b" =~ /\{(([a-z0-9\-_]+?\.)+?)([a-z0-9\-_]+?)\}/i; print("$&, $1, $2, $3");' + * {result.data.DATA}, result.data., data., DATA + * + * [ ] perl -e '"a {result.data.DATA} b" =~ /\{(([a-z0-9\-_]+?\.)+?)([a-z0-9\-_]+?)\}/gi; print("$&, $1, $2, $3");' + * {result.data.DATA}, result.data., data., DATA + * + * + * But in JavaScript, there will no longer be any sub-captures: + */ +status = inSection(2); +string = 'a {result.data.DATA} b'; +pattern = /\{(([a-z0-9\-_]+?\.)+?)([a-z0-9\-_]+?)\}/gi; +actualmatch = string.match(pattern); +expectedmatch = Array('{result.data.DATA}'); +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-220367-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-220367-001.js new file mode 100644 index 0000000..e6a767e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-220367-001.js @@ -0,0 +1,99 @@ +/* ***** 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: 26 September 2003 +* SUMMARY: Regexp conformance test +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=220367 +* +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 220367; +var summary = 'Regexp conformance test'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +status = inSection(1); +string = 'a'; +pattern = /(a)|(b)/; +actualmatch = string.match(pattern); +expectedmatch = Array(string, 'a', undefined); +addThis(); + +status = inSection(2); +string = 'b'; +pattern = /(a)|(b)/; +actualmatch = string.match(pattern); +expectedmatch = Array(string, undefined, 'b'); +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-220367-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-220367-002.js new file mode 100644 index 0000000..62eec23 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-220367-002.js @@ -0,0 +1,107 @@ +/* ***** 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: 26 September 2003 +* SUMMARY: Regexp conformance test +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=220367 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 220367; +var summary = 'Regexp conformance test'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + +var re = /(a)|(b)/; + +re.test('a'); + status = inSection(1); + actual = RegExp.$1; + expect = 'a'; + addThis(); + + status = inSection(2); + actual = RegExp.$2; + expect = ''; + addThis(); + +re.test('b'); + status = inSection(3); + actual = RegExp.$1; + expect = ''; + addThis(); + + status = inSection(4); + actual = RegExp.$2; + expect = 'b'; + 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][^<>]*[^\/])>|<([^\/<>])>/; +string = '

Some
test

'; +actualmatch = string.match(pattern); +expectedmatch = Array('

', undefined, 'p'); +addThis(); + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-57572.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-57572.js new file mode 100644 index 0000000..de9834a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-57572.js @@ -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: 28 December 2000 +* +* SUMMARY: Testing regular expressions containing the ? character. +* Arose from Bugzilla bug 57572: "RegExp with ? matches incorrectly" +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=57572 +* +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 57572; +var summary = 'Testing regular expressions containing "?"'; +var cnEmptyString = ''; var cnSingleSpace = ' '; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +status = inSection(1); +pattern = /(\S+)?(.*)/; +string = 'Test this'; +actualmatch = string.match(pattern); +expectedmatch = Array(string, 'Test', ' this'); //single space in front of 'this' +addThis(); + +status = inSection(2); +pattern = /(\S+)? ?(.*)/; //single space between the ? characters +string= 'Test this'; +actualmatch = string.match(pattern); +expectedmatch = Array(string, 'Test', 'this'); //NO space in front of 'this' +addThis(); + +status = inSection(3); +pattern = /(\S+)?(.*)/; +string = 'Stupid phrase, with six - (short) words'; +actualmatch = string.match(pattern); +expectedmatch = Array(string, 'Stupid', ' phrase, with six - (short) words'); //single space in front of 'phrase' +addThis(); + +status = inSection(4); +pattern = /(\S+)? ?(.*)/; //single space between the ? characters +string = 'Stupid phrase, with six - (short) words'; +actualmatch = string.match(pattern); +expectedmatch = Array(string, 'Stupid', 'phrase, with six - (short) words'); //NO space in front of 'phrase' +addThis(); + + +// let's add an extra back-reference this time - three instead of two - +status = inSection(5); +pattern = /(\S+)?( ?)(.*)/; //single space before second ? character +string = 'Stupid phrase, with six - (short) words'; +actualmatch = string.match(pattern); +expectedmatch = Array(string, 'Stupid', cnSingleSpace, 'phrase, with six - (short) words'); +addThis(); + +status = inSection(6); +pattern = /^(\S+)?( ?)(B+)$/; //single space before second ? character +string = 'AAABBB'; +actualmatch = string.match(pattern); +expectedmatch = Array(string, 'AAABB', cnEmptyString, 'B'); +addThis(); + +status = inSection(7); +pattern = /(\S+)?(!?)(.*)/; +string = 'WOW !!! !!!'; +actualmatch = string.match(pattern); +expectedmatch = Array(string, 'WOW', cnEmptyString, ' !!! !!!'); +addThis(); + +status = inSection(8); +pattern = /(.+)?(!?)(!+)/; +string = 'WOW !!! !!!'; +actualmatch = string.match(pattern); +expectedmatch = Array(string, 'WOW !!! !!', cnEmptyString, '!'); +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-57631.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-57631.js new file mode 100644 index 0000000..1917ed4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-57631.js @@ -0,0 +1,128 @@ +/* +* 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: 26 November 2000 +* +* +* SUMMARY: This test arose from Bugzilla bug 57631: +* "RegExp with invalid pattern or invalid flag causes segfault" +* +* Either error should throw an exception of type SyntaxError, +* and we check to see that it does... +*/ +//------------------------------------------------------------------------------------------------- +var bug = '57631'; +var summary = 'Testing new RegExp(pattern,flag) with illegal pattern or flag'; +var statprefix = 'Testing for error creating illegal RegExp object on pattern '; +var statsuffix = 'and flag '; +var cnSUCCESS = 'SyntaxError'; +var cnFAILURE = 'not a SyntaxError'; +var singlequote = "'"; +var i = -1; var j = -1; var s = ''; var f = ''; +var obj = {}; +var status = ''; var actual = ''; var expect = ''; var msg = ''; +var legalpatterns = new Array(); var illegalpatterns = new Array(); +var legalflags = new Array(); var illegalflags = new Array(); + + +// valid regular expressions to try - +legalpatterns[0] = ''; +legalpatterns[1] = 'abc'; +legalpatterns[2] = '(.*)(3-1)\s\w'; +legalpatterns[3] = '(.*)(...)\\s\\w'; +legalpatterns[4] = '[^A-Za-z0-9_]'; +legalpatterns[5] = '[^\f\n\r\t\v](123.5)([4 - 8]$)'; + +// invalid regular expressions to try - +illegalpatterns[0] = '()'; +illegalpatterns[1] = '(a'; +illegalpatterns[2] = '( ]'; +illegalpatterns[3] = '\d{s}'; + +// valid flags to try - +legalflags[0] = 'i'; +legalflags[1] = 'g'; +legalflags[2] = 'm'; +legalflags[3] = undefined; + +// invalid flags to try - +illegalflags[0] = 'a'; +illegalflags[1] = 123; +illegalflags[2] = new RegExp(); + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + testIllegalRegExps(legalpatterns, illegalflags); + testIllegalRegExps(illegalpatterns, legalflags); + testIllegalRegExps(illegalpatterns, illegalflags); + + exitFunc ('test'); +} + + +// This function will only be called where all the patterns are illegal, or all the flags +function testIllegalRegExps(patterns, flags) +{ + for (i in patterns) + { + s = patterns[i]; + + for (j in flags) + { + f = flags[j]; + status = getStatus(s, f); + + try + { + // This should cause an exception if either s or f is illegal - + eval('obj = new RegExp(s, f);'); + } + catch(e) + { + // We expect to get a SyntaxError - test for this: + actual = (e instanceof SyntaxError)? cnSUCCESS : cnFAILURE; + expect = cnSUCCESS; + reportCompare(expect, actual, status); + } + } + } +} + + +function getStatus(regexp, flag) +{ + return (statprefix + quote(regexp) + statsuffix + quote(flag)); +} + + +function quote(text) +{ + return (singlequote + text + singlequote); +} \ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-67773.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-67773.js new file mode 100644 index 0000000..e399050 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-67773.js @@ -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: 06 February 2001 +* +* SUMMARY: Arose from Bugzilla bug 67773: +* "Regular subexpressions followed by + failing to run to completion" +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=67773 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=69989 +*/ +//------------------------------------------------------------------------------------------------- +var i = 0; +var bug = 67773; +var summary = 'Testing regular subexpressions followed by ? or +\n'; +var cnSingleSpace = ' '; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +pattern = /^(\S+)?( ?)(B+)$/; //single space before second ? character + status = inSection(1); + string = 'AAABBB AAABBB '; //single space at middle and at end - + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + status = inSection(2); + string = 'AAABBB BBB'; //single space in the middle + actualmatch = string.match(pattern); + expectedmatch = Array(string, 'AAABBB', cnSingleSpace, 'BBB'); + addThis(); + + status = inSection(3); + string = 'AAABBB AAABBB'; //single space in the middle + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + +pattern = /^(A+B)+$/; + status = inSection(4); + string = 'AABAAB'; + actualmatch = string.match(pattern); + expectedmatch = Array(string, 'AAB'); + addThis(); + + status = inSection(5); + string = 'ABAABAAAAAAB'; + actualmatch = string.match(pattern); + expectedmatch = Array(string, 'AAAAAAB'); + addThis(); + + status = inSection(6); + string = 'ABAABAABAB'; + actualmatch = string.match(pattern); + expectedmatch = Array(string, 'AB'); + addThis(); + + status = inSection(7); + string = 'ABAABAABABB'; + actualmatch = string.match(pattern); + expectedmatch = null; // because string doesn't match at end + addThis(); + + +pattern = /^(A+1)+$/; + status = inSection(8); + string = 'AA1AA1'; + actualmatch = string.match(pattern); + expectedmatch = Array(string, 'AA1'); + addThis(); + + +pattern = /^(\w+\-)+$/; + status = inSection(9); + string = ''; + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + status = inSection(10); + string = 'bla-'; + actualmatch = string.match(pattern); + expectedmatch = Array(string, string); + addThis(); + + status = inSection(11); + string = 'bla-bla'; // hyphen missing at end - + actualmatch = string.match(pattern); + expectedmatch = null; //because string doesn't match at end + addThis(); + + status = inSection(12); + string = 'bla-bla-'; + actualmatch = string.match(pattern); + expectedmatch = Array(string, 'bla-'); + addThis(); + + +pattern = /^(\S+)+(A+)$/; + status = inSection(13); + string = 'asdldflkjAAA'; + actualmatch = string.match(pattern); + expectedmatch = Array(string, 'asdldflkjAA', 'A'); + addThis(); + + status = inSection(14); + string = 'asdldflkj AAA'; // space in middle + actualmatch = string.match(pattern); + expectedmatch = null; //because of the space + addThis(); + + +pattern = /^(\S+)+(\d+)$/; + status = inSection(15); + string = 'asdldflkj122211'; + actualmatch = string.match(pattern); + expectedmatch = Array(string, 'asdldflkj12221', '1'); + addThis(); + + status = inSection(16); + string = 'asdldflkj1111111aaa1'; + actualmatch = string.match(pattern); + expectedmatch = Array(string, 'asdldflkj1111111aaa', '1'); + addThis(); + + +/* + * This one comes from Stephen Ostermiller. + * See http://bugzilla.mozilla.org/show_bug.cgi?id=69989 + */ +pattern = /^[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)+$/; + status = inSection(17); + string = 'some.host.tld'; + actualmatch = string.match(pattern); + expectedmatch = Array(string, '.tld', '.'); + addThis(); + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-72964.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-72964.js new file mode 100644 index 0000000..5965313 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-72964.js @@ -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-07-17 +* +* SUMMARY: Regression test for Bugzilla bug 72964: +* "String method for pattern matching failed for Chinese Simplified (GB2312)" +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=72964 +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 72964; +var summary = 'Testing regular expressions containing non-Latin1 characters'; +var cnSingleSpace = ' '; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +pattern = /[\S]+/; + // 4 low Unicode chars = Latin1; whole string should match + status = inSection(1); + string = '\u00BF\u00CD\u00BB\u00A7'; + actualmatch = string.match(pattern); + expectedmatch = Array(string); + addThis(); + + // Now put a space in the middle; first half of string should match + status = inSection(2); + string = '\u00BF\u00CD \u00BB\u00A7'; + actualmatch = string.match(pattern); + expectedmatch = Array('\u00BF\u00CD'); + addThis(); + + + // 4 high Unicode chars = non-Latin1; whole string should match + status = inSection(3); + string = '\u4e00\uac00\u4e03\u4e00'; + actualmatch = string.match(pattern); + expectedmatch = Array(string); + addThis(); + + // Now put a space in the middle; first half of string should match + status = inSection(4); + string = '\u4e00\uac00 \u4e03\u4e00'; + actualmatch = string.match(pattern); + expectedmatch = Array('\u4e00\uac00'); + addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-76683.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-76683.js new file mode 100644 index 0000000..59b95b9 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-76683.js @@ -0,0 +1,93 @@ +/* +* 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: 01 May 2001 +* +* SUMMARY: Regression test for Bugzilla bug 76683 on Rhino: +* "RegExp regression (NullPointerException)" +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=76683 +*/ +//------------------------------------------------------------------------------------------------- +var i = 0; +var bug = 76683; +var summary = 'Regression test for Bugzilla bug 76683'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +/* + * Rhino (2001-04-19) crashed on the 3rd regular expression below. + * It didn't matter what the string was. No problem in SpiderMonkey - + */ +string = 'abc'; + status = inSection(1); + pattern = /()|(<([\$\w:\.\-]+)((([ ][^\/>]*)?\/>)|(([ ][^>]*)?>)))/; + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + status = inSection(2); + pattern = /()|(<(tagPattern)((([ ][^\/>]*)?\/>)|(([ ][^>]*)?>)))/; + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + // This was the one causing a Rhino crash - + status = inSection(3); + pattern = /()|(<(tagPattern)((([ ][^\/>]*)?\/>)|(([ ][^>]*)?>)))|(<\/tagPattern[^>]*>)/; + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-78156.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-78156.js new file mode 100644 index 0000000..08947ce --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-78156.js @@ -0,0 +1,102 @@ +/* +* 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: 06 February 2001 +* +* SUMMARY: Arose from Bugzilla bug 78156: +* "m flag of regular expression does not work with $" +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=78156 +* +* The m flag means a regular expression should search strings +* across multiple lines, i.e. across '\n', '\r'. +*/ +//------------------------------------------------------------------------------------------------- +var i = 0; +var bug = 78156; +var summary = 'Testing regular expressions with ^, $, and the m flag -'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + +/* + * All patterns have an m flag; all strings are multiline. + * Looking for digit characters at beginning/end of lines. + */ + +string = 'aaa\n789\r\nccc\r\n345'; + status = inSection(1); + pattern = /^\d/gm; + actualmatch = string.match(pattern); + expectedmatch = ['7','3']; + addThis(); + + status = inSection(2); + pattern = /\d$/gm; + actualmatch = string.match(pattern); + expectedmatch = ['9','5']; + addThis(); + +string = 'aaa\n789\r\nccc\r\nddd'; + status = inSection(3); + pattern = /^\d/gm; + actualmatch = string.match(pattern); + expectedmatch = ['7']; + addThis(); + + status = inSection(4); + pattern = /\d$/gm; + actualmatch = string.match(pattern); + expectedmatch = ['9']; + addThis(); + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-85721.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-85721.js new file mode 100644 index 0000000..41f5bc0 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-85721.js @@ -0,0 +1,271 @@ +/* ***** 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): rogerl@netscape.com, 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 Feb 2002 +* SUMMARY: Performance: Regexp performance degraded from 4.7 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=85721 +* +* Adjust this testcase if necessary. The FAST constant defines +* an upper bound in milliseconds for any execution to take. +* +*/ +//----------------------------------------------------------------------------- +var bug = 85721; +var summary = 'Performance: execution of regular expression'; +var FAST = 100; // execution should be 100 ms or less to pass the test +var MSG_FAST = 'Execution took less than ' + FAST + ' ms'; +var MSG_SLOW = 'Execution took '; +var MSG_MS = ' ms'; +var str = ''; +var re = ''; +var status = ''; +var actual = ''; +var expect= ''; + +printBugNumber (bug); +printStatus (summary); + + +function elapsedTime(startTime) +{ + return new Date() - startTime; +} + + +function isThisFast(ms) +{ + if (ms <= FAST) + return MSG_FAST; + return MSG_SLOW + ms + MSG_MS; +} + + + +/* + * The first regexp. We'll test for performance (Section 1) and accuracy (Section 2). + */ +str=' www.m.com drive.class\nfoo goo '; +re = /\s*\s*([^\r\n]*?)\s*<\/sql:url>\s*\s*([^\r\n]*?)\s*<\/sql:driver>\s*(\s*\s*([^\r\n]*?)\s*<\/sql:userId>\s*)?\s*(\s*\s*([^\r\n]*?)\s*<\/sql:password>\s*)?\s*<\/sql:connection>/; +expect = Array(" www.m.com drive.class\nfoo goo ","conn1","www.m.com","drive.class","foo ","foo","goo ","goo"); + +/* + * Check performance - + */ +status = inSection(1); +var start = new Date(); +var result = re.exec(str); +actual = elapsedTime(start); +reportCompare(isThisFast(FAST), isThisFast(actual), status); + +/* + * Check accuracy - + */ +status = inSection(2); +testRegExp([status], [re], [str], [result], [expect]); + + + +/* + * The second regexp (HUGE!). We'll test for performance (Section 3) and accuracy (Section 4). + * It comes from the O'Reilly book "Mastering Regular Expressions" by Jeffrey Friedl, Appendix B + */ + +//# Some things for avoiding backslashitis later on. +$esc = '\\\\'; +$Period = '\.'; +$space = '\040'; $tab = '\t'; +$OpenBR = '\\['; $CloseBR = '\\]'; +$OpenParen = '\\('; $CloseParen = '\\)'; +$NonASCII = '\x80-\xff'; $ctrl = '\000-\037'; +$CRlist = '\n\015'; //# note: this should really be only \015. +// Items 19, 20, 21 +$qtext = '[^' + $esc + $NonASCII + $CRlist + '\"]'; // # for within "..." +$dtext = '[^' + $esc + $NonASCII + $CRlist + $OpenBR + $CloseBR + ']'; // # for within [...] +$quoted_pair = $esc + '[^' + $NonASCII + ']'; // # an escaped character + +//############################################################################## +//# Items 22 and 23, comment. +//# Impossible to do properly with a regex, I make do by allowing at most one level of nesting. +$ctext = '[^' + $esc + $NonASCII + $CRlist + '()]'; + +//# $Cnested matches one non-nested comment. +//# It is unrolled, with normal of $ctext, special of $quoted_pair. +$Cnested = + $OpenParen + // # ( + $ctext + '*' + // # normal* + '(?:' + $quoted_pair + $ctext + '*)*' + // # (special normal*)* + $CloseParen; // # ) + + +//# $comment allows one level of nested parentheses +//# It is unrolled, with normal of $ctext, special of ($quoted_pair|$Cnested) +$comment = + $OpenParen + // # ( + $ctext + '*' + // # normal* + '(?:' + // # ( + '(?:' + $quoted_pair + '|' + $Cnested + ')' + // # special + $ctext + '*' + // # normal* + ')*' + // # )* + $CloseParen; // # ) + + +//############################################################################## +//# $X is optional whitespace/comments. +$X = + '[' + $space + $tab + ']*' + // # Nab whitespace. + '(?:' + $comment + '[' + $space + $tab + ']*)*'; // # If comment found, allow more spaces. + + +//# Item 10: atom +$atom_char = '[^(' + $space + '<>\@,;:\".' + $esc + $OpenBR + $CloseBR + $ctrl + $NonASCII + ']'; +$atom = + $atom_char + '+' + // # some number of atom characters... + '(?!' + $atom_char + ')'; // # ..not followed by something that could be part of an atom + +// # Item 11: doublequoted string, unrolled. +$quoted_str = + '\"' + // # " + $qtext + '*' + // # normal + '(?:' + $quoted_pair + $qtext + '*)*' + // # ( special normal* )* + '\"'; // # " + +//# Item 7: word is an atom or quoted string +$word = + '(?:' + + $atom + // # Atom + '|' + // # or + $quoted_str + // # Quoted string + ')' + +//# Item 12: domain-ref is just an atom +$domain_ref = $atom; + +//# Item 13: domain-literal is like a quoted string, but [...] instead of "..." +$domain_lit = + $OpenBR + // # [ + '(?:' + $dtext + '|' + $quoted_pair + ')*' + // # stuff + $CloseBR; // # ] + +// # Item 9: sub-domain is a domain-ref or domain-literal +$sub_domain = + '(?:' + + $domain_ref + + '|' + + $domain_lit + + ')' + + $X; // # optional trailing comments + +// # Item 6: domain is a list of subdomains separated by dots. +$domain = + $sub_domain + + '(?:' + + $Period + $X + $sub_domain + + ')*'; + +//# Item 8: a route. A bunch of "@ $domain" separated by commas, followed by a colon. +$route = + '\@' + $X + $domain + + '(?:,' + $X + '\@' + $X + $domain + ')*' + // # additional domains + ':' + + $X; // # optional trailing comments + +//# Item 6: local-part is a bunch of $word separated by periods +$local_part = + $word + $X + '(?:' + + $Period + $X + $word + $X + // # additional words + ')*'; + +// # Item 2: addr-spec is local@domain +$addr_spec = + $local_part + '\@' + $X + $domain; + +//# Item 4: route-addr is +$route_addr = + '<' + $X + // # < + '(?:' + $route + ')?' + // # optional route + $addr_spec + // # address spec + '>'; // # > + +//# Item 3: phrase........ +$phrase_ctrl = '\000-\010\012-\037'; // # like ctrl, but without tab + +//# Like atom-char, but without listing space, and uses phrase_ctrl. +//# Since the class is negated, this matches the same as atom-char plus space and tab +$phrase_char = + '[^()<>\@,;:\".' + $esc + $OpenBR + $CloseBR + $NonASCII + $phrase_ctrl + ']'; + +// # We've worked it so that $word, $comment, and $quoted_str to not consume trailing $X +// # because we take care of it manually. +$phrase = + $word + // # leading word + $phrase_char + '*' + // # "normal" atoms and/or spaces + '(?:' + + '(?:' + $comment + '|' + $quoted_str + ')' + // # "special" comment or quoted string + $phrase_char + '*' + // # more "normal" + ')*'; + +// ## Item #1: mailbox is an addr_spec or a phrase/route_addr +$mailbox = + $X + // # optional leading comment + '(?:' + + $phrase + $route_addr + // # name and address + '|' + // # or + $addr_spec + // # address + ')'; + + +//########################################################################### + + +re = new RegExp($mailbox, "g"); +str = 'Jeffy<"That Tall Guy"@ora.com (this address is no longer active)>'; +expect = Array('Jeffy<"That Tall Guy"@ora.com (this address is no longer active)>'); + +/* + * Check performance - + */ +status = inSection(3); +var start = new Date(); +var result = re.exec(str); +actual = elapsedTime(start); +reportCompare(isThisFast(FAST), isThisFast(actual), status); + +/* + * Check accuracy - + */ +status = inSection(4); +testRegExp([status], [re], [str], [result], [expect]); diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-87231.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-87231.js new file mode 100644 index 0000000..7fde4ff --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-87231.js @@ -0,0 +1,124 @@ +/* +* 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: 22 June 2001 +* +* SUMMARY: Regression test for Bugzilla bug 87231: +* "Regular expression /(A)?(A.*)/ picks 'A' twice" +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=87231 +* Key case: +* +* pattern = /^(A)?(A.*)$/; +* string = 'A'; +* expectedmatch = Array('A', '', 'A'); +* +* +* We expect the 1st subexpression (A)? NOT to consume the single 'A'. +* Recall that "?" means "match 0 or 1 times". Here, it should NOT do +* greedy matching: it should match 0 times instead of 1. This allows +* the 2nd subexpression to make the only match it can: the single 'A'. +* Such "altruism" is the only way there can be a successful global match... +*/ +//------------------------------------------------------------------------------------------------- +var i = 0; +var bug = 87231; +var cnEmptyString = ''; +var summary = 'Testing regular expression /(A)?(A.*)/'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +pattern = /^(A)?(A.*)$/; + status = inSection(1); + string = 'AAA'; + actualmatch = string.match(pattern); + expectedmatch = Array('AAA', 'A', 'AA'); + addThis(); + + status = inSection(2); + string = 'AA'; + actualmatch = string.match(pattern); + expectedmatch = Array('AA', 'A', 'A'); + addThis(); + + status = inSection(3); + string = 'A'; + actualmatch = string.match(pattern); + expectedmatch = Array('A', undefined, 'A'); // 'altruistic' case: see above + addThis(); + + +pattern = /(A)?(A.*)/; +var strL = 'zxcasd;fl\\\ ^'; +var strR = 'aaAAaaaf;lrlrzs'; + + status = inSection(4); + string = strL + 'AAA' + strR; + actualmatch = string.match(pattern); + expectedmatch = Array('AAA' + strR, 'A', 'AA' + strR); + addThis(); + + status = inSection(5); + string = strL + 'AA' + strR; + actualmatch = string.match(pattern); + expectedmatch = Array('AA' + strR, 'A', 'A' + strR); + addThis(); + + status = inSection(6); + string = strL + 'A' + strR; + actualmatch = string.match(pattern); + expectedmatch = Array('A' + strR, undefined, 'A' + strR); // 'altruistic' case: see above + addThis(); + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-98306.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-98306.js new file mode 100644 index 0000000..e812ebf --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-98306.js @@ -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): jrgm@netscape.com, pschwartau@netscape.com +* Date: 04 September 2001 +* +* SUMMARY: Regression test for Bugzilla bug 98306 +* "JS parser crashes in ParseAtom for script using Regexp()" +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=98306 +*/ +//----------------------------------------------------------------------------- +var bug = 98306; +var summary = "Testing that we don't crash on this code -"; +var cnUBOUND = 10; +var re; +var s; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + s = '"Hello".match(/[/]/)'; + tryThis(s); + + s = 're = /[/'; + tryThis(s); + + s = 're = /[/]/'; + tryThis(s); + + s = 're = /[//]/'; + tryThis(s); + + exitFunc ('test'); +} + + +// Try to provoke a crash - +function tryThis(sCode) +{ + // sometimes more than one attempt is necessary - + for (var i=0; i 'aaZaa' + expect = strJim.replace(new RegExp(strA), strB); // expect 'aa$aaZ' + reportCompare(expect, actual, status); + + + * + * Note: 'Zabc' is the result we expect for 'abc'.replace('', 'Z'). + * + * The string '' is supposed to be equivalent to new RegExp('') = //. + * The regexp // means we should match the "empty string" conceived of + * at the beginning boundary of the word, before the first character. + * + status = 'Section F of test'; + strA = cnEmptyString; + actual = str.replace(strA, strB); + expect = 'Zabc'; + reportCompare(expect, actual, status); + + status = 'Section G of test'; + strA = cnEmptyString; + actual = str.replace(strA, strB); + expect = str.replace(new RegExp(strA), strB); + reportCompare(expect, actual, status); + +************************* END OF INCORRECT CASES ****************************/ + + +////////////////////////// OK, LET'S START OVER ////////////////////////////// + + status = 'Section 1 of test'; + actual = 'abc'.replace('a', 'Z'); + expect = 'Zbc'; + reportCompare(expect, actual, status); + + status = 'Section 2 of test'; + actual = 'abc'.replace('b', 'Z'); + expect = 'aZc'; + reportCompare(expect, actual, status); + + status = 'Section 3 of test'; + actual = 'abc'.replace(undefined, 'Z'); + expect = 'abc'; // String(undefined) == 'undefined'; no replacement possible + reportCompare(expect, actual, status); + + status = 'Section 4 of test'; + actual = 'abc'.replace(null, 'Z'); + expect = 'abc'; // String(null) == 'null'; no replacement possible + reportCompare(expect, actual, status); + + status = 'Section 5 of test'; + actual = 'abc'.replace(true, 'Z'); + expect = 'abc'; // String(true) == 'true'; no replacement possible + reportCompare(expect, actual, status); + + status = 'Section 6 of test'; + actual = 'abc'.replace(false, 'Z'); + expect = 'abc'; // String(false) == 'false'; no replacement possible + reportCompare(expect, actual, status); + + status = 'Section 7 of test'; + actual = 'aa$aa'.replace('$', 'Z'); + expect = 'aaZaa'; // NOT 'aa$aaZ' as in ECMA Final Draft; see above + reportCompare(expect, actual, status); + + status = 'Section 8 of test'; + actual = 'abc'.replace('.*', 'Z'); + expect = 'abc'; // not 'Z' as in EMCA Final Draft + reportCompare(expect, actual, status); + + status = 'Section 9 of test'; + actual = 'abc'.replace('', 'Z'); + expect = 'Zabc'; // Still expect 'Zabc' for this + reportCompare(expect, actual, status); + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-001-n.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-001-n.js new file mode 100644 index 0000000..6527c16 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-001-n.js @@ -0,0 +1,44 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * 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 Communicator client code, released March + * 31, 1998. + * + * 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): + * Rob Ginda rginda@netscape.com + */ + +test(); + +function test() +{ + enterFunc ("test"); + + printStatus ("Unicode Characters 1C-1F negative test."); + printBugNumber (23612); + + reportCompare ("error", eval ("'no'\u001C+' error'"), + "Unicode whitespace test (1C.)"); + reportCompare ("error", eval ("'no'\u001D+' error'"), + "Unicode whitespace test (1D.)"); + reportCompare ("error", eval ("'no'\u001E+' error'"), + "Unicode whitespace test (1E.)"); + reportCompare ("error", eval ("'no'\u001F+' error'"), + "Unicode whitespace test (1F.)"); + + exitFunc ("test"); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-001.js new file mode 100644 index 0000000..470e8bc --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-001.js @@ -0,0 +1,38 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * 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 Communicator client code, released March + * 31, 1998. + * + * 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): + * Rob Ginda rginda@netscape.com + */ + +test(); + +function test() +{ + enterFunc ("test"); + + printStatus ("Unicode format-control character (Category Cf) test."); + printBugNumber (23610); + + reportCompare ("no error", eval('"no\u200E error"'), + "Unicode format-control character test (Category Cf.)"); + + exitFunc ("test"); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-002-n.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-002-n.js new file mode 100644 index 0000000..9c54a26 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-002-n.js @@ -0,0 +1,38 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * 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 Communicator client code, released March + * 31, 1998. + * + * 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): + * Rob Ginda rginda@netscape.com + */ + +test(); + +function test() +{ + enterFunc ("test"); + + printStatus ("Non-character escapes in identifiers negative test."); + printBugNumber (23607); + + reportCompare ("error", eval("\u0020 = 5"), + "Non-character escapes in identifiers negative test."); + + exitFunc ("test"); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-002.js new file mode 100644 index 0000000..3b05d83 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-002.js @@ -0,0 +1,42 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * 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 Communicator client code, released March + * 31, 1998. + * + * 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): + * Rob Ginda rginda@netscape.com + */ + +test(); + +function test() +{ + enterFunc ("test"); + + printStatus ("Unicode non-breaking space character test."); + printBugNumber (23613); + + reportCompare ("no error", eval("'no'\u00A0+ ' error'"), + "Unicode non-breaking space character test."); + + var str = "\u00A0foo"; + reportCompare (0, str.search(/^\sfoo$/), + "Unicode non-breaking space character regexp test."); + + exitFunc ("test"); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-003.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-003.js new file mode 100644 index 0000000..7004cf4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-003.js @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * 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 Communicator client code, released March + * 31, 1998. + * + * 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): + * Rob Ginda rginda@netscape.com + */ + +test(); + +function test() +{ + enterFunc ("test"); + + var \u0041 = 5; + var A\u03B2 = 15; + var c\u0061se = 25; + + printStatus ("Escapes in identifiers test."); + printBugNumber (23608); + printBugNumber (23607); + + reportCompare (5, eval("\u0041"), + "Escaped ASCII Identifier test."); + reportCompare (6, eval("++\u0041"), + "Escaped ASCII Identifier test"); + reportCompare (15, eval("A\u03B2"), + "Escaped non-ASCII Identifier test"); + reportCompare (16, eval("++A\u03B2"), + "Escaped non-ASCII Identifier test"); + reportCompare (25, eval("c\\u00" + "61se"), + "Escaped keyword Identifier test"); + reportCompare (26, eval("++c\\u00" + "61se"), + "Escaped keyword Identifier test"); + + exitFunc ("test"); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-004.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-004.js new file mode 100644 index 0000000..2518124 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-004.js @@ -0,0 +1,47 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * 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 Communicator client code, released March + * 31, 1998. + * + * 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): + * Rob Ginda rginda@netscape.com + */ + +test(); + +function test() +{ + enterFunc ("test"); + + printStatus ("Unicode Characters 1C-1F with regexps test."); + printBugNumber (23612); + + var ary = ["\u001Cfoo", "\u001Dfoo", "\u001Efoo", "\u001Ffoo"]; + + for (var i in ary) + { + reportCompare (0, ary[Number(i)].search(/^\Sfoo$/), + "Unicode characters 1C-1F in regexps, ary[" + + i + "] did not match \\S test (it should not.)"); + reportCompare (-1, ary[Number(i)].search(/^\sfoo$/), + "Unicode characters 1C-1F in regexps, ary[" + + i + "] matched \\s test (it should not.)"); + } + + exitFunc ("test"); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-005.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-005.js new file mode 100644 index 0000000..5b1be03 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-005.js @@ -0,0 +1,271 @@ +/* ***** 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): rogerl@netscape.com, 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: 15 July 2002 +* SUMMARY: Testing identifiers with double-byte names +* See http://bugzilla.mozilla.org/show_bug.cgi?id=58274 +* +* Here is a sample of the problem: +* +* js> function f\u02B1 () {} +* +* js> f\u02B1.toSource(); +* function f¦() {} +* +* js> f\u02B1.toSource().toSource(); +* (new String("function f\xB1() {}")) +* +* +* See how the high-byte information (the 02) has been lost? +* The same thing was happening with the toString() method: +* +* js> f\u02B1.toString(); +* +* function f¦() { +* } +* +* js> f\u02B1.toString().toSource(); +* (new String("\nfunction f\xB1() {\n}\n")) +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 58274; +var summary = 'Testing identifiers with double-byte names'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +/* + * Define a function that uses double-byte identifiers in + * "every possible way" + * + * Then recover each double-byte identifier via f.toString(). + * To make this easier, put a 'Z' token before every one. + * + * Our eval string will be: + * + * sEval = "function Z\u02b1(Z\u02b2, b) { + * try { Z\u02b3 : var Z\u02b4 = Z\u02b1; } + * catch (Z\u02b5) { for (var Z\u02b6 in Z\u02b5) + * {for (1; 1<0; Z\u02b7++) {new Array()[Z\u02b6] = 1;} };} }"; + * + * It will be helpful to build this string in stages: + */ +var s0 = 'function Z'; +var s1 = '\u02b1(Z'; +var s2 = '\u02b2, b) {try { Z'; +var s3 = '\u02b3 : var Z'; +var s4 = '\u02b4 = Z'; +var s5 = '\u02b1; } catch (Z' +var s6 = '\u02b5) { for (var Z'; +var s7 = '\u02b6 in Z'; +var s8 = '\u02b5){for (1; 1<0; Z'; +var s9 = '\u02b7++) {new Array()[Z'; +var s10 = '\u02b6] = 1;} };} }'; + + +/* + * Concatenate these and eval() to create the function Z\u02b1 + */ +var sEval = s0 + s1 + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10; +eval(sEval); + + +/* + * Recover all the double-byte identifiers via Z\u02b1.toString(). + * We'll recover the 1st one as arrID[1], the 2nd one as arrID[2], + * and so on ... + */ +var arrID = getIdentifiers(Z\u02b1); + + +/* + * Now check that we got back what we put in - + */ +status = inSection(1); +actual = arrID[1]; +expect = s1.charAt(0); +addThis(); + +status = inSection(2); +actual = arrID[2]; +expect = s2.charAt(0); +addThis(); + +status = inSection(3); +actual = arrID[3]; +expect = s3.charAt(0); +addThis(); + +status = inSection(4); +actual = arrID[4]; +expect = s4.charAt(0); +addThis(); + +status = inSection(5); +actual = arrID[5]; +expect = s5.charAt(0); +addThis(); + +status = inSection(6); +actual = arrID[6]; +expect = s6.charAt(0); +addThis(); + +status = inSection(7); +actual = arrID[7]; +expect = s7.charAt(0); +addThis(); + +status = inSection(8); +actual = arrID[8]; +expect = s8.charAt(0); +addThis(); + +status = inSection(9); +actual = arrID[9]; +expect = s9.charAt(0); +addThis(); + +status = inSection(10); +actual = arrID[10]; +expect = s10.charAt(0); +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +/* + * Goal: recover the double-byte identifiers from f.toString() + * by getting the very next character after each 'Z' token. + * + * The return value will be an array |arr| indexed such that + * |arr[1]| is the 1st identifier, |arr[2]| the 2nd, and so on. + * + * Note, however, f.toString() is implementation-independent. + * For example, it may begin with '\nfunction' instead of 'function'. + * + * Rhino uses a Unicode representation for f.toString(); whereas + * SpiderMonkey uses an ASCII representation, putting escape sequences + * for non-ASCII characters. For example, if a function is called f\u02B1, + * then in Rhino the toString() method will present a 2-character Unicode + * string for its name, whereas SpiderMonkey will present a 7-character + * ASCII string for its name: the string literal 'f\u02B1'. + * + * So we force the lexer to condense the string before we use it. + * This will give uniform results in Rhino and SpiderMonkey. + */ +function getIdentifiers(f) +{ + var str = condenseStr(f.toString()); + var arr = str.split('Z'); + + /* + * The identifiers are the 1st char of each split substring + * EXCEPT the first one, which is just ('\n' +) 'function '. + * + * Thus note the 1st identifier will be stored in |arr[1]|, + * the 2nd one in |arr[2]|, etc., making the indexing easy - + */ + for (i in arr) + arr[i] = arr[i].charAt(0); + return arr; +} + + +/* + * This function is the opposite of a functions like escape(), which take + * Unicode characters and return escape sequences for them. Here, we force + * the lexer to turn escape sequences back into single characters. + * + * Note we can't simply do |eval(str)|, since in practice |str| will be an + * identifier somewhere in the program (e.g. a function name); thus |eval(str)| + * would return the object that the identifier represents: not what we want. + * + * So we surround |str| lexicographically with quotes to force the lexer to + * evaluate it as a string. Have to strip out any linefeeds first, however - + */ +function condenseStr(str) +{ + /* + * You won't be able to do the next step if |str| has + * any carriage returns or linefeeds in it. For example: + * + * js> eval("'" + '\nHello' + "'"); + * 1: SyntaxError: unterminated string literal: + * 1: ' + * 1: ^ + * + * So replace them with the empty string - + */ + str = str.replace(/[\r\n]/g, '') + return eval("'" + str + "'") +} + + +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