From 10c6de6fbc8a0b9eb07801f4ac19bea8304a9cb3 Mon Sep 17 00:00:00 2001 From: acolyer Date: Wed, 28 Jul 2004 15:13:09 +0000 Subject: fix for Bugzilla Bug 48990 Special case if(false) to not require a dynamic test --- tests/ajcTests.xml | 12 ++++++++++++ tests/new/IfFalse.aj | 37 +++++++++++++++++++++++++++++++++++++ tests/new/IfTrue.aj | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+) create mode 100644 tests/new/IfFalse.aj create mode 100644 tests/new/IfTrue.aj (limited to 'tests') diff --git a/tests/ajcTests.xml b/tests/ajcTests.xml index f76405da3..96bdd14c5 100644 --- a/tests/ajcTests.xml +++ b/tests/ajcTests.xml @@ -7794,6 +7794,18 @@ text="void Subclass.nonstaticMethod() cannot override void Superclass.nonstaticMethod(); overriding method is static"/> + + + + + + + + + + diff --git a/tests/new/IfFalse.aj b/tests/new/IfFalse.aj new file mode 100644 index 000000000..6b1b8d402 --- /dev/null +++ b/tests/new/IfFalse.aj @@ -0,0 +1,37 @@ +import org.aspectj.testing.Tester; + +public aspect IfFalse { + + private static boolean x = false; + + pointcut p1() : if(false); + + pointcut p2() : if( false ); + + pointcut p3() : if(x); + + pointcut p4() : within(IfFalse) && if(false); + + + after() returning : p1() { + // should never get here + Tester.checkFailed("if(false) matched!"); + } + + after() returning : p2() { + // should never get here + Tester.checkFailed("if( false ) matched!"); + } + + after() returning : p3() { + // should never get here + Tester.checkFailed("if(x) matched!"); + } + + after() returning : p4() { + // should never get here + Tester.checkFailed("if(false) matched!"); + } + + public static void main(String[] args) {} +} \ No newline at end of file diff --git a/tests/new/IfTrue.aj b/tests/new/IfTrue.aj new file mode 100644 index 000000000..afbbdb48f --- /dev/null +++ b/tests/new/IfTrue.aj @@ -0,0 +1,37 @@ +import org.aspectj.testing.Tester; + +public aspect IfTrue { + + private static boolean x = true; + + pointcut p1() : !if(true); + + pointcut p2() : !if( true ); + + pointcut p3() : !if(x) && execution(* *(..)); + + pointcut p4() : within(IfTrue) && !if(true); + + + after() returning : p1() { + // should never get here + Tester.checkFailed("!if(true) matched!"); + } + + after() returning : p2() { + // should never get here + Tester.checkFailed("!if( true ) matched!"); + } + + after() returning : p3() { + // should never get here + Tester.checkFailed("!if(x) matched!"); + } + + after() returning : p4() { + // should never get here + Tester.checkFailed("!if(true) matched!"); + } + + public static void main(String[] args) {} +} \ No newline at end of file -- cgit v1.2.3