Skip to content

Commit

Permalink
failing tests for issue 35
Browse files Browse the repository at this point in the history
  • Loading branch information
awatertree committed Apr 12, 2012
1 parent 3ec1d7b commit c189c5d
Showing 1 changed file with 78 additions and 1 deletion.
Expand Up @@ -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 c189c5d

Please sign in to comment.