001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * Portions Copyrighted 2007 Sun Microsystems, Inc.
027: */
028:
029: package org.netbeans.modules.search;
030:
031: import java.lang.reflect.Field;
032: import java.util.regex.Matcher;
033: import java.util.regex.Pattern;
034: import org.netbeans.junit.NbTestCase;
035:
036: /**
037: *
038: * @author mp
039: */
040: public class RegexpMakerTest extends NbTestCase {
041:
042: public RegexpMakerTest() {
043: super ("SimpleRegexpParserTest");
044: }
045:
046: private static String getClassField(String name) throws Exception {
047: Field field = RegexpMaker.class.getDeclaredField(name);
048: field.setAccessible(true);
049: return (String) field.get(null);
050: }
051:
052: public void testMakeRegexp() throws Exception {
053:
054: /* basics: */
055: assertEquals("", RegexpMaker.makeRegexp(""));
056: assertEquals("a", RegexpMaker.makeRegexp("a"));
057: assertEquals("ab", RegexpMaker.makeRegexp("ab"));
058: assertEquals("abc", RegexpMaker.makeRegexp("abc"));
059:
060: /* special chars in the middle: */
061: assertEquals("a.*?b.c", RegexpMaker.makeRegexp("a*b?c"));
062: assertEquals("a..+?b", RegexpMaker.makeRegexp("a?*?b"));
063: assertEquals("a.+?b", RegexpMaker.makeRegexp("a*?*b"));
064:
065: /* ignore stars in the begining: */
066: assertEquals("a", RegexpMaker.makeRegexp("*a"));
067: assertEquals(".a", RegexpMaker.makeRegexp("?a"));
068: assertEquals("a", RegexpMaker.makeRegexp("**a"));
069: assertEquals(".a", RegexpMaker.makeRegexp("*?a"));
070: assertEquals(".a", RegexpMaker.makeRegexp("?*a"));
071: assertEquals("..a", RegexpMaker.makeRegexp("??a"));
072:
073: /* ignore stars at the end: */
074: assertEquals("a", RegexpMaker.makeRegexp("a*"));
075: assertEquals("a.", RegexpMaker.makeRegexp("a?"));
076: assertEquals("a", RegexpMaker.makeRegexp("a**"));
077: assertEquals("a.", RegexpMaker.makeRegexp("a*?"));
078: assertEquals("a.", RegexpMaker.makeRegexp("a?*"));
079: assertEquals("a..", RegexpMaker.makeRegexp("a??"));
080:
081: /* other usage of '*' and '?': */
082: assertEquals(" .*?a", RegexpMaker.makeRegexp(" *a"));
083: assertEquals(" .a", RegexpMaker.makeRegexp(" ?a"));
084: assertEquals(" a", RegexpMaker.makeRegexp("* a"));
085: assertEquals(". a", RegexpMaker.makeRegexp("? a"));
086: assertEquals("\\,a", RegexpMaker.makeRegexp("*,a"));
087: assertEquals(".\\,a", RegexpMaker.makeRegexp("?,a"));
088: assertEquals("a.*? ", RegexpMaker.makeRegexp("a* "));
089: assertEquals("a. ", RegexpMaker.makeRegexp("a? "));
090: assertEquals("a ", RegexpMaker.makeRegexp("a *"));
091: assertEquals("a .", RegexpMaker.makeRegexp("a ?"));
092: assertEquals("a\\,", RegexpMaker.makeRegexp("a,*"));
093: assertEquals("a\\,.", RegexpMaker.makeRegexp("a,?"));
094:
095: /* whole words: */
096:
097: final String wordCharsExpr = getClassField("wordCharsExpr");
098: final String checkNotAfterWordChar = getClassField("checkNotAfterWordChar");
099: final String checkNotBeforeWordChar = getClassField("checkNotBeforeWordChar");
100:
101: assertEquals("", RegexpMaker.makeRegexp("", true));
102: assertEquals(checkNotAfterWordChar + "a"
103: + checkNotBeforeWordChar, RegexpMaker.makeRegexp("a",
104: true));
105: assertEquals(checkNotAfterWordChar + "a" + wordCharsExpr
106: + "*?b" + wordCharsExpr + "c" + checkNotBeforeWordChar,
107: RegexpMaker.makeRegexp("a*b?c", true));
108: assertEquals(checkNotAfterWordChar + "a" + wordCharsExpr
109: + "{2,}?b" + checkNotBeforeWordChar, RegexpMaker
110: .makeRegexp("a?*?b", true));
111: assertEquals(checkNotAfterWordChar + "a" + wordCharsExpr
112: + "+?b" + checkNotBeforeWordChar, RegexpMaker
113: .makeRegexp("a*?*b", true));
114:
115: assertEquals(wordCharsExpr + "*a" + checkNotBeforeWordChar,
116: RegexpMaker.makeRegexp("*a", true));
117: assertEquals(checkNotAfterWordChar + wordCharsExpr + "a"
118: + checkNotBeforeWordChar, RegexpMaker.makeRegexp("?a",
119: true));
120: assertEquals(wordCharsExpr + "*a" + checkNotBeforeWordChar,
121: RegexpMaker.makeRegexp("**a", true));
122: assertEquals(wordCharsExpr + "+a" + checkNotBeforeWordChar,
123: RegexpMaker.makeRegexp("*?a", true));
124: assertEquals(wordCharsExpr + "+a" + checkNotBeforeWordChar,
125: RegexpMaker.makeRegexp("?*a", true));
126: assertEquals(checkNotAfterWordChar + wordCharsExpr + "{2}a"
127: + checkNotBeforeWordChar, RegexpMaker.makeRegexp("??a",
128: true));
129:
130: assertEquals(checkNotAfterWordChar + "a" + wordCharsExpr + "*",
131: RegexpMaker.makeRegexp("a*", true));
132: assertEquals(checkNotAfterWordChar + "a" + wordCharsExpr
133: + checkNotBeforeWordChar, RegexpMaker.makeRegexp("a?",
134: true));
135: assertEquals(checkNotAfterWordChar + "a" + wordCharsExpr + "*",
136: RegexpMaker.makeRegexp("a**", true));
137: assertEquals(checkNotAfterWordChar + "a" + wordCharsExpr + "+",
138: RegexpMaker.makeRegexp("a*?", true));
139: assertEquals(checkNotAfterWordChar + "a" + wordCharsExpr + "+",
140: RegexpMaker.makeRegexp("a?*", true));
141: assertEquals(checkNotAfterWordChar + "a" + wordCharsExpr
142: + "{2}" + checkNotBeforeWordChar, RegexpMaker
143: .makeRegexp("a??", true));
144:
145: assertEquals(" " + wordCharsExpr + "*?a"
146: + checkNotBeforeWordChar, RegexpMaker.makeRegexp(" *a",
147: true));
148: assertEquals(
149: " " + wordCharsExpr + "a" + checkNotBeforeWordChar,
150: RegexpMaker.makeRegexp(" ?a", true));
151: assertEquals(wordCharsExpr + "* a" + checkNotBeforeWordChar,
152: RegexpMaker.makeRegexp("* a", true));
153: assertEquals(checkNotAfterWordChar + wordCharsExpr + " a"
154: + checkNotBeforeWordChar, RegexpMaker.makeRegexp("? a",
155: true));
156: assertEquals(wordCharsExpr + "*\\,a" + checkNotBeforeWordChar,
157: RegexpMaker.makeRegexp("*,a", true));
158: assertEquals(checkNotAfterWordChar + wordCharsExpr + "\\,a"
159: + checkNotBeforeWordChar, RegexpMaker.makeRegexp("?,a",
160: true));
161: assertEquals(checkNotAfterWordChar + "a" + wordCharsExpr
162: + "*? ", RegexpMaker.makeRegexp("a* ", true));
163: assertEquals(checkNotAfterWordChar + "a" + wordCharsExpr + " ",
164: RegexpMaker.makeRegexp("a? ", true));
165: assertEquals(
166: checkNotAfterWordChar + "a " + wordCharsExpr + "*",
167: RegexpMaker.makeRegexp("a *", true));
168: assertEquals(checkNotAfterWordChar + "a " + wordCharsExpr
169: + checkNotBeforeWordChar, RegexpMaker.makeRegexp("a ?",
170: true));
171: assertEquals(checkNotAfterWordChar + "a\\," + wordCharsExpr
172: + "*", RegexpMaker.makeRegexp("a,*", true));
173: assertEquals(checkNotAfterWordChar + "a\\," + wordCharsExpr
174: + checkNotBeforeWordChar, RegexpMaker.makeRegexp("a,?",
175: true));
176:
177: assertEquals("a b", RegexpMaker.makeRegexp("a b"));
178: assertEquals("a\\!b", RegexpMaker.makeRegexp("a!b"));
179: assertEquals("a\\\"b", RegexpMaker.makeRegexp("a\"b"));
180: assertEquals("a\\#b", RegexpMaker.makeRegexp("a#b"));
181: assertEquals("a\\$b", RegexpMaker.makeRegexp("a$b"));
182: assertEquals("a\\%b", RegexpMaker.makeRegexp("a%b"));
183: assertEquals("a\\&b", RegexpMaker.makeRegexp("a&b"));
184: assertEquals("a\\'b", RegexpMaker.makeRegexp("a'b"));
185: assertEquals("a\\(b", RegexpMaker.makeRegexp("a(b"));
186: assertEquals("a\\)b", RegexpMaker.makeRegexp("a)b"));
187: assertEquals("a\\+b", RegexpMaker.makeRegexp("a+b"));
188: assertEquals("a\\,b", RegexpMaker.makeRegexp("a,b"));
189: assertEquals("a\\-b", RegexpMaker.makeRegexp("a-b"));
190: assertEquals("a\\.b", RegexpMaker.makeRegexp("a.b"));
191: assertEquals("a\\/b", RegexpMaker.makeRegexp("a/b"));
192:
193: assertEquals("a0b", RegexpMaker.makeRegexp("a0b"));
194: assertEquals("a1b", RegexpMaker.makeRegexp("a1b"));
195: assertEquals("a2b", RegexpMaker.makeRegexp("a2b"));
196: assertEquals("a3b", RegexpMaker.makeRegexp("a3b"));
197: assertEquals("a4b", RegexpMaker.makeRegexp("a4b"));
198: assertEquals("a5b", RegexpMaker.makeRegexp("a5b"));
199: assertEquals("a6b", RegexpMaker.makeRegexp("a6b"));
200: assertEquals("a7b", RegexpMaker.makeRegexp("a7b"));
201: assertEquals("a8b", RegexpMaker.makeRegexp("a8b"));
202: assertEquals("a9b", RegexpMaker.makeRegexp("a9b"));
203:
204: assertEquals("a\\:b", RegexpMaker.makeRegexp("a:b"));
205: assertEquals("a\\;b", RegexpMaker.makeRegexp("a;b"));
206: assertEquals("a\\<b", RegexpMaker.makeRegexp("a<b"));
207: assertEquals("a\\=b", RegexpMaker.makeRegexp("a=b"));
208: assertEquals("a\\>b", RegexpMaker.makeRegexp("a>b"));
209: assertEquals("a\\@b", RegexpMaker.makeRegexp("a@b"));
210: assertEquals("a\\[b", RegexpMaker.makeRegexp("a[b"));
211: assertEquals("ab", RegexpMaker.makeRegexp("a\\b"));
212: assertEquals("a\\]b", RegexpMaker.makeRegexp("a]b"));
213: assertEquals("a\\^b", RegexpMaker.makeRegexp("a^b"));
214: assertEquals("a\\_b", RegexpMaker.makeRegexp("a_b"));
215: assertEquals("a\\`b", RegexpMaker.makeRegexp("a`b"));
216: assertEquals("a\\{b", RegexpMaker.makeRegexp("a{b"));
217: assertEquals("a\\|b", RegexpMaker.makeRegexp("a|b"));
218: assertEquals("a\\}b", RegexpMaker.makeRegexp("a}b"));
219: assertEquals("a\\~b", RegexpMaker.makeRegexp("a~b"));
220: assertEquals("a\\\u007fb", RegexpMaker.makeRegexp("a\u007fb"));
221:
222: assertEquals("a\u0080b", RegexpMaker.makeRegexp("a\u0080b"));
223: assertEquals("a\u00c1b", RegexpMaker.makeRegexp("a\u00c1b"));
224:
225: assertEquals("abc\\\\", RegexpMaker.makeRegexp("abc\\"));
226: }
227:
228: public void testRegexpMatches() {
229: checkMatch("public", "x", null);
230: checkMatch("public", "li", "li");
231: checkMatch("public", "*li", "li");
232: checkMatch("public", "li*", "li");
233: checkMatch("public", "*li*", "li");
234:
235: checkMatchWW("public", "x", null);
236: checkMatchWW("public", "li", null);
237: checkMatchWW("public", "*li", null);
238: checkMatchWW("public", "li*", null);
239: checkMatchWW("public", "*li*", "public");
240: checkMatchWW("public poklice", "*li*", "public");
241: checkMatchWW("public poklice", "*lic", "public");
242: checkMatchWW("poklice public", "*lic", "public");
243: checkMatchWW("public", "??lic", null);
244: checkMatchWW("public", "pub??", null);
245: checkMatchWW("", "???", null);
246: checkMatchWW("p", "???", null);
247: checkMatchWW("pub", "???", "pub");
248: checkMatchWW("public", "???", null);
249: }
250:
251: private void checkMatch(String testString, String simpleExpr,
252: String expectedMatch) {
253: checkMatch(testString, simpleExpr, expectedMatch, false);
254: }
255:
256: private void checkMatchWW(String testString, String simpleExpr,
257: String expectedMatch) {
258: checkMatch(testString, simpleExpr, expectedMatch, true);
259: }
260:
261: /**
262: * Checks whether the given simple expression matches the expected substring
263: * of the given string.
264: *
265: * @param simpleExpr simple search expression to be tested
266: * @param expectedMatch substring that should be matched by the expression
267: * @param testString test string to be searched
268: * @param wholeWords whether to search with the <i>Whole Words</i> option
269: */
270: private void checkMatch(String testString, String simpleExpr,
271: String expectedMatch, boolean wholeWords) {
272: String regexp = RegexpMaker.makeRegexp(simpleExpr, wholeWords);
273: Matcher matcher = Pattern.compile(regexp).matcher(testString);
274:
275: if (expectedMatch == null) {
276: assertFalse(matcher.find());
277: } else {
278: assertTrue(matcher.find());
279: assertEquals(expectedMatch, matcher.group());
280: }
281: }
282:
283: public void testMakeMultiRegexp() {
284: assertEquals("", RegexpMaker.makeMultiRegexp(""));
285: assertEquals("a", RegexpMaker.makeMultiRegexp("a"));
286: assertEquals("ab", RegexpMaker.makeMultiRegexp("ab"));
287: assertEquals("abc", RegexpMaker.makeMultiRegexp("abc"));
288: assertEquals("a.", RegexpMaker.makeMultiRegexp("a?"));
289: assertEquals("a.*", RegexpMaker.makeMultiRegexp("a*"));
290: assertEquals(".a", RegexpMaker.makeMultiRegexp("?a"));
291: assertEquals(".*a", RegexpMaker.makeMultiRegexp("*a"));
292: assertEquals("a.b", RegexpMaker.makeMultiRegexp("a?b"));
293: assertEquals(".a.", RegexpMaker.makeMultiRegexp("?a?"));
294: assertEquals("a.*b.c", RegexpMaker.makeMultiRegexp("a*b?c"));
295: assertEquals("a...*b", RegexpMaker.makeMultiRegexp("a?*?b"));
296: assertEquals("a..*b", RegexpMaker.makeMultiRegexp("a*?*b"));
297:
298: assertEquals("a|b", RegexpMaker.makeMultiRegexp("a b"));
299: assertEquals("a\\!b", RegexpMaker.makeMultiRegexp("a!b"));
300: assertEquals("a\\\"b", RegexpMaker.makeMultiRegexp("a\"b"));
301: assertEquals("a\\#b", RegexpMaker.makeMultiRegexp("a#b"));
302: assertEquals("a\\$b", RegexpMaker.makeMultiRegexp("a$b"));
303: assertEquals("a\\%b", RegexpMaker.makeMultiRegexp("a%b"));
304: assertEquals("a\\&b", RegexpMaker.makeMultiRegexp("a&b"));
305: assertEquals("a\\'b", RegexpMaker.makeMultiRegexp("a'b"));
306: assertEquals("a\\(b", RegexpMaker.makeMultiRegexp("a(b"));
307: assertEquals("a\\)b", RegexpMaker.makeMultiRegexp("a)b"));
308: assertEquals("a\\+b", RegexpMaker.makeMultiRegexp("a+b"));
309: assertEquals("a|b", RegexpMaker.makeMultiRegexp("a,b"));
310: assertEquals("a\\-b", RegexpMaker.makeMultiRegexp("a-b"));
311: assertEquals("a\\.b", RegexpMaker.makeMultiRegexp("a.b"));
312: assertEquals("a\\/b", RegexpMaker.makeMultiRegexp("a/b"));
313:
314: assertEquals("a0b", RegexpMaker.makeMultiRegexp("a0b"));
315: assertEquals("a1b", RegexpMaker.makeMultiRegexp("a1b"));
316: assertEquals("a2b", RegexpMaker.makeMultiRegexp("a2b"));
317: assertEquals("a3b", RegexpMaker.makeMultiRegexp("a3b"));
318: assertEquals("a4b", RegexpMaker.makeMultiRegexp("a4b"));
319: assertEquals("a5b", RegexpMaker.makeMultiRegexp("a5b"));
320: assertEquals("a6b", RegexpMaker.makeMultiRegexp("a6b"));
321: assertEquals("a7b", RegexpMaker.makeMultiRegexp("a7b"));
322: assertEquals("a8b", RegexpMaker.makeMultiRegexp("a8b"));
323: assertEquals("a9b", RegexpMaker.makeMultiRegexp("a9b"));
324:
325: assertEquals("a\\:b", RegexpMaker.makeMultiRegexp("a:b"));
326: assertEquals("a\\;b", RegexpMaker.makeMultiRegexp("a;b"));
327: assertEquals("a\\<b", RegexpMaker.makeMultiRegexp("a<b"));
328: assertEquals("a\\=b", RegexpMaker.makeMultiRegexp("a=b"));
329: assertEquals("a\\>b", RegexpMaker.makeMultiRegexp("a>b"));
330: assertEquals("a\\@b", RegexpMaker.makeMultiRegexp("a@b"));
331: assertEquals("a\\[b", RegexpMaker.makeMultiRegexp("a[b"));
332: assertEquals("ab", RegexpMaker.makeMultiRegexp("a\\b"));
333: assertEquals("a\\]b", RegexpMaker.makeMultiRegexp("a]b"));
334: assertEquals("a\\^b", RegexpMaker.makeMultiRegexp("a^b"));
335: assertEquals("a\\_b", RegexpMaker.makeMultiRegexp("a_b"));
336: assertEquals("a\\`b", RegexpMaker.makeMultiRegexp("a`b"));
337: assertEquals("a\\{b", RegexpMaker.makeMultiRegexp("a{b"));
338: assertEquals("a\\|b", RegexpMaker.makeMultiRegexp("a|b"));
339: assertEquals("a\\}b", RegexpMaker.makeMultiRegexp("a}b"));
340: assertEquals("a\\~b", RegexpMaker.makeMultiRegexp("a~b"));
341: assertEquals("a\\\u007fb", RegexpMaker
342: .makeMultiRegexp("a\u007fb"));
343:
344: assertEquals("a\u0080b", RegexpMaker
345: .makeMultiRegexp("a\u0080b"));
346: assertEquals("a\u00c1b", RegexpMaker
347: .makeMultiRegexp("a\u00c1b"));
348:
349: assertEquals("abc\\\\", RegexpMaker.makeRegexp("abc\\"));
350:
351: assertEquals("", RegexpMaker.makeMultiRegexp(""));
352: assertEquals("", RegexpMaker.makeMultiRegexp(" "));
353: assertEquals("", RegexpMaker.makeMultiRegexp(","));
354: assertEquals("", RegexpMaker.makeMultiRegexp(", "));
355: assertEquals("", RegexpMaker.makeMultiRegexp(" ,"));
356: assertEquals("a", RegexpMaker.makeMultiRegexp("a,"));
357: assertEquals("a", RegexpMaker.makeMultiRegexp("a "));
358: assertEquals("a", RegexpMaker.makeMultiRegexp("a, "));
359: assertEquals("a", RegexpMaker.makeMultiRegexp("a ,"));
360: assertEquals("a", RegexpMaker.makeMultiRegexp(",a"));
361: assertEquals("a", RegexpMaker.makeMultiRegexp(" a"));
362: assertEquals("a", RegexpMaker.makeMultiRegexp(", a"));
363: assertEquals("a", RegexpMaker.makeMultiRegexp(" ,a"));
364: assertEquals("a|b", RegexpMaker.makeMultiRegexp("a b"));
365: assertEquals("a|b", RegexpMaker.makeMultiRegexp("a,b"));
366: assertEquals("a|b", RegexpMaker.makeMultiRegexp("a, b"));
367: assertEquals("a|b", RegexpMaker.makeMultiRegexp("a ,b"));
368: assertEquals(" ", RegexpMaker.makeMultiRegexp("\\ "));
369: assertEquals("\\,", RegexpMaker.makeMultiRegexp("\\,"));
370: assertEquals("\\,", RegexpMaker.makeMultiRegexp("\\, "));
371: assertEquals(" ", RegexpMaker.makeMultiRegexp(",\\ "));
372: assertEquals("\\, ", RegexpMaker.makeMultiRegexp("\\,\\ "));
373: assertEquals(" ", RegexpMaker.makeMultiRegexp("\\ ,"));
374: assertEquals("\\,", RegexpMaker.makeMultiRegexp(" \\,"));
375: assertEquals(" \\,", RegexpMaker.makeMultiRegexp("\\ \\,"));
376: assertEquals("a", RegexpMaker.makeMultiRegexp("\\a,"));
377: assertEquals("a\\,", RegexpMaker.makeMultiRegexp("a\\,"));
378: assertEquals("a\\,", RegexpMaker.makeMultiRegexp("\\a\\,"));
379: assertEquals("a", RegexpMaker.makeMultiRegexp("\\a "));
380: assertEquals("a ", RegexpMaker.makeMultiRegexp("a\\ "));
381: assertEquals("a ", RegexpMaker.makeMultiRegexp("\\a\\ "));
382: assertEquals("a|\\\\", RegexpMaker.makeMultiRegexp("a, \\"));
383: assertEquals("a| ", RegexpMaker.makeMultiRegexp("a,\\ "));
384: assertEquals("a| \\\\", RegexpMaker.makeMultiRegexp("a,\\ \\"));
385: assertEquals("a\\,", RegexpMaker.makeMultiRegexp("a\\, "));
386: assertEquals("a\\,|\\\\", RegexpMaker
387: .makeMultiRegexp("a\\, \\"));
388: assertEquals("a\\, ", RegexpMaker.makeMultiRegexp("a\\,\\ "));
389: assertEquals("a\\, \\\\", RegexpMaker
390: .makeMultiRegexp("a\\,\\ \\"));
391: assertEquals("a", RegexpMaker.makeMultiRegexp("\\a, "));
392: assertEquals("a|\\\\", RegexpMaker.makeMultiRegexp("\\a, \\"));
393: assertEquals("a| ", RegexpMaker.makeMultiRegexp("\\a,\\ "));
394: assertEquals("a| \\\\", RegexpMaker
395: .makeMultiRegexp("\\a,\\ \\"));
396: assertEquals("a\\,", RegexpMaker.makeMultiRegexp("\\a\\, "));
397: assertEquals("a\\,|\\\\", RegexpMaker
398: .makeMultiRegexp("\\a\\, \\"));
399: assertEquals("a\\, ", RegexpMaker.makeMultiRegexp("\\a\\,\\ "));
400: assertEquals("a\\, \\\\", RegexpMaker
401: .makeMultiRegexp("\\a\\,\\ \\"));
402: assertEquals("a|\\\\", RegexpMaker.makeMultiRegexp("a ,\\"));
403: assertEquals("a|\\,", RegexpMaker.makeMultiRegexp("a \\,"));
404: assertEquals("a|\\,\\\\", RegexpMaker
405: .makeMultiRegexp("a \\,\\"));
406: assertEquals("a ", RegexpMaker.makeMultiRegexp("a\\ ,"));
407: assertEquals("a |\\\\", RegexpMaker.makeMultiRegexp("a\\ ,\\"));
408: assertEquals("a \\,", RegexpMaker.makeMultiRegexp("a\\ \\,"));
409: assertEquals("a \\,\\\\", RegexpMaker
410: .makeMultiRegexp("a\\ \\,\\"));
411: assertEquals("a", RegexpMaker.makeMultiRegexp("\\a ,"));
412: assertEquals("a|\\\\", RegexpMaker.makeMultiRegexp("\\a ,\\"));
413: assertEquals("a|\\,", RegexpMaker.makeMultiRegexp("\\a \\,"));
414: assertEquals("a|\\,\\\\", RegexpMaker
415: .makeMultiRegexp("\\a \\,\\"));
416: assertEquals("a ", RegexpMaker.makeMultiRegexp("\\a\\ ,"));
417: assertEquals("a |\\\\", RegexpMaker
418: .makeMultiRegexp("\\a\\ ,\\"));
419: assertEquals("a \\,", RegexpMaker.makeMultiRegexp("\\a\\ \\,"));
420: assertEquals("a \\,\\\\", RegexpMaker
421: .makeMultiRegexp("\\a\\ \\,\\"));
422:
423: assertEquals("a|b", RegexpMaker.makeMultiRegexp("a, b"));
424: assertEquals("a|.*b.", RegexpMaker.makeMultiRegexp("a,*b?"));
425: assertEquals("a|\\*b.", RegexpMaker.makeMultiRegexp("a,\\*b?"));
426: assertEquals("a|.*b\\?", RegexpMaker.makeMultiRegexp("a,*b\\?"));
427: }
428:
429: }
|