diff options
author | Alexander Kriegisch <Alexander@Kriegisch.name> | 2021-03-17 23:38:08 +0700 |
---|---|---|
committer | Alexander Kriegisch <Alexander@Kriegisch.name> | 2021-03-17 23:38:08 +0700 |
commit | 4e5430011fc9283074339b39754b0f07ff5d8a04 (patch) | |
tree | c56b73057f7255faee0b5a04532155c281db65e0 /tests/src/test/java/org | |
parent | 58830078585fd045c92737ce56cb693b903f5545 (diff) | |
download | aspectj-4e5430011fc9283074339b39754b0f07ff5d8a04.tar.gz aspectj-4e5430011fc9283074339b39754b0f07ff5d8a04.zip |
Add Java 15 / AspectJ 1.9.7 test suite
Also fix some minor details in Java 14 suite
Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
Diffstat (limited to 'tests/src/test/java/org')
6 files changed, 221 insertions, 5 deletions
diff --git a/tests/src/test/java/org/aspectj/systemtest/AllTests19.java b/tests/src/test/java/org/aspectj/systemtest/AllTests19.java index 20ecc3894..418ecbff5 100644 --- a/tests/src/test/java/org/aspectj/systemtest/AllTests19.java +++ b/tests/src/test/java/org/aspectj/systemtest/AllTests19.java @@ -16,6 +16,7 @@ import org.aspectj.systemtest.ajc196.AllTestsAspectJ196; import junit.framework.Test; import junit.framework.TestSuite; +import org.aspectj.systemtest.ajc197.AllTestsAspectJ197; /** * @author Andy Clement @@ -32,6 +33,7 @@ public class AllTests19 { // there were no new tests for 1.9.4 suite.addTest(AllTestsAspectJ195.suite()); suite.addTest(AllTestsAspectJ196.suite()); + suite.addTest(AllTestsAspectJ197.suite()); suite.addTest(AllTests18.suite()); // $JUnit-END$ return suite; diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc196/SanityTestsJava14.java b/tests/src/test/java/org/aspectj/systemtest/ajc196/SanityTestsJava14.java index edf08298c..a07e3afa4 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc196/SanityTestsJava14.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc196/SanityTestsJava14.java @@ -60,23 +60,22 @@ public class SanityTestsJava14 extends XMLBasedAjcTestCaseForJava14OrLater { runTest("simple - i"); } - public void testVersionCorrect1() throws ClassNotFoundException { + public void testVersionCorrect1() { runTest("simple - j"); checkVersion("A", bytecode_version_for_JDK_level, 0); } - public void testVersionCorrect2() throws ClassNotFoundException { + public void testVersionCorrect2() { 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 + 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(SanityTestsJava14.class); } diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc197/Ajc197PreviewFeaturesTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc197/Ajc197PreviewFeaturesTests.java new file mode 100644 index 000000000..2c26ca441 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc197/Ajc197PreviewFeaturesTests.java @@ -0,0 +1,58 @@ +/******************************************************************************* + * 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.XMLBasedAjcTestCaseForJava15Only; + +/** + * @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 void testSealedClassWithLegalSubclasses() { + runTest("sealed class with legal subclasses"); + } + + public void testSealedClassWithIllegalSubclass() { + runTest("sealed class with illegal subclass"); + } + + public void testWeaveSealedClass() { + runTest("weave sealed class"); + } + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc197PreviewFeaturesTests.class); + } + + @Override + protected java.net.URL getSpecFile() { + return getClassResource("ajc197.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc197/Ajc197Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc197/Ajc197Tests.java new file mode 100644 index 000000000..bd6600f49 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc197/Ajc197Tests.java @@ -0,0 +1,40 @@ +/******************************************************************************* + * 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/AllTestsAspectJ197.java b/tests/src/test/java/org/aspectj/systemtest/ajc197/AllTestsAspectJ197.java new file mode 100644 index 000000000..2b33099cb --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc197/AllTestsAspectJ197.java @@ -0,0 +1,30 @@ +/******************************************************************************* + * 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 junit.framework.TestSuite; +import org.aspectj.util.LangUtil; + +/** + * @author Alexander Kriegisch + */ +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()); + } + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc197/SanityTestsJava15.java b/tests/src/test/java/org/aspectj/systemtest/ajc197/SanityTestsJava15.java new file mode 100644 index 000000000..8a9d5c3bd --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc197/SanityTestsJava15.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.XMLBasedAjcTestCaseForJava15OrLater; + +/* + * 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 SanityTestsJava15 extends XMLBasedAjcTestCaseForJava15OrLater { + + public static final int bytecode_version_for_JDK_level = 59; + + // 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(SanityTestsJava15.class); + } + + @Override + protected java.net.URL getSpecFile() { + return getClassResource("sanity-tests-15.xml"); + } + +} |