X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FMicrosoft.Build.Engine%2FTest%2Fvarious%2FConditions.cs;h=c3c8dacabc5c4d3e19f5c2142195cffff4297174;hb=a341404ecdd3b5ca2ed0ab1e9a5bcb9b5ccd2566;hp=ba7409f91dcfcb4d92719a5c2c3d360598020e74;hpb=c31edd2dd9272c33acdd6859fd84d94a0123e356;p=mono.git
diff --git a/mcs/class/Microsoft.Build.Engine/Test/various/Conditions.cs b/mcs/class/Microsoft.Build.Engine/Test/various/Conditions.cs
index ba7409f91dc..c3c8dacabc5 100644
--- a/mcs/class/Microsoft.Build.Engine/Test/various/Conditions.cs
+++ b/mcs/class/Microsoft.Build.Engine/Test/various/Conditions.cs
@@ -278,9 +278,152 @@ namespace MonoTests.Microsoft.Build.BuildEngine.Various {
proj.LoadXml (documentString);
Assert.IsNotNull (proj.EvaluatedProperties ["A"], "A1");
- Assert.IsNotNull (proj.EvaluatedProperties ["B"], "A1");
- Assert.IsNotNull (proj.EvaluatedProperties ["C"], "A1");
- Assert.IsNull (proj.EvaluatedProperties ["D"], "A1");
+ Assert.IsNotNull (proj.EvaluatedProperties ["B"], "A2");
+ Assert.IsNotNull (proj.EvaluatedProperties ["C"], "A3");
+ Assert.IsNull (proj.EvaluatedProperties ["D"], "A4");
+ }
+
+ [Test]
+ [Category ("NotDotNet")]
+ public void TestCondition10 ()
+ {
+ Engine engine = new Engine (Consts.BinPath);
+ Project proj = engine.CreateNewProject ();
+
+ string documentString = @"
+
+
+
+
+
+
+
+
+
+ ";
+
+ proj.LoadXml (documentString);
+
+ Assert.IsNull (proj.EvaluatedProperties ["A"], "A1");
+ Assert.IsNotNull (proj.EvaluatedProperties ["B"], "A2");
+ Assert.IsNotNull (proj.EvaluatedProperties ["C"], "A3");
+ Assert.IsNotNull (proj.EvaluatedProperties ["D"], "A4");
+ Assert.IsNotNull (proj.EvaluatedProperties ["E"], "A5");
+ }
+ [Test]
+ public void TestCondition11 ()
+ {
+ Engine engine = new Engine (Consts.BinPath);
+ Project proj = engine.CreateNewProject ();
+ string documentString = @"
+
+ true
+
+
+
+
+ '%(Extension)a(foo', ',')' == '.exea(foo'"" />
+ '%(Extension)', ',') == '.exe'"" />
+
+";
+
+ proj.LoadXml (documentString);
+
+ BuildItemGroup bgp = proj.GetEvaluatedItemsByName ("List1");
+ Assert.IsNotNull (bgp, "Expected values in List1");
+ Assert.AreEqual (3, bgp.Count, "A1");
+ Assert.AreEqual ("fr_a.txt", bgp [0].FinalItemSpec, "A2");
+ Assert.AreEqual ("fr_b.txt", bgp [1].FinalItemSpec, "A3");
+ Assert.AreEqual ("fr_c.txt", bgp [2].FinalItemSpec, "A4");
+ }
+
+ // Test shortcircuiting
+ [Test]
+ public void TestCondition12 ()
+ {
+ Engine engine = new Engine (Consts.BinPath);
+ Project proj = engine.CreateNewProject ();
+
+ string documentString = @"
+
+
+
+
+
+ ";
+
+ proj.LoadXml (documentString);
+
+ Assert.IsNull (proj.EvaluatedProperties ["A"], "A1");
+ }
+
+ [Test]
+ public void TestCondition_References ()
+ {
+ Engine engine = new Engine (Consts.BinPath);
+ Project proj = engine.CreateNewProject ();
+
+ string documentString = @"
+
+
+ valid
+
+
+ ";
+
+ proj.LoadXml (documentString);
+
+ Assert.AreEqual ("valid", proj.GetEvaluatedProperty ("A"), "#1");
+ }
+
+ [Test]
+ public void TestHasTrailingSlash1 ()
+ {
+ Engine engine = new Engine (Consts.BinPath);
+ Project proj = engine.CreateNewProject ();
+
+ string documentString = @"
+
+
+
+ foo\
+ foo/
+ Foo
+
+
+
+
+
+
+
+
+ ";
+
+ proj.LoadXml (documentString);
+
+ Assert.IsNull (proj.EvaluatedProperties ["A"], "A1");
+ Assert.IsNotNull (proj.EvaluatedProperties ["B"], "A2");
+ Assert.IsNotNull (proj.EvaluatedProperties ["C"], "A3");
+ Assert.IsNull (proj.EvaluatedProperties ["D"], "A4");
+ Assert.IsNull (proj.EvaluatedProperties ["E"], "A5");
+ }
+
+ [Test]
+ [ExpectedException (typeof (InvalidProjectFileException))]
+ public void TestUnknownFunction ()
+ {
+ Engine engine = new Engine (Consts.BinPath);
+ Project proj = engine.CreateNewProject ();
+
+ string documentString = @"
+
+
+
+
+
+ ";
+
+ proj.LoadXml (documentString);
}
[Test]
@@ -301,9 +444,9 @@ namespace MonoTests.Microsoft.Build.BuildEngine.Various {
proj.LoadXml (documentString);
}
+ // A reference to an item list at position 1 is not allowed in this condition "@(A)".
[Test]
- [ExpectedException (typeof (InvalidProjectFileException),
- "A reference to an item list at position 1 is not allowed in this condition \"@(A)\". ")]
+ [ExpectedException (typeof (InvalidProjectFileException))]
[Category ("NotWorking")]
public void TestIncorrectCondition2 ()
{
@@ -321,9 +464,9 @@ namespace MonoTests.Microsoft.Build.BuildEngine.Various {
proj.LoadXml (documentString);
}
+ // Found an unexpected character '%' at position 0 in condition \%(A)\.
[Test]
- [ExpectedException (typeof (InvalidProjectFileException),
- "Found an unexpected character '%' at position 0 in condition \"%(A)\". ")]
+ [ExpectedException (typeof (InvalidProjectFileException))]
[Category ("NotWorking")]
public void TestIncorrectCondition3 ()
{
@@ -341,9 +484,9 @@ namespace MonoTests.Microsoft.Build.BuildEngine.Various {
proj.LoadXml (documentString);
}
+ // Found an unexpected character '%' at position 0 in condition "%(A)\.
[Test]
- [ExpectedException (typeof (InvalidProjectFileException),
- "Found an unexpected character '%' at position 0 in condition \"%(A)\". ")]
+ [ExpectedException (typeof (InvalidProjectFileException))]
[Category ("NotWorking")]
public void TestIncorrectCondition4 ()
{
@@ -378,5 +521,24 @@ namespace MonoTests.Microsoft.Build.BuildEngine.Various {
proj.LoadXml (documentString);
}
+
+ [Test]
+ [ExpectedException (typeof (InvalidProjectFileException))]
+ public void TestIncorrectCondition6 ()
+ {
+ Engine engine = new Engine (Consts.BinPath);
+ Project proj = engine.CreateNewProject ();
+
+ string documentString = @"
+
+
+
+
+
+ ";
+
+ proj.LoadXml (documentString);
+ }
+
}
}