aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/test/java/org/aspectj
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src/test/java/org/aspectj')
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/AllTests19.java2
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc1919/Ajc1919TestsJava.java32
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc1919/AllTestsAspectJ1919.java33
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc1919/Bugs1919Tests.java31
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc1919/Java19PreviewFeaturesTests.java54
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc1919/SanityTestsJava19.java87
6 files changed, 239 insertions, 0 deletions
diff --git a/tests/src/test/java/org/aspectj/systemtest/AllTests19.java b/tests/src/test/java/org/aspectj/systemtest/AllTests19.java
index d14bc54cb..21ad9de90 100644
--- a/tests/src/test/java/org/aspectj/systemtest/AllTests19.java
+++ b/tests/src/test/java/org/aspectj/systemtest/AllTests19.java
@@ -9,6 +9,7 @@ package org.aspectj.systemtest;
import org.aspectj.systemtest.ajc190.AllTestsAspectJ190;
import org.aspectj.systemtest.ajc191.AllTestsAspectJ191;
+import org.aspectj.systemtest.ajc1919.AllTestsAspectJ1919;
import org.aspectj.systemtest.ajc192.AllTestsAspectJ192;
import org.aspectj.systemtest.ajc193.AllTestsAspectJ193;
import org.aspectj.systemtest.ajc195.AllTestsAspectJ195;
@@ -38,6 +39,7 @@ public class AllTests19 {
suite.addTest(AllTestsAspectJ197.suite());
suite.addTest(AllTestsAspectJ198.suite());
suite.addTest(AllTestsAspectJ199.suite());
+ suite.addTest(AllTestsAspectJ1919.suite());
suite.addTest(AllTests18.suite());
// $JUnit-END$
return suite;
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1919/Ajc1919TestsJava.java b/tests/src/test/java/org/aspectj/systemtest/ajc1919/Ajc1919TestsJava.java
new file mode 100644
index 000000000..5f471490d
--- /dev/null
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc1919/Ajc1919TestsJava.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2022 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.ajc1919;
+
+import junit.framework.Test;
+import org.aspectj.testing.XMLBasedAjcTestCase;
+import org.aspectj.testing.XMLBasedAjcTestCaseForJava19OrLater;
+
+/**
+ * @author Alexander Kriegisch
+ */
+public class Ajc1919TestsJava extends XMLBasedAjcTestCaseForJava19OrLater {
+
+ public void testDummyJava19() {
+ //runTest("dummy Java 19");
+ }
+
+ public static Test suite() {
+ return XMLBasedAjcTestCase.loadSuite(Ajc1919TestsJava.class);
+ }
+
+ @Override
+ protected java.net.URL getSpecFile() {
+ return getClassResource("ajc1919.xml");
+ }
+
+}
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1919/AllTestsAspectJ1919.java b/tests/src/test/java/org/aspectj/systemtest/ajc1919/AllTestsAspectJ1919.java
new file mode 100644
index 000000000..da1a81f97
--- /dev/null
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc1919/AllTestsAspectJ1919.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2022 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.ajc1919;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.aspectj.util.LangUtil;
+
+/**
+ * @author Alexander Kriegisch
+ */
+public class AllTestsAspectJ1919 {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("AspectJ 1.9.19 tests");
+ suite.addTest(Bugs1919Tests.suite());
+ if (LangUtil.is19VMOrGreater()) {
+ suite.addTest(SanityTestsJava19.suite());
+ suite.addTest(Ajc1919TestsJava.suite());
+ }
+ // Do not run tests using a previous compiler's preview features anymore. They would all fail.
+ // TODO: Comment out the following block when upgrading JDT Core to Java 20
+ if (LangUtil.is19VMOrGreater() && !LangUtil.is20VMOrGreater()) {
+ suite.addTest(Java19PreviewFeaturesTests.suite());
+ }
+ return suite;
+ }
+}
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1919/Bugs1919Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc1919/Bugs1919Tests.java
new file mode 100644
index 000000000..38441267e
--- /dev/null
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc1919/Bugs1919Tests.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2022 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.ajc1919;
+
+import junit.framework.Test;
+import org.aspectj.testing.XMLBasedAjcTestCase;
+
+/**
+ * @author Alexander Kriegisch
+ */
+public class Bugs1919Tests extends XMLBasedAjcTestCase {
+
+ public void testDummyBug() {
+ //runTest("dummy Java 19 bug");
+ }
+
+ public static Test suite() {
+ return XMLBasedAjcTestCase.loadSuite(Bugs1919Tests.class);
+ }
+
+ @Override
+ protected java.net.URL getSpecFile() {
+ return getClassResource("ajc1919.xml");
+ }
+
+}
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1919/Java19PreviewFeaturesTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc1919/Java19PreviewFeaturesTests.java
new file mode 100644
index 000000000..39f9019f4
--- /dev/null
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc1919/Java19PreviewFeaturesTests.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2022 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.ajc1919;
+
+import junit.framework.Test;
+import org.aspectj.apache.bcel.Constants;
+import org.aspectj.testing.XMLBasedAjcTestCase;
+import org.aspectj.testing.XMLBasedAjcTestCaseForJava19Only;
+
+/**
+ * @author Alexander Kriegisch
+ */
+public class Java19PreviewFeaturesTests extends XMLBasedAjcTestCaseForJava19Only {
+
+ public void testSwitchPatternMatchingPreview3Java() {
+ runTest("switch pattern matching preview 3 java");
+ checkVersion("SwitchPatternPreview3OK", Constants.MAJOR_19, Constants.PREVIEW_MINOR_VERSION);
+ }
+
+ public void testSwitchPatternMatchingPreview3Aspect() {
+ runTest("switch pattern matching preview 3 aspect");
+ checkVersion("SwitchPatternPreview3Aspect", Constants.MAJOR_19, Constants.PREVIEW_MINOR_VERSION);
+ checkVersion("Application", Constants.MAJOR_19, Constants.PREVIEW_MINOR_VERSION);
+ checkVersion("Shape", Constants.MAJOR_19, Constants.PREVIEW_MINOR_VERSION);
+ checkVersion("S", Constants.MAJOR_19, Constants.PREVIEW_MINOR_VERSION);
+ }
+
+ public void testSwitchPatternMatchingCaseLabelDominatedByPrecedingError() {
+ runTest("switch pattern matching error");
+ }
+
+ public void testSwitchPatternMatchingPreview3Error1() {
+ runTest("switch pattern matching preview 3 error 1");
+ }
+
+ public void testSwitchPatternMatchingPreview3Error2() {
+ runTest("switch pattern matching preview 3 error 2");
+ }
+
+ public static Test suite() {
+ return XMLBasedAjcTestCase.loadSuite(Java19PreviewFeaturesTests.class);
+ }
+
+ @Override
+ protected java.net.URL getSpecFile() {
+ return getClassResource("ajc1919.xml");
+ }
+
+}
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1919/SanityTestsJava19.java b/tests/src/test/java/org/aspectj/systemtest/ajc1919/SanityTestsJava19.java
new file mode 100644
index 000000000..fa2abafe5
--- /dev/null
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc1919/SanityTestsJava19.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2022 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.ajc1919;
+
+import junit.framework.Test;
+import org.aspectj.testing.XMLBasedAjcTestCase;
+import org.aspectj.testing.XMLBasedAjcTestCaseForJava19OrLater;
+
+/*
+ * 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 -19 option
+ * to check code generation and modification with that version specified.
+ *
+ * @author Alexander Kriegisch
+ */
+public class SanityTestsJava19 extends XMLBasedAjcTestCaseForJava19OrLater {
+
+ public static final int bytecode_version_for_JDK_level = 63;
+
+ // 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(SanityTestsJava19.class);
+ }
+
+ @Override
+ protected java.net.URL getSpecFile() {
+ return getClassResource("sanity-tests-19.xml");
+ }
+
+}