diff options
author | acolyer <acolyer> | 2005-09-26 15:05:01 +0000 |
---|---|---|
committer | acolyer <acolyer> | 2005-09-26 15:05:01 +0000 |
commit | d485f9bcc4df37aef60863fceb88654bbd32b680 (patch) | |
tree | 1341f68a69f16d1a6b0f86d840ee8a5553c8d091 /bridge/testsrc | |
parent | 4afdcf2612e94ce3c07ab0db5b20ea73134ac632 (diff) | |
download | aspectj-d485f9bcc4df37aef60863fceb88654bbd32b680.tar.gz aspectj-d485f9bcc4df37aef60863fceb88654bbd32b680.zip |
fix for pr108123 and pr106500 - better diagnostics and exceptions, plus support for -Xdev:Pinpoint
Diffstat (limited to 'bridge/testsrc')
-rw-r--r-- | bridge/testsrc/BridgeModuleTests.java | 3 | ||||
-rw-r--r-- | bridge/testsrc/org/aspectj/bridge/context/CompilationAndWeavingContextTest.java | 67 |
2 files changed, 70 insertions, 0 deletions
diff --git a/bridge/testsrc/BridgeModuleTests.java b/bridge/testsrc/BridgeModuleTests.java index e0049f863..23e28ea60 100644 --- a/bridge/testsrc/BridgeModuleTests.java +++ b/bridge/testsrc/BridgeModuleTests.java @@ -14,6 +14,8 @@ // default package +import org.aspectj.bridge.context.CompilationAndWeavingContextTest; + import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; @@ -23,6 +25,7 @@ public class BridgeModuleTests extends TestCase { public static Test suite() { TestSuite suite = new TestSuite(BridgeModuleTests.class.getName()); suite.addTest(org.aspectj.bridge.BridgeTests.suite()); + suite.addTestSuite(CompilationAndWeavingContextTest.class); return suite; } diff --git a/bridge/testsrc/org/aspectj/bridge/context/CompilationAndWeavingContextTest.java b/bridge/testsrc/org/aspectj/bridge/context/CompilationAndWeavingContextTest.java new file mode 100644 index 000000000..6e8c73e22 --- /dev/null +++ b/bridge/testsrc/org/aspectj/bridge/context/CompilationAndWeavingContextTest.java @@ -0,0 +1,67 @@ +/* ******************************************************************* + * Copyright (c) 2005 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://eclipse.org/legal/epl-v10.html + * + * Contributors: + * Adrian Colyer Initial implementation + * ******************************************************************/ +package org.aspectj.bridge.context; + +import junit.framework.TestCase; + +/** + * @author colyer + * + */ +public class CompilationAndWeavingContextTest extends TestCase { + + public void testEnteringPhase() { + CompilationAndWeavingContext.enteringPhase(1,"XYZ"); + assertEquals("when fiddling XYZ\n",CompilationAndWeavingContext.getCurrentContext()); + } + + public void testDoubleEntry() { + CompilationAndWeavingContext.enteringPhase(1,"XYZ"); + CompilationAndWeavingContext.enteringPhase(2, "ABC"); + assertEquals("when fiddling XYZ\nwhen mucking about with ABC\n",CompilationAndWeavingContext.getCurrentContext()); + } + + public void testEntryEntryExit() { + CompilationAndWeavingContext.enteringPhase(1,"XYZ"); + ContextToken ct = CompilationAndWeavingContext.enteringPhase(2, "ABC"); + CompilationAndWeavingContext.leavingPhase(ct); + assertEquals("when fiddling XYZ\n",CompilationAndWeavingContext.getCurrentContext()); + } + + public void testEntryExitTop() { + ContextToken ct = CompilationAndWeavingContext.enteringPhase(1,"XYZ"); + CompilationAndWeavingContext.enteringPhase(2, "ABC"); + CompilationAndWeavingContext.leavingPhase(ct); + assertEquals("",CompilationAndWeavingContext.getCurrentContext()); + } + + + protected void setUp() throws Exception { + CompilationAndWeavingContext.reset(); + CompilationAndWeavingContext.registerFormatter(1, new MyContextFormatter("fiddling ")); + CompilationAndWeavingContext.registerFormatter(2, new MyContextFormatter("mucking about with ")); + } + + private static class MyContextFormatter implements ContextFormatter { + + private String prefix; + + public MyContextFormatter(String prefix) { + this.prefix = prefix; + } + + public String formatEntry(int phaseId, Object data) { + return prefix + data.toString(); + } + + } +} |