diff options
author | Alexander Kriegisch <Alexander@Kriegisch.name> | 2024-03-22 20:53:10 +0100 |
---|---|---|
committer | Alexander Kriegisch <Alexander@Kriegisch.name> | 2024-03-23 20:22:39 +0100 |
commit | 5a223d492823aeb1d5d655792193675811deb84a (patch) | |
tree | 5b7900a3f70cd037fa0b2f60b346cd8839b2dccf /tests/src/test/java/org/aspectj/systemtest/ajc1922/SanityTestsJava22.java | |
parent | dcc2fd168c30a6d4293f3ceade2e95d822e67e36 (diff) | |
download | aspectj-5a223d492823aeb1d5d655792193675811deb84a.tar.gz aspectj-5a223d492823aeb1d5d655792193675811deb84a.zip |
Switch to Java 22 + add basic test suite
The tests from Java 21 were copied to 22. Inactive ones were activated
after their features under test were fixed/implemented. Preview ones
were promotes to final ones for unnamed variables and patterns.
TODO: Add tests for new Java 22 features and maybe adjust or
amend existing feature tests, if preview or final characteristics have
changed since Java 21.
Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
Diffstat (limited to 'tests/src/test/java/org/aspectj/systemtest/ajc1922/SanityTestsJava22.java')
-rw-r--r-- | tests/src/test/java/org/aspectj/systemtest/ajc1922/SanityTestsJava22.java | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1922/SanityTestsJava22.java b/tests/src/test/java/org/aspectj/systemtest/ajc1922/SanityTestsJava22.java new file mode 100644 index 000000000..30cea09f5 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1922/SanityTestsJava22.java @@ -0,0 +1,92 @@ +/******************************************************************************* + * 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.ajc1922; + +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 -22 option + * to check code generation and modification with that version specified. + * + * @author Alexander Kriegisch + */ +public class SanityTestsJava22 extends JavaVersionSpecificXMLBasedAjcTestCase { + + public static final int bytecode_version_for_JDK_level = Constants.ClassFileVersion.of(22).MAJOR; + + public SanityTestsJava22() { + super(22); + } + + // 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", Constants.ClassFileVersion.of(5).MAJOR, 0); + } + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(SanityTestsJava22.class); + } + + @Override + protected java.net.URL getSpecFile() { + return getClassResource("sanity-tests-22.xml"); + } + +} |