01: /*
02: * Author: Chris Seguin
03: *
04: * This software has been developed under the copyleft
05: * rules of the GNU General Public License. Please
06: * consult the GNU General Public License for more
07: * details about use and distribution of this software.
08: */
09: package org.acm.seguin.pretty.line;
10:
11: import org.acm.seguin.tools.builder.LineNumberTool;
12: import java.io.File;
13: import org.acm.seguin.io.FileCopy;
14: import org.acm.seguin.junit.DirSourceTestCase;
15: import org.acm.seguin.junit.FileCompare;
16:
17: /**
18: * Description of the Class
19: *
20: *@author Chris Seguin
21: *@created February 22, 2002
22: */
23: public class LineNumberingTest extends DirSourceTestCase {
24: private File checkDir;
25: private File cleanDir;
26: private File destDir;
27:
28: /**
29: * Constructor for the LineNumberingTest object
30: *
31: *@param name Description of Parameter
32: */
33: public LineNumberingTest(String name) {
34: super (name);
35: }
36:
37: /**
38: * A unit test for JUnit
39: */
40: public void test01() {
41: File dest = new File(destDir, "SingleLineComments.java");
42: (new FileCopy(new File(cleanDir, "SingleLineComments.java"),
43: dest, false)).run();
44:
45: String path = dest.getPath();
46:
47: String[] args = new String[] { "-out",
48: destDir.getPath() + "\\shortfile.txt", path };
49: LineNumberTool.main(args);
50:
51: FileCompare.assertEquals("SingleLineComments.java in error",
52: new File(checkDir, "shortfile.txt"), new File(destDir,
53: "shortfile.txt"));
54: }
55:
56: /**
57: * A unit test for JUnit
58: */
59: public void test02() {
60: (new FileCopy(new File(cleanDir, "TryTest.java"), new File(
61: destDir, "TryTest.java"), false)).run();
62: (new FileCopy(new File(cleanDir, "LoadingProblem.java"),
63: new File(destDir, "LoadingProblem.java"), false)).run();
64: (new FileCopy(new File(cleanDir, "SingleLineComments.java"),
65: new File(destDir, "SingleLineComments.java"), false))
66: .run();
67:
68: String path = destDir.getPath();
69:
70: String[] args = new String[] { "-out", path + "\\longfile.txt",
71: path + "\\TryTest.java",
72: path + "\\LoadingProblem.java",
73: path + "\\SingleLineComments.java" };
74: LineNumberTool.main(args);
75:
76: FileCompare.assertEquals("Multiple files in error", new File(
77: checkDir, "longfile.txt"), new File(destDir,
78: "longfile.txt"));
79: }
80:
81: /**
82: * The JUnit setup method
83: */
84: protected void setUp() {
85: cleanDir = new File(clean + "/pretty");
86: destDir = new File("./test/temp");
87: checkDir = new File(check + "/lineno");
88: }
89: }
|