Merge pull request #1248 from kumpera/kill_the_interpreter
[mono.git] / mcs / class / corlib / Test / System.IO / DirectoryTest.cs
index 0692a876b7586dab66ab986d4170991dbc262c29..f2d7e03d3d6bee7329915f13f871845b0ae6ed77 100644 (file)
@@ -14,11 +14,12 @@ using System.Collections.Generic;
 using System.Diagnostics;\r
 using System.Globalization;\r
 using System.IO;\r
-using System.IO;\r
 using System.Text;\r
 using System.Threading;\r
 \r
+#if !MONOTOUCH\r
 using Mono.Unix;\r
+#endif\r
 using NUnit.Framework;\r
 \r
 namespace MonoTests.System.IO\r
@@ -46,12 +47,12 @@ public class DirectoryTest
                if (Directory.Exists (TempFolder))\r
                        Directory.Delete (TempFolder, true);\r
        }\r
-\r
+#if !MONOTOUCH\r
        [Test] //BXC #12461\r
        public void EnumerateFilesListSymlinks ()\r
        {\r
                if (!RunningOnUnix)\r
-                       return;\r
+                       Assert.Ignore ("Not running on Unix.");\r
 \r
                var afile = Path.Combine (TempFolder, "afile.src");\r
                var bfile = Path.Combine (TempFolder, "bfile.src");\r
@@ -68,11 +69,13 @@ public class DirectoryTest
                Assert.AreEqual (afile, files0 [0], "#2");\r
                Assert.AreEqual (bfile, files0 [1], "#3");\r
 \r
+#if NET_4_0\r
                var files1 = new List<string> (Directory.EnumerateFiles (TempFolder, "*.src")).ToArray ();\r
                Array.Sort (files1);\r
                Assert.AreEqual (2, files1.Length, "#1.b");\r
                Assert.AreEqual (afile, files1 [0], "#2.b");\r
                Assert.AreEqual (bfile, files1 [1], "#3.b");\r
+#endif\r
 \r
                var files2 = Directory.GetFileSystemEntries (TempFolder, "*.src");\r
                Array.Sort (files2);\r
@@ -81,15 +84,16 @@ public class DirectoryTest
                Assert.AreEqual (bfile, files2 [1], "#3.c");\r
                Assert.AreEqual (cdir, files2 [2], "#4.c");\r
 \r
+#if NET_4_0\r
                var files3 = new List<string> (Directory.EnumerateFileSystemEntries (TempFolder, "*.src")).ToArray ();\r
                Array.Sort (files3);\r
                Assert.AreEqual (3, files3.Length, "#1.d");\r
                Assert.AreEqual (afile, files3 [0], "#2.d");\r
                Assert.AreEqual (bfile, files3 [1], "#3.d");\r
                Assert.AreEqual (cdir, files3 [2], "#4.d");\r
-\r
+#endif\r
        }\r
-\r
+#endif\r
        [Test]\r
        public void CreateDirectory ()\r
        {\r
@@ -360,28 +364,27 @@ public class DirectoryTest
                Assert.IsFalse (Directory.Exists (null as string));\r
        }\r
 \r
-#if !TARGET_JVM && !MOBILE // We don't support yet the Process class.\r
+#if !MOBILE // We don't support yet the Process class.\r
        [Test] // bug #78239\r
        public void ExistsAccessDenied ()\r
        {\r
                if (!RunningOnUnix)\r
-                       return; // this test does not work on Windows.\r
+                       Assert.Ignore ("Not running on Unix."); // this test does not work on Windows.\r
 \r
                string path = TempFolder + DSC + "ExistsAccessDenied";\r
 \r
                Directory.CreateDirectory (path);\r
-               Mono.Posix.Syscall.chmod (path, 0);\r
+               global::Mono.Posix.Syscall.chmod (path, 0);\r
                try {\r
                        Assert.IsFalse (Directory.Exists(path + DSC + "b"));\r
                } finally {\r
-                       Mono.Posix.Syscall.chmod (path, (Mono.Posix.FileMode) 755);\r
+                       global::Mono.Posix.Syscall.chmod (path, (global::Mono.Posix.FileMode) 755);\r
                        Directory.Delete (path);\r
                }\r
        }\r
 #endif\r
        \r
        [Test]\r
-       [Category("TargetJvmNotSupported")] // GetCreationTime not supported for TARGET_JVM\r
        [ExpectedException(typeof(ArgumentNullException))]\r
        public void GetCreationTimeException1 ()\r
        {\r
@@ -390,7 +393,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // GetCreationTime not supported for TARGET_JVM\r
        public void GetCreationTimeException2 ()\r
        {\r
                Directory.GetCreationTime (string.Empty);\r
@@ -400,7 +402,6 @@ public class DirectoryTest
 #if !NET_2_0\r
        [ExpectedException(typeof(IOException))]\r
 #endif\r
-       [Category("TargetJvmNotSupported")] // GetCreationTime not supported for TARGET_JVM\r
        public void GetCreationTimeException_NonExistingPath ()\r
        {\r
                string path = TempFolder + DSC + "DirectoryTest.GetCreationTime.1";\r
@@ -424,7 +425,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // GetCreationTime not supported for TARGET_JVM\r
        public void GetCreationTimeException4 ()\r
        {\r
                Directory.GetCreationTime ("    ");\r
@@ -432,7 +432,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // GetCreationTime not supported for TARGET_JVM\r
        public void GetCreationTimeException5 ()\r
        {\r
                Directory.GetCreationTime (Path.InvalidPathChars [0].ToString ());\r
@@ -440,7 +439,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentNullException))]\r
-       [Category("TargetJvmNotSupported")] // GetCreationTime not supported for TARGET_JVM\r
        public void GetCreationTimeUtcException1 ()\r
        {\r
                Directory.GetCreationTimeUtc (null as string);\r
@@ -448,7 +446,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // GetCreationTime not supported for TARGET_JVM\r
        public void GetCreationTimeUtcException2 ()\r
        {\r
                Directory.GetCreationTimeUtc (string.Empty);\r
@@ -458,7 +455,6 @@ public class DirectoryTest
 #if !NET_2_0\r
        [ExpectedException (typeof (IOException))]\r
 #endif\r
-       [Category("TargetJvmNotSupported")] // GetCreationTime not supported for TARGET_JVM\r
        public void GetCreationTimeUtc_NonExistingPath ()\r
        {\r
                string path = TempFolder + DSC + "DirectoryTest.GetCreationTimeUtc.1";\r
@@ -482,7 +478,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // GetCreationTime not supported for TARGET_JVM\r
        public void GetCreationTimeUtcException4 ()\r
        {\r
                Directory.GetCreationTimeUtc ("    ");\r
@@ -490,7 +485,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // GetCreationTime not supported for TARGET_JVM\r
        public void GetCreationTimeUtcException5 ()\r
        {\r
                Directory.GetCreationTime (Path.InvalidPathChars [0].ToString ());\r
@@ -498,7 +492,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentNullException))]\r
-       [Category("TargetJvmNotSupported")] // GetLastAccessTime not supported for TARGET_JVM\r
        public void GetLastAccessTime_Null ()\r
        {\r
                Directory.GetLastAccessTime (null as string);\r
@@ -506,7 +499,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // GetLastAccessTime not supported for TARGET_JVM\r
        public void GetLastAccessTimeException2 ()\r
        {\r
                Directory.GetLastAccessTime (string.Empty);\r
@@ -516,7 +508,6 @@ public class DirectoryTest
 #if !NET_2_0\r
        [ExpectedException (typeof (IOException))]\r
 #endif\r
-       [Category("TargetJvmNotSupported")] // GetLastAccessTime not supported for TARGET_JVM\r
        public void GetLastAccessTime_NonExistingPath ()\r
        {\r
                string path = TempFolder + DSC + "DirectoryTest.GetLastAccessTime.1";\r
@@ -541,7 +532,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // GetLastAccessTime not supported for TARGET_JVM\r
        public void GetLastAccessTimeException4 ()\r
        {\r
                Directory.GetLastAccessTime ("    ");\r
@@ -549,7 +539,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // GetLastAccessTime not supported for TARGET_JVM\r
        public void GetLastAccessTimeException5 ()\r
        {\r
                Directory.GetLastAccessTime (Path.InvalidPathChars [0].ToString ());\r
@@ -557,7 +546,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentNullException))]\r
-       [Category("TargetJvmNotSupported")] // GetLastAccessTime not supported for TARGET_JVM\r
        public void GetLastAccessTimeUtc_Null ()\r
        {\r
                Directory.GetLastAccessTimeUtc (null as string);\r
@@ -565,7 +553,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // GetLastAccessTime not supported for TARGET_JVM\r
        public void GetLastAccessTimeUtcException2 ()\r
        {\r
                Directory.GetLastAccessTimeUtc (string.Empty);\r
@@ -575,7 +562,6 @@ public class DirectoryTest
 #if !NET_2_0\r
        [ExpectedException (typeof (IOException))]\r
 #endif\r
-       [Category("TargetJvmNotSupported")] // GetLastAccessTime not supported for TARGET_JVM\r
        public void GetLastAccessTimeUtc_NonExistingPath ()\r
        {\r
                string path = TempFolder + DSC + "DirectoryTest.GetLastAccessTimeUtc.1";\r
@@ -598,7 +584,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // GetLastAccessTime not supported for TARGET_JVM\r
        public void GetLastAccessTimeUtcException4 ()\r
        {\r
                Directory.GetLastAccessTimeUtc ("    ");\r
@@ -606,7 +591,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // GetLastAccessTime not supported for TARGET_JVM\r
        public void GetLastAccessTimeUtcException5 ()\r
        {\r
                Directory.GetLastAccessTimeUtc (Path.InvalidPathChars [0].ToString ());\r
@@ -998,7 +982,6 @@ public class DirectoryTest
        }\r
        \r
        [Test]\r
-       [Category("TargetJvmNotSupported")] // CreationTime not supported for TARGET_JVM\r
        public void CreationTime ()\r
        {\r
                if (RunningOnUnix)\r
@@ -1049,7 +1032,6 @@ public class DirectoryTest
        }\r
 \r
        [Test]\r
-       [Category("TargetJvmNotSupported")] // LastAccessTime not supported for TARGET_JVM\r
        public void LastAccessTime ()\r
        {\r
                string path = TempFolder + DSC + "DirectoryTest.AccessTime.1";\r
@@ -1271,7 +1253,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentNullException))]\r
-       [Category("TargetJvmNotSupported")] // SetLastAccessTime not supported for TARGET_JVM\r
        public void SetLastAccessTimeException1 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);\r
@@ -1280,7 +1261,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // SetLastAccessTime not supported for TARGET_JVM\r
        public void SetLastAccessTimeException2 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);\r
@@ -1289,7 +1269,6 @@ public class DirectoryTest
        \r
        [Test]\r
        [ExpectedException(typeof(FileNotFoundException))]\r
-       [Category("TargetJvmNotSupported")] // SetLastAccessTime not supported for TARGET_JVM\r
        public void SetLastAccessTimeException3 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);\r
@@ -1304,7 +1283,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // SetLastAccessTime not supported for TARGET_JVM\r
        public void SetLastAccessTimeException4 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);\r
@@ -1313,7 +1291,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // SetLastAccessTime not supported for TARGET_JVM\r
        public void SetLastAccessTimeException5 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);\r
@@ -1339,7 +1316,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentNullException))]\r
-       [Category("TargetJvmNotSupported")] // SetLastAccessTime not supported for TARGET_JVM\r
        public void SetLastAccessTimeUtcException1 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);\r
@@ -1348,7 +1324,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // SetLastAccessTime not supported for TARGET_JVM\r
        public void SetLastAccessTimeUtcException2 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);\r
@@ -1357,7 +1332,6 @@ public class DirectoryTest
        \r
        [Test]\r
        [ExpectedException(typeof(FileNotFoundException))]\r
-       [Category("TargetJvmNotSupported")] // SetLastAccessTime not supported for TARGET_JVM\r
        public void SetLastAccessTimeUtcException3 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);\r
@@ -1372,7 +1346,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // SetLastAccessTime not supported for TARGET_JVM\r
        public void SetLastAccessTimeUtcException4 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);\r
@@ -1381,7 +1354,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // SetLastAccessTime not supported for TARGET_JVM\r
        public void SetLastAccessTimeUtcException5 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);\r
@@ -1406,7 +1378,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentNullException))]\r
-       [Category("TargetJvmNotSupported")] // SetCreationTime not supported for TARGET_JVM\r
        public void SetCreationTimeException1 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);\r
@@ -1415,7 +1386,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // SetCreationTime not supported for TARGET_JVM\r
        public void SetCreationTimeException2 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);\r
@@ -1424,7 +1394,6 @@ public class DirectoryTest
        \r
        [Test]\r
        [ExpectedException(typeof(FileNotFoundException))]\r
-       [Category("TargetJvmNotSupported")] // SetCreationTime not supported for TARGET_JVM\r
        public void SetCreationTimeException3 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);\r
@@ -1440,7 +1409,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // SetCreationTime not supported for TARGET_JVM\r
        public void SetCreationTimeException4 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);\r
@@ -1449,7 +1417,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // SetCreationTime not supported for TARGET_JVM\r
        public void SetCreationTimeException5 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);\r
@@ -1476,7 +1443,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentNullException))]\r
-       [Category("TargetJvmNotSupported")] // SetCreationTime not supported for TARGET_JVM\r
        public void SetCreationTimeUtcException1 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);\r
@@ -1485,7 +1451,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // SetCreationTime not supported for TARGET_JVM\r
        public void SetCreationTimeUtcException2 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);\r
@@ -1494,7 +1459,6 @@ public class DirectoryTest
        \r
        [Test]\r
        [ExpectedException(typeof(FileNotFoundException))]\r
-       [Category("TargetJvmNotSupported")] // SetCreationTime not supported for TARGET_JVM\r
        public void SetCreationTimeUtcException3 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);\r
@@ -1511,7 +1475,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // SetCreationTime not supported for TARGET_JVM\r
        public void SetCreationTimeUtcException4 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);\r
@@ -1520,7 +1483,6 @@ public class DirectoryTest
 \r
        [Test]\r
        [ExpectedException(typeof(ArgumentException))]\r
-       [Category("TargetJvmNotSupported")] // SetCreationTime not supported for TARGET_JVM\r
        public void SetCreationTimeUtcException5 ()\r
        {\r
                DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);\r
@@ -1573,7 +1535,7 @@ public class DirectoryTest
        {\r
                if (!RunningOnUnix)\r
                        // on Windows, backslash is used as directory separator\r
-                       return;\r
+                       Assert.Ignore ("Not running on Unix.");\r
 \r
                string dir = Path.Combine (TempFolder, @"sub\dir");\r
                Directory.CreateDirectory (dir);\r
@@ -1624,7 +1586,7 @@ public class DirectoryTest
        {\r
                if (!RunningOnUnix)\r
                        // on Windows, backslash is used as directory separator\r
-                       return;\r
+                       Assert.Ignore ("Not running on Unix.");\r
 \r
                string file = Path.Combine (TempFolder, @"doc\temp1.file");\r
                File.Create (file).Close ();\r