1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
package org.aspectj.tools.ajdoc;
import junit.framework.Test;
import junit.framework.Assert;
import junit.textui.TestRunner;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import java.io.File;
import org.aspectj.tools.ajdoc.Main;
/**
* Test driver for ajdoc
* currently only has disabled test cases to invoke ajdoc
* but not verify results.
* @deprecated org.aspectj.testing.harness.AjdocScript
*/
public class JUnitDriver extends TestCase {
private static final String[] ME
= new String[] {"org.aspectj.tools.ajdoc.JUnitDriver"};
static final String ajbase = "c:/home/wes/aj";
static final String testbase = ajbase + "/aj-build-modules/tests/ajdoc/JUnitDriver";
static final String srcbase = ajbase + "/aspectj/modules/ajdoc/testsrc";
private AjdocTestCase[] CASES;
protected void setUp() {
assertTrue(null == CASES);
System.setProperty("seetag.debug", "on");
CASES = new AjdocTestCase[]
{ // both disabled as samples not checked in
// getLinkTestCase()
//, getJUnitTestCase()
};
}
AjdocTestCase getLinkTestCase() {
String outDir = testbase + "/link/api";
new File(outDir).mkdirs();
return new AjdocTestCase("Link", new String[]
{
"-d", outDir
, "-private"
, "-sourcepath", srcbase
, "test" // doc test package only
});
}
AjdocTestCase getJUnitTestCase() {
String outDir = "c:/home/doc/junit/api";
new File(outDir).mkdir();
return new AjdocTestCase("JUnit", new String[]
{
"-d", outDir
, "-private"
, "-sourcepath"
, "c:/home/doc/junit/src"
, "junitjunit.awtui"
, "junit.extensions"
, "junit.framework"
, "junit.runner"
, "junit.swingui"
, "junit.swingui.icons"
, "junit.textui"
, "junit.ui"
});
}
public static void main(String[] args) {
TestRunner.main(ME);
}
/** todo result logging? */
public static void log(String s) {
System.err.println(""+s);
}
/** load all KNOWN_TEST_CLASSES */
public static Test suite() {
TestSuite result = new TestSuite();
result.addTestSuite(JUnitDriver.class);
return result;
}
//------------------ instance members
public JUnitDriver(String name) { super(name); }
/**
* Run known test cases in CASES
*/
public void testAll() {
assertTrue(null != CASES);
for (int i = 0; i < CASES.length; i++) {
CASES[i].run(this);
}
}
/** this just invokes AJDoc but does not verify results */
static class AjdocTestCase {
private final String label;
public final String[] args;
public AjdocTestCase(String label, String[] args) {
this.label = (null == label ? "no label" : label);
this.args = (null == args? new String[] {"help"} : args);
}
public void run(Assert assert) {
int result = Main.execute(args);
assert.assertTrue("result: " + result,0 == result);
// now verify...
}
}
}
|