diff options
author | Atsushi Eno <atsushieno@veritas-vos-liberabit.com> | 2013-12-04 12:44:53 +0400 |
---|---|---|
committer | Atsushi Eno <atsushieno@gmail.com> | 2014-01-07 19:09:33 +0400 |
commit | c304f080a7a0ee66ed55b8cd2d2965802e11674d (patch) | |
tree | 0ca3236ca4b000555f55b9eb0530cfa703812036 /mcs/class/Microsoft.Build/Test | |
parent | 96fe7c837248763b90fa4a1668b5ce2a760181ff (diff) |
Add logger related tests (to sort out those Loggers properties relationship)
Diffstat (limited to 'mcs/class/Microsoft.Build/Test')
-rw-r--r-- | mcs/class/Microsoft.Build/Test/Microsoft.Build.Execution/BuildSubmissionTest.cs | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/mcs/class/Microsoft.Build/Test/Microsoft.Build.Execution/BuildSubmissionTest.cs b/mcs/class/Microsoft.Build/Test/Microsoft.Build.Execution/BuildSubmissionTest.cs index df2febcbf75..a26cbd41e77 100644 --- a/mcs/class/Microsoft.Build/Test/Microsoft.Build.Execution/BuildSubmissionTest.cs +++ b/mcs/class/Microsoft.Build/Test/Microsoft.Build.Execution/BuildSubmissionTest.cs @@ -110,6 +110,55 @@ namespace MonoTests.Microsoft.Build.Execution Assert.IsTrue (endBuildDone - beforeExec >= TimeSpan.FromSeconds (1), "#2"); Assert.IsTrue (endBuildDone > waitDone, "#3"); } + + [Test] + public void BuildParameterLoggersExplicitlyRequired () + { + string project_xml = @"<Project DefaultTargets='Foo' xmlns='http://schemas.microsoft.com/developer/msbuild/2003'> + <Import Project='$(MSBuildToolsPath)\Microsoft.Common.targets' /> + <Target Name='Foo'> + <ItemGroup> + <Foo Condition='$(X)' Include='foo.txt' /> + </ItemGroup> + </Target> +</Project>"; + var xml = XmlReader.Create (new StringReader (project_xml)); + var root = ProjectRootElement.Create (xml); + root.FullPath = "BuildSubmissionTest.TaskOutputsToLoggers.proj"; + var pc = new ProjectCollection (); + var sw = new StringWriter (); + pc.RegisterLogger (new ConsoleLogger (LoggerVerbosity.Diagnostic, sw.WriteLine, null, null)); + var proj = new ProjectInstance (root); + var bm = new BuildManager (); + var bp = new BuildParameters (pc); + var br = new BuildRequestData (proj, null); + Assert.IsFalse (bm.Build (bp, br).OverallResult == BuildResultCode.Failure, "#1"); + // the logger is *ignored* + Assert.IsFalse (sw.ToString ().Contains ("$(X)"), "#2"); + } + + [Test] + public void ProjectInstanceBuildLoggersExplicitlyRequired () + { + string project_xml = @"<Project DefaultTargets='Foo' xmlns='http://schemas.microsoft.com/developer/msbuild/2003'> + <Import Project='$(MSBuildToolsPath)\Microsoft.Common.targets' /> + <Target Name='Foo'> + <ItemGroup> + <Foo Condition='$(X)' Include='foo.txt' /> + </ItemGroup> + </Target> +</Project>"; + var xml = XmlReader.Create (new StringReader (project_xml)); + var root = ProjectRootElement.Create (xml); + root.FullPath = "BuildSubmissionTest.TaskOutputsToLoggers.proj"; + var pc = new ProjectCollection (); + var sw = new StringWriter (); + pc.RegisterLogger (new ConsoleLogger (LoggerVerbosity.Diagnostic, sw.WriteLine, null, null)); + var proj = new ProjectInstance (root); + Assert.IsFalse (proj.Build (), "#1"); + // the logger is *ignored* again + Assert.IsFalse (sw.ToString ().Contains ("$(X)"), "#2"); + } } } |