]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma_3/RegExp/regress-76683.js
JavaScriptCore-1097.3.3.tar.gz
[apple/javascriptcore.git] / tests / mozilla / ecma_3 / RegExp / regress-76683.js
1 /*
2 * The contents of this file are subject to the Netscape Public
3 * License Version 1.1 (the "License"); you may not use this file
4 * except in compliance with the License. You may obtain a copy of
5 * the License at http://www.mozilla.org/NPL/
6 *
7 * Software distributed under the License is distributed on an "AS IS"
8 * basis, WITHOUT WARRANTY OF ANY KIND, either expressed
9 * or implied. See the License for the specific language governing
10 * rights and limitations under the License.
11 *
12 * The Original Code is mozilla.org code.
13 *
14 * The Initial Developer of the Original Code is Netscape
15 * Communications Corporation. Portions created by Netscape are
16 * Copyright (C) 1998 Netscape Communications Corporation.
17 * All Rights Reserved.
18 *
19 * Contributor(s): pschwartau@netscape.com
20 * Date: 01 May 2001
21 *
22 * SUMMARY: Regression test for Bugzilla bug 76683 on Rhino:
23 * "RegExp regression (NullPointerException)"
24 *
25 * See http://bugzilla.mozilla.org/show_bug.cgi?id=76683
26 */
27 //-------------------------------------------------------------------------------------------------
28 var i = 0;
29 var bug = 76683;
30 var summary = 'Regression test for Bugzilla bug 76683';
31 var status = '';
32 var statusmessages = new Array();
33 var pattern = '';
34 var patterns = new Array();
35 var string = '';
36 var strings = new Array();
37 var actualmatch = '';
38 var actualmatches = new Array();
39 var expectedmatch = '';
40 var expectedmatches = new Array();
41
42
43 /*
44 * Rhino (2001-04-19) crashed on the 3rd regular expression below.
45 * It didn't matter what the string was. No problem in SpiderMonkey -
46 */
47 string = 'abc';
48 status = inSection(1);
49 pattern = /(<!--([^-]|-[^-]|--[^>])*-->)|(<([\$\w:\.\-]+)((([ ][^\/>]*)?\/>)|(([ ][^>]*)?>)))/;
50 actualmatch = string.match(pattern);
51 expectedmatch = null;
52 addThis();
53
54 status = inSection(2);
55 pattern = /(<!--([^-]|-[^-]|--[^>])*-->)|(<(tagPattern)((([ ][^\/>]*)?\/>)|(([ ][^>]*)?>)))/;
56 actualmatch = string.match(pattern);
57 expectedmatch = null;
58 addThis();
59
60 // This was the one causing a Rhino crash -
61 status = inSection(3);
62 pattern = /(<!--([^-]|-[^-]|--[^>])*-->)|(<(tagPattern)((([ ][^\/>]*)?\/>)|(([ ][^>]*)?>)))|(<\/tagPattern[^>]*>)/;
63 actualmatch = string.match(pattern);
64 expectedmatch = null;
65 addThis();
66
67
68
69 //-------------------------------------------------------------------------------------------------
70 test();
71 //-------------------------------------------------------------------------------------------------
72
73
74
75 function addThis()
76 {
77 statusmessages[i] = status;
78 patterns[i] = pattern;
79 strings[i] = string;
80 actualmatches[i] = actualmatch;
81 expectedmatches[i] = expectedmatch;
82 i++;
83 }
84
85
86 function test()
87 {
88 enterFunc ('test');
89 printBugNumber (bug);
90 printStatus (summary);
91 testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
92 exitFunc ('test');
93 }