diff options
author | mkersten <mkersten> | 2003-07-30 17:27:45 +0000 |
---|---|---|
committer | mkersten <mkersten> | 2003-07-30 17:27:45 +0000 |
commit | 5b758d8aed9c13794d58567d96bc2dd628f9fb40 (patch) | |
tree | 1e135263342c952c22d32ff43364f8c1cc30d271 /ajde | |
parent | 89cd34df0631c3da14a80dd899ba23ffae31c327 (diff) | |
download | aspectj-5b758d8aed9c13794d58567d96bc2dd628f9fb40.tar.gz aspectj-5b758d8aed9c13794d58567d96bc2dd628f9fb40.zip |
fixed 40194: error handling during build config parsing
Diffstat (limited to 'ajde')
3 files changed, 32 insertions, 24 deletions
diff --git a/ajde/testdata/LstBuildConfigManagerTest/bad-injar.lst b/ajde/testdata/LstBuildConfigManagerTest/bad-injar.lst new file mode 100644 index 000000000..36a40acb5 --- /dev/null +++ b/ajde/testdata/LstBuildConfigManagerTest/bad-injar.lst @@ -0,0 +1 @@ +-injars foo.jar
diff --git a/ajde/testdata/LstBuildConfigManagerTest/dir-entry.lst b/ajde/testdata/LstBuildConfigManagerTest/dir-entry.lst new file mode 100644 index 000000000..c7a556d92 --- /dev/null +++ b/ajde/testdata/LstBuildConfigManagerTest/dir-entry.lst @@ -0,0 +1 @@ +moduleB
diff --git a/ajde/testsrc/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java b/ajde/testsrc/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java index 75c4748c3..1266b0c4b 100644 --- a/ajde/testsrc/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java +++ b/ajde/testsrc/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java @@ -13,20 +13,16 @@ package org.aspectj.ajde.internal; -import java.io.File; -import java.io.IOException; -import java.util.Iterator; -import java.util.List; -import java.util.StringTokenizer; +import java.io.*; +import java.util.*; import junit.framework.TestSuite; -import org.aspectj.ajde.AjdeTestCase; -import org.aspectj.ajde.BuildConfigManager; -import org.aspectj.ajde.NullIdeManager; +import org.aspectj.ajde.*; import org.aspectj.ajde.NullIdeTaskListManager.SourceLineTask; import org.aspectj.ajde.ui.BuildConfigModel; import org.aspectj.ajde.ui.internal.AjcBuildOptions; +import org.aspectj.bridge.Message; public class LstBuildConfigManagerTest extends AjdeTestCase { @@ -48,40 +44,41 @@ public class LstBuildConfigManagerTest extends AjdeTestCase { return result; } + public void testConfigParserErrorMessages() { + doSynchronousBuild("dir-entry.lst"); + List messages = NullIdeManager.getIdeManager().getCompilationSourceLineTasks(); + NullIdeTaskListManager.SourceLineTask message = (NullIdeTaskListManager.SourceLineTask)messages.get(0); + + assertEquals(message.location.getSourceFile().getAbsolutePath(), openFile("dir-entry.lst").getAbsolutePath()); + + doSynchronousBuild("bad-injar.lst"); + messages = NullIdeManager.getIdeManager().getCompilationSourceLineTasks(); + message = (NullIdeTaskListManager.SourceLineTask)messages.get(0); + assertTrue(message.message.indexOf("invalid") != -1); + } + public void testErrorMessages() throws IOException { doSynchronousBuild("invalid-entry.lst"); - assertTrue("compile failed", !testerBuildListener.getBuildSucceeded()); - + assertTrue("compile failed", testerBuildListener.getBuildSucceeded()); + List messages = NullIdeManager.getIdeManager().getCompilationSourceLineTasks(); - SourceLineTask message = (SourceLineTask)messages.get(0); - - System.err.println(">>>> " + message.message); + SourceLineTask message = (SourceLineTask)messages.get(0); assertEquals("invalid option: aaa.bbb", message.message); + } public void testNonExistentConfigFile() throws IOException { File file = openFile("mumbleDoesNotExist.lst"); assertTrue("valid non-existing file", !file.exists()); BuildConfigModel model = buildConfigManager.buildModel(file.getCanonicalPath()); - System.err.println(model.getRoot().getChildren()); assertTrue("root: " + model.getRoot(), model.getRoot() != null); } public void testFileRelativePathSameDir() throws IOException { File file = openFile("file-relPath-sameDir.lst"); - System.err.println("> " + file.getCanonicalPath()); BuildConfigModel model = buildConfigManager.buildModel(file.getCanonicalPath()); - System.err.println("> " + model.getRoot()); assertTrue("single file", true); } - -// public void testWildcards() { -// verifyFile(WILDCARDS_FILE, WILDCARDS_FILE_CONTENTS); -// } -// -// public void testIncludes() { -// verifyFile(INCLUDES_FILE, INCLUDES_FILE_CONTENTS); -// } private void verifyFile(String configFile, String fileContents) { StringTokenizer st = new StringTokenizer(fileContents, ";"); @@ -170,3 +167,12 @@ public class LstBuildConfigManagerTest extends AjdeTestCase { } } + +//public void testWildcards() { +// verifyFile(WILDCARDS_FILE, WILDCARDS_FILE_CONTENTS); +//} +// +//public void testIncludes() { +// verifyFile(INCLUDES_FILE, INCLUDES_FILE_CONTENTS); +//} + |