diff options
author | Andy Clement <aclement@pivotal.io> | 2018-04-20 09:45:31 -0700 |
---|---|---|
committer | Andy Clement <aclement@pivotal.io> | 2018-04-20 09:45:31 -0700 |
commit | 3876a7dfcc371e3be43276c58bb792a09ed23c40 (patch) | |
tree | d29e000aaa7ee58a7575ab4c02331b35dd955273 /tests | |
parent | 836beab108ef4be8b59c1ad9c8596ce959bdf1c7 (diff) | |
download | aspectj-3876a7dfcc371e3be43276c58bb792a09ed23c40.tar.gz aspectj-3876a7dfcc371e3be43276c58bb792a09ed23c40.zip |
Working towards 1.9.1V1_9_1
Diffstat (limited to 'tests')
5 files changed, 172 insertions, 1 deletions
diff --git a/tests/src/org/aspectj/systemtest/AllTests19.java b/tests/src/org/aspectj/systemtest/AllTests19.java index 4835a6154..8cb86d449 100644 --- a/tests/src/org/aspectj/systemtest/AllTests19.java +++ b/tests/src/org/aspectj/systemtest/AllTests19.java @@ -11,6 +11,7 @@ package org.aspectj.systemtest; import org.aspectj.systemtest.ajc190.AllTestsAspectJ190; +import org.aspectj.systemtest.ajc191.AllTestsAspectJ191; import junit.framework.Test; import junit.framework.TestSuite; @@ -21,6 +22,7 @@ public class AllTests19 { TestSuite suite = new TestSuite("AspectJ System Test Suite - 1.9"); // $JUnit-BEGIN$ suite.addTest(AllTestsAspectJ190.suite()); + suite.addTest(AllTestsAspectJ191.suite()); suite.addTest(AllTests18.suite()); // $JUnit-END$ return suite; diff --git a/tests/src/org/aspectj/systemtest/ajc191/AllTestsAspectJ191.java b/tests/src/org/aspectj/systemtest/ajc191/AllTestsAspectJ191.java index a42ad5b4c..8588b845b 100644 --- a/tests/src/org/aspectj/systemtest/ajc191/AllTestsAspectJ191.java +++ b/tests/src/org/aspectj/systemtest/ajc191/AllTestsAspectJ191.java @@ -19,6 +19,7 @@ public class AllTestsAspectJ191 { TestSuite suite = new TestSuite("AspectJ 1.9.1 tests"); // $JUnit-BEGIN$ suite.addTest(Ajc191Tests.suite()); + suite.addTest(SanityTestsJava10.suite()); // $JUnit-END$ return suite; } diff --git a/tests/src/org/aspectj/systemtest/ajc191/SanityTestsJava10.java b/tests/src/org/aspectj/systemtest/ajc191/SanityTestsJava10.java new file mode 100644 index 000000000..f4b8f3698 --- /dev/null +++ b/tests/src/org/aspectj/systemtest/ajc191/SanityTestsJava10.java @@ -0,0 +1,98 @@ +/******************************************************************************* + * Copyright (c) 2006, 2081 IBM and 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.ajc191; + +import java.io.File; + +import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.testing.XMLBasedAjcTestCase; + +import junit.framework.Test; + +/* + * 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 Andy Clement + */ +public class SanityTestsJava10 extends org.aspectj.testing.XMLBasedAjcTestCase { + + // 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() throws ClassNotFoundException { + runTest("simple - j"); + checkVersion("A", 54, 0); + } + + public void testVersionCorrect2() throws ClassNotFoundException { + runTest("simple - k"); + checkVersion("A", 54, 0); + } + + public void testVersionCorrect4() throws ClassNotFoundException { // check it is 49.0 when -1.5 is specified + runTest("simple - m"); + 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); + } + + @Override + protected File getSpecFile() { + return getClassResource("sanity-tests-10.xml"); + } + +} diff --git a/tests/src/org/aspectj/systemtest/ajc191/ajc191.xml b/tests/src/org/aspectj/systemtest/ajc191/ajc191.xml index ab14b9e73..3a87375e9 100644 --- a/tests/src/org/aspectj/systemtest/ajc191/ajc191.xml +++ b/tests/src/org/aspectj/systemtest/ajc191/ajc191.xml @@ -28,7 +28,7 @@ <run class="Code3"> <stdout> <line text="call(Class java.lang.Object.getClass())"/> - <line text="class java.util.ArrayList"/> + <line text="class java.lang.String"/> </stdout> </run> </ajc-test> diff --git a/tests/src/org/aspectj/systemtest/ajc191/sanity-tests-10.xml b/tests/src/org/aspectj/systemtest/ajc191/sanity-tests-10.xml new file mode 100644 index 000000000..a6bdbd938 --- /dev/null +++ b/tests/src/org/aspectj/systemtest/ajc191/sanity-tests-10.xml @@ -0,0 +1,70 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<!-- AspectJ v1.6.0 Tests --> +<suite> + + <!-- empty class --> + <ajc-test dir="bugs160/simplejava" title="simple - a"> + <compile files="SimpleA.java" options="-10"/> + </ajc-test> + + <!-- class with one method --> + <ajc-test dir="bugs160/simplejava" title="simple - b"> + <compile files="SimpleB.java" options="-10"/> + <run class="SimpleB"/> + </ajc-test> + + <!-- empty aspect --> + <ajc-test dir="bugs160/simplejava" title="simple - c"> + <compile files="SimpleC.java" options="-10"/> + </ajc-test> + + <!-- simple before --> + <ajc-test dir="bugs160/simplejava" title="simple - d"> + <compile files="SimpleD.java" options="-10"/> + </ajc-test> + + <!-- simple itd field --> + <ajc-test dir="bugs160/simplejava" title="simple - e"> + <compile files="SimpleE.java" options="-10"/> + </ajc-test> + + <!-- aspect with main calling a static method --> + <ajc-test dir="bugs160/simplejava" title="simple - f"> + <compile files="SimpleF.java" options="-10"/> + </ajc-test> + + <!-- pertarget --> + <ajc-test dir="bugs160/simplejava" title="simple - g"> + <compile files="SimpleG.java" options="-10"/> + </ajc-test> + + <!-- generic ctor itds --> + <ajc-test dir="bugs160/simplejava" title="simple - h"> + <compile files="SimpleH.java" options="-10"/> + </ajc-test> + + <!-- overriding generic itd methods --> + <ajc-test dir="bugs160/simplejava" title="simple - i"> + <compile files="SimpleI.java" options="-10"/> + </ajc-test> + + <!-- check class file version is 54.0 --> + <ajc-test dir="bugs160/simplejava" title="simple - j"> + <compile files="SimpleJ.java" options="-10"/> + </ajc-test> + + <!-- check class file version is 54.0 --> + <ajc-test dir="bugs160/simplejava" title="simple - k"> + <compile files="SimpleJ.java" options="-source 10"/> + </ajc-test> + + <!-- check class file version is 49.0 --> + <ajc-test dir="bugs160/simplejava" title="simple - m"> + <compile files="SimpleJ.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs160/simplejava" title="simple - n"> + <compile files="SimpleN.java" options="-10"/> + </ajc-test> +</suite> |