* 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
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
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
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
+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.
--- /dev/null
+//
+// 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"; }
+ }
+}
// 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;
[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." +
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);
}
}
}
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>
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>
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'
/>
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");
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>
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");
string documentString = @"
<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
<UsingTask
- AssemblyFile='Test/resources/SimpleTask.dll'
+ AssemblyFile='Test/resources/TestTasks.dll'
/>
</Project>
";
<CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
</Configuration>
</Configurations>
+ <DeployTargets />
<DeploymentInformation strategy="File">
<excludeFiles />
</DeploymentInformation>
<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" />
<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>
+++ /dev/null
-//
-// 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;
- }
-}
--- /dev/null
+//
+// 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"; }
+ }
+}
--- /dev/null
+//
+// 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");
+ }
+ }
+}
--- /dev/null
+//
+// 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");
+ }
+ }
+}
--- /dev/null
+//
+// 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");
+ }
+ }
+}
--- /dev/null
+//
+// 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");
+ }
+ }
+}