From 2b24e7377da7c849fe7f9f4fa06a701664f9d27d Mon Sep 17 00:00:00 2001 From: Andy Clement Date: Wed, 30 Jan 2019 16:55:38 -0800 Subject: mavenizing tests - wip --- .../org/aspectj/systemtest/xlint/XLint5Tests.java | 36 +++ .../org/aspectj/systemtest/xlint/XLintTests.java | 169 +++++++++++++ .../org/aspectj/systemtest/xlint/xlint-tests.xml | 267 +++++++++++++++++++++ .../java/org/aspectj/systemtest/xlint/xlint.xml | 10 + 4 files changed, 482 insertions(+) create mode 100644 tests/src/test/java/org/aspectj/systemtest/xlint/XLint5Tests.java create mode 100644 tests/src/test/java/org/aspectj/systemtest/xlint/XLintTests.java create mode 100644 tests/src/test/java/org/aspectj/systemtest/xlint/xlint-tests.xml create mode 100644 tests/src/test/java/org/aspectj/systemtest/xlint/xlint.xml (limited to 'tests/src/test/java/org/aspectj/systemtest/xlint') diff --git a/tests/src/test/java/org/aspectj/systemtest/xlint/XLint5Tests.java b/tests/src/test/java/org/aspectj/systemtest/xlint/XLint5Tests.java new file mode 100644 index 000000000..35e5b05ca --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/xlint/XLint5Tests.java @@ -0,0 +1,36 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM + * 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 + * + * Contributors: + * Matthew Webster Move Java 5 dependent tests + *******************************************************************************/ +package org.aspectj.systemtest.xlint; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class XLint5Tests extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(XLint5Tests.class); + } + + protected File getSpecFile() { + return getClassResource("xlint.xml"); + } + + public void testBug99136(){ + runTest("Two Xlint warnings wth cflow?"); + if(ajc.getLastCompilationResult().getWarningMessages().size() != 1){ + fail(); + } + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/xlint/XLintTests.java b/tests/src/test/java/org/aspectj/systemtest/xlint/XLintTests.java new file mode 100644 index 000000000..c5a2b7fdf --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/xlint/XLintTests.java @@ -0,0 +1,169 @@ +/* ******************************************************************* + * Copyright (c) 2004 IBM Corporation + * 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.xlint; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.weaver.bcel.BcelShadow; + +public class XLintTests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(XLintTests.class); + } + + protected File getSpecFile() { + return getClassResource("xlint.xml"); + } + + + public void test001(){ + runTest("options -Xlint args()"); + } + + public void test002(){ + runTest("options declare field on bad type"); + } + + public void test003(){ + runTest("options declare method on bad type"); + } + + public void test004(){ + runTest("options -Xlint declare parent"); + } + + public void test005(){ + runTest("options -Xlint target()"); + } + + public void test006(){ + runTest("options -Xlint this()"); + } + + public void test007(){ + runTest("options negative -Xlint args()"); + } + + public void test008(){ + runTest("options negative -Xlint declare parent"); + } + + public void test009(){ + runTest("options negative -Xlint target()"); + } + + public void test010(){ + runTest("options negative -Xlint this()"); + } + + public void test011(){ + runTest("unmatched type name in a declare parents should result in a warning in -Xlint mode"); + } + + public void test012(){ + runTest("privileged access to code outside the control of the compiler"); + } + + public void test013(){ + runTest("Unexpected Xlint:unresolvableMember warning with withincode"); + } + + public void test014(){ + runTest("valid XLintWarningTest file, default level of warning"); + } + + public void test015(){ + runTest("XLint:ignore suppresses XLint warnings"); + } + + public void test016(){ + runTest("XLint:error promotes XLint warnings to error"); + } + + public void test017(){ + runTest("alias getCause for getWrappedThrowable in SoftException"); + } + +// public void test018(){ +// runTest("XLint warning for call PCD's using subtype of defining type"); +// } + + public void test019(){ + runTest("XLint warning for call PCD's using subtype of defining type (-1.3 -Xlint:ignore)"); + } + + + // the following five tests check various scenarios around the lazyTjp XLint message + public void test020(){ + runTest("no XLint warning: thisJoinPoint potentially lazy and nothing stopping it"); + assertTrue("Something prevented the lazytjp optimization from working??",BcelShadow.appliedLazyTjpOptimization); + } + + public void test021(){ + runTest("XLint warning: thisJoinPoint potentially lazy but stopped by around advice which doesn't use tjp"); + assertFalse("lazytjp optimization should have failed to be applied because of around advice at the jp", + BcelShadow.appliedLazyTjpOptimization); + } + + public void test022(){ + runTest("no XLint warning: thisJoinPoint not lazy (no if PCD) but would have been stopped anyway by around advice"); + assertFalse("lazytjp optimization should have failed to be applied because of around advice *and* before advice has no if() at the jp", + BcelShadow.appliedLazyTjpOptimization); + } + + public void test023(){ + runTest("no XLint warning: thisJoinPoint cannot be built lazily"); + assertFalse("lazytjp optimization should have failed to be applied because before advice has no if() at the jp", + BcelShadow.appliedLazyTjpOptimization); + } + + public void test024(){ + runTest("XLint warning: thisJoinPoint potentially lazy but stopped by around advice which uses tjp"); + assertFalse("lazytjp optimization should have failed to be applied because around advice uses tjp", + BcelShadow.appliedLazyTjpOptimization); + } + + public void test025(){ + runTest("check for xlazytjp warning if actually supplied"); + assertTrue("Something prevented the lazytjp optimization from working??",BcelShadow.appliedLazyTjpOptimization); + } + + public void test026(){ + runTest("lazytjp: warning when around advice uses tjp"); + } + + public void test027() { + runTest("lazytjp: warning when if missing on before advice"); + } + + public void test028() { + runTest("lazytjp: warning when if missing on after advice"); + } + + public void test029() { + runTest("lazytjp: multiple clashing advice preventing lazytjp"); + } + + public void test030() { + runTest("lazytjp: interfering before and around"); + } + + // FIXME asc put this back in ! +// public void test031() { +// if (is15VMOrGreater) +// runTest("7 lint warnings"); +// } + +} + diff --git a/tests/src/test/java/org/aspectj/systemtest/xlint/xlint-tests.xml b/tests/src/test/java/org/aspectj/systemtest/xlint/xlint-tests.xml new file mode 100644 index 000000000..4bbf23841 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/xlint/xlint-tests.xml @@ -0,0 +1,267 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/xlint/xlint.xml b/tests/src/test/java/org/aspectj/systemtest/xlint/xlint.xml new file mode 100644 index 000000000..efe2a0014 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/xlint/xlint.xml @@ -0,0 +1,10 @@ + +]> + + + + +&tests; + + \ No newline at end of file -- cgit v1.2.3