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 |
|
---|
21 | package JFlex.tests;
|
---|
22 |
|
---|
23 |
|
---|
24 | import java.io.File;
|
---|
25 |
|
---|
26 | import JFlex.Skeleton;
|
---|
27 | import junit.framework.TestCase;
|
---|
28 |
|
---|
29 | /**
|
---|
30 | * SkeletonTest
|
---|
31 | *
|
---|
32 | * @author Gerwin Klein
|
---|
33 | * @version $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
|
---|
34 | */
|
---|
35 | public class SkeletonTest extends TestCase {
|
---|
36 |
|
---|
37 | /**
|
---|
38 | * Constructor for SkeletonTest.
|
---|
39 | * @param arg0 test name
|
---|
40 | */
|
---|
41 | public SkeletonTest(String arg0) {
|
---|
42 | super(arg0);
|
---|
43 | }
|
---|
44 |
|
---|
45 | public void testReplace() {
|
---|
46 | assertEquals(Skeleton.replace("bla ", "blub", "bla blub bla "),
|
---|
47 | "blubblub blub");
|
---|
48 | }
|
---|
49 |
|
---|
50 | public void testMakePrivate() {
|
---|
51 | Skeleton.makePrivate();
|
---|
52 | for (int i=0; i < Skeleton.line.length; i++) {
|
---|
53 | assertEquals(Skeleton.line[i].indexOf("public"), -1);
|
---|
54 | }
|
---|
55 | }
|
---|
56 |
|
---|
57 | public void testDefault() {
|
---|
58 | Skeleton.readSkelFile(new File("src/skeleton.nested"));
|
---|
59 | assertTrue(JFlex.Skeleton.line[3].indexOf("java.util.Stack") > 0);
|
---|
60 | Skeleton.readDefault();
|
---|
61 | assertEquals(JFlex.Skeleton.line[3].indexOf("java.util.Stack"), -1);
|
---|
62 | }
|
---|
63 | }
|
---|