adammurdoch 2002/06/25 04:19:07
Modified: framework/src/test/org/apache/myrmidon/framework
ExpectOutputTask.java ExpectOutputTaskTestCase.java
expect-output.ant
Log:
Added 'absolute-path' attribute to <expect-output>. Allows the task paths
in expected log messages to be expressed as absolute paths, rather than
relative to the <expect-output> task (useful for testing stuff that executes
in another project).
Revision Changes Path
1.4 +17 -3
jakarta-ant-myrmidon/framework/src/test/org/apache/myrmidon/framework/ExpectOutputTask.java
Index: ExpectOutputTask.java
===================================================================
RCS file:
/home/cvs/jakarta-ant-myrmidon/framework/src/test/org/apache/myrmidon/framework/ExpectOutputTask.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ExpectOutputTask.java 21 Jun 2002 00:45:16 -0000 1.3
+++ ExpectOutputTask.java 25 Jun 2002 11:19:07 -0000 1.4
@@ -28,6 +28,12 @@
{
private TaskList m_tasks;
private ModelElement m_output;
+ private boolean m_absolutePath;
+
+ public void setAbsolutePath( final boolean absolutePath )
+ {
+ m_absolutePath = absolutePath;
+ }
/**
* The tasks to execute.
@@ -63,8 +69,16 @@
final LogMessageTracker listener = new LogMessageTracker();
if( m_output != null )
{
- final String path = getContext().getPath();
- configureListener( listener, m_output, path );
+ final String startPath;
+ if( m_absolutePath )
+ {
+ startPath = "";
+ }
+ else
+ {
+ startPath = getContext().getPath();
+ }
+ configureListener( listener, m_output, startPath );
}
// Install the listener, execute the tasks, and check all is good
1.2 +2 -26
jakarta-ant-myrmidon/framework/src/test/org/apache/myrmidon/framework/ExpectOutputTaskTestCase.java
Index: ExpectOutputTaskTestCase.java
===================================================================
RCS file:
/home/cvs/jakarta-ant-myrmidon/framework/src/test/org/apache/myrmidon/framework/ExpectOutputTaskTestCase.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ExpectOutputTaskTestCase.java 6 Jun 2002 10:27:37 -0000 1.1
+++ ExpectOutputTaskTestCase.java 25 Jun 2002 11:19:07 -0000 1.2
@@ -31,37 +31,13 @@
final File projectFile = getTestResource( "expect-output.ant" );
executeTarget( projectFile, "expected" );
executeTarget( projectFile, "expected2" );
+ executeTarget( projectFile, "absolute-path" );
executeTarget( projectFile, "none-expected" );
executeTarget( projectFile, "nested" );
- }
-
- /**
- * Checks the task fails when extra messages appear in the output.
- */
- public void testExtraMessage() throws Exception
- {
- final File projectFile = getTestResource( "expect-output.ant" );
executeTarget( projectFile, "extra" );
executeTarget( projectFile, "extra2" );
- }
-
- /**
- * Checks the task fails when an expected message does not appear in the
- * output.
- */
- public void testMissingMessage() throws Exception
- {
- final File projectFile = getTestResource( "expect-output.ant" );
executeTarget( projectFile, "missing" );
executeTarget( projectFile, "missing2" );
- }
-
- /**
- * Checks the task fails when incorrect messages appear in the output.
- */
- public void testMismatchedMessage() throws Exception
- {
- final File projectFile = getTestResource( "expect-output.ant" );
executeTarget( projectFile, "mismatched" );
executeTarget( projectFile, "mismatched2" );
executeTarget( projectFile, "bad-path" );
1.2 +17 -0
jakarta-ant-myrmidon/framework/src/test/org/apache/myrmidon/framework/expect-output.ant
Index: expect-output.ant
===================================================================
RCS file:
/home/cvs/jakarta-ant-myrmidon/framework/src/test/org/apache/myrmidon/framework/expect-output.ant,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- expect-output.ant 6 Jun 2002 10:27:37 -0000 1.1
+++ expect-output.ant 25 Jun 2002 11:19:07 -0000 1.2
@@ -26,6 +26,23 @@
</expect-output>
</target>
+ <target name="absolute-path">
+ <expect-output absolute-path="true">
+ <out>
+ <expect-output>
+ <absolute-path>
+ <expect-output>
+ <unit-test-log>log message</unit-test-log>
+ </expect-output>
+ </absolute-path>
+ </expect-output>
+ </out>
+ <tasks>
+ <unit-test-log>log message</unit-test-log>
+ </tasks>
+ </expect-output>
+ </target>
+
<target name="nested">
<expect-output>
<out>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>