diff options
author | acolyer <acolyer> | 2004-08-04 12:04:41 +0000 |
---|---|---|
committer | acolyer <acolyer> | 2004-08-04 12:04:41 +0000 |
commit | 0f211e17cac9b031ab8d9115f9030b3e65d3927a (patch) | |
tree | cabe16f0e367daaa4b28685e09f5b0bcd55bb43d /tests/base | |
parent | 9a051d348a240095e56ead5485c2dba8cf6ad4a7 (diff) | |
download | aspectj-0f211e17cac9b031ab8d9115f9030b3e65d3927a.tar.gz aspectj-0f211e17cac9b031ab8d9115f9030b3e65d3927a.zip |
Spring cleaning in the test suite. Docs for AjcTestCase and XMLBasedAjcTestCase
added in docs dir.
Diffstat (limited to 'tests/base')
-rw-r--r-- | tests/base/test117/Driver.java | 126 | ||||
-rw-r--r-- | tests/base/test117/Readme.txt | 12 | ||||
-rw-r--r-- | tests/base/test120/Driver.java | 53 | ||||
-rw-r--r-- | tests/base/test120/Readme.txt | 9 | ||||
-rw-r--r-- | tests/base/test126/Driver.java | 18 | ||||
-rw-r--r-- | tests/base/test126/Readme.txt | 7 | ||||
-rw-r--r-- | tests/base/test133/Driver.java | 24 | ||||
-rw-r--r-- | tests/base/test143/OneArgCallsIsOkay.java (renamed from tests/base/OneArgCallsIsOkay.java) | 0 | ||||
-rw-r--r-- | tests/base/test144/SuperStaticCallJoinPoint.java | 25 |
9 files changed, 25 insertions, 249 deletions
diff --git a/tests/base/test117/Driver.java b/tests/base/test117/Driver.java deleted file mode 100644 index c8cf1a2b3..000000000 --- a/tests/base/test117/Driver.java +++ /dev/null @@ -1,126 +0,0 @@ -import org.aspectj.testing.Tester; - -public class Driver { - public static void main(String[] args) { test(); } - - public static void test() { - C1 c1 = new C1(); - C11 c11 = new C11(); - C111 c111 = new C111(); - C12 c12 = new C12(); - Cleaf1 cleaf1 = new Cleaf1(); - Cleaf11 cleaf11 = new Cleaf11(); - Cleaf111 cleaf111 = new Cleaf111(); - Cleaf12 cleaf12 = new Cleaf12(); - - Tester.checkEqual(c1.a, 0, "c1.a"); - Tester.checkEqual(c11.a, 0, "c11.a"); - Tester.checkEqual(c111.a, 0, "c111.a"); - Tester.checkEqual(c12.a, 0, "c12.a"); - - Tester.checkEqual(cleaf1.a, 0, "cleaf1.a"); - Tester.checkEqual(cleaf11.a, 0, "cleaf11.a"); - Tester.checkEqual(cleaf111.a, 0, "cleaf111.a"); - Tester.checkEqual(cleaf12.a, 0, "cleaf12.a"); - - Tester.checkEqual(c1.b, 0, "c1.b"); - Tester.checkEqual(cleaf1.b, 0, "cleaf1.b"); - - Tester.checkEqual(I1.c, 5, "I1.c"); - - Tester.checkEqual(c1.d, 1, "c1.d"); - Tester.checkEqual(c11.d, 1, "c11.d"); - Tester.checkEqual(c111.d, 1, "c111.d"); - Tester.checkEqual(c12.d, 1, "c12.d"); - - Tester.checkEqual(c1.e, 2, "c1.e"); - Tester.checkEqual(cleaf1.e, 2, "cleaf1.e"); - - Tester.checkEqual(C1.f, 4, "C1.f"); - Tester.checkEqual(cleaf1.f, 4, "cleaf1.f"); - Tester.checkEqual(c1.f, 4, "c1.f"); - - Tester.checkEqual(c1.getF(), 4, "c1.getF()"); - } -} - -interface I1 { } -interface I11 extends I1 { } -interface I111 extends I11 { } -interface I12 extends I1 { } - -class C1 implements I1 { } -class C11 implements I11 { } -class C111 implements I111 { } -class C12 implements I12 { } - -class Cleaf1 extends C1 { } -class Cleaf11 extends C11 { } -class Cleaf111 extends C111 { } -class Cleaf12 extends C12 { } - -// For this class structure: here is the "directly implements" relation -// C1 directly implements I1 -// C11 directly implements I11 -// C11 directly implements I1 -// C111 directly implements I111 -// C111 directly implements I11 -// C111 directly implements I1 -// C12 directly implements I12 -// C12 directly implements I1 - - - -// introducing a bunch of variables (almost all non-static). -aspect A1 { - - // Variable Introductions: - // without initializer X designator is interface - // with initializer X designator is class - - // with initializer, interface also has the two cases of presence or - // absence of the modifiers. - - // introduce on initializer without initializer - // should introduce into: - // C1, C11, C111, C12 - int I1.a; - - // introduce on interface with initializer but no Mods - // should introduce into: - // C1, C11, C111, C12 - int I1.d = 1; - - // introduce on interface with initializer and Mods - // should introduce into: - // I1 - public static final int I1.c = 5; - - // introduce on class - // should introduce into - // C1 - int C1.b; - int C1.e = 2; - - // introduce on class with static modifier - // should introduce into - // C1 - static int C1.f = 2; - - int C1.getF() { return 2; } -} - -aspect A2 { - declare precedence: A2, A1; - - int around() : set(int C1.f) && within(A1) { - return C1.f = 3; - } - - after (): staticinitialization(C1) { - C1.f = 4; - } - - // this should override the introduction from A1 - int C1.getF() { return 4; } -} diff --git a/tests/base/test117/Readme.txt b/tests/base/test117/Readme.txt deleted file mode 100644 index 51d75a7c3..000000000 --- a/tests/base/test117/Readme.txt +++ /dev/null @@ -1,12 +0,0 @@ -Mode: vm run -Title: introduce of variables - -This tests if variable introductions happen at all the places that -they are supposed to happen in the presence of interfaces, -subinterfaces, classes and inheritance. It tests rule 2 partly, (the -non-error causing cases only). - -It DOES NOT test if variable introductions do not happen at all the -places they should not happen. (That will be a separate test.) - - diff --git a/tests/base/test120/Driver.java b/tests/base/test120/Driver.java deleted file mode 100644 index 14bf33201..000000000 --- a/tests/base/test120/Driver.java +++ /dev/null @@ -1,53 +0,0 @@ -public \u0063l\u0061ss Driver { - - public static void main(String[] args) { test(); } - - public static void test() { - - // integer literals - int dec = 5; - long longDec = 5; - long longDecL = 5L; - - int hex = 0xAbcdE; - long longHex = 0xAbcdE; - long longHexL = 0xAbcdEL; - - int oct = 0762; - long longOct = 0762; - long longOctL = 0762L; - - // boolean literals - boolean btrue = true; - boolean bfalse = false; - - // float literals - float f1 = 1e1f, f2 = 2.f, f3 = .3f, f4 = 3.14f, f5 = 6.023e+23f; - - // character literals - char - // c1 = '\u2352', - c2 = '\u0063'; // 'c' - // c3 = '\u0007'; - - // string literals - String \u0063 = "c"; // String c = "c"; - String s1 = ""; - String s2 = "\u0063"; // the string "c"; - // String s3 = "\u3333"; // uncommenting this will break weaver - - // string literals with escapes - String bs = "\b"; - String ht = "\t"; - String lf = "\n"; - String cr = "\r"; - String dq = "\""; - String sq = "\'"; - String backslash = "\\"; - String oes = "\u0000"; // octal escape smallest - String oeb = "\u00ff"; // octal escape biggest - String ctrlg = ""; // this turns into "\u0007" by the time it is parsed. - String random = "\u3333"; - } -} - diff --git a/tests/base/test120/Readme.txt b/tests/base/test120/Readme.txt deleted file mode 100644 index 351d8d6e5..000000000 --- a/tests/base/test120/Readme.txt +++ /dev/null @@ -1,9 +0,0 @@ -Mode: VM run -Title: unicodes and literals - -This test checks if the weaver correctly handles all forms of Java -literal expressions and unicodes. See bugs b076 and b077. - - - - diff --git a/tests/base/test126/Driver.java b/tests/base/test126/Driver.java deleted file mode 100644 index e855c5781..000000000 --- a/tests/base/test126/Driver.java +++ /dev/null @@ -1,18 +0,0 @@ -public class Driver { - public static void main(String[] args) { test(); } - - public static void test() { - - // local variable declaration in the init part of a for - for (int i = 0, j = 0; j < 10 ; i++, j++) { - j++; - } - int m, n, j = 0; - - // init part without local var declaration - for (m = 0, n = 0; j < 10 ; m++, n++) { - j++; - m++; - } - } -} diff --git a/tests/base/test126/Readme.txt b/tests/base/test126/Readme.txt deleted file mode 100644 index b4b666098..000000000 --- a/tests/base/test126/Readme.txt +++ /dev/null @@ -1,7 +0,0 @@ -Mode: VM run -Title: For Statement - -This tests the weaving of For statements. More variants of the for -statement can be added to the test. The current test only checks for -variation in the init part of the for loop. - diff --git a/tests/base/test133/Driver.java b/tests/base/test133/Driver.java deleted file mode 100644 index 1f1b1f7ab..000000000 --- a/tests/base/test133/Driver.java +++ /dev/null @@ -1,24 +0,0 @@ -// PUREJAVA: Corrrect supercall lookup for method().name() -import org.aspectj.testing.Tester; - -public class Driver { - private Foo foo = new Foo(); - - public static void main(String[] args) { test(); } - - public Foo getFoo() { return foo; } - - public String bar() { - return getFoo().bar(); - } - - public static void test() { - Tester.checkEqual(new Driver().bar(), "Foo", "getFoo().bar()"); - } -} - -class Foo { - public String bar() { - return "Foo"; - } -} diff --git a/tests/base/OneArgCallsIsOkay.java b/tests/base/test143/OneArgCallsIsOkay.java index c0e7916a7..c0e7916a7 100644 --- a/tests/base/OneArgCallsIsOkay.java +++ b/tests/base/test143/OneArgCallsIsOkay.java diff --git a/tests/base/test144/SuperStaticCallJoinPoint.java b/tests/base/test144/SuperStaticCallJoinPoint.java new file mode 100644 index 000000000..5d75b8955 --- /dev/null +++ b/tests/base/test144/SuperStaticCallJoinPoint.java @@ -0,0 +1,25 @@ +import org.aspectj.testing.Tester; + +class Sup { + static void m() {} +} + +public class SuperStaticCallJoinPoint extends Sup { + static boolean ran = false; + public static void main(String[] args) { + new SuperStaticCallJoinPoint().foo(); + Tester.check(ran, "didn't run advice"); + } + void foo() { + super.m(); + } + static void m() { + throw new RuntimeException(); + } +} + +aspect A { + before(): this(SuperStaticCallJoinPoint) && call(void Sup.m()) { + SuperStaticCallJoinPoint.ran = true; + } +} |