Debian Codegraph @

rhino/testsrc/tests/ecma_3/RegExp/regress-225343.js

raw symbols SCIP
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 /*
7 *
8 * Date: 11 November 2003
9 * SUMMARY: Testing regexp character classes and the case-insensitive flag
10 *
11 * See http://bugzilla.mozilla.org/show_bug.cgi?id=225343
12 *
13 */
14 //-----------------------------------------------------------------------------
15 var gTestfile = 'regress-225343.js';
16 var i = 0;
17 var BUGNUMBER = 225343;
18 var summary = 'Testing regexp character classes and the case-insensitive flag';
19 var status = '';
20 var statusmessages = new Array();
21 var pattern = '';
22 var patterns = new Array();
23 var string = '';
24 var strings = new Array();
25 var actualmatch = '';
26 var actualmatches = new Array();
27 var expectedmatch = '';
28 var expectedmatches = new Array();
29
30
31 status = inSection(1);
32 string = 'a';
33 pattern = /[A]/i;
34 actualmatch = string.match(pattern);
35 expectedmatch = Array('a');
36 addThis();
37
38 status = inSection(2);
39 string = 'A';
40 pattern = /[a]/i;
41 actualmatch = string.match(pattern);
42 expectedmatch = Array('A');
43 addThis();
44
45 status = inSection(3);
46 string = '123abc123';
47 pattern = /([A-Z]+)/i;
48 actualmatch = string.match(pattern);
49 expectedmatch = Array('abc', 'abc');
50 addThis();
51
52 status = inSection(4);
53 string = '123abc123';
54 pattern = /([A-Z])+/i;
55 actualmatch = string.match(pattern);
56 expectedmatch = Array('abc', 'c');
57 addThis();
58
59 status = inSection(5);
60 string = '[email protected]';
61 pattern = /^[-!#$%&\'*+\.\/0-9=?A-Z^_`{|}~]+@([-0-9A-Z]+\.)+([0-9A-Z]){2,4}$/i;
62 actualmatch = string.match(pattern);
63 expectedmatch = Array('[email protected]', 'test.', 'm');
64 addThis();
65
66
67
68 //-------------------------------------------------------------------------------------------------
69 test();
70 //-------------------------------------------------------------------------------------------------
71
72
73
74 function addThis()
75 {
76 statusmessages[i] = status;
77 patterns[i] = pattern;
78 strings[i] = string;
79 actualmatches[i] = actualmatch;
80 expectedmatches[i] = expectedmatch;
81 i++;
82 }
83
84
85 function test()
86 {
87 enterFunc ('test');
88 printBugNumber(BUGNUMBER);
89 printStatus (summary);
90 testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
91 exitFunc ('test');
92 }