Browse files

failing tests for issue 35

  • Loading branch information...
1 parent 374f1cb commit 3f465c60f9354880aae5fec1e109eb17f7a8b4eb @awatertree awatertree committed Apr 6, 2012
Showing with 78 additions and 1 deletion.
  1. +78 −1 ICSharpCode.NRefactory.Tests/FormattingTests/TestFormattingBugs.cs
View
79 ICSharpCode.NRefactory.Tests/FormattingTests/TestFormattingBugs.cs
@@ -227,7 +227,84 @@ public object GetValue ()
}
}");
}
-
+
+ /// <summary>
+ /// Bug GH35 - Formatter issues with if/else statements and // comments
+ /// </summary>
+ [Test()]
+ public void TestBugGH35()
+ {
+ var policy = new CSharpFormattingOptions();
+ policy.ConstructorBraceStyle = BraceStyle.EndOfLine;
+
+ Test(policy, @"public class A : B
+{
+ public void Test()
+ {
+ // Comment before
+ if (conditionA) {
+ DoSomething();
+ }
+ // Comment before else ends up incorporating it
+ else if (conditionB) {
+ DoSomethingElse();
+ }
+ }
+}",
+@"public class A : B
+{
+ public void Test()
+ {
+ // Comment before
+ if (conditionA) {
+ DoSomething();
+ }
+ // Comment before else ends up incorporating it
+ else if (conditionB) {
+ DoSomethingElse();
+ }
+ }
+}");
+ }
+
+ /// <summary>
+ /// Bug GH35a - Formatter issues with if/else statements and // comments else variant
+ /// </summary>
+ [Test()]
+ public void TestBugGH35a()
+ {
+ var policy = new CSharpFormattingOptions();
+ policy.ConstructorBraceStyle = BraceStyle.EndOfLine;
+
+ Test(policy, @"public class A : B
+{
+ public void Test()
+ {
+ // Comment before
+ if (conditionA) {
+ DoSomething();
+ }
+ // Comment before else ends up incorporating it
+ else (conditionB) {
+ DoSomethingElse();
+ }
+ }
+}",
+@"public class A : B
+{
+ public void Test()
+ {
+ // Comment before
+ if (conditionA) {
+ DoSomething();
+ }
+ // Comment before else ends up incorporating it
+ else (conditionB) {
+ DoSomethingElse();
+ }
+ }
+}");
+ }
}
}

0 comments on commit 3f465c6

Please sign in to comment.