aboutsummaryrefslogtreecommitdiffstats
path: root/org.aspectj.ajdt.core
diff options
context:
space:
mode:
authoracolyer <acolyer>2003-09-12 19:28:25 +0000
committeracolyer <acolyer>2003-09-12 19:28:25 +0000
commita76fbd2d4e1247d699ae9910ae5252d67b29b823 (patch)
tree0608c7a0fc1a00ce2e940dbc0cb78ea4ba71ee08 /org.aspectj.ajdt.core
parentad0dd8b3fdc19a961b039f9dad16711d9d20250b (diff)
downloadaspectj-a76fbd2d4e1247d699ae9910ae5252d67b29b823.tar.gz
aspectj-a76fbd2d4e1247d699ae9910ae5252d67b29b823.zip
test for canonical versions of sourcedirs etc.
Diffstat (limited to 'org.aspectj.ajdt.core')
-rw-r--r--org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/BuildArgParserTestCase.java35
1 files changed, 24 insertions, 11 deletions
diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/BuildArgParserTestCase.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/BuildArgParserTestCase.java
index 7ce74846a..f5ea0ee01 100644
--- a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/BuildArgParserTestCase.java
+++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/BuildArgParserTestCase.java
@@ -153,8 +153,8 @@ public class BuildArgParserTestCase extends TestCase {
AjBuildConfig config = parser.genBuildConfig(new String[] {
"-sourceroots", SRCROOT_1 + File.pathSeparator + SRCROOT_2 },
messageWriter);
-
- assertEquals(new File(SRCROOT_1).getAbsolutePath(), ((File)config.getSourceRoots().get(0)).getAbsolutePath());
+
+ assertEquals(getCanonicalPath(new File(SRCROOT_1)), ((File)config.getSourceRoots().get(0)).getAbsolutePath());
Collection expectedFiles = Arrays.asList(new File[] {
new File(SRCROOT_1+File.separator+"A.java").getAbsoluteFile(),
@@ -171,13 +171,27 @@ public class BuildArgParserTestCase extends TestCase {
TestUtil.assertSetEquals(expectedFiles, config.getFiles());
}
+ /**
+ * @param file
+ * @return String
+ */
+ private String getCanonicalPath(File file) {
+ String ret = "";
+ try {
+ ret = file.getCanonicalPath();
+ } catch (IOException ioEx) {
+ fail("Unable to canonicalize " + file + " : " + ioEx);
+ }
+ return ret;
+ }
+
public void testSourceRootDir() throws InvalidInputException {
final String SRCROOT = "testdata/ajc";
AjBuildConfig config = parser.genBuildConfig(new String[] {
"-sourceroots", SRCROOT },
messageWriter);
- assertEquals(new File(SRCROOT).getAbsolutePath(), ((File)config.getSourceRoots().get(0)).getAbsolutePath());
+ assertEquals(getCanonicalPath(new File(SRCROOT)), ((File)config.getSourceRoots().get(0)).getAbsolutePath());
Collection expectedFiles = Arrays.asList(new File[] {
new File(SRCROOT+File.separator+"A.java").getAbsoluteFile(),
@@ -215,7 +229,7 @@ public class BuildArgParserTestCase extends TestCase {
"-sourceroots", SRCROOT, "testdata/src1/A.java"},
messageWriter);
- assertEquals(new File(SRCROOT).getAbsolutePath(), ((File)config.getSourceRoots().get(0)).getAbsolutePath());
+ assertEquals(getCanonicalPath(new File(SRCROOT)), ((File)config.getSourceRoots().get(0)).getAbsolutePath());
Collection expectedFiles = Arrays.asList(new File[] {
new File(SRCROOT+File.separator+"Hello.java").getAbsoluteFile(),
@@ -260,17 +274,16 @@ public class BuildArgParserTestCase extends TestCase {
assertTrue(
"will generate: " + config.getAjOptions().get(AjCompilerOptions.OPTION_OutJAR),
config.getAjOptions().get(AjCompilerOptions.OPTION_OutJAR).equals(CompilerOptions.GENERATE));
- assertTrue(
- "testclasses jar: " + config.getOutputJar().getName(),
- config.getOutputJar().getAbsolutePath().equals(new File(OUT_JAR).getAbsolutePath()));
+ assertEquals(
+ getCanonicalPath(new File(OUT_JAR)),config.getOutputJar().getAbsolutePath());
File nonExistingJar = new File("testdata/mumbleDoesNotExist.jar");
config = parser.genBuildConfig(new String[] {
"-outjar", nonExistingJar.getAbsolutePath() },
messageWriter);
- assertTrue(
- "testclasses jar: " + config.getOutputJar().getName(),
- config.getOutputJar().getAbsolutePath().equals(nonExistingJar.getAbsolutePath()));
+ assertEquals(
+ getCanonicalPath(nonExistingJar),
+ config.getOutputJar().getAbsolutePath());
nonExistingJar.delete();
}
@@ -356,7 +369,7 @@ public class BuildArgParserTestCase extends TestCase {
String badLintFile = "lint.props";
AjBuildConfig config = parser.genBuildConfig(new String[] {"-Xlintfile", lintFile}, messageWriter);
assertTrue(new File(lintFile).exists());
- assertTrue(config.getLintSpecFile().getAbsolutePath(), config.getLintSpecFile().getAbsolutePath().equals(new File(lintFile).getAbsolutePath()));
+ assertEquals(getCanonicalPath(new File(lintFile)),config.getLintSpecFile().getAbsolutePath());
}
public void testOptions() throws InvalidInputException {