diff options
author | Alexander Kriegisch <Alexander@Kriegisch.name> | 2021-03-21 02:16:20 +0700 |
---|---|---|
committer | Alexander Kriegisch <Alexander@Kriegisch.name> | 2021-03-21 02:16:20 +0700 |
commit | 68ad86eb6ed70c15ad4209295903a9a977b001f6 (patch) | |
tree | e65d53e92cf4136d76337bd5e6f8e55da958fff5 /tests/src/test/java/org/aspectj/systemtest/ajc197/SanityTestsJava16.java | |
parent | a1867b05ba6443d32abc4049c26b92fc226d6f78 (diff) | |
download | aspectj-68ad86eb6ed70c15ad4209295903a9a977b001f6.tar.gz aspectj-68ad86eb6ed70c15ad4209295903a9a977b001f6.zip |
Add Java 16 test suite for AspectJ 1.9.7 + test refactorings
- Test all features which were preview in 14+15 and are now final in 16,
compiling them with language level 16.
- For Java 15 we only have sanity tests (and of course the Java <14
tests), compiling Java 16 features to target 15 does not seem to work.
- Test remaining Java 16 preview feature (sealed classes).
- Instead of overriding runTest(String) in several base classes like
XMLBasedAjcTestCaseForJava*Only or XMLBasedAjcTestCaseForJava*OrLater,
we now override setUp() from JUnit's TestCase base class. This will
run before runTest(String) and make the tests fail much faster, if a
user tries to run them on the wrong VM.
Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
Diffstat (limited to 'tests/src/test/java/org/aspectj/systemtest/ajc197/SanityTestsJava16.java')
-rw-r--r-- | tests/src/test/java/org/aspectj/systemtest/ajc197/SanityTestsJava16.java | 87 |
1 files changed, 87 insertions, 0 deletions
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"); + } + +} |