summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/src/org/aspectj/systemtest/AllTests18.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc184/Ajc184Tests.java111
-rw-r--r--tests/src/org/aspectj/systemtest/ajc184/AllTestsAspectJ184.java27
-rw-r--r--tests/src/org/aspectj/systemtest/ajc184/ajc184.xml180
4 files changed, 320 insertions, 0 deletions
diff --git a/tests/src/org/aspectj/systemtest/AllTests18.java b/tests/src/org/aspectj/systemtest/AllTests18.java
index 547a17817..aecbe05ab 100644
--- a/tests/src/org/aspectj/systemtest/AllTests18.java
+++ b/tests/src/org/aspectj/systemtest/AllTests18.java
@@ -17,12 +17,14 @@ import org.aspectj.systemtest.ajc180.AllTestsAspectJ180;
import org.aspectj.systemtest.ajc181.AllTestsAspectJ181;
import org.aspectj.systemtest.ajc182.AllTestsAspectJ182;
import org.aspectj.systemtest.ajc183.AllTestsAspectJ183;
+import org.aspectj.systemtest.ajc184.AllTestsAspectJ184;
public class AllTests18 {
public static Test suite() {
TestSuite suite = new TestSuite("AspectJ System Test Suite - 1.8");
// $JUnit-BEGIN$
+ suite.addTest(AllTestsAspectJ184.suite());
suite.addTest(AllTestsAspectJ183.suite());
suite.addTest(AllTestsAspectJ182.suite());
suite.addTest(AllTestsAspectJ181.suite());
diff --git a/tests/src/org/aspectj/systemtest/ajc184/Ajc184Tests.java b/tests/src/org/aspectj/systemtest/ajc184/Ajc184Tests.java
new file mode 100644
index 000000000..7ba5654ab
--- /dev/null
+++ b/tests/src/org/aspectj/systemtest/ajc184/Ajc184Tests.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andy Clement - initial API and implementation
+ *******************************************************************************/
+package org.aspectj.systemtest.ajc184;
+
+import java.io.File;
+
+import junit.framework.Test;
+
+import org.aspectj.testing.XMLBasedAjcTestCase;
+
+/**
+ * @author Andy Clement
+ */
+public class Ajc184Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
+
+ // The thisAspectInstance tests here are a copy from Ajc1612Tests but we are compiling with -1.8 and not -1.5
+
+ public void testThisAspectInstance_239649_1() throws Exception {
+ // simple case
+ runTest("thisAspectInstance - 1");
+ }
+
+ public void testThisAspectInstance_239649_2() throws Exception {
+ // before advice toggling on/off through if called method
+ runTest("thisAspectInstance - 2");
+ }
+
+ public void testThisAspectInstance_239649_3() throws Exception {
+ // after advice toggling on/off through if called method
+ runTest("thisAspectInstance - 3");
+ }
+
+ public void testThisAspectInstance_239649_4() throws Exception {
+ // before advice, also using thisJoinPointStaticPart
+ runTest("thisAspectInstance - 4");
+ }
+
+ public void testThisAspectInstance_239649_5() throws Exception {
+ // before advice, also using thisJoinPoint
+ runTest("thisAspectInstance - 5");
+ }
+
+ public void testThisAspectInstance_239649_6() throws Exception {
+ // before advice, also using thisEnclosingJoinPointStaticPart
+ runTest("thisAspectInstance - 6");
+ }
+
+ public void testThisAspectInstance_239649_7() throws Exception {
+ // before advice, also using thisJoinPoint and thisJoinPointStaticPart
+ runTest("thisAspectInstance - 7");
+ }
+
+ public void testThisAspectInstance_239649_8() throws Exception {
+ // before advice, also using abstract aspects
+ runTest("thisAspectInstance - 8");
+ }
+
+ public void testThisAspectInstance_239649_9() throws Exception {
+ // before advice, also using abstract aspects 2
+ runTest("thisAspectInstance - 9");
+ }
+
+ public void testThisAspectInstance_239649_10() throws Exception {
+ // aspects in a package
+ runTest("thisAspectInstance - 10");
+ }
+
+ public void testThisAspectInstance_239649_11() throws Exception {
+ // non-singleton aspect - should be an error for now
+ runTest("thisAspectInstance - 11");
+ }
+
+ public void testThisAspectInstance_239649_12() throws Exception {
+ // arg binding and tjpsp
+ runTest("thisAspectInstance - 12");
+ }
+
+ public void testThisAspectInstance_239649_13() throws Exception {
+ // pass instance
+ runTest("thisAspectInstance - 13");
+ }
+
+ public void testThisAspectInstance_239649_14() throws Exception {
+ // multiple ifs
+ runTest("thisAspectInstance - 14");
+ }
+
+ public void testThisAspectInstance_239649_15() throws Exception {
+ // abstract aspects
+ runTest("thisAspectInstance - 15");
+ }
+ // ---
+
+ public static Test suite() {
+ return XMLBasedAjcTestCase.loadSuite(Ajc184Tests.class);
+ }
+
+ @Override
+ protected File getSpecFile() {
+ return getClassResource("ajc184.xml");
+ }
+
+}
diff --git a/tests/src/org/aspectj/systemtest/ajc184/AllTestsAspectJ184.java b/tests/src/org/aspectj/systemtest/ajc184/AllTestsAspectJ184.java
new file mode 100644
index 000000000..1c1c61a98
--- /dev/null
+++ b/tests/src/org/aspectj/systemtest/ajc184/AllTestsAspectJ184.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andy Clement - initial API and implementation
+ *******************************************************************************/
+package org.aspectj.systemtest.ajc184;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.aspectj.systemtest.apt.AptTests;
+
+public class AllTestsAspectJ184 {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("AspectJ 1.8.4 tests");
+ // $JUnit-BEGIN$
+ suite.addTest(Ajc184Tests.suite());
+ suite.addTest(AptTests.suite());
+ // $JUnit-END$
+ return suite;
+ }
+}
diff --git a/tests/src/org/aspectj/systemtest/ajc184/ajc184.xml b/tests/src/org/aspectj/systemtest/ajc184/ajc184.xml
new file mode 100644
index 000000000..01d4d2312
--- /dev/null
+++ b/tests/src/org/aspectj/systemtest/ajc184/ajc184.xml
@@ -0,0 +1,180 @@
+<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]>
+
+<suite>
+
+
+<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 1">
+<compile files="One.java" options="-1.8"/>
+<run class="One">
+ <stdout>
+ <line text="In instance check method doit()"/>
+ <line text="In advice()"/>
+ <line text="Method m() running"/>
+ </stdout>
+</run>
+</ajc-test>
+
+<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 2">
+<compile files="Two.java" options="-1.8"/>
+<run class="Two">
+ <stdout>
+ <line text="In instance check method, count=1 so doit returns false"/>
+ <line text="Method m() running"/>
+ <line text="In instance check method, count=2 so doit returns true"/>
+ <line text="In advice()"/>
+ <line text="Method m() running"/>
+ <line text="In instance check method, count=3 so doit returns false"/>
+ <line text="Method m() running"/>
+ <line text="In instance check method, count=4 so doit returns true"/>
+ <line text="In advice()"/>
+ <line text="Method m() running"/>
+ </stdout>
+</run>
+</ajc-test>
+
+<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 3">
+<compile files="Three.java" options="-1.8"/>
+<run class="Three">
+ <stdout>
+ <line text="Method m() running"/>
+ <line text="In instance check method, count=1 so doit returns false"/>
+ <line text="Method m() running"/>
+ <line text="In instance check method, count=2 so doit returns true"/>
+ <line text="In advice()"/>
+ <line text="Method m() running"/>
+ <line text="In instance check method, count=3 so doit returns false"/>
+ <line text="Method m() running"/>
+ <line text="In instance check method, count=4 so doit returns true"/>
+ <line text="In advice()"/>
+ </stdout>
+</run>
+</ajc-test>
+
+<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 4">
+<compile files="Four.java" options="-1.8"/>
+<run class="Four">
+ <stdout>
+ <line text="In instance check method doit()"/>
+ <line text="In advice() execution(void Four.m())"/>
+ <line text="Method m() running"/>
+ </stdout>
+</run>
+</ajc-test>
+
+<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 5">
+<compile files="Five.java" options="-1.8"/>
+<run class="Five">
+ <stdout>
+ <line text="In instance check method doit()"/>
+ <line text="In advice() arg0=abc"/>
+ <line text="Method m() running"/>
+ </stdout>
+</run>
+</ajc-test>
+
+<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 6">
+<compile files="Six.java" options="-1.8"/>
+<run class="Six">
+ <stdout>
+ <line text="In instance check method doit()"/>
+ <line text="In advice() execution(void Six.main(String[]))"/>
+ <line text="Method m() running"/>
+ </stdout>
+</run>
+</ajc-test>
+
+<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 7">
+<compile files="Seven.java" options="-1.8"/>
+<run class="Seven">
+ <stdout>
+ <line text="In instance check method doit()"/>
+ <line text="In advice() call(void Seven.m()) execution(void Seven.main(String[]))"/>
+ <line text="Method m() running"/>
+ </stdout>
+</run>
+</ajc-test>
+
+<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 8">
+<compile files="Eight.java" options="-1.8"/>
+<run class="Eight">
+ <stdout>
+ <line text="in doit(): class=X"/>
+ <line text="In advice()"/>
+ <line text="Method m() running"/>
+ </stdout>
+</run>
+</ajc-test>
+
+<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 9">
+<compile files="Nine.java" options="-1.8"/>
+<run class="Nine">
+ <stdout>
+ <line text="in doit(): class=X"/>
+ <line text="In advice()"/>
+ <line text="Method m() running"/>
+ </stdout>
+</run>
+</ajc-test>
+
+<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 10">
+<compile files="Ten.java" options="-1.8"/>
+<run class="com.foo.bar.Ten">
+ <stdout>
+ <line text="In instance check method doit() class=com.foo.bar.X"/>
+ <line text="In advice()"/>
+ <line text="Method m() running"/>
+ </stdout>
+</run>
+</ajc-test>
+
+<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 11">
+<compile files="Eleven.java" options="-1.8">
+<message kind="error" text="thisAspectInstance can only be used inside an if() clause for singleton aspects (compiler limitation)"/>
+</compile>
+</ajc-test>
+
+<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 12">
+<compile files="Twelve.java" options="-1.8"/>
+<run class="Twelve">
+ <stdout>
+ <line text="In instance check method doit()"/>
+ <line text="In advice() arg=abc tjpsp=execution(void Twelve.m(String))"/>
+ <line text="Method m() running"/>
+ </stdout>
+</run>
+</ajc-test>
+
+<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 13">
+<compile files="Thirteen.java" options="-1.8"/>
+<run class="Thirteen">
+ <stdout>
+ <line text="instance is X"/>
+ <line text="In advice() arg=abc tjpsp=execution(void Thirteen.m(String))"/>
+ <line text="Method m() running"/>
+ </stdout>
+</run>
+</ajc-test>
+
+<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 14">
+<compile files="Fourteen.java" options="-1.8"/>
+<run class="Fourteen">
+ <stdout>
+ <line text="instance is X"/>
+ <line text="In advice()"/>
+ <line text="Method m() running"/>
+ </stdout>
+</run>
+</ajc-test>
+
+<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 15">
+<compile files="Fifteen.java" options="-1.8"/>
+<run class="Fifteen">
+ <stdout>
+ <line text="in doit(): class=X"/>
+ <line text="In advice()"/>
+ <line text="Method m() running"/>
+ </stdout>
+</run>
+</ajc-test>
+
+</suite>