diff options
author | Andy Clement <aclement@pivotal.io> | 2019-04-03 10:23:44 -0700 |
---|---|---|
committer | Andy Clement <aclement@pivotal.io> | 2019-04-03 10:23:44 -0700 |
commit | 0e2c95a36900fe913f5d768e7f4632034ddf005b (patch) | |
tree | f7f1bb92dfbae87de0a8998491e863490984aa0a /tests/src | |
parent | dbb2c59fcfa6837f1fde9e0c1f0d04751c9268ee (diff) | |
download | aspectj-0e2c95a36900fe913f5d768e7f4632034ddf005b.tar.gz aspectj-0e2c95a36900fe913f5d768e7f4632034ddf005b.zip |
Updated with Java12 support
Diffstat (limited to 'tests/src')
9 files changed, 94 insertions, 59 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 157fdc6ce..9bdb68665 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc160/SanityTests.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc160/SanityTests.java @@ -10,16 +10,14 @@ *******************************************************************************/ package org.aspectj.systemtest.ajc160; -import java.io.File; - -import junit.framework.Test; - import org.aspectj.apache.bcel.classfile.Attribute; import org.aspectj.apache.bcel.classfile.Code; import org.aspectj.apache.bcel.classfile.JavaClass; import org.aspectj.apache.bcel.classfile.Method; import org.aspectj.testing.XMLBasedAjcTestCase; +import junit.framework.Test; + /* * Some very trivial tests that help verify things are OK. * Followed by some Java6 specific checks to ensure the class files are well formed. @@ -136,16 +134,6 @@ public class SanityTests extends org.aspectj.testing.XMLBasedAjcTestCase { return false; } - private void checkVersion(String classname, int major, int minor) throws ClassNotFoundException { - JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), classname); - if (jc.getMajor() != major) { - fail("Expected major version to be " + major + " but was " + jc.getMajor()); - } - if (jc.getMinor() != minor) { - fail("Expected minor version to be " + minor + " but was " + jc.getMinor()); - } - } - // Check the stackmap stuff is removed when a method gets woven (for now...) // public void testStackMapAttributesDeletedInWovenCode() { // fail("Not implemented"); diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc190/ModuleTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc190/ModuleTests.java index 8cdf93597..ac5eb14e4 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc190/ModuleTests.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc190/ModuleTests.java @@ -149,16 +149,6 @@ public class ModuleTests extends XMLBasedAjcTestCaseForJava9OrLater { return false; } - private void checkVersion(String classname, int major, int minor) throws ClassNotFoundException { - JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), classname); - if (jc.getMajor() != major) { - fail("Expected major version to be " + major + " but was " + jc.getMajor()); - } - if (jc.getMinor() != minor) { - fail("Expected minor version to be " + minor + " but was " + jc.getMinor()); - } - } - // Check the stackmap stuff is removed when a method gets woven (for now...) // public void testStackMapAttributesDeletedInWovenCode() { // fail("Not implemented"); 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 edb45c513..46aaddff1 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc190/SanityTests19.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc190/SanityTests19.java @@ -10,7 +10,6 @@ *******************************************************************************/ package org.aspectj.systemtest.ajc190; -import org.aspectj.apache.bcel.classfile.JavaClass; import org.aspectj.testing.XMLBasedAjcTestCase; import junit.framework.Test; @@ -124,16 +123,6 @@ public class SanityTests19 extends org.aspectj.testing.XMLBasedAjcTestCase { // return false; // } - private void checkVersion(String classname, int major, int minor) throws ClassNotFoundException { - JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), classname); - if (jc.getMajor() != major) { - fail("Expected major version to be " + major + " but was " + jc.getMajor()); - } - if (jc.getMinor() != minor) { - fail("Expected minor version to be " + minor + " but was " + jc.getMinor()); - } - } - // Check the stackmap stuff is removed when a method gets woven (for now...) // public void testStackMapAttributesDeletedInWovenCode() { // fail("Not implemented"); 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 87d8b932a..c6d4bc86e 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc191/SanityTestsJava10.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc191/SanityTestsJava10.java @@ -7,7 +7,6 @@ *******************************************************************************/ package org.aspectj.systemtest.ajc191; -import org.aspectj.apache.bcel.classfile.JavaClass; import org.aspectj.testing.XMLBasedAjcTestCase; import junit.framework.Test; @@ -73,16 +72,6 @@ public class SanityTestsJava10 extends org.aspectj.testing.XMLBasedAjcTestCase { checkVersion("A", 49, 0); } - private void checkVersion(String classname, int major, int minor) throws ClassNotFoundException { - JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), classname); - if (jc.getMajor() != major) { - fail("Expected major version to be " + major + " but was " + jc.getMajor()); - } - if (jc.getMinor() != minor) { - fail("Expected minor version to be " + minor + " but was " + jc.getMinor()); - } - } - // /////////////////////////////////////// public static Test suite() { return XMLBasedAjcTestCase.loadSuite(SanityTestsJava10.class); 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 33a5affe6..0506f90a1 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc192/SanityTestsJava11.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc192/SanityTestsJava11.java @@ -74,15 +74,6 @@ public class SanityTestsJava11 extends XMLBasedAjcTestCaseForJava11OrLater { checkVersion("A", 49, 0); } - private void checkVersion(String classname, int major, int minor) throws ClassNotFoundException { - JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), classname); - if (jc.getMajor() != major) { - fail("Expected major version to be " + major + " but was " + jc.getMajor()); - } - if (jc.getMinor() != minor) { - fail("Expected minor version to be " + minor + " but was " + jc.getMinor()); - } - } // /////////////////////////////////////// public static Test suite() { diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc193/AllTestsAspectJ193.java b/tests/src/test/java/org/aspectj/systemtest/ajc193/AllTestsAspectJ193.java index 62cfcccb2..ddd88372d 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc193/AllTestsAspectJ193.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc193/AllTestsAspectJ193.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018 Contributors + * Copyright (c) 2018-2019 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 @@ -17,9 +17,8 @@ public class AllTestsAspectJ193 { public static Test suite() { TestSuite suite = new TestSuite("AspectJ 1.9.3 tests"); - // $JUnit-BEGIN$ suite.addTest(Ajc193Tests.suite()); - // $JUnit-END$ + suite.addTest(Java12Tests.suite()); return suite; } } diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc193/Java12Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc193/Java12Tests.java new file mode 100644 index 000000000..72388ba68 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc193/Java12Tests.java @@ -0,0 +1,46 @@ +/******************************************************************************* + * Copyright (c) 2019 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.ajc193; + +import org.aspectj.apache.bcel.Constants; +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.testing.XMLBasedAjcTestCaseForJava12OrLater; + +import junit.framework.Test; + +/** + * @author Andy Clement + */ +public class Java12Tests extends XMLBasedAjcTestCaseForJava12OrLater { + + public void testSwitch1() { + runTest("switch 1"); + checkVersion("Switch1", Constants.MAJOR_12, Constants.PREVIEW_MINOR_VERSION); + } + + public void testSwitch2() { + runTest("switch 2"); + checkVersion("Switch2", Constants.MAJOR_12, Constants.PREVIEW_MINOR_VERSION); + } + + public void testSwitch3() { + runTest("switch 3"); + checkVersion("Switch3", Constants.MAJOR_12, Constants.PREVIEW_MINOR_VERSION); + } + // --- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Java12Tests.class); + } + + @Override + protected java.net.URL getSpecFile() { + return getClassResource("ajc193.xml"); + } + +} diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc190/ajc190.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc190/ajc190.xml index 2936888cb..5a3dec730 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc190/ajc190.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc190/ajc190.xml @@ -111,8 +111,12 @@ <!-- this fails because if you start working with modules you commit to the modules story and classpath becomes irrelevant --> <compile files="module-info.java aaa/bbb/A.java" options="-1.9" outjar="module.jar" classpath="foo.jar"> - <message kind="error" text="The import ddd cannot be resolved"/> + <message kind="error" text="The type ddd.D is not accessible"/> <message kind="error" text="D cannot be resolved"/> + <!-- + <message kind="error" text="The import ddd cannot be resolved"/> + <message kind="error" text="package ddd is not visible"/> + --> </compile> </ajc-test> diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc193/ajc193.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc193/ajc193.xml index 2a4be40f8..c13159c30 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc193/ajc193.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc193/ajc193.xml @@ -51,6 +51,45 @@ Method call </run> </ajc-test> + <ajc-test dir="features193" vm="12" title="switch 1"> + <compile files="Switch1.java" options="-12 --enable-preview"> + </compile> + <run class="Switch1" vmargs="--enable-preview"> + <stdout> + <line text="0"/> + <line text="1"/> + <line text="2"/> + <line text="3"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features193" vm="12" title="switch 2"> + <compile files="Switch2.java" options="--enable-preview -source 12"> + </compile> + <run class="Switch2" vmargs="--enable-preview"> + <stdout> + <line text="0"/> + <line text="2"/> + <line text="4"/> + <line text="6"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features193" vm="12" title="switch 3"> + <compile files="Switch3.java" options="--enable-preview -source 12"> + </compile> + <run class="Switch3" vmargs="--enable-preview"> + <stdout> + <line text="3"/> + <line text="6"/> + <line text="9"/> + <line text="12"/> + </stdout> + </run> + </ajc-test> + <ajc-test dir="bugs193/543657" vm="1.8" title="overweaving decm - reweaving"> <compile files="MoodIndicator.java,Code1.java" options="-showWeaveInfo -1.8" outjar="one.jar"> <message kind="weave" text="Mixing interface 'MoodIndicator$Moody' (MoodIndicator.java) into type 'Code1' (Code1.java)"/> |