Fix order of InvalidPathChars on windows.
authorBoris Kirzner <borisk@mono-cvs.ximian.com>
Mon, 19 Feb 2007 09:25:40 +0000 (09:25 -0000)
committerBoris Kirzner <borisk@mono-cvs.ximian.com>
Mon, 19 Feb 2007 09:25:40 +0000 (09:25 -0000)
svn path=/trunk/mcs/; revision=73099

mcs/class/corlib/System.IO/ChangeLog
mcs/class/corlib/System.IO/Path.cs
mcs/class/corlib/Test/System.IO/ChangeLog
mcs/class/corlib/Test/System.IO/DirectoryTest.cs
mcs/class/corlib/Test/System.IO/PathTest.cs

index d98b16d0fc5614ed8bfd930702bb966bb859d447..80ff011f07d2fd6049032890f92fe825cd5f5536 100644 (file)
@@ -1,3 +1,7 @@
+2007-02-19     Boris Kirzner <borisk@mainsoft.com>
+
+       * Path.cs: fix order of InvalidPathChars on windows.
+
 2007-01-31  Gert Driesen  <drieseng@users.sourceforge.net>
 
        * StreamReader.cs: Removed checks for non-existing directory or file,
index 44b391d69985552c95395ea8cebc03344c95fa18..6cc6e043b47c6914eb3a6b7f16f7ba0cdca5fdb9 100644 (file)
@@ -429,10 +429,10 @@ namespace System.IO {
                {
                        // return a new array as we do not want anyone to be able to change the values
                        if (Environment.IsRunningOnWindows) {
-                               return new char [36] { '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07',
+                               return new char [36] { '\x22', '\x3C', '\x3E', '\x7C', '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07',
                                        '\x08', '\x09', '\x0A', '\x0B', '\x0C', '\x0D', '\x0E', '\x0F', '\x10', '\x11', '\x12', 
                                        '\x13', '\x14', '\x15', '\x16', '\x17', '\x18', '\x19', '\x1A', '\x1B', '\x1C', '\x1D', 
-                                       '\x1E', '\x1F', '\x22', '\x3C', '\x3E', '\x7C' };
+                                       '\x1E', '\x1F' };
                        } else {
                                return new char [1] { '\x00' };
                        }
index d6e81ae427b1bb080e1a7a7bd4fe197623b43703..65f8f1fd1e841c0a4202c78087be99af563fd2a2 100644 (file)
@@ -1,3 +1,8 @@
+2007-02-19     Boris Kirzner <borisk@mainsoft.com>
+
+       * DirectoryTest.cs, PathTest.cs: added test for 
+       order of InvalidPathChars on windows.
+
 2007-01-31  Gert Driesen  <drieseng@users.sourceforge.net>
 
        * FileStreamTest.cs: Added and improved tests to verify whether the
index 152e4d0e9d5b0d02724895aeab098d3fd82b338a..f2d4a3c105e7378cd16b38f81fb7981721934c77 100644 (file)
@@ -98,7 +98,7 @@ public class DirectoryTest
                string path = TempFolder + DSC + "DirectoryTest.Test";\r
                DeleteDirectory (path);\r
                try {\r
-                       path += Path.InvalidPathChars [0];\r
+                       path += '\x00';\r
                        path += ".2";\r
                        DirectoryInfo info = Directory.CreateDirectory (path);\r
                } finally {\r
index d4fbba920fc17fea89361145b34a3b17d7ebe416..da6cc6da192a412444a0600abeed8bc79a83155a 100644 (file)
@@ -834,6 +834,22 @@ namespace MonoTests.System.IO
                        }
                }
 
+               [Test]
+               public void GetInvalidPathChars_Order()
+               {
+                       if (Windows) {
+                               char [] invalid = Path.GetInvalidPathChars ();
+                               char [] expected = new char [36] { '\x22', '\x3C', '\x3E', '\x7C', '\x00', '\x01', '\x02',
+                                       '\x03', '\x04', '\x05', '\x06', '\x07', '\x08', '\x09', '\x0A', '\x0B', '\x0C', '\x0D',
+                                       '\x0E', '\x0F', '\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17', '\x18',
+                                       '\x19', '\x1A', '\x1B', '\x1C', '\x1D', '\x1E', '\x1F' };
+                               AssertEquals (expected.Length, invalid.Length);
+                               for (int i = 0; i < expected.Length; i++ ) {
+                                       AssertEquals( "Character at position " + i,expected [i], invalid [i]);
+                               }
+                       }
+               }
+
                [Test]
                public void GetInvalidPathChars_Modify ()
                {