30 import java.io.*;
31 import java.util.*;
32
33 public class GraphicalInstallerTest {
34 public static void main(String... args) throws Exception {
35 new GraphicalInstallerTest().run();
36 }
37
38 void run() throws Exception {
39 File testSrc = new File(System.getProperty("test.src"));
40 File classes = new File("classes");
41 classes.mkdirs();
42 List<String> opts = Arrays.asList("-d", classes.getPath());
43 int rc = compile(opts, new File(testSrc, "GraphicalInstaller.java"));
44 if (rc != 0) {
45 error("compilation failed: rc=" + rc);
46 return;
47 }
48
49 check(classes,
50 "GraphicalInstaller$1.class",
51 "GraphicalInstaller$1X$1.class",
52 "GraphicalInstaller$1X.class",
53 "GraphicalInstaller$BackgroundInstaller.class",
54 "GraphicalInstaller.class");
55
56 if (errors > 0)
57 throw new Exception(errors + " errors occurred");
58 }
59
60 /**
61 * Compile files with given options.
62 * Display any output from compiler, and return javac return code.
63 */
64 int compile(List<String> opts, File... files) {
65 List<String> args = new ArrayList<String>();
66 args.addAll(opts);
67 for (File f: files)
68 args.add(f.getPath());
69 StringWriter sw = new StringWriter();
70 PrintWriter pw = new PrintWriter(sw);
|
30 import java.io.*;
31 import java.util.*;
32
33 public class GraphicalInstallerTest {
34 public static void main(String... args) throws Exception {
35 new GraphicalInstallerTest().run();
36 }
37
38 void run() throws Exception {
39 File testSrc = new File(System.getProperty("test.src"));
40 File classes = new File("classes");
41 classes.mkdirs();
42 List<String> opts = Arrays.asList("-d", classes.getPath());
43 int rc = compile(opts, new File(testSrc, "GraphicalInstaller.java"));
44 if (rc != 0) {
45 error("compilation failed: rc=" + rc);
46 return;
47 }
48
49 check(classes,
50 "GraphicalInstaller$1X$1.class",
51 "GraphicalInstaller$1X.class",
52 "GraphicalInstaller$BackgroundInstaller.class",
53 "GraphicalInstaller.class");
54
55 if (errors > 0)
56 throw new Exception(errors + " errors occurred");
57 }
58
59 /**
60 * Compile files with given options.
61 * Display any output from compiler, and return javac return code.
62 */
63 int compile(List<String> opts, File... files) {
64 List<String> args = new ArrayList<String>();
65 args.addAll(opts);
66 for (File f: files)
67 args.add(f.getPath());
68 StringWriter sw = new StringWriter();
69 PrintWriter pw = new PrintWriter(sw);
|