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);
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]
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");
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]
}
}
-#if NET_4_0
string Concat (string sep, params string [] parms)
{
return String.Join (sep, parms);
Assert.AreEqual ("", Path.Combine ("", "", "", "", ""), "#A4");
}
-#endif
}
}