Hi Jasper,

I've updated the <nunit2> task (in CVS) to only add a default plain-text
formatter if no other formatters were specified.  In that case, I also
output the following warning message :

"No <formatter .../> element was specified. A plain-text formatter was added
to prevent loosing output of the test results.
Add a <formatter .../> element to the <nunit2> task to prevent this warning
from being output and to ensure forward compatibility with future revisions
of NAnt."

Gert

----- Original Message ----- 
From: "Jasper Keuper" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, August 19, 2003 5:44 PM
Subject: [nant-dev] NUnit2Task Default Formatter


Hi,

when working with NUnit2Task I saw that the output of the test always showed
up twice when specifying a formatter.

This is caused by always adding a defaultFormatter, even when there are
formatters specified.

Added: if (_formatterElements.Count == 0)

The patch is copied below, also attached as NUnit2Task.patch

Jasper.


-----
Index: src/NAnt.NUnit/NUnit2/NUnit2Task.cs
===================================================================
RCS file: /cvsroot/nant/nant/src/NAnt.NUnit/NUnit2/NUnit2Task.cs,v
retrieving revision 1.19
diff -u -r1.19 NUnit2Task.cs
--- src/NAnt.NUnit/NUnit2/NUnit2Task.cs 25 May 2003 08:20:26 -0000 1.19
+++ src/NAnt.NUnit/NUnit2/NUnit2Task.cs 19 Aug 2003 15:30:11 -0000
@@ -124,11 +124,13 @@
         /// </summary>
         /// <param name="taskNode"><see cref="XmlNode" /> containing the
XML fragment used to initialize this task instance.</param>
         protected override void InitializeTask(XmlNode taskNode) {
-            FormatterElement defaultFormatter = new FormatterElement();
-            defaultFormatter.Project = Project;
-            defaultFormatter.Type = FormatterType.Plain;
-            defaultFormatter.UseFile = false;
-            _formatterElements.Add(defaultFormatter);
+            if (_formatterElements.Count == 0) {
+                FormatterElement defaultFormatter = new FormatterElement();
+                defaultFormatter.Project = Project;
+                defaultFormatter.Type = FormatterType.Plain;
+                defaultFormatter.UseFile = false;
+                _formatterElements.Add(defaultFormatter);
+            }
         }

         /// <summary>
@@ -340,4 +342,4 @@
             #endregion Private Instance Fields
         }
     }
-}
\ No newline at end of file
+}



-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines
at the same time. Free trial click here:http://www.vmware.com/wl/offer/358/0
_______________________________________________
nant-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-developers

Reply via email to