[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnetlib/csunit TestMain.cs,1.10,1.11
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnetlib/csunit TestMain.cs,1.10,1.11 |
Date: |
Fri, 30 May 2003 23:32:04 -0400 |
Update of /cvsroot/dotgnu-pnet/pnetlib/csunit
In directory subversions:/tmp/cvs-serv32646/csunit
Modified Files:
TestMain.cs
Log Message:
Add the CONFIG_SMALL_CONSOLE profile option, which strips
System.Console down to a smaller size.
Index: TestMain.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/csunit/TestMain.cs,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** TestMain.cs 9 Dec 2002 10:18:13 -0000 1.10
--- TestMain.cs 31 May 2003 03:32:02 -0000 1.11
***************
*** 23,26 ****
--- 23,28 ----
using System;
+ using System.IO;
+ using System.Text;
using System.Reflection;
***************
*** 151,155 ****
if(type == null)
{
! Console.Error.WriteLine
(typeName + ": type does not
exist in " + filename);
return 1;
--- 153,157 ----
if(type == null)
{
! ErrorWriteLine
(typeName + ": type does not
exist in " + filename);
return 1;
***************
*** 168,172 ****
if(method == null)
{
! Console.Error.WriteLine
(typeName + ".Suite(): method
does not exist in " + filename);
return 1;
--- 170,174 ----
if(method == null)
{
! ErrorWriteLine
(typeName + ".Suite(): method
does not exist in " + filename);
return 1;
***************
*** 175,179 ****
if(test == null)
{
! Console.Error.WriteLine
(typeName + ".Suite(): method
returned null");
return 1;
--- 177,181 ----
if(test == null)
{
! ErrorWriteLine
(typeName + ".Suite(): method
returned null");
return 1;
***************
*** 182,186 ****
// Construct the TestResult class to collect up
the results.
result = new TestWriterResult
! (Console.Out, stopAtFail,
showOnlyFailed);
// List or run the tests.
--- 184,188 ----
// Construct the TestResult class to collect up
the results.
result = new TestWriterResult
! (ConsoleOut, stopAtFail,
showOnlyFailed);
// List or run the tests.
***************
*** 195,199 ****
if(specificTest == null)
{
!
Console.Error.WriteLine
(args[argNum] + ": unknown test name");
}
--- 197,201 ----
if(specificTest == null)
{
! ErrorWriteLine
(args[argNum] + ": unknown test name");
}
***************
*** 221,225 ****
if(specificTest == null)
{
!
Console.Error.WriteLine
(args[argNum] + ": unknown test name");
}
--- 223,227 ----
if(specificTest == null)
{
! ErrorWriteLine
(args[argNum] + ": unknown test name");
}
***************
*** 314,317 ****
--- 316,377 ----
(" Print this help message.");
}
+
+ // Write a string to standard error.
+ private static void ErrorWriteLine(String str)
+ {
+ #if CONFIG_SMALL_CONSOLE
+ Console.WriteLine(str);
+ #else
+ Console.Error.WriteLine(str);
+ #endif
+ }
+
+ // Get a TextWriter stream for Console.Out.
+ private static TextWriter ConsoleOut
+ {
+ get
+ {
+ #if CONFIG_SMALL_CONSOLE
+ return new ConsoleWriter();
+ #else
+ return Console.Out;
+ #endif
+ }
+ }
+
+ #if CONFIG_SMALL_CONSOLE
+
+ // Helper class for writing to the console when Console.Out doesn't
exist.
+ private sealed class ConsoleWriter : TextWriter
+ {
+ // Constructor.
+ public ConsoleWriter() {}
+
+ // Get the encoding in use by this text writer.
+ public override System.Text.Encoding Encoding
+ {
+ get
+ {
+ return Encoding.Default;
+ }
+ }
+
+ // Write to this text writer.
+ public override void Write(char value)
+ {
+ Console.Write(value);
+ }
+ public override void Write(String value)
+ {
+ Console.Write(value);
+ }
+ public override void WriteLine()
+ {
+ Console.WriteLine();
+ }
+
+ }; // class ConsoleWriter
+
+ #endif
}; // class TestMain
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnetlib/csunit TestMain.cs,1.10,1.11,
Rhys Weatherley <address@hidden> <=