2006-06-22 Marek Sieradzki <marek.sieradzki@gmail.com>
authorMarek Sieradzki <msierad@mono-cvs.ximian.com>
Thu, 22 Jun 2006 20:16:59 +0000 (20:16 -0000)
committerMarek Sieradzki <msierad@mono-cvs.ximian.com>
Thu, 22 Jun 2006 20:16:59 +0000 (20:16 -0000)
        * UsingTaskCollectionTest.cs, UsingTaskTest.cs: Updated names.
        * ProjectTest.cs: Moved most of the old tests to various/.
        * Consts.cs: Added.

svn path=/trunk/mcs/; revision=61956

15 files changed:
mcs/class/Microsoft.Build.Engine/Makefile
mcs/class/Microsoft.Build.Engine/Microsoft.Build.Engine_test.dll.sources
mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ChangeLog
mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/Consts.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ProjectTest.cs
mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/UsingTaskCollectionTest.cs
mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/UsingTaskTest.cs
mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.Engine.Test.mdp
mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.Engine.Test.mds
mcs/class/Microsoft.Build.Engine/Test/resources/SimpleTask.cs [deleted file]
mcs/class/Microsoft.Build.Engine/Test/resources/TestTasks.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Test/various/DefaultTasks.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Test/various/Items.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Test/various/ProjectElement.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Engine/Test/various/Properties.cs [new file with mode: 0644]

index 338b4ae3339be83f4a126db0a584b99c6d047e8d..b10db95bba45ea473f534ae9db54373479474f4c 100644 (file)
@@ -24,9 +24,9 @@ TEST_MCS_FLAGS = \
 
 EXTRA_DISTFILES = Test/resources/SimpleTask.cs
 
-Test/resources/SimpleTask.dll: Test/resources/SimpleTask.cs
-       $(CSCOMPILE) Test/resources/SimpleTask.cs /r:Microsoft.Build.Framework.dll /r:Microsoft.Build.Utilities.dll /target:library
+Test/resources/TestTasks.dll: Test/resources/TestTasks.cs
+       $(CSCOMPILE) Test/resources/TestTasks.cs /r:Microsoft.Build.Framework.dll /r:Microsoft.Build.Utilities.dll /target:library
 
-test-local: Test/resources/SimpleTask.dll
+test-local: Test/resources/TestTasks.dll
 
 include ../../build/library.make
index 729d7dea102de2d7af469f49da3a1821b9e85179..8488706ec06a2e5a9c1f6ce0fa8ec31bfe5da5d9 100644 (file)
@@ -2,6 +2,7 @@ Microsoft.Build.BuildEngine/BuildItemTest.cs
 Microsoft.Build.BuildEngine/BuildPropertyTest.cs
 Microsoft.Build.BuildEngine/BuildPropertyGroupTest.cs
 Microsoft.Build.BuildEngine/BuildPropertyGroupCollectionTest.cs
+Microsoft.Build.BuildEngine/Consts.cs
 Microsoft.Build.BuildEngine/EngineTest.cs
 Microsoft.Build.BuildEngine/InternalLoggerExceptionTest.cs
 Microsoft.Build.BuildEngine/InvalidProjectFileExceptionTest.cs
@@ -9,3 +10,7 @@ Microsoft.Build.BuildEngine/ProjectTest.cs
 Microsoft.Build.BuildEngine/UsingTaskTest.cs
 Microsoft.Build.BuildEngine/UsingTaskCollectionTest.cs
 Microsoft.Build.BuildEngine/UtilitiesTest.cs
+various/DefaultTasks.cs
+various/Items.cs
+various/ProjectElement.cs
+various/Properties.cs
index dee361c4d4234fa8f04256531dcf90dc17ffa3f5..5c72c59d86c99dd373b780f4928857e57b309fb4 100644 (file)
@@ -1,3 +1,9 @@
+2006-06-22  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * UsingTaskCollectionTest.cs, UsingTaskTest.cs: Updated names.
+       * ProjectTest.cs: Moved most of the old tests to various/.
+       * Consts.cs: Added.
+
 2006-06-14  Marek Sieradzki  <marek.sieradzki@gmail.com>
 
        * BuildPropertyGroupTest.cs: Added some tests.
diff --git a/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/Consts.cs b/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/Consts.cs
new file mode 100644 (file)
index 0000000..4534c7b
--- /dev/null
@@ -0,0 +1,32 @@
+//
+// Consts.cs
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2006 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+public static class Consts {
+       public static string BinPath {
+               get { return "../../tools/xbuild/xbuild"; }
+       }
+}
index 4a8f3a0a3e6661b062adec613fc3f98a2ee3c01d..c932ac4e5de5e4cf0ff237149303b3cd026cf408 100644 (file)
@@ -26,6 +26,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 using System;
+using System.Collections;
 using System.Xml;
 using Microsoft.Build.BuildEngine;
 using NUnit.Framework;
@@ -34,43 +35,6 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
        [TestFixture]
        public class ProjectTest {
 
-               string binPath;
-
-               [SetUp]
-               public void SetUp ()
-               {
-                   binPath = "../../tools/xbuild/xbuild";
-               }
-
-               // Clones a project by reloading from original.Xml
-               private Project CloneProject (Project original)
-               {
-                       Project clone;
-                       
-                       clone = original.ParentEngine.CreateNewProject ();
-                       clone.LoadXml (original.Xml);
-
-                       return clone;
-               }
-
-               // Get all items with a specific name, separated by ;
-               private string GetItems (Project proj, string name)
-               {
-                       BuildItemGroup big = proj.GetEvaluatedItemsByName (name);
-                       string str = String.Empty;
-                       if (big == null) {
-                               return str;
-                       }
-                       foreach (BuildItem bi in big) {
-                               if (str == String.Empty) {
-                                       str = bi.FinalItemSpec;
-                               } else {
-                                       str += ";" + bi.FinalItemSpec;
-                               }
-                       }
-                       return str;
-               }
-
                [Test]
                [ExpectedException (typeof (InvalidProjectFileException),
                @"The default XML namespace of the project must be the MSBuild XML namespace." + 
@@ -84,125 +48,32 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
                        string documentString =
                                "<Project></Project>";
                        
-                       engine = new Engine (binPath);
+                       engine = new Engine (Consts.BinPath);
                        project = engine.CreateNewProject ();
                        project.LoadXml (documentString);
                }
 
                [Test]
-               public void TestDefaultTargets ()
+               public void TestBuild1 ()
                {
                        Engine engine;
-                       Project proj;
-                       Project cproj;
-                       string documentString = @"
-                       <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" DefaultTargets=""Build;Compile"">
-                       </Project>
-                       ";
+                       Project project;
+                       IDictionary hashtable = new Hashtable ();
                        
-                       engine = new Engine (binPath);
-                       proj = engine.CreateNewProject ();
-                       Assert.AreEqual (String.Empty, proj.FullFileName, "A1");
-
-                       proj.LoadXml (documentString);
-                       Assert.AreEqual (String.Empty, proj.FullFileName, "A2");
-                       proj.DefaultTargets = "Build";
-                       Assert.AreEqual ("Build", proj.DefaultTargets, "A3");
-                       cproj = CloneProject (proj);
-                       Assert.AreEqual (proj.DefaultTargets, cproj.DefaultTargets, "A4");
-               }
-
-               [Test]
-               public void TestProperties ()
-               {
-                       Engine engine = new Engine (binPath);
-                       Project proj = engine.CreateNewProject ();
-
                        string documentString = @"
-                               <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
-                                       <PropertyGroup>
-                                               <Config>debug</Config>
-                                               <ExpProp>$(Config)-$(Config)</ExpProp>
-                                       </PropertyGroup>
-                               </Project>
-                       ";
-
-                       proj.LoadXml (documentString);
-                       Assert.AreEqual (1, proj.PropertyGroups.Count, "A1");
-                       Assert.AreEqual ("debug", proj.GetEvaluatedProperty ("Config"), "A2");
-                       Assert.AreEqual ("debug-debug", proj.GetEvaluatedProperty ("ExpProp"), "A3");
-               }
-
-               [Test]
-               public void TestItems ()
-               {
-                       Engine engine = new Engine (binPath);
-                       Project proj = engine.CreateNewProject ();
-
-                       string documentString = @"
-                               <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
-                                       <ItemGroup>
-                                               <Item0 Include=""A"" />
-                                               <Item1 Include=""A;B;C"" />
-                                               <Item2 Include=""@(Item1);A;D"" />
-                                               <Item3 Include=""@(Item2)"" Exclude=""A"" />
-                                               <Item4 Include=""@(Item1);Q"" Exclude=""@(Item2)"" />
-                                               <Item5 Include=""@(Item1)"" Exclude=""@(Item2)"" />
-                                               <Item6 Include=""@(Item2)"" Exclude=""@(Item1)"" />
-
-                                               <ItemOrig Include=""A\B.txt;A\C.txt;B\B.zip;B\C.zip"" />
-                                               <ItemT1 Include=""@(Item1->'%(Identity)')"" />
-                                               <ItemT2 Include=""@(Item1->'%(Identity)%(Identity)')"" />
-                                               <ItemT3 Include=""@(Item1->'(-%(Identity)-)')"" />
-                                               <ItemT4 Include=""@(ItemOrig->'%(Extension)')"" />
-                                               <ItemT5 Include=""@(ItemOrig->'%(Filename)/%(Extension)')"" />
-                                               <ItemT6 Include=""@(ItemOrig->'%(RelativeDir)X/%(Filename)')"" />
-                                               
-                                               <ItemS1 Include=""@(Item1,'-')"" />
-                                               <ItemS2 Include=""@(Item1,'xx')"" />
-                                               <ItemS3 Include=""@(Item1, '-')"" />
-                                       </ItemGroup>
-                               </Project>
-                       ";
-
-                       proj.LoadXml (documentString);
-                       Assert.AreEqual ("A", GetItems (proj, "Item0"), "A1");
-                       Assert.AreEqual ("A;B;C", GetItems (proj, "Item1"), "A2");
-                       Assert.AreEqual ("A;B;C;A;D", GetItems (proj, "Item2"), "A3");
-                       Assert.AreEqual ("B;C;D", GetItems (proj, "Item3"), "A4");
-                       Assert.AreEqual ("Q", GetItems (proj, "Item4"), "A5");
-                       Assert.AreEqual ("", GetItems (proj, "Item5"), "A6");
-                       Assert.AreEqual ("D", GetItems (proj, "Item6"), "A7");
-
-                       Assert.AreEqual ("A;B;C", GetItems (proj, "ItemT1"), "A8");
-                       Assert.AreEqual ("AA;BB;CC", GetItems (proj, "ItemT2"), "A9");
-                       Assert.AreEqual ("(-A-);(-B-);(-C-)", GetItems (proj, "ItemT3"), "A10");
-                       Assert.AreEqual (".txt;.txt;.zip;.zip", GetItems (proj, "ItemT4"), "A11");
-                       Assert.AreEqual ("B/.txt;C/.txt;B/.zip;C/.zip", GetItems (proj, "ItemT5"), "A12");
-                       Assert.AreEqual (@"A\X/B;A\X/C;B\X/B;B\X/C", GetItems (proj, "ItemT6"), "A13");
-
-                       Assert.AreEqual ("A-B-C", GetItems (proj, "ItemS1"), "A14");
-                       Assert.AreEqual ("AxxBxxC", GetItems (proj, "ItemS2"), "A15");
-                       // Will fail.
-                       Assert.AreEqual ("A-B-C", GetItems (proj, "ItemS3"), "A16");
-               }
-
-               [Test]
-               public void TestDefaultTasks ()
-               {
-                       Engine engine = new Engine (binPath);
-                       Project project = engine.CreateNewProject ();
-
-                       string documentString = @"
-                                <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
-                                       <Target Name=""Main"">
+                               <Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
+                                       <Target Name='Main'>
                                                <Message Text='Text' />
                                        </Target>
-                                </Project>
+                               </Project>
                        ";
-
+                       
+                       engine = new Engine (Consts.BinPath);
+                       project = engine.CreateNewProject ();
                        project.LoadXml (documentString);
-                       project.Build ("Main");
+                       project.Build (new string[] { "Main" }, hashtable);
+                       
+                       Assert.AreEqual (0, hashtable.Count);
                }
        }
 }
index 96ab0c2fdf1e7f527dfb9626eb1ef34419451ebb..837b944a6b30a4b5e2b1ebf32b3dde962aebcc96 100644 (file)
@@ -52,7 +52,7 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
                        string documentString = @"
                                <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
                                        <UsingTask
-                                               AssemblyFile='Test/resources/SimpleTask.dll'
+                                               AssemblyFile='Test/resources/TestTasks.dll'
                                                TaskName='SimpleTask'
                                        />
                                </Project>
@@ -74,7 +74,7 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
                        string documentString = @"
                                <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
                                        <UsingTask
-                                               AssemblyFile='Test/resources/SimpleTask.dll'
+                                               AssemblyFile='Test/resources/TestTasks.dll'
                                                TaskName='SimpleTask'
                                        />
                                </Project>
index f5f9c44224d14c89bb8cbe32513d603dcafb4b5b..4d5d7f3ebe95bffdaead98954dc7c2ff76e88993 100644 (file)
@@ -52,7 +52,7 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
                        string documentString = @"
                                <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
                                        <UsingTask
-                                               AssemblyFile='Test/resources/SimpleTask.dll'
+                                               AssemblyFile='Test/resources/TestTasks.dll'
                                                TaskName='SimpleTask'
                                                Condition='true'
                                        />
@@ -68,7 +68,7 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
                        
                        UsingTask ut = (UsingTask) en.Current;
                        
-                       Assert.AreEqual ("Test/resources/SimpleTask.dll", ut.AssemblyFile, "A1");
+                       Assert.AreEqual ("Test/resources/TestTasks.dll", ut.AssemblyFile, "A1");
                        Assert.IsNull (ut.AssemblyName, "A2");
                        Assert.AreEqual ("true", ut.Condition, "A3");
                        Assert.AreEqual (false, ut.IsImported, "A4");
@@ -81,7 +81,7 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
                        string documentString = @"
                                <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
                                        <UsingTask
-                                               AssemblyFile='Test/resources/SimpleTask.dll'
+                                               AssemblyFile='Test/resources/TestTasks.dll'
                                                TaskName='SimpleTask'
                                        />
                                </Project>
@@ -96,7 +96,7 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
                        
                        UsingTask ut = (UsingTask) en.Current;
                        
-                       Assert.AreEqual ("Test/resources/SimpleTask.dll", ut.AssemblyFile, "A1");
+                       Assert.AreEqual ("Test/resources/TestTasks.dll", ut.AssemblyFile, "A1");
                        Assert.IsNull (ut.AssemblyName, "A2");
                        Assert.AreEqual (null, ut.Condition, "A3");
                        Assert.AreEqual (false, ut.IsImported, "A4");
@@ -141,7 +141,7 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
                        string documentString = @"
                                <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
                                        <UsingTask
-                                               AssemblyFile='Test/resources/SimpleTask.dll'
+                                               AssemblyFile='Test/resources/TestTasks.dll'
                                        />
                                </Project>
                        ";
index 758384abea4d9c3f759785a989bc26ca0942f36f..0cc9acef0f4085ac5ec390c976959520b51380ac 100644 (file)
@@ -13,6 +13,7 @@
       <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
     </Configuration>
   </Configurations>
+  <DeployTargets />
   <DeploymentInformation strategy="File">
     <excludeFiles />
   </DeploymentInformation>
@@ -28,6 +29,7 @@
     <File name="./Microsoft.Build.BuildEngine/BuildPropertyGroupCollectionTest.cs" subtype="Code" buildaction="Compile" />
     <File name="./Microsoft.Build.BuildEngine/UsingTaskCollectionTest.cs" subtype="Code" buildaction="Compile" />
     <File name="./Microsoft.Build.BuildEngine/UsingTaskTest.cs" subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/Consts.cs" subtype="Code" buildaction="Compile" />
   </Contents>
   <References>
     <ProjectReference type="Gac" localcopy="True" refto="nunit.framework, Version=2.2.0.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77" />
index 1857c4b37024f8b905a9446ee1582a77e7b0655a..bc65d10979c4d8ae9b80346cf8d54df6c01d5d9c 100644 (file)
@@ -7,6 +7,7 @@
       <Entry build="True" name="Microsoft.Build.Engine.Test" configuration="Debug" />
     </Configuration>
   </Configurations>
+  <DeployTargets />
   <StartMode startupentry="Microsoft.Build.Engine.Test" single="True">
     <Execute type="None" entry="Microsoft.Build.Engine.Test" />
   </StartMode>
diff --git a/mcs/class/Microsoft.Build.Engine/Test/resources/SimpleTask.cs b/mcs/class/Microsoft.Build.Engine/Test/resources/SimpleTask.cs
deleted file mode 100644 (file)
index 3252e08..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-//
-// SimpleTask.cs: Used for UsingTask tests.
-//
-// Author:
-//   Marek Sieradzki (marek.sieradzki@gmail.com)
-//
-// (C) 2006 Marek Sieradzki
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-using Microsoft.Build.Framework;
-using Microsoft.Build.Utilities;
-
-public class SimpleTask : Task {
-       public override bool Execute ()
-       {
-               return true;
-       }
-}
diff --git a/mcs/class/Microsoft.Build.Engine/Test/resources/TestTasks.cs b/mcs/class/Microsoft.Build.Engine/Test/resources/TestTasks.cs
new file mode 100644 (file)
index 0000000..0f0fca5
--- /dev/null
@@ -0,0 +1,48 @@
+//
+// SimpleTask.cs: Used for UsingTask tests.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2006 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using Microsoft.Build.Framework;
+using Microsoft.Build.Utilities;
+
+public class SimpleTask : Task {
+       public override bool Execute ()
+       {
+               return true;
+       }
+}
+
+public class OutputTestTast : Task {
+       public override bool Execute ()
+       {
+               return true;
+       }
+
+       [Output]
+       public string Property {
+               get { return "some_text"; }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Test/various/DefaultTasks.cs b/mcs/class/Microsoft.Build.Engine/Test/various/DefaultTasks.cs
new file mode 100644 (file)
index 0000000..de9fbe0
--- /dev/null
@@ -0,0 +1,54 @@
+//
+// DefaultTasks: Test if tasks that are included by default are usable.
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2006 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Xml;
+using Microsoft.Build.BuildEngine;
+using NUnit.Framework;
+
+namespace MonoTests.Microsoft.Build.BuildEngine.Various {
+       [TestFixture]
+       public class DefaultTasks {
+               [Test]
+               public void TestDefaultTasks ()
+               {
+                       Engine engine = new Engine (Consts.BinPath);
+                       Project proj = engine.CreateNewProject ();
+
+                       string documentString = @"
+                               <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+                                       <Target Name='Main'>
+                                               <Message Text='Message' />
+                                       </Target>
+                               </Project>
+                       ";
+
+                       proj.LoadXml (documentString);
+                       proj.Build ("Main");
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Test/various/Items.cs b/mcs/class/Microsoft.Build.Engine/Test/various/Items.cs
new file mode 100644 (file)
index 0000000..4055b4e
--- /dev/null
@@ -0,0 +1,108 @@
+//
+// Items.cs
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2006 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Xml;
+using Microsoft.Build.BuildEngine;
+using NUnit.Framework;
+
+namespace MonoTests.Microsoft.Build.BuildEngine.Various {
+       [TestFixture]
+       public class Items {
+               private string GetItems (Project proj, string name)
+               {
+                       BuildItemGroup big = proj.GetEvaluatedItemsByName (name);
+                       string str = String.Empty;
+                       if (big == null)
+                               return str;
+                       
+                       foreach (BuildItem bi in big) {
+                               if (str == String.Empty)
+                                       str = bi.FinalItemSpec;
+                               else 
+                                       str += ";" + bi.FinalItemSpec;
+                       }
+                       
+                       return str;
+               }
+
+               [Test]
+               // FIXME: split it to several tests and add more tests
+               public void TestItems1 ()
+               {
+                       Engine engine = new Engine (Consts.BinPath);
+                       Project proj = engine.CreateNewProject ();
+
+                       string documentString = @"
+                               <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+                                       <ItemGroup>
+                                               <Item0 Include=""A"" />
+                                               <Item1 Include=""A;B;C"" />
+                                               <Item2 Include=""@(Item1);A;D"" />
+                                               <Item3 Include=""@(Item2)"" Exclude=""A"" />
+                                               <Item4 Include=""@(Item1);Q"" Exclude=""@(Item2)"" />
+                                               <Item5 Include=""@(Item1)"" Exclude=""@(Item2)"" />
+                                               <Item6 Include=""@(Item2)"" Exclude=""@(Item1)"" />
+
+                                               <ItemOrig Include=""A\B.txt;A\C.txt;B\B.zip;B\C.zip"" />
+                                               <ItemT1 Include=""@(Item1->'%(Identity)')"" />
+                                               <ItemT2 Include=""@(Item1->'%(Identity)%(Identity)')"" />
+                                               <ItemT3 Include=""@(Item1->'(-%(Identity)-)')"" />
+                                               <ItemT4 Include=""@(ItemOrig->'%(Extension)')"" />
+                                               <ItemT5 Include=""@(ItemOrig->'%(Filename)/%(Extension)')"" />
+                                               <ItemT6 Include=""@(ItemOrig->'%(RelativeDir)X/%(Filename)')"" />
+                                               
+                                               <ItemS1 Include=""@(Item1,'-')"" />
+                                               <ItemS2 Include=""@(Item1,'xx')"" />
+                                               <ItemS3 Include=""@(Item1, '-')"" />
+                                       </ItemGroup>
+                               </Project>
+                       ";
+
+                       proj.LoadXml (documentString);
+                       Assert.AreEqual ("A", GetItems (proj, "Item0"), "A1");
+                       Assert.AreEqual ("A;B;C", GetItems (proj, "Item1"), "A2");
+                       Assert.AreEqual ("A;B;C;A;D", GetItems (proj, "Item2"), "A3");
+                       Assert.AreEqual ("B;C;D", GetItems (proj, "Item3"), "A4");
+                       Assert.AreEqual ("Q", GetItems (proj, "Item4"), "A5");
+                       Assert.AreEqual ("", GetItems (proj, "Item5"), "A6");
+                       Assert.AreEqual ("D", GetItems (proj, "Item6"), "A7");
+
+                       Assert.AreEqual ("A;B;C", GetItems (proj, "ItemT1"), "A8");
+                       Assert.AreEqual ("AA;BB;CC", GetItems (proj, "ItemT2"), "A9");
+                       Assert.AreEqual ("(-A-);(-B-);(-C-)", GetItems (proj, "ItemT3"), "A10");
+                       Assert.AreEqual (".txt;.txt;.zip;.zip", GetItems (proj, "ItemT4"), "A11");
+                       Assert.AreEqual ("B/.txt;C/.txt;B/.zip;C/.zip", GetItems (proj, "ItemT5"), "A12");
+                       Assert.AreEqual (@"A\X/B;A\X/C;B\X/B;B\X/C", GetItems (proj, "ItemT6"), "A13");
+
+                       Assert.AreEqual ("A-B-C", GetItems (proj, "ItemS1"), "A14");
+                       Assert.AreEqual ("AxxBxxC", GetItems (proj, "ItemS2"), "A15");
+                       // Will fail.
+                       Assert.AreEqual ("A-B-C", GetItems (proj, "ItemS3"), "A16");
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Test/various/ProjectElement.cs b/mcs/class/Microsoft.Build.Engine/Test/various/ProjectElement.cs
new file mode 100644 (file)
index 0000000..7e52c74
--- /dev/null
@@ -0,0 +1,70 @@
+//
+// ProjectElement.cs
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2006 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Xml;
+using Microsoft.Build.BuildEngine;
+using NUnit.Framework;
+
+namespace MonoTests.Microsoft.Build.BuildEngine.Various {
+       [TestFixture]
+       public class ProjectElement {
+               // Clones a project by reloading from original.Xml
+               private Project CloneProject (Project original)
+               {
+                       Project clone;
+                       
+                       clone = original.ParentEngine.CreateNewProject ();
+                       clone.LoadXml (original.Xml);
+
+                       return clone;
+               }
+
+               [Test]
+               public void TestDefaultTargetsAttribute ()
+               {
+                       Engine engine;
+                       Project proj;
+                       Project cproj;
+                       string documentString = @"
+                       <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" DefaultTargets=""Build;Compile"">
+                       </Project>
+                       ";
+                       
+                       engine = new Engine (Consts.BinPath);
+                       proj = engine.CreateNewProject ();
+                       Assert.AreEqual (String.Empty, proj.FullFileName, "A1");
+
+                       proj.LoadXml (documentString);
+                       Assert.AreEqual (String.Empty, proj.FullFileName, "A2");
+                       proj.DefaultTargets = "Build";
+                       Assert.AreEqual ("Build", proj.DefaultTargets, "A3");
+                       cproj = CloneProject (proj);
+                       Assert.AreEqual (proj.DefaultTargets, cproj.DefaultTargets, "A4");
+               }
+       }
+}
diff --git a/mcs/class/Microsoft.Build.Engine/Test/various/Properties.cs b/mcs/class/Microsoft.Build.Engine/Test/various/Properties.cs
new file mode 100644 (file)
index 0000000..e694010
--- /dev/null
@@ -0,0 +1,57 @@
+//
+// Properties.cs
+//
+// Author:
+//   Marek Sieradzki (marek.sieradzki@gmail.com)
+//
+// (C) 2006 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Xml;
+using Microsoft.Build.BuildEngine;
+using NUnit.Framework;
+
+namespace MonoTests.Microsoft.Build.BuildEngine.Various {
+       [TestFixture]
+       public class Properties {
+               [Test]
+               public void TestProperties ()
+               {
+                       Engine engine = new Engine (Consts.BinPath);
+                       Project proj = engine.CreateNewProject ();
+
+                       string documentString = @"
+                               <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+                                       <PropertyGroup>
+                                               <Config>debug</Config>
+                                               <ExpProp>$(Config)-$(Config)</ExpProp>
+                                       </PropertyGroup>
+                               </Project>
+                       ";
+
+                       proj.LoadXml (documentString);
+                       Assert.AreEqual (1, proj.PropertyGroups.Count, "A1");
+                       Assert.AreEqual ("debug", proj.GetEvaluatedProperty ("Config"), "A2");
+                       Assert.AreEqual ("debug-debug", proj.GetEvaluatedProperty ("ExpProp"), "A3");
+               }
+       }
+}