diff options
author | Atsushi Eno <atsushieno@gmail.com> | 2014-01-28 11:52:00 +0400 |
---|---|---|
committer | Atsushi Eno <atsushieno@gmail.com> | 2014-02-20 13:22:22 +0400 |
commit | 459b986b1c41d43292ca84726633ce5a0eaac26b (patch) | |
tree | fc76e733c85d28a5455293a7589a3480a3b838ab /mcs/class/Microsoft.Build/Test | |
parent | 92a1a5a0084bc74801a95628c15548671a77e2dd (diff) |
There is no local scope for properties and items that can be defined in a Target.
Diffstat (limited to 'mcs/class/Microsoft.Build/Test')
-rw-r--r-- | mcs/class/Microsoft.Build/Test/Microsoft.Build.Execution/ProjectTargetInstanceTest.cs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/mcs/class/Microsoft.Build/Test/Microsoft.Build.Execution/ProjectTargetInstanceTest.cs b/mcs/class/Microsoft.Build/Test/Microsoft.Build.Execution/ProjectTargetInstanceTest.cs index 9d12b288027..ce13ce36469 100644 --- a/mcs/class/Microsoft.Build/Test/Microsoft.Build.Execution/ProjectTargetInstanceTest.cs +++ b/mcs/class/Microsoft.Build/Test/Microsoft.Build.Execution/ProjectTargetInstanceTest.cs @@ -170,5 +170,44 @@ namespace MonoTests.Microsoft.Build.Execution File.Delete ("inputsandoutputstest.txt"); } } + + [Test] + public void PropertiesInTarget () + { + string project_xml = @"<Project DefaultTargets='Foo' xmlns='http://schemas.microsoft.com/developer/msbuild/2003'> + <Target Name='Foo' DependsOnTargets='Bar'> + <Error Text='error' Condition='$(X)!=x' /> + </Target> + <Target Name='Bar'> + <PropertyGroup> + <X>x</X> + </PropertyGroup> + </Target> +</Project>"; + var xml = XmlReader.Create (new StringReader (project_xml)); + var root = ProjectRootElement.Create (xml); + root.FullPath = "ProjectTargetInstanceTest.PropertiesInTarget.proj"; + var proj = new ProjectInstance (root); + Assert.IsTrue (proj.Build (), "#1"); // if it skips Bar or does not persist property X, it results in an error. + } + + [Test] + public void PropertiesInTarget2 () + { + string project_xml = @"<Project DefaultTargets='Foo' xmlns='http://schemas.microsoft.com/developer/msbuild/2003'> + <Target Name='Foo'> + <Error Text='error' Condition='$(X)!=x' /> + <!-- defined later, means it does not affect Condition above --> + <PropertyGroup> + <X>x</X> + </PropertyGroup> + </Target> +</Project>"; + var xml = XmlReader.Create (new StringReader (project_xml)); + var root = ProjectRootElement.Create (xml); + root.FullPath = "ProjectTargetInstanceTest.PropertiesInTarget.proj"; + var proj = new ProjectInstance (root); + Assert.IsFalse (proj.Build (), "#1"); + } } } |