Author: msierad
Date: 2006-12-04 11:02:09 -0500 (Mon, 04 Dec 2006)
New Revision: 68958
Added:
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/ALTest.cs
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/ManagedCompilerTest.cs
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/TestEngine.cs
Modified:
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/ChangeLog
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/Consts.cs
Log:
2006-12-04 Marek Sieradzki <[EMAIL PROTECTED]>
* ALTest.cs, ManagedCompilerTest.cs: New tests.
* Consts.cs: Added a platform check.
* TestEngine.cs: Class that acts like IBuildEngine implementation from
Microsoft.Build.BuildEngine.
Added:
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/ALTest.cs
===================================================================
--- trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/ALTest.cs
2006-12-04 15:56:36 UTC (rev 68957)
+++ trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/ALTest.cs
2006-12-04 16:02:09 UTC (rev 68958)
@@ -0,0 +1,556 @@
+//
+// ALTest.cs
+//
+// Author:
+// Marek Sieradzki ([EMAIL PROTECTED])
+//
+// (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.Collections;
+using Microsoft.Build.BuildEngine;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Tasks;
+using Microsoft.Build.Utilities;
+using NUnit.Framework;
+
+namespace MonoTests.Microsoft.Build.Tasks {
+
+ class ALExtended : AL {
+ public ALExtended ()
+ : base ()
+ {
+ }
+
+ public void ARFC (CommandLineBuilderExtension commandLine)
+ {
+ base.AddResponseFileCommands (commandLine);
+ }
+
+ public string TN {
+ get { return base.ToolName; }
+ }
+ }
+
+ [TestFixture]
+ public class ALTest {
+
+ [Test]
+ public void TestAssignment1 ()
+ {
+ AL al = new AL ();
+
+ al.AlgorithmId = "1";
+ al.BaseAddress = "2";
+ al.CompanyName = "3";
+ al.Configuration = "4";
+ al.Copyright = "5";
+ al.Culture = "6";
+ al.DelaySign = true;
+ al.Description = "7";
+ al.EmbedResources = new ITaskItem [1] { new TaskItem
("8") };
+ al.EvidenceFile = "9";
+ al.FileVersion = "10";
+ al.Flags = "11";
+ al.GenerateFullPaths = true;
+ al.KeyContainer = "12";
+ al.KeyFile = "13";
+ al.LinkResources = new ITaskItem [1] { new TaskItem
("14") };
+ al.MainEntryPoint = "15";
+ al.OutputAssembly = new TaskItem ("16");
+ al.Platform = "17";
+ al.ProductName = "18";
+ al.ProductVersion = "19";
+ al.ResponseFiles = new string [1] { "20" };
+ al.SourceModules = new ITaskItem [1] { new TaskItem
("21") };
+ al.TargetType = "22";
+ al.TemplateFile = "23";
+ al.Title = "24";
+ al.Trademark = "25";
+ al.Version = "26";
+ al.Win32Icon = "27";
+ al.Win32Resource = "28";
+
+ Assert.AreEqual ("1", al.AlgorithmId, "A1");
+ Assert.AreEqual ("2", al.BaseAddress, "A2");
+ Assert.AreEqual ("3", al.CompanyName, "A3");
+ Assert.AreEqual ("4", al.Configuration, "A4");
+ Assert.AreEqual ("5", al.Copyright, "A5");
+ Assert.AreEqual ("6", al.Culture, "A6");
+ Assert.AreEqual (true, al.DelaySign, "A7");
+ Assert.AreEqual ("7", al.Description, "A8");
+ Assert.AreEqual ("8", al.EmbedResources [0].ItemSpec,
"A9");
+ Assert.AreEqual ("9", al.EvidenceFile, "A10");
+ Assert.AreEqual ("10", al.FileVersion, "A11");
+ Assert.AreEqual ("11", al.Flags, "A12");
+ Assert.AreEqual (true, al.GenerateFullPaths, "A13");
+ Assert.AreEqual ("12", al.KeyContainer, "A14");
+ Assert.AreEqual ("13", al.KeyFile, "A15");
+ Assert.AreEqual ("14", al.LinkResources [0].ItemSpec,
"A16");
+ Assert.AreEqual ("15", al.MainEntryPoint, "A17");
+ Assert.AreEqual ("16", al.OutputAssembly.ItemSpec,
"A18");
+ Assert.AreEqual ("17", al.Platform, "A19");
+ Assert.AreEqual ("18", al.ProductName, "A20");
+ Assert.AreEqual ("19", al.ProductVersion, "A21");
+ Assert.AreEqual ("20", al.ResponseFiles [0], "A22");
+ Assert.AreEqual ("21", al.SourceModules [0].ItemSpec,
"A23");
+ Assert.AreEqual ("22", al.TargetType, "A24");
+ Assert.AreEqual ("23", al.TemplateFile, "A25");
+ Assert.AreEqual ("24", al.Title, "A26");
+ Assert.AreEqual ("25", al.Trademark, "A27");
+ Assert.AreEqual ("26", al.Version, "A28");
+ Assert.AreEqual ("27", al.Win32Icon, "A29");
+ Assert.AreEqual ("28", al.Win32Resource, "A30");
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ public void TestAssignment2 ()
+ {
+ ALExtended ale = new ALExtended ();
+ Assert.AreEqual ("AL.exe", ale.TN, "A31");
+ }
+
+ [Test]
+ public void TestDefaultValues ()
+ {
+ AL al = new AL ();
+
+ Assert.IsNull (al.AlgorithmId, "A1");
+ Assert.IsNull (al.BaseAddress, "A2");
+ Assert.IsNull (al.CompanyName, "A3");
+ Assert.IsNull (al.Configuration, "A4");
+ Assert.IsNull (al.Copyright, "A5");
+ Assert.IsNull (al.Culture, "A6");
+ Assert.IsFalse (al.DelaySign, "A7");
+ Assert.IsNull (al.Description, "A8");
+ Assert.IsNull (al.EmbedResources, "A9");
+ Assert.IsNull (al.EvidenceFile, "A10");
+ Assert.IsNull (al.FileVersion, "A11");
+ Assert.IsNull (al.Flags, "A12");
+ Assert.IsFalse (al.GenerateFullPaths, "A13");
+ Assert.IsNull (al.KeyContainer, "A14");
+ Assert.IsNull (al.KeyFile, "A15");
+ Assert.IsNull (al.LinkResources, "A16");
+ Assert.IsNull (al.MainEntryPoint, "A17");
+ Assert.IsNull (al.OutputAssembly, "A18");
+ Assert.IsNull (al.Platform, "A19");
+ Assert.IsNull (al.ProductName, "A20");
+ Assert.IsNull (al.ProductVersion, "A21");
+ Assert.IsNull (al.ResponseFiles, "A22");
+ Assert.IsNull (al.SourceModules, "A23");
+ Assert.IsNull (al.TargetType, "A24");
+ Assert.IsNull (al.TemplateFile, "A25");
+ Assert.IsNull (al.Title, "A26");
+ Assert.IsNull (al.Trademark, "A27");
+ Assert.IsNull (al.Version, "A28");
+ Assert.IsNull (al.Win32Icon, "A29");
+ Assert.IsNull (al.Win32Resource, "A30");
+ }
+
+ [Test]
+ public void TestAlgorithmId ()
+ {
+ ALExtended ale = new ALExtended ();
+ CommandLineBuilderExtension clbe = new
CommandLineBuilderExtension ();
+
+ ale.AlgorithmId = "a";
+ ale.ARFC (clbe);
+
+ Assert.AreEqual ("/algid:a", clbe.ToString (), "A1");
+ }
+
+ [Test]
+ public void TestBaseAddress ()
+ {
+ ALExtended ale = new ALExtended ();
+ CommandLineBuilderExtension clbe = new
CommandLineBuilderExtension ();
+
+ ale.BaseAddress = "a";
+ ale.ARFC (clbe);
+
+ Assert.AreEqual ("/baseaddress:a", clbe.ToString (),
"A1");
+ }
+
+ [Test]
+ public void TestCompanyName ()
+ {
+ ALExtended ale = new ALExtended ();
+ CommandLineBuilderExtension clbe = new
CommandLineBuilderExtension ();
+
+ ale.CompanyName = "a";
+ ale.ARFC (clbe);
+
+ Assert.AreEqual ("/company:a", clbe.ToString (), "A1");
+ }
+
+ [Test]
+ public void TestConfiguration ()
+ {
+ ALExtended ale = new ALExtended ();
+ CommandLineBuilderExtension clbe = new
CommandLineBuilderExtension ();
+
+ ale.Configuration = "a";
+ ale.ARFC (clbe);
+
+ Assert.AreEqual ("/configuration:a", clbe.ToString (),
"A1");
+ }
+
+ [Test]
+ public void TestCopyright ()
+ {
+ ALExtended ale = new ALExtended ();
+ CommandLineBuilderExtension clbe = new
CommandLineBuilderExtension ();
+
+ ale.Copyright = "a";
+ ale.ARFC (clbe);
+
+ Assert.AreEqual ("/copyright:a", clbe.ToString (),
"A1");
+ }
+
+ [Test]
+ public void TestCulture ()
+ {
+ ALExtended ale = new ALExtended ();
+ CommandLineBuilderExtension clbe = new
CommandLineBuilderExtension ();
+
+ ale.Culture = "a";
+ ale.ARFC (clbe);
+
+ Assert.AreEqual ("/culture:a", clbe.ToString (), "A1");
+ }
+
+ [Test]
+ public void TestDelaySign1 ()
+ {
+ ALExtended ale = new ALExtended ();
+ CommandLineBuilderExtension clbe = new
CommandLineBuilderExtension ();
+
+ ale.DelaySign = true;
+ ale.ARFC (clbe);
+
+ Assert.AreEqual ("/delaysign+", clbe.ToString (), "A1");
+ }
+
+ [Test]
+ public void TestDelaySign2 ()
+ {
+ ALExtended ale = new ALExtended ();
+ CommandLineBuilderExtension clbe = new
CommandLineBuilderExtension ();
+
+ ale.DelaySign = false;
+ ale.ARFC (clbe);
+
+ Assert.AreEqual ("/delaysign-", clbe.ToString (), "A1");
+ }
+
+ [Test]
+ public void TestDescription ()
+ {
+ ALExtended ale = new ALExtended ();
+ CommandLineBuilderExtension clbe = new
CommandLineBuilderExtension ();
+
+ ale.Description = "a";
+ ale.ARFC (clbe);
+
+ Assert.AreEqual ("/description:a", clbe.ToString (),
"A1");
+ }
+
+ [Test]
+ public void TestEmbedResources ()
+ {
+ ALExtended ale = new ALExtended ();
+ CommandLineBuilderExtension clbe = new
CommandLineBuilderExtension ();
+
+ ale.EmbedResources = new ITaskItem [2] { new TaskItem
("a"), new TaskItem ("b") };
+ ale.ARFC (clbe);
+
+ Assert.AreEqual ("/embed:a /embed:b", clbe.ToString (),
"A1");
+ }
+
+ [Test]
+ public void TestEvidenceFile ()
+ {
+ ALExtended ale = new ALExtended ();
+ CommandLineBuilderExtension clbe = new
CommandLineBuilderExtension ();
+
+ ale.EvidenceFile = "a";
+ ale.ARFC (clbe);
+
+ Assert.AreEqual ("/evidence:a", clbe.ToString (), "A1");
+ }
+
+ [Test]
+ public void TestFileVersion ()
+ {
+ ALExtended ale = new ALExtended ();
+ CommandLineBuilderExtension clbe = new
CommandLineBuilderExtension ();
+
+ ale.FileVersion = "a";
+ ale.ARFC (clbe);
+
+ Assert.AreEqual ("/fileversion:a", clbe.ToString (),
"A1");
+ }
+
+ [Test]
+ public void TestFlags ()
+ {
+ ALExtended ale = new ALExtended ();
+ CommandLineBuilderExtension clbe = new
CommandLineBuilderExtension ();
+
+ ale.Flags = "a";
+ ale.ARFC (clbe);
+
+ Assert.AreEqual ("/flags:a", clbe.ToString (), "A1");
+ }
+
+ [Test]
+ public void TestGenerateFullPaths1 ()
+ {
+ ALExtended ale = new ALExtended ();
+ CommandLineBuilderExtension clbe = new
CommandLineBuilderExtension ();
+
+ ale.GenerateFullPaths = true;
+ ale.ARFC (clbe);
+
+ Assert.AreEqual ("/fullpaths", clbe.ToString (), "A1");
+ }
+
+ [Test]
+ public void TestGenerateFullPaths2 ()
+ {
+ ALExtended ale = new ALExtended ();
+ CommandLineBuilderExtension clbe = new
CommandLineBuilderExtension ();
+
+ ale.GenerateFullPaths = false;
+ ale.ARFC (clbe);
+
+ Assert.AreEqual (String.Empty, clbe.ToString (), "A1");
+ }
+
+ [Test]
+ public void TestKeyContainer ()
+ {
+ ALExtended ale = new ALExtended ();
+ CommandLineBuilderExtension clbe = new
CommandLineBuilderExtension ();
+
+ ale.KeyContainer = "a";
+ ale.ARFC (clbe);
+
+ Assert.AreEqual ("/keyname:a", clbe.ToString (), "A1");
+ }
+
+ [Test]
+ public void TestKeyFile ()
+ {
+ ALExtended ale = new ALExtended ();
+ CommandLineBuilderExtension clbe = new
CommandLineBuilderExtension ();
+
+ ale.KeyFile = "a";
+ ale.ARFC (clbe);
+
+ Assert.AreEqual ("/keyfile:a", clbe.ToString (), "A1");
+ }
+
+ [Test]
+ public void TestLinkResources ()
+ {
+ ALExtended ale = new ALExtended ();
+ CommandLineBuilderExtension clbe = new
CommandLineBuilderExtension ();
+
+ ale.LinkResources = new ITaskItem [2] { new TaskItem
("a"), new TaskItem ("b") };
+ ale.ARFC (clbe);
+
+ Assert.AreEqual ("/link:a /link:b", clbe.ToString (),
"A1");
+ }
+
+ [Test]
+ public void TestMainEntryPoint ()
+ {
+ ALExtended ale = new ALExtended ();
+ CommandLineBuilderExtension clbe = new
CommandLineBuilderExtension ();
+
+ ale.MainEntryPoint = "a";
+ ale.ARFC (clbe);
+
+ Assert.AreEqual ("/main:a", clbe.ToString (), "A1");
+ }
+
+ [Test]
+ public void TestOutputAssembly ()
+ {
+ ALExtended ale = new ALExtended ();
+ CommandLineBuilderExtension clbe = new
CommandLineBuilderExtension ();
+
+ ale.OutputAssembly = new TaskItem ("a");
+ ale.ARFC (clbe);
+
+ Assert.AreEqual ("/out:a", clbe.ToString (), "A1");
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ public void TestPlatform ()
+ {
+ ALExtended ale = new ALExtended ();
+ CommandLineBuilderExtension clbe = new
CommandLineBuilderExtension ();
+
+ ale.Platform = "a";
+ ale.ARFC (clbe);
+
+ Assert.AreEqual ("/platform:a", clbe.ToString (), "A1");
+ }
+
+ [Test]
+ public void TestProductName ()
+ {
+ ALExtended ale = new ALExtended ();
+ CommandLineBuilderExtension clbe = new
CommandLineBuilderExtension ();
+
+ ale.ProductName = "a";
+ ale.ARFC (clbe);
+
+ Assert.AreEqual ("/product:a", clbe.ToString (), "A1");
+ }
+
+ [Test]
+ public void TestProductVersion ()
+ {
+ ALExtended ale = new ALExtended ();
+ CommandLineBuilderExtension clbe = new
CommandLineBuilderExtension ();
+
+ ale.ProductVersion = "a";
+ ale.ARFC (clbe);
+
+ Assert.AreEqual ("/productversion:a", clbe.ToString (),
"A1");
+ }
+
+ [Test]
+ public void TestResponseFiles ()
+ {
+ ALExtended ale = new ALExtended ();
+ CommandLineBuilderExtension clbe = new
CommandLineBuilderExtension ();
+
+ ale.ResponseFiles = new string [2] { "a", "b" };
+ ale.ARFC (clbe);
+
+ Assert.AreEqual ("@a @b", clbe.ToString (), "A1");
+ }
+
+ [Test]
+ public void TestSourceModules ()
+ {
+ ALExtended ale = new ALExtended ();
+ CommandLineBuilderExtension clbe = new
CommandLineBuilderExtension ();
+
+ ale.SourceModules = new ITaskItem [2] { new TaskItem
("a"), new TaskItem ("b") };
+ ale.ARFC (clbe);
+
+ Assert.AreEqual ("a b", clbe.ToString (), "A1");
+ }
+
+ [Test]
+ public void TestTargetType ()
+ {
+ ALExtended ale = new ALExtended ();
+ CommandLineBuilderExtension clbe = new
CommandLineBuilderExtension ();
+
+ ale.TargetType = "a";
+ ale.ARFC (clbe);
+
+ Assert.AreEqual ("/target:a", clbe.ToString (), "A1");
+ }
+
+ [Test]
+ public void TestTemplateFile ()
+ {
+ ALExtended ale = new ALExtended ();
+ CommandLineBuilderExtension clbe = new
CommandLineBuilderExtension ();
+
+ ale.TemplateFile = "a";
+ ale.ARFC (clbe);
+
+ Assert.AreEqual ("/template:a", clbe.ToString (), "A1");
+ }
+
+ [Test]
+ public void TestTitle ()
+ {
+ ALExtended ale = new ALExtended ();
+ CommandLineBuilderExtension clbe = new
CommandLineBuilderExtension ();
+
+ ale.Title = "a";
+ ale.ARFC (clbe);
+
+ Assert.AreEqual ("/title:a", clbe.ToString (), "A1");
+ }
+
+ [Test]
+ public void TestTrademark ()
+ {
+ ALExtended ale = new ALExtended ();
+ CommandLineBuilderExtension clbe = new
CommandLineBuilderExtension ();
+
+ ale.Trademark = "a";
+ ale.ARFC (clbe);
+
+ Assert.AreEqual ("/trademark:a", clbe.ToString (),
"A1");
+ }
+
+ [Test]
+ public void TestVersion ()
+ {
+ ALExtended ale = new ALExtended ();
+ CommandLineBuilderExtension clbe = new
CommandLineBuilderExtension ();
+
+ ale.Version = "a";
+ ale.ARFC (clbe);
+
+ Assert.AreEqual ("/version:a", clbe.ToString (), "A1");
+ }
+
+ [Test]
+ public void TestWin32Icon ()
+ {
+ ALExtended ale = new ALExtended ();
+ CommandLineBuilderExtension clbe = new
CommandLineBuilderExtension ();
+
+ ale.Win32Icon = "a";
+ ale.ARFC (clbe);
+
+ Assert.AreEqual ("/win32icon:a", clbe.ToString (),
"A1");
+ }
+
+ [Test]
+ public void TestWin32Resource ()
+ {
+ ALExtended ale = new ALExtended ();
+ CommandLineBuilderExtension clbe = new
CommandLineBuilderExtension ();
+
+ ale.Win32Resource = "a";
+ ale.ARFC (clbe);
+
+ Assert.AreEqual ("/win32res:a", clbe.ToString (), "A1");
+ }
+ }
+}
+
Property changes on:
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/ALTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Modified:
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/ChangeLog
===================================================================
--- trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/ChangeLog
2006-12-04 15:56:36 UTC (rev 68957)
+++ trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/ChangeLog
2006-12-04 16:02:09 UTC (rev 68958)
@@ -1,3 +1,10 @@
+2006-12-04 Marek Sieradzki <[EMAIL PROTECTED]>
+
+ * ALTest.cs, ManagedCompilerTest.cs: New tests.
+ * Consts.cs: Added a platform check.
+ * TestEngine.cs: Class that acts like IBuildEngine implementation from
+ Microsoft.Build.BuildEngine.
+
2006-06-17 Marek Sieradzki <[EMAIL PROTECTED]>
* ErrorTest.cs: Added check for Execute () return value.
Modified:
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/Consts.cs
===================================================================
--- trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/Consts.cs
2006-12-04 15:56:36 UTC (rev 68957)
+++ trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/Consts.cs
2006-12-04 16:02:09 UTC (rev 68958)
@@ -25,12 +25,18 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-namespace MonoTests.Microsoft.Build.Tasks {
+using System;
+using Microsoft.Build.Utilities;
- public static class Consts {
-
- public static string BinPath {
- get { return "../../tools/xbuild/xbuild"; }
+public static class Consts {
+ public static string BinPath {
+ get {
+ // FIXME: it should check for runtime not OS
+ int p = (int) Environment.OSVersion.Platform;
+ if (p == 4 || p == 128)
+ return "../../tools/xbuild/xbuild";
+ else
+ return
ToolLocationHelper.GetPathToDotNetFramework
(TargetDotNetFrameworkVersion.Version20);
}
}
}
Added:
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/ManagedCompilerTest.cs
===================================================================
---
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/ManagedCompilerTest.cs
2006-12-04 15:56:36 UTC (rev 68957)
+++
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/ManagedCompilerTest.cs
2006-12-04 16:02:09 UTC (rev 68958)
@@ -0,0 +1,700 @@
+//
+// ManagedCompilerTest.cs
+//
+// Author:
+// Marek Sieradzki ([EMAIL PROTECTED])
+//
+// (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.Collections;
+using Microsoft.Build.BuildEngine;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Tasks;
+using Microsoft.Build.Utilities;
+using NUnit.Framework;
+
+namespace MonoTests.Microsoft.Build.Tasks {
+
+ class MCExtended : ManagedCompiler {
+ public MCExtended ()
+ : base ()
+ {
+ }
+
+ public void ARFC (CommandLineBuilderExtension commandLine)
+ {
+ base.AddResponseFileCommands (commandLine);
+ }
+
+ public void ACLC (CommandLineBuilderExtension commandLine)
+ {
+ base.AddCommandLineCommands (commandLine);
+ }
+
+ public new bool CheckAllReferencesExistOnDisk ()
+ {
+ return base.CheckAllReferencesExistOnDisk ();
+ }
+
+
+ protected override string ToolName {
+ get { return "something"; }
+ }
+
+ protected override string GenerateFullPathToTool ()
+ {
+ return null;
+ }
+ }
+
+ [TestFixture]
+ public class ManagedCompilerTest {
+
+ [Test]
+ public void TestAssignment ()
+ {
+ MCExtended mc = new MCExtended ();
+
+ mc.AdditionalLibPaths = new string [1] { "1" };
+ mc.AddModules = new string [1] { "2" };
+ mc.CodePage = 3;
+ mc.DebugType = "4";
+ mc.DefineConstants = "5";
+ mc.DelaySign = true;
+ mc.EmitDebugInformation = true;
+ mc.FileAlignment = 6;
+ mc.KeyContainer = "7";
+ mc.KeyFile = "8";
+ mc.LinkResources = new ITaskItem [1] { new TaskItem
("9") };
+ mc.MainEntryPoint = "10";
+ mc.NoConfig = true;
+ mc.NoLogo = true;
+ mc.Optimize = true;
+ mc.OutputAssembly = new TaskItem ("11");
+ mc.References = new ITaskItem [1] { new TaskItem ("12")
};
+ mc.Resources = new ITaskItem [1] { new TaskItem ("13")
};
+ mc.ResponseFiles = new ITaskItem [1] { new TaskItem
("14") };
+ mc.Sources = new ITaskItem [1] { new TaskItem ("15") };
+ mc.TargetType = "16";
+ mc.TreatWarningsAsErrors = true;
+ mc.Utf8Output = true;
+ mc.Win32Icon = "17";
+ mc.Win32Resource = "18";
+
+ Assert.AreEqual ("1", mc.AdditionalLibPaths [0], "A1");
+ Assert.AreEqual ("2", mc.AddModules [0], "A2");
+ Assert.AreEqual (3, mc.CodePage, "A3");
+ Assert.AreEqual ("4", mc.DebugType, "A4");
+ Assert.AreEqual ("5", mc.DefineConstants, "A5");
+ Assert.AreEqual (true, mc.DelaySign, "A6");
+ Assert.AreEqual (true, mc.EmitDebugInformation, "A7");
+ Assert.AreEqual (6, mc.FileAlignment, "A8");
+ Assert.AreEqual ("7", mc.KeyContainer, "A9");
+ Assert.AreEqual ("8", mc.KeyFile, "A10");
+ Assert.AreEqual ("9", mc.LinkResources [0].ItemSpec,
"A11");
+ Assert.AreEqual ("10", mc.MainEntryPoint, "A12");
+ Assert.AreEqual (true, mc.NoConfig, "A13");
+ Assert.AreEqual (true, mc.NoLogo, "A14");
+ Assert.AreEqual (true, mc.Optimize, "A15");
+ Assert.AreEqual ("11", mc.OutputAssembly.ItemSpec,
"A16");
+ Assert.AreEqual ("12", mc.References [0].ItemSpec,
"A17");
+ Assert.AreEqual ("13", mc.Resources [0].ItemSpec,
"A18");
+ Assert.AreEqual ("14", mc.ResponseFiles [0].ItemSpec,
"A19");
+ Assert.AreEqual ("15", mc.Sources [0].ItemSpec, "A20");
+ Assert.AreEqual ("16", mc.TargetType, "A21");
+ Assert.AreEqual (true, mc.TreatWarningsAsErrors, "A22");
+ Assert.AreEqual (true, mc.Utf8Output, "A23");
+ Assert.AreEqual ("17", mc.Win32Icon, "A24");
+ Assert.AreEqual ("18", mc.Win32Resource, "A25");
+ }
+
+ [Test]
+ public void TestDefaultValues ()
+ {
+ MCExtended mc = new MCExtended ();
+
+ Assert.IsNull (mc.AdditionalLibPaths, "A1");
+ Assert.IsNull (mc.AddModules, "A2");
+ Assert.AreEqual (0, mc.CodePage, "A3");
+ Assert.IsNull (mc.DebugType, "A4");
+ Assert.IsNull (mc.DefineConstants, "A5");
+ Assert.IsFalse (mc.DelaySign, "A6");
+ Assert.IsFalse (mc.EmitDebugInformation, "A7");
+ Assert.AreEqual (0, mc.FileAlignment, "A8");
+ Assert.IsNull (mc.KeyContainer, "A9");
+ Assert.IsNull (mc.KeyFile, "A10");
+ Assert.IsNull (mc.LinkResources, "A11");
+ Assert.IsNull (mc.MainEntryPoint, "A12");
+ Assert.IsFalse (mc.NoConfig, "A13");
+ Assert.IsFalse (mc.NoLogo, "A14");
+ Assert.IsFalse (mc.Optimize, "A15");
+ Assert.IsNull (mc.OutputAssembly, "A16");
+ Assert.IsNull (mc.References, "A17");
+ Assert.IsNull (mc.Resources, "A18");
+ Assert.IsNull (mc.ResponseFiles, "A19");
+ Assert.IsNull (mc.Sources, "A20");
+ Assert.IsNull (mc.TargetType, "A21");
+ Assert.IsFalse (mc.TreatWarningsAsErrors, "A22");
+ Assert.IsFalse (mc.Utf8Output, "A23");
+ Assert.IsNull (mc.Win32Icon, "A24");
+ Assert.IsNull (mc.Win32Resource, "A25");
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ public void TestAdditionalLibPaths ()
+ {
+ MCExtended mc = new MCExtended ();
+ CommandLineBuilderExtension c1 = new
CommandLineBuilderExtension ();
+ CommandLineBuilderExtension c2 = new
CommandLineBuilderExtension ();
+
+ mc.AdditionalLibPaths = new string [2] { "A", "B" };
+ mc.ARFC (c1);
+ mc.ACLC (c2);
+
+ Assert.AreEqual (String.Empty, c1.ToString (), "A1");
+ Assert.AreEqual (String.Empty, c2.ToString (), "A2");
+ }
+
+ [Test]
+ public void TestAddModules ()
+ {
+ MCExtended mc = new MCExtended ();
+ CommandLineBuilderExtension c1 = new
CommandLineBuilderExtension ();
+ CommandLineBuilderExtension c2 = new
CommandLineBuilderExtension ();
+
+ mc.AddModules = new string [2] { "A", "B" };
+ mc.ARFC (c1);
+ mc.ACLC (c2);
+
+ Assert.AreEqual ("/addmodule:A,B", c1.ToString (),
"A1");
+ Assert.AreEqual (String.Empty, c2.ToString (), "A2");
+ }
+
+ [Test]
+ public void TestCodePage1 ()
+ {
+ MCExtended mc = new MCExtended ();
+ CommandLineBuilderExtension c1 = new
CommandLineBuilderExtension ();
+ CommandLineBuilderExtension c2 = new
CommandLineBuilderExtension ();
+
+ mc.CodePage = 1111;
+ mc.ARFC (c1);
+ mc.ACLC (c2);
+
+ Assert.AreEqual ("/codepage:1111", c1.ToString (),
"A1");
+ Assert.AreEqual (String.Empty, c2.ToString (), "A2");
+ }
+
+ [Test]
+ public void TestCodePage2 ()
+ {
+ MCExtended mc = new MCExtended ();
+ CommandLineBuilderExtension c1 = new
CommandLineBuilderExtension ();
+ CommandLineBuilderExtension c2 = new
CommandLineBuilderExtension ();
+
+ mc.ARFC (c1);
+ mc.ACLC (c2);
+
+ Assert.AreEqual (String.Empty, c1.ToString (), "A1");
+ Assert.AreEqual (String.Empty, c2.ToString (), "A2");
+ }
+
+ [Test]
+ public void TestDebugType ()
+ {
+ MCExtended mc = new MCExtended ();
+ CommandLineBuilderExtension c1 = new
CommandLineBuilderExtension ();
+ CommandLineBuilderExtension c2 = new
CommandLineBuilderExtension ();
+
+ mc.DebugType = "A";
+ mc.ARFC (c1);
+ mc.ACLC (c2);
+
+ Assert.AreEqual ("/debug:A", c1.ToString (), "A1");
+ Assert.AreEqual (String.Empty, c2.ToString (), "A2");
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ public void TestDefineConstants ()
+ {
+ MCExtended mc = new MCExtended ();
+ CommandLineBuilderExtension c1 = new
CommandLineBuilderExtension ();
+ CommandLineBuilderExtension c2 = new
CommandLineBuilderExtension ();
+
+ mc.DefineConstants = "A;B";
+ mc.ARFC (c1);
+ mc.ACLC (c2);
+
+ Assert.AreEqual (String.Empty, c1.ToString (), "A1");
+ Assert.AreEqual (String.Empty, c2.ToString (), "A2");
+ }
+
+ [Test]
+ public void TestDelaySign1 ()
+ {
+ MCExtended mc = new MCExtended ();
+ CommandLineBuilderExtension c1 = new
CommandLineBuilderExtension ();
+ CommandLineBuilderExtension c2 = new
CommandLineBuilderExtension ();
+
+ mc.DelaySign = true;
+ mc.ARFC (c1);
+ mc.ACLC (c2);
+
+ Assert.AreEqual ("/delaysign+", c1.ToString (), "A1");
+ Assert.AreEqual (String.Empty, c2.ToString (), "A2");
+ }
+
+ [Test]
+ public void TestDelaySign2 ()
+ {
+ MCExtended mc = new MCExtended ();
+ CommandLineBuilderExtension c1 = new
CommandLineBuilderExtension ();
+ CommandLineBuilderExtension c2 = new
CommandLineBuilderExtension ();
+
+ mc.DelaySign = false;
+ mc.ARFC (c1);
+ mc.ACLC (c2);
+
+ Assert.AreEqual ("/delaysign-", c1.ToString (), "A1");
+ Assert.AreEqual (String.Empty, c2.ToString (), "A2");
+ }
+
+ [Test]
+ public void TestEmitDebugInformation1 ()
+ {
+ MCExtended mc = new MCExtended ();
+ CommandLineBuilderExtension c1 = new
CommandLineBuilderExtension ();
+ CommandLineBuilderExtension c2 = new
CommandLineBuilderExtension ();
+
+ mc.EmitDebugInformation = true;
+ mc.ARFC (c1);
+ mc.ACLC (c2);
+
+ Assert.AreEqual ("/debug+", c1.ToString (), "A1");
+ Assert.AreEqual (String.Empty, c2.ToString (), "A2");
+ }
+
+ [Test]
+ public void TestEmitDebugInformation2 ()
+ {
+ MCExtended mc = new MCExtended ();
+ CommandLineBuilderExtension c1 = new
CommandLineBuilderExtension ();
+ CommandLineBuilderExtension c2 = new
CommandLineBuilderExtension ();
+
+ mc.EmitDebugInformation = false;
+ mc.ARFC (c1);
+ mc.ACLC (c2);
+
+ Assert.AreEqual ("/debug-", c1.ToString (), "A1");
+ Assert.AreEqual (String.Empty, c2.ToString (), "A2");
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ public void TestFileAlignment1 ()
+ {
+ MCExtended mc = new MCExtended ();
+ CommandLineBuilderExtension c1 = new
CommandLineBuilderExtension ();
+ CommandLineBuilderExtension c2 = new
CommandLineBuilderExtension ();
+
+ mc.FileAlignment = 100;
+ mc.ARFC (c1);
+ mc.ACLC (c2);
+
+ Assert.AreEqual ("/filealign:100", c1.ToString (),
"A1");
+ Assert.AreEqual (String.Empty, c2.ToString (), "A2");
+ }
+
+ [Test]
+ public void TestFileAlignment2 ()
+ {
+ MCExtended mc = new MCExtended ();
+ CommandLineBuilderExtension c1 = new
CommandLineBuilderExtension ();
+ CommandLineBuilderExtension c2 = new
CommandLineBuilderExtension ();
+
+ mc.ARFC (c1);
+ mc.ACLC (c2);
+
+ Assert.AreEqual (String.Empty, c1.ToString (), "A1");
+ Assert.AreEqual (String.Empty, c2.ToString (), "A2");
+ }
+
+ [Test]
+ public void TestKeyContainer ()
+ {
+ MCExtended mc = new MCExtended ();
+ CommandLineBuilderExtension c1 = new
CommandLineBuilderExtension ();
+ CommandLineBuilderExtension c2 = new
CommandLineBuilderExtension ();
+
+ mc.KeyContainer = "A";
+ mc.ARFC (c1);
+ mc.ACLC (c2);
+
+ Assert.AreEqual ("/keycontainer:A", c1.ToString (),
"A1");
+ Assert.AreEqual (String.Empty, c2.ToString (), "A2");
+ }
+
+ [Test]
+ public void TestKeyFile ()
+ {
+ MCExtended mc = new MCExtended ();
+ CommandLineBuilderExtension c1 = new
CommandLineBuilderExtension ();
+ CommandLineBuilderExtension c2 = new
CommandLineBuilderExtension ();
+
+ mc.KeyFile = "A";
+ mc.ARFC (c1);
+ mc.ACLC (c2);
+
+ Assert.AreEqual ("/keyfile:A", c1.ToString (), "A1");
+ Assert.AreEqual (String.Empty, c2.ToString (), "A2");
+ }
+
+ [Test]
+ public void TestLinkResources ()
+ {
+ MCExtended mc = new MCExtended ();
+ CommandLineBuilderExtension c1 = new
CommandLineBuilderExtension ();
+ CommandLineBuilderExtension c2 = new
CommandLineBuilderExtension ();
+
+ mc.LinkResources = new ITaskItem [2] { new TaskItem
("A"), new TaskItem ("B") };
+ mc.ARFC (c1);
+ mc.ACLC (c2);
+
+ Assert.AreEqual ("/linkresource:A /linkresource:B",
c1.ToString (), "A1");
+ Assert.AreEqual (String.Empty, c2.ToString (), "A2");
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ public void TestMainEntryPoint ()
+ {
+ MCExtended mc = new MCExtended ();
+ CommandLineBuilderExtension c1 = new
CommandLineBuilderExtension ();
+ CommandLineBuilderExtension c2 = new
CommandLineBuilderExtension ();
+
+ mc.MainEntryPoint = "A";
+ mc.ARFC (c1);
+ mc.ACLC (c2);
+
+ Assert.AreEqual (String.Empty, c1.ToString (), "A1");
+ Assert.AreEqual (String.Empty, c2.ToString (), "A2");
+ }
+
+ [Test]
+ public void TestNoConfig1 ()
+ {
+ MCExtended mc = new MCExtended ();
+ CommandLineBuilderExtension c1 = new
CommandLineBuilderExtension ();
+ CommandLineBuilderExtension c2 = new
CommandLineBuilderExtension ();
+
+ mc.NoConfig = true;
+ mc.ARFC (c1);
+ mc.ACLC (c2);
+
+ Assert.AreEqual (String.Empty, c1.ToString (), "A1");
+ Assert.AreEqual ("/noconfig", c2.ToString (), "A2");
+ }
+
+ [Test]
+ public void TestNoConfig2 ()
+ {
+ MCExtended mc = new MCExtended ();
+ CommandLineBuilderExtension c1 = new
CommandLineBuilderExtension ();
+ CommandLineBuilderExtension c2 = new
CommandLineBuilderExtension ();
+
+ mc.NoConfig = false;
+ mc.ARFC (c1);
+ mc.ACLC (c2);
+
+ Assert.AreEqual (String.Empty, c1.ToString (), "A1");
+ Assert.AreEqual (String.Empty, c2.ToString (), "A2");
+ }
+
+ [Test]
+ public void TestNoLogo1 ()
+ {
+ MCExtended mc = new MCExtended ();
+ CommandLineBuilderExtension c1 = new
CommandLineBuilderExtension ();
+ CommandLineBuilderExtension c2 = new
CommandLineBuilderExtension ();
+
+ mc.NoLogo = true;
+ mc.ARFC (c1);
+ mc.ACLC (c2);
+
+ Assert.AreEqual ("/nologo", c1.ToString (), "A1");
+ Assert.AreEqual (String.Empty, c2.ToString (), "A2");
+ }
+
+ [Test]
+ public void TestNoLogo2 ()
+ {
+ MCExtended mc = new MCExtended ();
+ CommandLineBuilderExtension c1 = new
CommandLineBuilderExtension ();
+ CommandLineBuilderExtension c2 = new
CommandLineBuilderExtension ();
+
+ mc.NoLogo = false;
+ mc.ARFC (c1);
+ mc.ACLC (c2);
+
+ Assert.AreEqual (String.Empty, c1.ToString (), "A1");
+ Assert.AreEqual (String.Empty, c2.ToString (), "A2");
+ }
+
+ [Test]
+ public void TestOptimize1 ()
+ {
+ MCExtended mc = new MCExtended ();
+ CommandLineBuilderExtension c1 = new
CommandLineBuilderExtension ();
+ CommandLineBuilderExtension c2 = new
CommandLineBuilderExtension ();
+
+ mc.Optimize = true;
+ mc.ARFC (c1);
+ mc.ACLC (c2);
+
+ Assert.AreEqual ("/optimize+", c1.ToString (), "A1");
+ Assert.AreEqual (String.Empty, c2.ToString (), "A2");
+ }
+
+ [Test]
+ public void TestOptimize2 ()
+ {
+ MCExtended mc = new MCExtended ();
+ CommandLineBuilderExtension c1 = new
CommandLineBuilderExtension ();
+ CommandLineBuilderExtension c2 = new
CommandLineBuilderExtension ();
+
+ mc.Optimize = false;
+ mc.ARFC (c1);
+ mc.ACLC (c2);
+
+ Assert.AreEqual ("/optimize-", c1.ToString (), "A1");
+ Assert.AreEqual (String.Empty, c2.ToString (), "A2");
+ }
+
+ [Test]
+ public void TestOutputAssembly ()
+ {
+ MCExtended mc = new MCExtended ();
+ CommandLineBuilderExtension c1 = new
CommandLineBuilderExtension ();
+ CommandLineBuilderExtension c2 = new
CommandLineBuilderExtension ();
+
+ mc.OutputAssembly = new TaskItem ("A");
+ mc.ARFC (c1);
+ mc.ACLC (c2);
+
+ Assert.AreEqual ("/out:A", c1.ToString (), "A1");
+ Assert.AreEqual (String.Empty, c2.ToString (), "A2");
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ public void TestReferences ()
+ {
+ MCExtended mc = new MCExtended ();
+ CommandLineBuilderExtension c1 = new
CommandLineBuilderExtension ();
+ CommandLineBuilderExtension c2 = new
CommandLineBuilderExtension ();
+
+ mc.References = new ITaskItem [2] { new TaskItem ("A"),
new TaskItem ("B") };
+ mc.ARFC (c1);
+ mc.ACLC (c2);
+
+ Assert.AreEqual (String.Empty, c1.ToString (), "A1");
+ Assert.AreEqual (String.Empty, c2.ToString (), "A2");
+ }
+
+ [Test]
+ public void TestResources ()
+ {
+ MCExtended mc = new MCExtended ();
+ CommandLineBuilderExtension c1 = new
CommandLineBuilderExtension ();
+ CommandLineBuilderExtension c2 = new
CommandLineBuilderExtension ();
+
+ mc.Resources = new ITaskItem [2] { new TaskItem ("A"),
new TaskItem ("B") };
+ mc.ARFC (c1);
+ mc.ACLC (c2);
+
+ Assert.AreEqual ("/resource:A /resource:B", c1.ToString
(), "A1");
+ Assert.AreEqual (String.Empty, c2.ToString (), "A2");
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ public void TestResponseFiles ()
+ {
+ MCExtended mc = new MCExtended ();
+ CommandLineBuilderExtension c1 = new
CommandLineBuilderExtension ();
+ CommandLineBuilderExtension c2 = new
CommandLineBuilderExtension ();
+
+ mc.ResponseFiles = new ITaskItem [2] { new TaskItem
("A"), new TaskItem ("B") };
+ mc.ARFC (c1);
+ mc.ACLC (c2);
+
+ Assert.AreEqual (String.Empty, c1.ToString (), "A1");
+ Assert.AreEqual (String.Empty, c2.ToString (), "A2");
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ public void TestSources ()
+ {
+ MCExtended mc = new MCExtended ();
+ CommandLineBuilderExtension c1 = new
CommandLineBuilderExtension ();
+ CommandLineBuilderExtension c2 = new
CommandLineBuilderExtension ();
+
+ mc.Sources = new ITaskItem [2] { new TaskItem ("A"),
new TaskItem ("B") };
+ mc.ARFC (c1);
+ mc.ACLC (c2);
+
+ Assert.AreEqual ("/out:A.exe A B", c1.ToString (),
"A1");
+ Assert.AreEqual (String.Empty, c2.ToString (), "A2");
+ }
+
+ [Test]
+ public void TestTargetType ()
+ {
+ MCExtended mc = new MCExtended ();
+ CommandLineBuilderExtension c1 = new
CommandLineBuilderExtension ();
+ CommandLineBuilderExtension c2 = new
CommandLineBuilderExtension ();
+
+ mc.TargetType = "A";
+ mc.ARFC (c1);
+ mc.ACLC (c2);
+
+ Assert.AreEqual ("/target:a", c1.ToString (), "A1");
+ Assert.AreEqual (String.Empty, c2.ToString (), "A2");
+ }
+
+ [Test]
+ public void TestTreatWarningsAsErrors1 ()
+ {
+ MCExtended mc = new MCExtended ();
+ CommandLineBuilderExtension c1 = new
CommandLineBuilderExtension ();
+ CommandLineBuilderExtension c2 = new
CommandLineBuilderExtension ();
+
+ mc.TreatWarningsAsErrors = true;
+ mc.ARFC (c1);
+ mc.ACLC (c2);
+
+ Assert.AreEqual ("/warnaserror+", c1.ToString (), "A1");
+ Assert.AreEqual (String.Empty, c2.ToString (), "A2");
+ }
+
+ [Test]
+ public void TestTreatWarningsAsErrors2 ()
+ {
+ MCExtended mc = new MCExtended ();
+ CommandLineBuilderExtension c1 = new
CommandLineBuilderExtension ();
+ CommandLineBuilderExtension c2 = new
CommandLineBuilderExtension ();
+
+ mc.TreatWarningsAsErrors = false;
+ mc.ARFC (c1);
+ mc.ACLC (c2);
+
+ Assert.AreEqual ("/warnaserror-", c1.ToString (), "A1");
+ Assert.AreEqual (String.Empty, c2.ToString (), "A2");
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ public void TestUtf8Output1 ()
+ {
+ MCExtended mc = new MCExtended ();
+ CommandLineBuilderExtension c1 = new
CommandLineBuilderExtension ();
+ CommandLineBuilderExtension c2 = new
CommandLineBuilderExtension ();
+
+ mc.Utf8Output = true;
+ mc.ARFC (c1);
+ mc.ACLC (c2);
+
+ Assert.AreEqual ("/utf8output", c1.ToString (), "A1");
+ Assert.AreEqual (String.Empty, c2.ToString (), "A2");
+ }
+
+ [Test]
+ public void TestUtf8Output2 ()
+ {
+ MCExtended mc = new MCExtended ();
+ CommandLineBuilderExtension c1 = new
CommandLineBuilderExtension ();
+ CommandLineBuilderExtension c2 = new
CommandLineBuilderExtension ();
+
+ mc.Utf8Output = false;
+ mc.ARFC (c1);
+ mc.ACLC (c2);
+
+ Assert.AreEqual (String.Empty, c1.ToString (), "A1");
+ Assert.AreEqual (String.Empty, c2.ToString (), "A2");
+ }
+
+ [Test]
+ public void TestWin32Icon ()
+ {
+ MCExtended mc = new MCExtended ();
+ CommandLineBuilderExtension c1 = new
CommandLineBuilderExtension ();
+ CommandLineBuilderExtension c2 = new
CommandLineBuilderExtension ();
+
+ mc.Win32Icon = "A";
+ mc.ARFC (c1);
+ mc.ACLC (c2);
+
+ Assert.AreEqual ("/win32icon:A", c1.ToString (), "A1");
+ Assert.AreEqual (String.Empty, c2.ToString (), "A2");
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ public void TestWin32Resource ()
+ {
+ MCExtended mc = new MCExtended ();
+ CommandLineBuilderExtension c1 = new
CommandLineBuilderExtension ();
+ CommandLineBuilderExtension c2 = new
CommandLineBuilderExtension ();
+
+ mc.Win32Resource = "A;B";
+ mc.ARFC (c1);
+ mc.ACLC (c2);
+
+ Assert.AreEqual (String.Empty, c1.ToString (), "A1");
+ Assert.AreEqual (String.Empty, c2.ToString (), "A2");
+ }
+
+ [Test]
+ public void TestCheckAllReferencesExistOnDisk1 ()
+ {
+ MCExtended mc = new MCExtended ();
+ mc.BuildEngine = new TestEngine ();
+
+ mc.References = new ITaskItem [0];
+ Assert.IsTrue (mc.CheckAllReferencesExistOnDisk (),
"A1");
+
+ mc.References = null;
+ Assert.IsTrue (mc.CheckAllReferencesExistOnDisk (),
"A2");
+
+ mc.References = new ITaskItem [1] { new TaskItem
(@"Test\resources\test.cs") };
+ Assert.IsTrue (mc.CheckAllReferencesExistOnDisk (),
"A3");
+
+ mc.References = new ITaskItem [2] { new TaskItem
(@"Test\resources\test.cs"), new TaskItem ("X") };
+ Assert.IsFalse (mc.CheckAllReferencesExistOnDisk (),
"A4");
+ }
+ }
+}
+
Property changes on:
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/ManagedCompilerTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Added:
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/TestEngine.cs
===================================================================
---
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/TestEngine.cs
2006-12-04 15:56:36 UTC (rev 68957)
+++
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/TestEngine.cs
2006-12-04 16:02:09 UTC (rev 68958)
@@ -0,0 +1,75 @@
+//
+// TestEngine.cs
+//
+// Author:
+// Marek Sieradzki ([EMAIL PROTECTED])
+//
+// (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.Collections;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Utilities;
+
+namespace MonoTests.Microsoft.Build.Tasks {
+
+ public class TestEngine : IBuildEngine {
+ public bool BuildProjectFile (string projectFileName, string[]
targetNames, IDictionary globalProperties,
+ IDictionary targetOutputs)
+ {
+ return true;
+ }
+
+ public void LogCustomEvent (CustomBuildEventArgs e)
+ {
+ }
+
+ public void LogErrorEvent (BuildErrorEventArgs e)
+ {
+ }
+
+ public void LogMessageEvent (BuildMessageEventArgs e)
+ {
+ }
+
+ public void LogWarningEvent (BuildWarningEventArgs e)
+ {
+ }
+
+ public int ColumnNumberOfTaskNode {
+ get { return 0; }
+ }
+
+ public bool ContinueOnError {
+ get { return true; }
+ }
+
+ public int LineNumberOfTaskNode {
+ get { return 0; }
+ }
+
+ public string ProjectFileOfTaskNode {
+ get { return String.Empty; }
+ }
+ }
+
+}
Property changes on:
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/TestEngine.cs
___________________________________________________________________
Name: svn:eol-style
+ native
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches