aboutsummaryrefslogtreecommitdiffstats
path: root/weaver
diff options
context:
space:
mode:
authorwisberg <wisberg>2003-10-31 19:31:22 +0000
committerwisberg <wisberg>2003-10-31 19:31:22 +0000
commitdd5ef5ce8c31ef643d2f1a40a0cfcf46e32ca6e4 (patch)
tree46d12745237ab6cfa48b7af5be91ab41b57431ce /weaver
parent458b26fe1241d3457ff8161ac8d18daa700a6cb0 (diff)
downloadaspectj-dd5ef5ce8c31ef643d2f1a40a0cfcf46e32ca6e4.tar.gz
aspectj-dd5ef5ce8c31ef643d2f1a40a0cfcf46e32ca6e4.zip
using ../{module}/ convention for testdata references so tests can be run from any peer directory/module, i.e., from one module
Diffstat (limited to 'weaver')
-rw-r--r--weaver/testsrc/org/aspectj/weaver/BcweaverTests.java1
-rw-r--r--weaver/testsrc/org/aspectj/weaver/bcel/WeaveTestCase.java8
-rw-r--r--weaver/testsrc/org/aspectj/weaver/bcel/ZipTestCase.java21
3 files changed, 19 insertions, 11 deletions
diff --git a/weaver/testsrc/org/aspectj/weaver/BcweaverTests.java b/weaver/testsrc/org/aspectj/weaver/BcweaverTests.java
index 88a72d815..d0eff4d15 100644
--- a/weaver/testsrc/org/aspectj/weaver/BcweaverTests.java
+++ b/weaver/testsrc/org/aspectj/weaver/BcweaverTests.java
@@ -17,6 +17,7 @@ import junit.framework.*;
public class BcweaverTests extends TestCase {
+ public static final String TESTDATA_PATH = "../weaver/testdata";
public static Test suite() {
TestSuite suite = new TestSuite(BcweaverTests.class.getName());
// abstract
diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/WeaveTestCase.java b/weaver/testsrc/org/aspectj/weaver/bcel/WeaveTestCase.java
index d4024bc7c..0f39caaf7 100644
--- a/weaver/testsrc/org/aspectj/weaver/bcel/WeaveTestCase.java
+++ b/weaver/testsrc/org/aspectj/weaver/bcel/WeaveTestCase.java
@@ -130,10 +130,10 @@ public abstract class WeaveTestCase extends TestCase {
if (regenerate) genClass(gen, outDir, expectedFile);
else realCheckClass(gen, outDir, expectedFile);
}
-
+ static final File TESTDATA_DIR = new File("../weaver/testdata");
void genClass(LazyClassGen gen, String outDir, String expectedFile) throws IOException {
//ClassGen b = getJavaClass(outDir, className);
- FileOutputStream out = new FileOutputStream(new File("testdata", expectedFile));
+ FileOutputStream out = new FileOutputStream(new File(TESTDATA_DIR, expectedFile));
PrintStream ps = new PrintStream(out);
gen.print(ps);
ps.flush();
@@ -142,7 +142,7 @@ public abstract class WeaveTestCase extends TestCase {
void realCheckClass(LazyClassGen gen, String outDir, String expectedFile) throws IOException {
TestUtil.assertMultiLineStringEquals("classes",
- FileUtil.readAsString(new File("testdata", expectedFile)),
+ FileUtil.readAsString(new File(TESTDATA_DIR, expectedFile)),
gen.toLongString());
}
@@ -263,7 +263,7 @@ public abstract class WeaveTestCase extends TestCase {
}
public String getTraceJar() {
- return "testdata/tracing.jar";
+ return BcweaverTests.TESTDATA_PATH + "/tracing.jar";
}
// ----
diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/ZipTestCase.java b/weaver/testsrc/org/aspectj/weaver/bcel/ZipTestCase.java
index ecc961a75..f3f63142d 100644
--- a/weaver/testsrc/org/aspectj/weaver/bcel/ZipTestCase.java
+++ b/weaver/testsrc/org/aspectj/weaver/bcel/ZipTestCase.java
@@ -16,6 +16,8 @@ package org.aspectj.weaver.bcel;
import java.io.*;
import java.util.Collection;
+import org.aspectj.weaver.BcweaverTests;
+
import junit.framework.TestCase;
public class ZipTestCase extends TestCase {
@@ -51,7 +53,7 @@ public class ZipTestCase extends TestCase {
weaver.addLibraryJarFile(new File(aspectjar));
}
}
- weaver.addLibraryJarFile(new File("testdata/Regex.jar")); //???
+ weaver.addLibraryJarFile(new File(BcweaverTests.TESTDATA_PATH + "/Regex.jar")); //???
Collection woven = weaver.weave(outFile);
@@ -64,17 +66,19 @@ public class ZipTestCase extends TestCase {
}
public void testSmall() throws IOException {
- zipTest("testdata/Regex.jar", null);
+ zipTest(BcweaverTests.TESTDATA_PATH + "/Regex.jar", null);
}
public void testSmallWithAspects() throws IOException {
System.out.println("could take 4 seconds...");
- zipTest("testdata/Regex.jar", "testdata/megatrace.jar");
+ zipTest(BcweaverTests.TESTDATA_PATH + "/Regex.jar",
+ BcweaverTests.TESTDATA_PATH + "/megatrace.jar");
}
public void testSmallWithAspectsNoWeave() throws IOException {
System.out.println("could take 4 seconds...");
- zipTest("testdata/Regex.jar", "testdata/megatraceNoweave.jar", true);
+ zipTest(BcweaverTests.TESTDATA_PATH + "/Regex.jar",
+ BcweaverTests.TESTDATA_PATH + "/megatraceNoweave.jar", true);
}
@@ -86,19 +90,22 @@ public class ZipTestCase extends TestCase {
public void testBigWithEasyNoTrace() throws IOException {
System.out.println("could take 4 seconds...");
- zipTest("../lib/bcel/bcel.jar", "testdata/megatrace0easy.jar");
+ zipTest("../lib/bcel/bcel.jar",
+ BcweaverTests.TESTDATA_PATH + "/megatrace0easy.jar");
}
// this is something we test every now and again.
public void xtestBigWithHardNoTrace() throws IOException {
System.out.println("could take 24 seconds...");
- zipTest("../lib/bcel/bcel.jar", "testdata/megatrace0hard.jar");
+ zipTest("../lib/bcel/bcel.jar",
+ BcweaverTests.TESTDATA_PATH + "/megatrace0hard.jar");
}
public void xtestBigWithAspects() throws IOException {
System.out.println("could take 40 seconds...");
- zipTest("../lib/bcel/bcel.jar", "testdata/megatrace.jar");
+ zipTest("../lib/bcel/bcel.jar",
+ BcweaverTests.TESTDATA_PATH + "/megatrace.jar");
}
}