Browse Source

Beautify sanity tests using bytecode level constants

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
tags/V1_9_21_M1
Alexander Kriegisch 7 months ago
parent
commit
3533dcd043

+ 6
- 4
tests/src/test/java/org/aspectj/systemtest/ajc160/SanityTests.java View File

@@ -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

+ 5
- 3
tests/src/test/java/org/aspectj/systemtest/ajc190/SanityTests19.java View File

@@ -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

+ 5
- 3
tests/src/test/java/org/aspectj/systemtest/ajc191/SanityTestsJava10.java View File

@@ -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);
}

// ///////////////////////////////////////

+ 3
- 2
tests/src/test/java/org/aspectj/systemtest/ajc1919/SanityTestsJava19.java View File

@@ -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() {

+ 5
- 3
tests/src/test/java/org/aspectj/systemtest/ajc192/SanityTestsJava11.java View File

@@ -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);
}



+ 3
- 2
tests/src/test/java/org/aspectj/systemtest/ajc1920/SanityTestsJava20.java View File

@@ -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() {

+ 3
- 2
tests/src/test/java/org/aspectj/systemtest/ajc195/SanityTestsJava13.java View File

@@ -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);
}



+ 3
- 2
tests/src/test/java/org/aspectj/systemtest/ajc196/SanityTestsJava14.java View File

@@ -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() {

+ 3
- 2
tests/src/test/java/org/aspectj/systemtest/ajc197/SanityTestsJava15.java View File

@@ -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() {

+ 3
- 2
tests/src/test/java/org/aspectj/systemtest/ajc197/SanityTestsJava16.java View File

@@ -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() {

+ 3
- 2
tests/src/test/java/org/aspectj/systemtest/ajc198/SanityTestsJava17.java View File

@@ -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() {

+ 3
- 2
tests/src/test/java/org/aspectj/systemtest/ajc199/SanityTestsJava18.java View File

@@ -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() {

Loading…
Cancel
Save