aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/test/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src/test/java/org')
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc196/Ajc196Tests.java2
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc196/Java14PreviewFeaturesTests.java (renamed from tests/src/test/java/org/aspectj/systemtest/ajc196/Ajc196PreviewFeaturesTests.java)6
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc197/Ajc197Tests.java40
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc197/Ajc197TestsJava.java64
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc197/AllTestsAspectJ197.java9
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc197/Java16PreviewFeaturesTests.java (renamed from tests/src/test/java/org/aspectj/systemtest/ajc197/Ajc197PreviewFeaturesTests.java)27
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc197/SanityTestsJava16.java87
7 files changed, 166 insertions, 69 deletions
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc196/Ajc196Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc196/Ajc196Tests.java
index 7fd25c04b..045ef6e47 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc196/Ajc196Tests.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc196/Ajc196Tests.java
@@ -37,8 +37,6 @@ public class Ajc196Tests extends XMLBasedAjcTestCaseForJava14OrLater {
checkVersion("Switch3", Constants.MAJOR_14, 0);
}
- // ---
-
public static Test suite() {
return XMLBasedAjcTestCase.loadSuite(Ajc196Tests.class);
}
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc196/Ajc196PreviewFeaturesTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc196/Java14PreviewFeaturesTests.java
index 56c95a265..28a2a75c9 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc196/Ajc196PreviewFeaturesTests.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc196/Java14PreviewFeaturesTests.java
@@ -16,7 +16,7 @@ import junit.framework.Test;
/**
* @author Alexander Kriegisch
*/
-public class Ajc196PreviewFeaturesTests extends XMLBasedAjcTestCaseForJava14Only {
+public class Java14PreviewFeaturesTests extends XMLBasedAjcTestCaseForJava14Only {
public void testRecords() {
runTest("simple record");
@@ -43,10 +43,8 @@ public class Ajc196PreviewFeaturesTests extends XMLBasedAjcTestCaseForJava14Only
runTest("textblock 2");
}
- // ---
-
public static Test suite() {
- return XMLBasedAjcTestCase.loadSuite(Ajc196PreviewFeaturesTests.class);
+ return XMLBasedAjcTestCase.loadSuite(Java14PreviewFeaturesTests.class);
}
@Override
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc197/Ajc197Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc197/Ajc197Tests.java
deleted file mode 100644
index bd6600f49..000000000
--- a/tests/src/test/java/org/aspectj/systemtest/ajc197/Ajc197Tests.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2021 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
- *******************************************************************************/
-package org.aspectj.systemtest.ajc197;
-
-import junit.framework.Test;
-import org.aspectj.testing.XMLBasedAjcTestCase;
-import org.aspectj.testing.XMLBasedAjcTestCaseForJava15OrLater;
-
-/**
- * @author Alexander Kriegisch
- */
-public class Ajc197Tests extends XMLBasedAjcTestCaseForJava15OrLater {
-
- public void testHiddenClass() {
- runTest("hidden class");
- }
-
- public void testTextBlock1() {
- runTest("textblock 1");
- }
-
- public void testTextBlock2() {
- runTest("textblock 2");
- }
-
- public static Test suite() {
- return XMLBasedAjcTestCase.loadSuite(Ajc197Tests.class);
- }
-
- @Override
- protected java.net.URL getSpecFile() {
- return getClassResource("ajc197.xml");
- }
-
-}
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc197/Ajc197TestsJava.java b/tests/src/test/java/org/aspectj/systemtest/ajc197/Ajc197TestsJava.java
new file mode 100644
index 000000000..081da9736
--- /dev/null
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc197/Ajc197TestsJava.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2021 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
+ *******************************************************************************/
+package org.aspectj.systemtest.ajc197;
+
+import junit.framework.Test;
+import org.aspectj.apache.bcel.Constants;
+import org.aspectj.testing.XMLBasedAjcTestCase;
+import org.aspectj.testing.XMLBasedAjcTestCaseForJava16OrLater;
+
+/**
+ * @author Alexander Kriegisch
+ */
+public class Ajc197TestsJava extends XMLBasedAjcTestCaseForJava16OrLater {
+
+ public void testHiddenClass() {
+ runTest("hidden class");
+ checkVersion("HiddenClassDemo", Constants.MAJOR_16, Constants.MINOR_16);
+ }
+
+ public void testTextBlock1() {
+ runTest("textblock 1");
+ checkVersion("Code", Constants.MAJOR_16, Constants.MINOR_16);
+ }
+
+ public void testTextBlock2() {
+ runTest("textblock 2");
+ checkVersion("Code2", Constants.MAJOR_16, Constants.MINOR_16);
+ }
+
+ public void testRecords() {
+ runTest("simple record");
+ checkVersion("Person", Constants.MAJOR_16, Constants.MINOR_16);
+ }
+
+ public void testRecords2() {
+ runTest("using a record");
+ checkVersion("UsingPersonRecord", Constants.MAJOR_16, Constants.MINOR_16);
+ }
+
+ public void testAdvisingRecords() {
+ runTest("advising records");
+ checkVersion("TraceRecordComponents", Constants.MAJOR_16, Constants.MINOR_16);
+ }
+
+ public void testInstanceofPatterns() {
+ runTest("instanceof patterns");
+ checkVersion("Jep305", Constants.MAJOR_16, Constants.MINOR_16);
+ }
+
+ public static Test suite() {
+ return XMLBasedAjcTestCase.loadSuite(Ajc197TestsJava.class);
+ }
+
+ @Override
+ protected java.net.URL getSpecFile() {
+ return getClassResource("ajc197.xml");
+ }
+
+}
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc197/AllTestsAspectJ197.java b/tests/src/test/java/org/aspectj/systemtest/ajc197/AllTestsAspectJ197.java
index 2b33099cb..995cd2976 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc197/AllTestsAspectJ197.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc197/AllTestsAspectJ197.java
@@ -19,11 +19,14 @@ public class AllTestsAspectJ197 {
public static Test suite() {
TestSuite suite = new TestSuite("AspectJ 1.9.7 tests");
if (LangUtil.is15VMOrGreater()) {
- suite.addTest(Ajc197Tests.suite());
suite.addTest(SanityTestsJava15.suite());
}
- if (LangUtil.is15VMOrGreater() && !LangUtil.is16VMOrGreater()) {
- suite.addTest(Ajc197PreviewFeaturesTests.suite());
+ if (LangUtil.is16VMOrGreater()) {
+ suite.addTest(SanityTestsJava16.suite());
+ suite.addTest(Ajc197TestsJava.suite());
+ }
+ if (LangUtil.is16VMOrGreater() && !LangUtil.is17VMOrGreater()) {
+ suite.addTest(Java16PreviewFeaturesTests.suite());
}
return suite;
}
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc197/Ajc197PreviewFeaturesTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc197/Java16PreviewFeaturesTests.java
index 2c26ca441..e0c68ccd4 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc197/Ajc197PreviewFeaturesTests.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc197/Java16PreviewFeaturesTests.java
@@ -10,44 +10,31 @@ package org.aspectj.systemtest.ajc197;
import junit.framework.Test;
import org.aspectj.apache.bcel.Constants;
import org.aspectj.testing.XMLBasedAjcTestCase;
-import org.aspectj.testing.XMLBasedAjcTestCaseForJava15Only;
+import org.aspectj.testing.XMLBasedAjcTestCaseForJava16Only;
/**
* @author Alexander Kriegisch
*/
-public class Ajc197PreviewFeaturesTests extends XMLBasedAjcTestCaseForJava15Only {
-
- public void testRecords() {
- runTest("simple record");
- checkVersion("Person", Constants.MAJOR_15, Constants.PREVIEW_MINOR_VERSION);
- }
-
- public void testRecords2() {
- runTest("using a record");
- }
-
- public void testInstanceofPatterns() {
- runTest("instanceof patterns");
- }
-
- public void testAdvisingRecords() {
- runTest("advising records");
- }
+public class Java16PreviewFeaturesTests extends XMLBasedAjcTestCaseForJava16Only {
public void testSealedClassWithLegalSubclasses() {
runTest("sealed class with legal subclasses");
+ checkVersion("Employee", Constants.MAJOR_16, Constants.PREVIEW_MINOR_VERSION);
+ checkVersion("Manager", Constants.MAJOR_16, Constants.PREVIEW_MINOR_VERSION);
}
public void testSealedClassWithIllegalSubclass() {
runTest("sealed class with illegal subclass");
+ checkVersion("Person", Constants.MAJOR_16, Constants.PREVIEW_MINOR_VERSION);
}
public void testWeaveSealedClass() {
runTest("weave sealed class");
+ checkVersion("PersonAspect", Constants.MAJOR_16, Constants.PREVIEW_MINOR_VERSION);
}
public static Test suite() {
- return XMLBasedAjcTestCase.loadSuite(Ajc197PreviewFeaturesTests.class);
+ return XMLBasedAjcTestCase.loadSuite(Java16PreviewFeaturesTests.class);
}
@Override
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc197/SanityTestsJava16.java b/tests/src/test/java/org/aspectj/systemtest/ajc197/SanityTestsJava16.java
new file mode 100644
index 000000000..ed050f56b
--- /dev/null
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc197/SanityTestsJava16.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2021 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
+ *******************************************************************************/
+package org.aspectj.systemtest.ajc197;
+
+import junit.framework.Test;
+import org.aspectj.testing.XMLBasedAjcTestCase;
+import org.aspectj.testing.XMLBasedAjcTestCaseForJava16OrLater;
+
+/*
+ * 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 -10 option
+ * to check code generation and modification with that version specified.
+ *
+ * @author Alexander Kriegisch
+ */
+public class SanityTestsJava16 extends XMLBasedAjcTestCaseForJava16OrLater {
+
+ public static final int bytecode_version_for_JDK_level = 60;
+
+ // 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() {
+ runTest("simple - j");
+ checkVersion("A", bytecode_version_for_JDK_level, 0);
+ }
+
+ public void testVersionCorrect2() {
+ runTest("simple - k");
+ checkVersion("A", bytecode_version_for_JDK_level, 0);
+ }
+
+ public void testVersionCorrect4() {
+ runTest("simple - m");
+ // Must be 49.0 when -1.5 is specified
+ checkVersion("A", 49, 0);
+ }
+
+ public static Test suite() {
+ return XMLBasedAjcTestCase.loadSuite(SanityTestsJava16.class);
+ }
+
+ @Override
+ protected java.net.URL getSpecFile() {
+ return getClassResource("sanity-tests-16.xml");
+ }
+
+}