]>
Commit | Line | Data |
---|---|---|
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 31316: | |
23 | * "Rhino: Regexp matches return garbage" | |
24 | * | |
25 | * See http://bugzilla.mozilla.org/show_bug.cgi?id=31316 | |
26 | */ | |
27 | //------------------------------------------------------------------------------------------------- | |
28 | var i = 0; | |
29 | var bug = 31316; | |
30 | var summary = 'Regression test for Bugzilla bug 31316'; | |
31 | var cnEmptyString = ''; | |
32 | var status = ''; | |
33 | var statusmessages = new Array(); | |
34 | var pattern = ''; | |
35 | var patterns = new Array(); | |
36 | var string = ''; | |
37 | var strings = new Array(); | |
38 | var actualmatch = ''; | |
39 | var actualmatches = new Array(); | |
40 | var expectedmatch = ''; | |
41 | var expectedmatches = new Array(); | |
42 | ||
43 | ||
44 | status = inSection(1); | |
45 | pattern = /<([^\/<>][^<>]*[^\/])>|<([^\/<>])>/; | |
46 | string = '<p>Some<br />test</p>'; | |
47 | actualmatch = string.match(pattern); | |
48 | expectedmatch = Array('<p>', undefined, 'p'); | |
49 | addThis(); | |
50 | ||
51 | ||
52 | //------------------------------------------------------------------------------------------------- | |
53 | test(); | |
54 | //------------------------------------------------------------------------------------------------- | |
55 | ||
56 | ||
57 | function addThis() | |
58 | { | |
59 | statusmessages[i] = status; | |
60 | patterns[i] = pattern; | |
61 | strings[i] = string; | |
62 | actualmatches[i] = actualmatch; | |
63 | expectedmatches[i] = expectedmatch; | |
64 | i++; | |
65 | } | |
66 | ||
67 | ||
68 | function test() | |
69 | { | |
70 | enterFunc ('test'); | |
71 | printBugNumber (bug); | |
72 | printStatus (summary); | |
73 | testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); | |
74 | exitFunc ('test'); | |
75 | } |