aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/test/java/org/aspectj/systemtest/ajc193
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src/test/java/org/aspectj/systemtest/ajc193')
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc193/Ajc193Tests.java12
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc193/AllTestsAspectJ193.java7
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc193/Java13Tests.java31
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc193/SanityTestsJava12.java93
4 files changed, 106 insertions, 37 deletions
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc193/Ajc193Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc193/Ajc193Tests.java
index 4f7bd8047..e8d3c5e1c 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc193/Ajc193Tests.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc193/Ajc193Tests.java
@@ -7,19 +7,21 @@
*******************************************************************************/
package org.aspectj.systemtest.ajc193;
-import java.io.File;
-
+import junit.framework.Test;
import org.aspectj.apache.bcel.classfile.JavaClass;
+import org.aspectj.testing.JavaVersionSpecificXMLBasedAjcTestCase;
import org.aspectj.testing.XMLBasedAjcTestCase;
-import org.aspectj.testing.XMLBasedAjcTestCaseForJava10OrLater;
import org.aspectj.weaver.WeaverStateInfo;
-import junit.framework.Test;
+import java.io.File;
/**
* @author Andy Clement
*/
-public class Ajc193Tests extends XMLBasedAjcTestCaseForJava10OrLater {
+public class Ajc193Tests extends JavaVersionSpecificXMLBasedAjcTestCase {
+ public Ajc193Tests() {
+ super(10);
+ }
public void testNestedAroundProceed() {
runTest("nested around proceed");
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc193/AllTestsAspectJ193.java b/tests/src/test/java/org/aspectj/systemtest/ajc193/AllTestsAspectJ193.java
index 364136be9..403af7b9a 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc193/AllTestsAspectJ193.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc193/AllTestsAspectJ193.java
@@ -12,13 +12,18 @@ package org.aspectj.systemtest.ajc193;
import junit.framework.Test;
import junit.framework.TestSuite;
+import org.aspectj.util.LangUtil;
public class AllTestsAspectJ193 {
+ private static final int JAVA_VERSION = 12;
public static Test suite() {
TestSuite suite = new TestSuite("AspectJ 1.9.3 tests");
suite.addTest(Ajc193Tests.suite());
- // suite.addTest(Java13Tests.suite());
+ // suite.addTest(Java12Tests.suite());
+ if (LangUtil.isVMGreaterOrEqual(JAVA_VERSION)) {
+ suite.addTest(SanityTestsJava12.suite());
+ }
return suite;
}
}
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc193/Java13Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc193/Java13Tests.java
deleted file mode 100644
index 801d99291..000000000
--- a/tests/src/test/java/org/aspectj/systemtest/ajc193/Java13Tests.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2019 Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
- *******************************************************************************/
-package org.aspectj.systemtest.ajc193;
-
-import org.aspectj.testing.XMLBasedAjcTestCase;
-import org.aspectj.testing.XMLBasedAjcTestCaseForJava13OrLater;
-
-import junit.framework.Test;
-
-/**
- * @author Andy Clement
- */
-public class Java13Tests extends XMLBasedAjcTestCaseForJava13OrLater {
-
- // ---
-
- public static Test suite() {
- return XMLBasedAjcTestCase.loadSuite(Java13Tests.class);
- }
-
- @Override
- protected java.net.URL getSpecFile() {
- return getClassResource("ajc193.xml");
- }
-
-}
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc193/SanityTestsJava12.java b/tests/src/test/java/org/aspectj/systemtest/ajc193/SanityTestsJava12.java
new file mode 100644
index 000000000..f3bf166a2
--- /dev/null
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc193/SanityTestsJava12.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2024 Contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *******************************************************************************/
+package org.aspectj.systemtest.ajc193;
+
+import junit.framework.Test;
+import org.aspectj.apache.bcel.Constants;
+import org.aspectj.testing.JavaVersionSpecificXMLBasedAjcTestCase;
+import org.aspectj.testing.XMLBasedAjcTestCase;
+
+/*
+ * Some very trivial tests that help verify things are OK.
+ * These are a copy of the earlier Sanity Tests created for 1.6 but these supply the -12 option
+ * to check code generation and modification with that version specified.
+ *
+ * @author Alexander Kriegisch
+ */
+public class SanityTestsJava12 extends JavaVersionSpecificXMLBasedAjcTestCase {
+
+ public static final int bytecode_version_for_JDK_level = Constants.ClassFileVersion.of(12).MAJOR;
+
+ public SanityTestsJava12() {
+ super(12);
+ }
+
+ // Incredibly trivial test programs that check the compiler works at all (these are easy-ish to debug)
+ public void testSimpleJava_A() {
+ runTest("simple - a");
+ }
+
+ public void testSimpleJava_B() {
+ runTest("simple - b");
+ }
+
+ public void testSimpleCode_C() {
+ runTest("simple - c");
+ }
+
+ public void testSimpleCode_D() {
+ runTest("simple - d");
+ }
+
+ public void testSimpleCode_E() {
+ runTest("simple - e");
+ }
+
+ public void testSimpleCode_F() {
+ runTest("simple - f");
+ }
+
+ public void testSimpleCode_G() {
+ runTest("simple - g");
+ }
+
+ public void testSimpleCode_H() {
+ runTest("simple - h", true);
+ }
+
+ public void testSimpleCode_I() {
+ runTest("simple - i");
+ }
+
+ public void testVersionCorrect1() throws ClassNotFoundException {
+ runTest("simple - j");
+ checkVersion("A", bytecode_version_for_JDK_level, 0);
+ }
+
+ public void testVersionCorrect2() throws ClassNotFoundException {
+ runTest("simple - k");
+ checkVersion("A", bytecode_version_for_JDK_level, 0);
+ }
+
+ public void testVersionCorrect4() throws ClassNotFoundException { // check it is 49.0 when -1.5 is specified
+ runTest("simple - m");
+ checkVersion("A", Constants.ClassFileVersion.of(5).MAJOR, 0);
+ }
+
+
+ // ///////////////////////////////////////
+ public static Test suite() {
+ return XMLBasedAjcTestCase.loadSuite(SanityTestsJava12.class);
+ }
+
+ @Override
+ protected java.net.URL getSpecFile() {
+ return getClassResource("sanity-tests-12.xml");
+ }
+
+}