[xbuild] Fix test on windows.
authorAnkit Jain <radical@corewars.org>
Wed, 9 Mar 2011 12:31:15 +0000 (18:01 +0530)
committerAnkit Jain <radical@corewars.org>
Wed, 9 Mar 2011 17:45:33 +0000 (23:15 +0530)
AssignTargetPathTest.TestLink : Fix test on windows

mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/AssignTargetPathTest.cs

index 6524e0b1f2ebe77eb550b4d0e59931777c23fa6e..43917b03e340b8917fac8248808ced3b00b13c5c 100755 (executable)
@@ -148,7 +148,11 @@ namespace MonoTests.Microsoft.Build.Tasks
                        Assert.IsTrue(project.Build("1"), id + "1 : Error in building");
 
                        string [] files = new string [] { "xyz.cs", "rel/bar.resx", "rel/qwe.txt"};
-                       string [] assignedFiles = new string [] { "Test/Link/xyz.cs", "Test/Link/bar.resx", "../Test/Link/qwe.txt"};
+                       string [] assignedFiles = new string [] {
+                               PathCombine ("Test", "Link", "xyz.cs"),
+                               PathCombine ("Test", "Link", "bar.resx"),
+                               PathCombine ("..", "Test", "Link", "qwe.txt")
+                       };
 
                        BuildItemGroup include = project.GetEvaluatedItemsByName("FooPath");
                        Assert.AreEqual(files.Length, include.Count, id + "2");
@@ -162,6 +166,18 @@ namespace MonoTests.Microsoft.Build.Tasks
                        }
                }
 
+               string PathCombine (string path1, params string[] parts)
+               {
+                       if (parts == null || parts.Length == 0)
+                               return path1;
+
+                       string final_path = path1;
+                       foreach (string part in parts)
+                               final_path = Path.Combine (final_path, part);
+
+                       return final_path;
+               }
+
                void CheckTargetPath(string[] files, string[] assignedFiles, string rootFolder, string id)
                {
                        Engine engine = new Engine(Consts.BinPath);