added test for bug #413203.
authorGert Driesen <drieseng@users.sourceforge.net>
Sat, 2 Aug 2008 20:13:16 +0000 (20:13 -0000)
committerGert Driesen <drieseng@users.sourceforge.net>
Sat, 2 Aug 2008 20:13:16 +0000 (20:13 -0000)
svn path=/trunk/mcs/; revision=109501

mcs/class/System.Configuration/Test/standalone/ChangeLog
mcs/class/System.Configuration/Test/standalone/Makefile
mcs/class/System.Configuration/Test/standalone/t47.cs [new file with mode: 0644]
mcs/class/System.Configuration/Test/standalone/t47.exe.config [new file with mode: 0644]
mcs/class/System.Configuration/Test/standalone/t47.exe.expected [new file with mode: 0644]

index 3a4cdef8b4da53ab6abe56ca897bb6b5afd03336..38aa233e3a38702786212bedae497deea3d4de19 100644 (file)
@@ -1,3 +1,10 @@
+2008-08-02  Gert Driesen  <drieseng@users.sourceforge.net>
+
+       * Makefile
+       * t47.cs
+       * t47.exe.config
+       * t47.exe.expected: added test for bug #413203.
+
 2008-07-02  Gert Driesen  <drieseng@users.sourceforge.net>
 
        * t46.cs: Improve test coverage.
index 98fd59cf7000fa715df37f51ae36ea6c4454d305..bdc6757d31d9e474a6fe520aa39794e8fb918a38 100644 (file)
@@ -1,4 +1,4 @@
-TESTS = t1.exe t2.exe t3.exe t4.exe t5.exe t6.exe t7.exe t8.exe t9.exe t10.exe t11.exe t12.exe t15.exe t16.exe t17.exe t18.exe t19.exe t20.exe t21.exe t22.exe t23.exe t24.exe t25.exe t26.exe t27.exe t28.exe t29.exe t30.exe t31.exe t32.exe t33.exe t34.exe t35.exe t36.exe t37.exe t38.exe t39.exe t40.exe t41.exe t42.exe t43.exe t44.exe t45.exe t46.exe
+TESTS = t1.exe t2.exe t3.exe t4.exe t5.exe t6.exe t7.exe t8.exe t9.exe t10.exe t11.exe t12.exe t15.exe t16.exe t17.exe t18.exe t19.exe t20.exe t21.exe t22.exe t23.exe t24.exe t25.exe t26.exe t27.exe t28.exe t29.exe t30.exe t31.exe t32.exe t33.exe t34.exe t35.exe t36.exe t37.exe t38.exe t39.exe t40.exe t41.exe t42.exe t43.exe t44.exe t45.exe t46.exe t47.exe
 # t13.exe t14.exe
 
 check: local compare
diff --git a/mcs/class/System.Configuration/Test/standalone/t47.cs b/mcs/class/System.Configuration/Test/standalone/t47.cs
new file mode 100644 (file)
index 0000000..8c00090
--- /dev/null
@@ -0,0 +1,70 @@
+#define TRACE
+
+using System;
+using System.Diagnostics;
+using System.Globalization;
+using System.IO;
+using System.Text;
+
+namespace MonoTest.Configuration
+{
+       class Program
+       {
+               static void Main ()
+               {
+                       Trace.Write ("OK");
+
+                       string basedir = AppDomain.CurrentDomain.BaseDirectory;
+                       string output = Path.Combine (basedir, "log.tmp");
+
+                       try {
+                               using (StreamReader sr = new StreamReader (Path.Combine (basedir, "log.tmp"), Encoding.UTF8)) {
+                                       string text = sr.ReadToEnd ();
+                                       Console.WriteLine (text);
+                               }
+                       } finally {
+                               File.Delete (output);
+                       }
+               }
+       }
+
+       public class CustomFileListener : TraceListener
+       {
+               private string Prefix {
+                       get {
+                               return Attributes ["prefix"];
+                       }
+               }
+
+               private string OutputFile {
+                       get {
+                               string basedir = AppDomain.CurrentDomain.BaseDirectory;
+                               return Path.Combine (basedir, Attributes ["output"]);
+                       }
+               }
+
+               protected override string [] GetSupportedAttributes ()
+               {
+                       return new string [] { "output", "prefix", "suffix" };
+               }
+
+               public override void Write (string message)
+               {
+                       using (StreamWriter sw = new StreamWriter (OutputFile, true, Encoding.UTF8)) {
+                               if (Prefix != null)
+                                       sw.Write (Prefix);
+                               sw.Write (message);
+                               sw.Write (Attributes.Count.ToString (CultureInfo.InvariantCulture));
+                       }
+               }
+
+               public override void WriteLine (string message)
+               {
+                       using (StreamWriter sw = new StreamWriter (OutputFile, true, Encoding.UTF8)) {
+                               if (Prefix != null)
+                                       sw.Write (Prefix);
+                               sw.WriteLine (message);
+                       }
+               }
+       }
+}
diff --git a/mcs/class/System.Configuration/Test/standalone/t47.exe.config b/mcs/class/System.Configuration/Test/standalone/t47.exe.config
new file mode 100644 (file)
index 0000000..f7c3856
--- /dev/null
@@ -0,0 +1,12 @@
+<configuration>
+       <system.diagnostics>
+               <sharedListeners>
+                       <add name="CustomFile" type="MonoTest.Configuration.CustomFileListener, t47" traceOutputOptions="None" output="log.tmp" prefix="Custom:" />
+               </sharedListeners>
+               <trace>
+                       <listeners>
+                               <add name="CustomFile" />
+                       </listeners>
+               </trace>
+       </system.diagnostics>
+</configuration>
diff --git a/mcs/class/System.Configuration/Test/standalone/t47.exe.expected b/mcs/class/System.Configuration/Test/standalone/t47.exe.expected
new file mode 100644 (file)
index 0000000..0b8e4f5
--- /dev/null
@@ -0,0 +1 @@
+Custom:OK2