diff options
author | Alexander Kriegisch <Alexander@Kriegisch.name> | 2023-10-05 08:00:47 +0700 |
---|---|---|
committer | Alexander Kriegisch <Alexander@Kriegisch.name> | 2023-10-05 08:00:47 +0700 |
commit | 3533dcd043ca31e6988fae714882328d23543a65 (patch) | |
tree | 4295918fb3bbdabae9fa730ecb64805df72f953c /tests/src/test/java | |
parent | 19a414b7153c05197ac7d6c74dd3de969cf4a349 (diff) | |
download | aspectj-3533dcd043ca31e6988fae714882328d23543a65.tar.gz aspectj-3533dcd043ca31e6988fae714882328d23543a65.zip |
Beautify sanity tests using bytecode level constants
Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
Diffstat (limited to 'tests/src/test/java')
12 files changed, 45 insertions, 29 deletions
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc160/SanityTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc160/SanityTests.java index 224e3e599..4a7c39a01 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc160/SanityTests.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc160/SanityTests.java @@ -10,6 +10,7 @@ *******************************************************************************/ package org.aspectj.systemtest.ajc160; +import org.aspectj.apache.bcel.Constants; import org.aspectj.apache.bcel.classfile.Attribute; import org.aspectj.apache.bcel.classfile.Code; import org.aspectj.apache.bcel.classfile.JavaClass; @@ -25,6 +26,7 @@ import junit.framework.Test; * rather than executing them. */ public class SanityTests extends org.aspectj.testing.XMLBasedAjcTestCase { + public static final int bytecode_version_for_JDK_level = Constants.MAJOR_1_6; // Incredibly trivial test programs that check the compiler works at all (these are easy-ish to debug) public void testSimpleJava_A() { @@ -66,22 +68,22 @@ public class SanityTests extends org.aspectj.testing.XMLBasedAjcTestCase { // Check the version number in the classfiles is correct when Java6 options specified public void testVersionCorrect1() throws ClassNotFoundException { runTest("simple - j"); - checkVersion("A", 50, 0); + checkVersion("A", bytecode_version_for_JDK_level, 0); } public void testVersionCorrect2() throws ClassNotFoundException { runTest("simple - k"); - checkVersion("A", 50, 0); + checkVersion("A", bytecode_version_for_JDK_level, 0); } public void testVersionCorrect3() throws ClassNotFoundException { runTest("simple - l"); - checkVersion("A", 50, 0); + checkVersion("A", bytecode_version_for_JDK_level, 0); } public void testVersionCorrect4() throws ClassNotFoundException {// check it is 49.0 when -1.5 is specified runTest("simple - m"); - checkVersion("A", 49, 0); + checkVersion("A", Constants.MAJOR_1_5, 0); } // Check the stackmap stuff appears for methods in a Java6 file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc190/SanityTests19.java b/tests/src/test/java/org/aspectj/systemtest/ajc190/SanityTests19.java index c42a0cc25..ac5b109e6 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc190/SanityTests19.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc190/SanityTests19.java @@ -10,6 +10,7 @@ *******************************************************************************/ package org.aspectj.systemtest.ajc190; +import org.aspectj.apache.bcel.Constants; import org.aspectj.testing.XMLBasedAjcTestCase; import junit.framework.Test; @@ -20,6 +21,7 @@ import junit.framework.Test; * to check code generation and modification with that version specified. */ public class SanityTests19 extends org.aspectj.testing.XMLBasedAjcTestCase { + public static final int bytecode_version_for_JDK_level = Constants.MAJOR_1_9; // Incredibly trivial test programs that check the compiler works at all (these are easy-ish to debug) public void testSimpleJava_A() { @@ -61,17 +63,17 @@ public class SanityTests19 extends org.aspectj.testing.XMLBasedAjcTestCase { // Check the version number in the classfiles is correct when Java6 options specified public void testVersionCorrect1() throws ClassNotFoundException { runTest("simple - j"); - checkVersion("A", 53, 0); + checkVersion("A", bytecode_version_for_JDK_level, 0); } public void testVersionCorrect2() throws ClassNotFoundException { runTest("simple - k"); - checkVersion("A", 53, 0); + checkVersion("A", bytecode_version_for_JDK_level, 0); } public void testVersionCorrect4() throws ClassNotFoundException { // check it is 49.0 when -1.5 is specified runTest("simple - m"); - checkVersion("A", 49, 0); + checkVersion("A", Constants.MAJOR_1_5, 0); } // Check the stackmap stuff appears for methods in a Java6 file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc191/SanityTestsJava10.java b/tests/src/test/java/org/aspectj/systemtest/ajc191/SanityTestsJava10.java index d5505a252..5d5a04564 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc191/SanityTestsJava10.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc191/SanityTestsJava10.java @@ -7,6 +7,7 @@ *******************************************************************************/ package org.aspectj.systemtest.ajc191; +import org.aspectj.apache.bcel.Constants; import org.aspectj.testing.XMLBasedAjcTestCase; import junit.framework.Test; @@ -19,6 +20,7 @@ import junit.framework.Test; * @author Andy Clement */ public class SanityTestsJava10 extends org.aspectj.testing.XMLBasedAjcTestCase { + public static final int bytecode_version_for_JDK_level = Constants.MAJOR_10; // Incredibly trivial test programs that check the compiler works at all (these are easy-ish to debug) public void testSimpleJava_A() { @@ -59,17 +61,17 @@ public class SanityTestsJava10 extends org.aspectj.testing.XMLBasedAjcTestCase { public void testVersionCorrect1() throws ClassNotFoundException { runTest("simple - j"); - checkVersion("A", 54, 0); + checkVersion("A", bytecode_version_for_JDK_level, 0); } public void testVersionCorrect2() throws ClassNotFoundException { runTest("simple - k"); - checkVersion("A", 54, 0); + checkVersion("A", bytecode_version_for_JDK_level, 0); } public void testVersionCorrect4() throws ClassNotFoundException { // check it is 49.0 when -1.5 is specified runTest("simple - m"); - checkVersion("A", 49, 0); + checkVersion("A", Constants.MAJOR_1_5, 0); } // /////////////////////////////////////// diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1919/SanityTestsJava19.java b/tests/src/test/java/org/aspectj/systemtest/ajc1919/SanityTestsJava19.java index fa2abafe5..a8a3826ea 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc1919/SanityTestsJava19.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1919/SanityTestsJava19.java @@ -8,6 +8,7 @@ package org.aspectj.systemtest.ajc1919; import junit.framework.Test; +import org.aspectj.apache.bcel.Constants; import org.aspectj.testing.XMLBasedAjcTestCase; import org.aspectj.testing.XMLBasedAjcTestCaseForJava19OrLater; @@ -20,7 +21,7 @@ import org.aspectj.testing.XMLBasedAjcTestCaseForJava19OrLater; */ public class SanityTestsJava19 extends XMLBasedAjcTestCaseForJava19OrLater { - public static final int bytecode_version_for_JDK_level = 63; + public static final int bytecode_version_for_JDK_level = Constants.MAJOR_19; // Incredibly trivial test programs that check the compiler works at all (these are easy-ish to debug) public void testSimpleJava_A() { @@ -72,7 +73,7 @@ public class SanityTestsJava19 extends XMLBasedAjcTestCaseForJava19OrLater { public void testVersionCorrect4() { runTest("simple - m"); // Must be 49.0 when -1.5 is specified - checkVersion("A", 49, 0); + checkVersion("A", Constants.MAJOR_1_5, 0); } public static Test suite() { diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc192/SanityTestsJava11.java b/tests/src/test/java/org/aspectj/systemtest/ajc192/SanityTestsJava11.java index 329b3f880..b0f2cdb67 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc192/SanityTestsJava11.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc192/SanityTestsJava11.java @@ -7,6 +7,7 @@ *******************************************************************************/ package org.aspectj.systemtest.ajc192; +import org.aspectj.apache.bcel.Constants; import org.aspectj.testing.XMLBasedAjcTestCase; import org.aspectj.testing.XMLBasedAjcTestCaseForJava11OrLater; @@ -20,6 +21,7 @@ import junit.framework.Test; * @author Andy Clement */ public class SanityTestsJava11 extends XMLBasedAjcTestCaseForJava11OrLater { + public static final int bytecode_version_for_JDK_level = Constants.MAJOR_11; // Incredibly trivial test programs that check the compiler works at all (these are easy-ish to debug) public void testSimpleJava_A() { @@ -60,17 +62,17 @@ public class SanityTestsJava11 extends XMLBasedAjcTestCaseForJava11OrLater { public void testVersionCorrect1() throws ClassNotFoundException { runTest("simple - j"); - checkVersion("A", 55, 0); + checkVersion("A", bytecode_version_for_JDK_level, 0); } public void testVersionCorrect2() throws ClassNotFoundException { runTest("simple - k"); - checkVersion("A", 55, 0); + checkVersion("A", bytecode_version_for_JDK_level, 0); } public void testVersionCorrect4() throws ClassNotFoundException { // check it is 49.0 when -1.5 is specified runTest("simple - m"); - checkVersion("A", 49, 0); + checkVersion("A", Constants.MAJOR_1_5, 0); } diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1920/SanityTestsJava20.java b/tests/src/test/java/org/aspectj/systemtest/ajc1920/SanityTestsJava20.java index 09f52c1b7..88b9670e9 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc1920/SanityTestsJava20.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1920/SanityTestsJava20.java @@ -8,6 +8,7 @@ package org.aspectj.systemtest.ajc1920; import junit.framework.Test; +import org.aspectj.apache.bcel.Constants; import org.aspectj.testing.XMLBasedAjcTestCase; import org.aspectj.testing.XMLBasedAjcTestCaseForJava20OrLater; @@ -20,7 +21,7 @@ import org.aspectj.testing.XMLBasedAjcTestCaseForJava20OrLater; */ public class SanityTestsJava20 extends XMLBasedAjcTestCaseForJava20OrLater { - public static final int bytecode_version_for_JDK_level = 64; + public static final int bytecode_version_for_JDK_level = Constants.MAJOR_20; // Incredibly trivial test programs that check the compiler works at all (these are easy-ish to debug) public void testSimpleJava_A() { @@ -72,7 +73,7 @@ public class SanityTestsJava20 extends XMLBasedAjcTestCaseForJava20OrLater { public void testVersionCorrect4() { runTest("simple - m"); // Must be 49.0 when -1.5 is specified - checkVersion("A", 49, 0); + checkVersion("A", Constants.MAJOR_1_5, 0); } public static Test suite() { diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc195/SanityTestsJava13.java b/tests/src/test/java/org/aspectj/systemtest/ajc195/SanityTestsJava13.java index f8cffca69..54397cf2f 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc195/SanityTestsJava13.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc195/SanityTestsJava13.java @@ -7,6 +7,7 @@ *******************************************************************************/ package org.aspectj.systemtest.ajc195; +import org.aspectj.apache.bcel.Constants; import org.aspectj.testing.XMLBasedAjcTestCase; import org.aspectj.testing.XMLBasedAjcTestCaseForJava13OrLater; @@ -21,7 +22,7 @@ import junit.framework.Test; */ public class SanityTestsJava13 extends XMLBasedAjcTestCaseForJava13OrLater { - public static final int bytecode_version_for_JDK_level = 57; + public static final int bytecode_version_for_JDK_level = Constants.MAJOR_13; // Incredibly trivial test programs that check the compiler works at all (these are easy-ish to debug) public void testSimpleJava_A() { @@ -72,7 +73,7 @@ public class SanityTestsJava13 extends XMLBasedAjcTestCaseForJava13OrLater { public void testVersionCorrect4() throws ClassNotFoundException { // check it is 49.0 when -1.5 is specified runTest("simple - m"); - checkVersion("A", 49, 0); + checkVersion("A", Constants.MAJOR_1_5, 0); } 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 6857b4d8a..960ba4420 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc196/SanityTestsJava14.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc196/SanityTestsJava14.java @@ -7,6 +7,7 @@ *******************************************************************************/ package org.aspectj.systemtest.ajc196; +import org.aspectj.apache.bcel.Constants; import org.aspectj.testing.XMLBasedAjcTestCase; import org.aspectj.testing.XMLBasedAjcTestCaseForJava14OrLater; @@ -21,7 +22,7 @@ import junit.framework.Test; */ public class SanityTestsJava14 extends XMLBasedAjcTestCaseForJava14OrLater { - public static final int bytecode_version_for_JDK_level = 58; + public static final int bytecode_version_for_JDK_level = Constants.MAJOR_14; // Incredibly trivial test programs that check the compiler works at all (these are easy-ish to debug) public void testSimpleJava_A() { @@ -73,7 +74,7 @@ public class SanityTestsJava14 extends XMLBasedAjcTestCaseForJava14OrLater { public void testVersionCorrect4() { runTest("simple - m"); // Must be 49.0 when -1.5 is specified - checkVersion("A", 49, 0); + checkVersion("A", Constants.MAJOR_1_5, 0); } public static Test 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 index 9622e7364..a7ee41d5f 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc197/SanityTestsJava15.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc197/SanityTestsJava15.java @@ -8,6 +8,7 @@ package org.aspectj.systemtest.ajc197; import junit.framework.Test; +import org.aspectj.apache.bcel.Constants; import org.aspectj.testing.XMLBasedAjcTestCase; import org.aspectj.testing.XMLBasedAjcTestCaseForJava15OrLater; @@ -20,7 +21,7 @@ import org.aspectj.testing.XMLBasedAjcTestCaseForJava15OrLater; */ public class SanityTestsJava15 extends XMLBasedAjcTestCaseForJava15OrLater { - public static final int bytecode_version_for_JDK_level = 59; + public static final int bytecode_version_for_JDK_level = Constants.MAJOR_15; // Incredibly trivial test programs that check the compiler works at all (these are easy-ish to debug) public void testSimpleJava_A() { @@ -72,7 +73,7 @@ public class SanityTestsJava15 extends XMLBasedAjcTestCaseForJava15OrLater { public void testVersionCorrect4() { runTest("simple - m"); // Must be 49.0 when -1.5 is specified - checkVersion("A", 49, 0); + checkVersion("A", Constants.MAJOR_1_5, 0); } public static Test suite() { diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc197/SanityTestsJava16.java b/tests/src/test/java/org/aspectj/systemtest/ajc197/SanityTestsJava16.java index 52950b4dd..185660b15 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc197/SanityTestsJava16.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc197/SanityTestsJava16.java @@ -8,6 +8,7 @@ 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; @@ -20,7 +21,7 @@ import org.aspectj.testing.XMLBasedAjcTestCaseForJava16OrLater; */ public class SanityTestsJava16 extends XMLBasedAjcTestCaseForJava16OrLater { - public static final int bytecode_version_for_JDK_level = 60; + public static final int bytecode_version_for_JDK_level = Constants.MAJOR_16; // Incredibly trivial test programs that check the compiler works at all (these are easy-ish to debug) public void testSimpleJava_A() { @@ -72,7 +73,7 @@ public class SanityTestsJava16 extends XMLBasedAjcTestCaseForJava16OrLater { public void testVersionCorrect4() { runTest("simple - m"); // Must be 49.0 when -1.5 is specified - checkVersion("A", 49, 0); + checkVersion("A", Constants.MAJOR_1_5, 0); } public static Test suite() { diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc198/SanityTestsJava17.java b/tests/src/test/java/org/aspectj/systemtest/ajc198/SanityTestsJava17.java index 0769be83b..a9c247dad 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc198/SanityTestsJava17.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc198/SanityTestsJava17.java @@ -8,6 +8,7 @@ package org.aspectj.systemtest.ajc198; import junit.framework.Test; +import org.aspectj.apache.bcel.Constants; import org.aspectj.testing.XMLBasedAjcTestCase; import org.aspectj.testing.XMLBasedAjcTestCaseForJava17OrLater; @@ -20,7 +21,7 @@ import org.aspectj.testing.XMLBasedAjcTestCaseForJava17OrLater; */ public class SanityTestsJava17 extends XMLBasedAjcTestCaseForJava17OrLater { - public static final int bytecode_version_for_JDK_level = 61; + public static final int bytecode_version_for_JDK_level = Constants.MAJOR_17; // Incredibly trivial test programs that check the compiler works at all (these are easy-ish to debug) public void testSimpleJava_A() { @@ -72,7 +73,7 @@ public class SanityTestsJava17 extends XMLBasedAjcTestCaseForJava17OrLater { public void testVersionCorrect4() { runTest("simple - m"); // Must be 49.0 when -1.5 is specified - checkVersion("A", 49, 0); + checkVersion("A", Constants.MAJOR_1_5, 0); } public static Test suite() { diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc199/SanityTestsJava18.java b/tests/src/test/java/org/aspectj/systemtest/ajc199/SanityTestsJava18.java index 2fd9d2660..a4c8ee9e2 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc199/SanityTestsJava18.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc199/SanityTestsJava18.java @@ -8,6 +8,7 @@ package org.aspectj.systemtest.ajc199; import junit.framework.Test; +import org.aspectj.apache.bcel.Constants; import org.aspectj.testing.XMLBasedAjcTestCase; import org.aspectj.testing.XMLBasedAjcTestCaseForJava18OrLater; @@ -20,7 +21,7 @@ import org.aspectj.testing.XMLBasedAjcTestCaseForJava18OrLater; */ public class SanityTestsJava18 extends XMLBasedAjcTestCaseForJava18OrLater { - public static final int bytecode_version_for_JDK_level = 62; + public static final int bytecode_version_for_JDK_level = Constants.MAJOR_18; // Incredibly trivial test programs that check the compiler works at all (these are easy-ish to debug) public void testSimpleJava_A() { @@ -72,7 +73,7 @@ public class SanityTestsJava18 extends XMLBasedAjcTestCaseForJava18OrLater { public void testVersionCorrect4() { runTest("simple - m"); // Must be 49.0 when -1.5 is specified - checkVersion("A", 49, 0); + checkVersion("A", Constants.MAJOR_1_5, 0); } public static Test suite() { |