// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
using System;
+using System.Reflection;
using System.Collections;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
public void ARFC (CommandLineBuilderExtension commandLine)
{
base.AddResponseFileCommands (commandLine);
+#if !NET_4_0
+ string s = commandLine.ToString ();
+ if (s.Length == 6)
+ Assert.AreEqual ("/sdk:2", s);
+ else
+ Assert.AreEqual ("/sdk:2 ", s.Substring (0, 7));
+
+ BindingFlags flags = BindingFlags.Instance | BindingFlags.NonPublic;
+ PropertyInfo pi = typeof (CommandLineBuilderExtension).GetProperty ("CommandLine", flags);
+ System.Text.StringBuilder sb = (System.Text.StringBuilder) pi.GetValue (commandLine, null);
+ sb.Length = 0;
+ if (s.Length > 6)
+ sb.Append (s.Substring (7));
+#endif
}
public void ACLC (CommandLineBuilderExtension commandLine)
Assert.AreEqual ("/nowarn:A", clbe.ToString (), "A1");
}
+ [Test]
+ public void TestDisabledWarningsComma ()
+ {
+ CscExtended csc = new CscExtended ();
+ CommandLineBuilderExtension clbe = new CommandLineBuilderExtension ();
+
+ csc.DisabledWarnings = "A, B";
+ csc.ARFC (clbe);
+
+ Assert.AreEqual ("/nowarn:A;B", clbe.ToString (), "A1");
+ }
+
[Test]
public void TestDocumentationFile ()
{
Assert.AreEqual (String.Empty, c2.ToString (), "A2");
}
+ // Behavior for this intentionally differs from .net .
+ // msbuild doesn't quote the define args, but we do
+ // that to make it easier to copy/paste and execute
+ // compiler command lines, helps in debugging.
+ [Category ("NotDotNet")]
[Test]
public void TestDefineConstants ()
{
CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
- csc.DefineConstants = "A;B";
+ csc.DefineConstants = "A;B;;CD;;;Foo Bar";
+ csc.ARFC (c1);
+ csc.ACLC (c2);
+
+ Assert.AreEqual ("/define:\"A;B;CD;Foo;Bar\"", c1.ToString (), "A1");
+ Assert.AreEqual (String.Empty, c2.ToString (), "A2");
+ }
+
+ [Test]
+ public void TestDefineConstants2 ()
+ {
+ CscExtended csc = new CscExtended ();
+ CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
+ CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
+
+ csc.DefineConstants = ";;;";
csc.ARFC (c1);
csc.ACLC (c2);
- Assert.AreEqual ("/define:A;B", c1.ToString (), "A1");
+ Assert.AreEqual (String.Empty, c1.ToString (), "A1");
Assert.AreEqual (String.Empty, c2.ToString (), "A2");
}