[mcs] Replace NET_2_1 by MOBILE
[mono.git] / mcs / class / corlib / Test / System.IO / PathTest.cs
index 8f5e4909b9f2b8005a5c2317b2be063f3419df48..c3ab9935350c9b1f3071960bda46d06d97b74d81 100644 (file)
@@ -173,9 +173,10 @@ namespace MonoTests.System.IO
                        Assert.AreEqual ("one", testPath, "Combine #03");
 
                        string current = Directory.GetCurrentDirectory ();
+                       bool currentIsDSC = current.Length == 1 && current [0] == DSC;
                        testPath = Path.Combine (current, "one");
 
-                       string expected = current + DSC + "one";
+                       string expected = (currentIsDSC ? String.Empty : current) + DSC + "one";
                        Assert.AreEqual (expected, testPath, "Combine #04");
 
                        testPath = Path.Combine ("one", current);
@@ -200,9 +201,7 @@ namespace MonoTests.System.IO
                        expected = "one" + DSC + "two" + DSC;
                        Assert.AreEqual (expected, testPath, "Combine #07");
 
-#if NET_4_0
                        Assert.AreEqual ("a", Path.Combine (new [] { "a", "" }), "Combine #08");
-#endif
                }
 
                [Test]
@@ -484,9 +483,9 @@ namespace MonoTests.System.IO
                public void GetFullPath ()
                {
                        string current = Directory.GetCurrentDirectory ();
-
+                       bool currentIsDSC = current.Length == 1 && current [0] == DSC;
                        string testFullPath = Path.GetFullPath ("foo.txt");
-                       string expected = current + DSC + "foo.txt";
+                       string expected = (currentIsDSC ? String.Empty : current) + DSC + "foo.txt";
                        Assert.AreEqual (expected, testFullPath, "GetFullPath #01");
 
                        testFullPath = Path.GetFullPath ("a//./.././foo.txt");
@@ -689,6 +688,11 @@ namespace MonoTests.System.IO
                                                i, root + test [i, 0], ex.GetType ()));
                                }
                        }
+
+                       // These cases require that we don't pass a root to GetFullPath - it should return the proper drive root.
+                       string root4 = Path.GetPathRoot(Directory.GetCurrentDirectory());
+                       Assert.AreEqual(root4, Path.GetFullPath(@"\"));
+                       Assert.AreEqual(root4, Path.GetFullPath("/"));
                }
 
                [Test]
@@ -1241,7 +1245,6 @@ namespace MonoTests.System.IO
                        }
                }
 
-#if NET_4_0
                string Concat (string sep, params string [] parms)
                {
                        return String.Join (sep, parms);
@@ -1381,7 +1384,6 @@ namespace MonoTests.System.IO
 
                        Assert.AreEqual ("", Path.Combine ("", "", "", "", ""), "#A4");
                }
-#endif
        }
 }