source: other-projects/rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/tests/RegExpTests.java@ 25584

Last change on this file since 25584 was 25584, checked in by davidb, 12 years ago

Initial cut an a text edit area for GLI that supports color syntax highlighting

File size: 2.5 KB
Line 
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2 * JFlex 1.4.3 *
3 * Copyright (C) 1998-2009 Gerwin Klein <[email protected]> *
4 * All rights reserved. *
5 * *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License. See the file *
8 * COPYRIGHT for more information. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License along *
16 * with this program; if not, write to the Free Software Foundation, Inc., *
17 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
18 * *
19 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
20
21package JFlex.tests;
22
23import JFlex.*;
24import junit.framework.TestCase;
25
26/**
27 * Unit tests for JFlex.RegExp
28 *
29 * @author Gerwin Klein
30 * @version $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
31 */
32public class RegExpTests extends TestCase implements sym {
33
34 /**
35 * Constructor for RegExpTests.
36 *
37 * @param name the test name
38 */
39 public RegExpTests(String name) {
40 super(name);
41 }
42
43 public void testrevString() {
44 assertTrue(RegExp.revString("blah").equals("halb"));
45 }
46
47 public void testCharClass() {
48 Macros m = new Macros();
49 RegExp e1 = new RegExp1(CCLASS, new Interval('a','z'));
50 RegExp e2 = new RegExp1(CHAR, new Character('Z'));
51 RegExp e3 = new RegExp1(CCLASS, new Interval('0','9'));
52 m.insert("macro", e3);
53 RegExp s = new RegExp1(STAR, e1);
54 RegExp u = new RegExp1(MACROUSE, "macro");
55 RegExp b = new RegExp2(BAR, e2, u);
56 assertTrue(e1.isCharClass(m));
57 assertTrue(e2.isCharClass(m));
58 assertTrue(b.isCharClass(m));
59 assertTrue(!s.isCharClass(m));
60 assertTrue(u.isCharClass(m));
61 }
62}
Note: See TracBrowser for help on using the repository browser.