diff --git a/ICSharpCode.NRefactory.CSharp/Formatter/AstFormattingVisitor.cs b/ICSharpCode.NRefactory.CSharp/Formatter/AstFormattingVisitor.cs index 8a12bc84a1..06c1f6e4b6 100644 --- a/ICSharpCode.NRefactory.CSharp/Formatter/AstFormattingVisitor.cs +++ b/ICSharpCode.NRefactory.CSharp/Formatter/AstFormattingVisitor.cs @@ -739,15 +739,15 @@ namespace ICSharpCode.NRefactory.CSharp } var lastLoc = fieldDeclaration.StartLocation; - curIndent.Push(IndentType.Block); foreach (var initializer in fieldDeclaration.Variables) { if (lastLoc.Line != initializer.StartLocation.Line) { + curIndent.Push(IndentType.Block); FixStatementIndentation(initializer.StartLocation); + curIndent.Pop (); lastLoc = initializer.StartLocation; } initializer.AcceptVisitor(this); } - curIndent.Pop (); } public override void VisitFixedFieldDeclaration(FixedFieldDeclaration fixedFieldDeclaration) @@ -1179,8 +1179,10 @@ namespace ICSharpCode.NRefactory.CSharp nextStatementIndent = " "; } } + bool pushed = false; if (policy.IndentBlocks && !(policy.AlignEmbeddedIfStatements && node is IfElseStatement && node.Parent is IfElseStatement || policy.AlignEmbeddedUsingStatements && node is UsingStatement && node.Parent is UsingStatement)) { curIndent.Push(IndentType.Block); + pushed = true; } if (isBlock) { VisitBlockWithoutFixingBraces((BlockStatement)node, false); @@ -1190,7 +1192,7 @@ namespace ICSharpCode.NRefactory.CSharp } node.AcceptVisitor(this); } - if (policy.IndentBlocks && !(policy.AlignEmbeddedIfStatements && node is IfElseStatement && node.Parent is IfElseStatement || policy.AlignEmbeddedUsingStatements && node is UsingStatement && node.Parent is UsingStatement)) { + if (pushed) { curIndent.Pop(); } switch (braceForcement) { @@ -2105,6 +2107,10 @@ namespace ICSharpCode.NRefactory.CSharp void FixStatementIndentation(TextLocation location) { + if (location.Line < 1 || location.Column < 1) { + Console.WriteLine("invalid location!"); + return; + } int offset = document.GetOffset(location); if (offset <= 0) { Console.WriteLine("possible wrong offset"); diff --git a/ICSharpCode.NRefactory.CSharp/Formatter/FormattingOptionsFactory.cs b/ICSharpCode.NRefactory.CSharp/Formatter/FormattingOptionsFactory.cs index 354d5865ff..c430717a4f 100644 --- a/ICSharpCode.NRefactory.CSharp/Formatter/FormattingOptionsFactory.cs +++ b/ICSharpCode.NRefactory.CSharp/Formatter/FormattingOptionsFactory.cs @@ -82,6 +82,7 @@ namespace ICSharpCode.NRefactory.CSharp StatementBraceStyle = BraceStyle.EndOfLine, ElseNewLinePlacement = NewLinePlacement.SameLine, + ElseIfNewLinePlacement = NewLinePlacement.SameLine, CatchNewLinePlacement = NewLinePlacement.SameLine, FinallyNewLinePlacement = NewLinePlacement.SameLine, WhileNewLinePlacement = NewLinePlacement.SameLine, diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/Script.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/Script.cs index 574fafe817..51897bf50e 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/Script.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/Script.cs @@ -152,6 +152,7 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring text += Options.EolMarker; InsertText(startOffset, text); output.RegisterTrackedSegments(this, startOffset); + CorrectFormatting (node, insertNode); } public void InsertAfter(AstNode node, AstNode insertNode) @@ -164,6 +165,7 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring var insertOffset = GetCurrentOffset(node.EndLocation); InsertText(insertOffset, text); output.RegisterTrackedSegments(this, insertOffset); + CorrectFormatting (node, insertNode); } public void AddTo(BlockStatement bodyStatement, AstNode insertNode) @@ -172,6 +174,7 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring var output = OutputNode(1 + GetIndentLevelAt(startOffset), insertNode, true); InsertText(startOffset, output.Text); output.RegisterTrackedSegments(this, startOffset); + CorrectFormatting (null, insertNode); } public virtual Task Link (params AstNode[] nodes) @@ -196,6 +199,18 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring output.TrimStart (); Replace (startOffset, segment.Length, output.Text); output.RegisterTrackedSegments(this, startOffset); + CorrectFormatting (node, node); + } + + void CorrectFormatting(AstNode node, AstNode newNode) + { + if (node is Identifier || node is IdentifierExpression || node is CSharpTokenNode || node is AstType) + return; + if (node == null || node.Parent is BlockStatement) { + FormatText(newNode); + } else { + FormatText((node.Parent != null && (node.Parent is Statement || node.Parent is Expression || node.Parent is VariableInitializer)) ? node.Parent : newNode); + } } public abstract void Remove (AstNode node, bool removeEmptyLine = true); diff --git a/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/AddCatchTypeTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/AddCatchTypeTests.cs index f414b2c747..dd217ecffa 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/AddCatchTypeTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/AddCatchTypeTests.cs @@ -50,8 +50,7 @@ class TestClass public void F() { try { - } - catch (System.Exception e) { + } catch (System.Exception e) { } } }"); @@ -107,8 +106,7 @@ class TestClass public void F() { try { - } - catch (Exception e) { + } catch (Exception e) { } } }"); diff --git a/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ConvertAnonymousDelegateToLambdaTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ConvertAnonymousDelegateToLambdaTests.cs index 7768848404..f1f81024a2 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ConvertAnonymousDelegateToLambdaTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ConvertAnonymousDelegateToLambdaTests.cs @@ -47,9 +47,9 @@ class A { void F () { - System.Action action = (i1, i2) => { - System.Console.WriteLine (i1); -}; + System.Action action = (i1, i2) => { + System.Console.WriteLine (i1); + }; } }"); } @@ -69,9 +69,9 @@ class A { void F () { - var action = (int i1, int i2) => { - System.Console.WriteLine (i1); -}; + var action = (int i1, int i2) => { + System.Console.WriteLine (i1); + }; } }"); } diff --git a/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ConvertConditionalToIfTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ConvertConditionalToIfTests.cs index d897580de6..ac075ddae3 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ConvertConditionalToIfTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ConvertConditionalToIfTests.cs @@ -239,10 +239,10 @@ class TestClass { int a; if (i < 10) - if (i > 0) - a = 0; - else - a = 1; + if (i > 0) + a = 0; + else + a = 1; } }"); } diff --git a/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ConvertLamdaToAnonymousDelegateTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ConvertLamdaToAnonymousDelegateTests.cs index b55d90dedc..ab23167efd 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ConvertLamdaToAnonymousDelegateTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ConvertLamdaToAnonymousDelegateTests.cs @@ -47,8 +47,8 @@ class A void F () { System.Action = delegate (int i1, int i2) { - System.Console.WriteLine (i1); -}; + System.Console.WriteLine (i1); + }; } }"); } @@ -69,8 +69,8 @@ class A void F () { System.Action = delegate (int i1, int i2) { - System.Console.WriteLine (i1); -}; + System.Console.WriteLine (i1); + }; } }"); } @@ -91,8 +91,8 @@ class A void F () { System.Action = delegate { - System.Console.WriteLine (); -}; + System.Console.WriteLine (); + }; } }"); } diff --git a/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ConvertSwitchToIfTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ConvertSwitchToIfTests.cs index 4a1a91e389..5f2bc4180b 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ConvertSwitchToIfTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ConvertSwitchToIfTests.cs @@ -61,11 +61,9 @@ class TestClass { if (a == 0) { return 0; - } else - if (a == 1 || a == 2) { + } else if (a == 1 || a == 2) { return 1; - } else - if (a == 3 || a == 4 || a == 5) { + } else if (a == 3 || a == 4 || a == 5) { return 1; } else { return 2; @@ -101,11 +99,9 @@ class TestClass { if (a == 0) { return 0; - } else - if (a == 1 || a == 2) { + } else if (a == 1 || a == 2) { return 1; - } else - if (a == 3 || a == 4 || a == 5) { + } else if (a == 3 || a == 4 || a == 5) { return 1; } } @@ -142,10 +138,8 @@ class TestClass { if (a == 0) { int b = 1; - } else - if (a == 1 || a == 2) { - } else - if (a == 3 || a == 4 || a == 5) { + } else if (a == 1 || a == 2) { + } else if (a == 3 || a == 4 || a == 5) { } else { } } @@ -176,8 +170,7 @@ class TestClass { if (a == 0) { return 0; - } else - if (a == (1 == 1 ? 1 : 2)) { + } else if (a == (1 == 1 ? 1 : 2)) { return 1; } else { return 2; diff --git a/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/DeclareLocalVariableTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/DeclareLocalVariableTests.cs index e93b5f2395..5247afcf9d 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/DeclareLocalVariableTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/DeclareLocalVariableTests.cs @@ -206,7 +206,7 @@ namespace ICSharpCode.NRefactory.CSharp.CodeActions void DoStuff() { System.Func getInt = GetInt; - if (getInt() == 0) { + if (getInt () == 0) { } } diff --git a/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ExtensionMethodInvocationToStaticMethodInvocationTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ExtensionMethodInvocationToStaticMethodInvocationTests.cs index 64a1b65802..48c94d88a4 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ExtensionMethodInvocationToStaticMethodInvocationTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ExtensionMethodInvocationToStaticMethodInvocationTests.cs @@ -82,7 +82,7 @@ class C void F() { A a = new A(); - if(a.$Ext (1)) + if (a.$Ext (1)) return; } }", @" @@ -99,7 +99,7 @@ class C void F() { A a = new A(); - if(B.Ext (a, 1)) + if (B.Ext (a, 1)) return; } }"); diff --git a/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/MoveToOuterScopeTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/MoveToOuterScopeTests.cs index 14a7c5b074..c9f40e5503 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/MoveToOuterScopeTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/MoveToOuterScopeTests.cs @@ -54,13 +54,13 @@ class A public void SimpleCase() { TestStatements(@" -while (true) { - int $i = 2; -} + while (true) { + int $i = 2; + } ", @" -int i = 2; -while (true) { -} + int i = 2; + while (true) { + } "); } @@ -81,14 +81,14 @@ class A public void MovesOnlyTheCurrentVariableInitialization() { TestStatements(@" -while (true) { - int $i = 2, j = 3; -} + while (true) { + int $i = 2, j = 3; + } ", @" -int i = 2; -while (true) { - int j = 3; -} + int i = 2; + while (true) { + int j = 3; + } "); } @@ -96,13 +96,13 @@ while (true) { public void MovesAllInitializersWhenOnType() { TestStatements(@" -while (true) { - i$nt i = 2, j = 3; -} + while (true) { + i$nt i = 2, j = 3; + } ", @" -int i = 2, j = 3; -while (true) { -} + int i = 2, j = 3; + while (true) { + } "); } @@ -110,16 +110,16 @@ while (true) { public void OnlyMovesDeclarationWhenInitializerDependsOnOtherStatements() { TestStatements(@" -while (true) { - int i = 2; - int j$ = i; -} + while (true) { + int i = 2; + int j$ = i; + } ", @" -int j; -while (true) { - int i = 2; - j = i; -} + int j; + while (true) { + int i = 2; + j = i; + } "); } @@ -127,13 +127,13 @@ while (true) { public void HandlesLambdaDelegate() { TestStatements(@" -var action = new Action(i => { - int j$ = 2; -}); + var action = new Action(i => { + int j$ = 2; + }); ", @" -int j = 2; -var action = new Action(i => { -}); + int j = 2; + var action = new Action(i => { + }); "); } } diff --git a/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/RemoveRedundantCatchTypeTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/RemoveRedundantCatchTypeTests.cs index 492bbd21c9..932ef86923 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/RemoveRedundantCatchTypeTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/RemoveRedundantCatchTypeTests.cs @@ -52,8 +52,7 @@ class TestClass public void F() { try { - } - catch { + } catch { } } }"); @@ -79,8 +78,7 @@ class TestClass public void F() { try { - } - catch { + } catch { System.Console.WriteLine (""Hi""); } } diff --git a/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/SplitDeclarationAndAssignmentTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/SplitDeclarationAndAssignmentTests.cs index cc2a6a488a..b0eb3566e9 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/SplitDeclarationAndAssignmentTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/SplitDeclarationAndAssignmentTests.cs @@ -100,7 +100,8 @@ namespace ICSharpCode.NRefactory.CSharp.CodeActions " void Test ()" + Environment.NewLine + " {" + Environment.NewLine + " int i;" + Environment.NewLine + - " for (i = 1; i < 10; i++) {}" + Environment.NewLine + + " for (i = 1; i < 10; i++) {" + Environment.NewLine + + " }" + Environment.NewLine + " }" + Environment.NewLine + "}", result); } diff --git a/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/AccessToModifiedClosureTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/AccessToModifiedClosureTests.cs index d73cd6b156..1aa87dee80 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/AccessToModifiedClosureTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/AccessToModifiedClosureTests.cs @@ -403,7 +403,7 @@ class TestClass foreach (var i in a) { var f = new System.Func (x => { var f2 = new System.Func (y => y - i); - return f2(x) + i; + return f2 (x) + i; }); } } @@ -417,7 +417,7 @@ class TestClass var i1 = i; var f = new System.Func (x => { var f2 = new System.Func (y => y - i1); - return f2(x) + i1; + return f2 (x) + i1; }); } } @@ -432,7 +432,7 @@ class TestClass var f = new System.Func (x => { var i1 = i; var f2 = new System.Func (y => y - i1); - return f2(x) + i; + return f2 (x) + i; }); } } @@ -579,7 +579,7 @@ class TestClass { void TestMethod2 (int b, System.Func a) { - TestMethod2 (b++, c => c + b); + TestMethod2 (b++, c => c + b); } }"; var input2 = @" @@ -587,7 +587,7 @@ class TestClass { void TestMethod3 (System.Func a, int b) { - TestMethod3 (c => c + b, b++); + TestMethod3 (c => c + b, b++); } }"; var output2 = @" @@ -596,7 +596,7 @@ class TestClass void TestMethod3 (System.Func a, int b) { var b1 = b; - TestMethod3 (c => c + b1, b++); + TestMethod3 (c => c + b1, b++); } }"; Test (input1, 0); diff --git a/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/ConstantConditionIssueTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/ConstantConditionIssueTests.cs index 9578343015..17fd361b62 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/ConstantConditionIssueTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/ConstantConditionIssueTests.cs @@ -114,7 +114,8 @@ class TestClass { void TestMethod () { - for (int i = 0; true; i++) ; + for (int i = 0; true; i++) + ; } }"; Test (input, 1, output); @@ -128,7 +129,8 @@ class TestClass { void TestMethod () { - while (1 > 0) ; + while (1 > 0) + ; } }"; var output = @" @@ -136,7 +138,8 @@ class TestClass { void TestMethod () { - while (true) ; + while (true) + ; } }"; Test (input, 1, output); diff --git a/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/ExpressionIsAlwaysOfProvidedTypeIssueTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/ExpressionIsAlwaysOfProvidedTypeIssueTests.cs index 3bb9c8f750..bd7db047ff 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/ExpressionIsAlwaysOfProvidedTypeIssueTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/ExpressionIsAlwaysOfProvidedTypeIssueTests.cs @@ -39,7 +39,8 @@ class TestClass { void TestMethod (" + variableType + @" x) { - if (x is " + providedType + @") ; + if (x is " + providedType + @") + ; } }"; var output = @" @@ -47,7 +48,8 @@ class TestClass { void TestMethod (" + variableType + @" x) { - if (x != null) ; + if (x != null) + ; } }"; Test (input, 1, output); @@ -73,7 +75,8 @@ class TestClass { void TestMethod (T x) where T : TestClass { - if (x is TestClass) ; + if (x is TestClass) + ; } }"; var output = @" @@ -81,7 +84,8 @@ class TestClass { void TestMethod (T x) where T : TestClass { - if (x != null) ; + if (x != null) + ; } }"; Test (input, 1, output); diff --git a/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/InspectionActionTestBase.cs b/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/InspectionActionTestBase.cs index 88cb013619..465bce52cb 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/InspectionActionTestBase.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/InspectionActionTestBase.cs @@ -59,6 +59,9 @@ namespace ICSharpCode.NRefactory.CSharp.CodeIssues } bool pass = expectedOutput == ctx.Text; if (!pass) { + Console.WriteLine ("expected:"); + Console.WriteLine (expectedOutput); + Console.WriteLine ("got:"); Console.WriteLine (ctx.Text); } Assert.AreEqual (expectedOutput, ctx.Text); diff --git a/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/RedundantToStringTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/RedundantToStringTests.cs index 7925e405c9..570db1b618 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/RedundantToStringTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/RedundantToStringTests.cs @@ -140,7 +140,7 @@ class Foo { void Bar (int i) { - string s = string.Format(""{0}"", i); + string s = string.Format (""{0}"", i); } }"); } @@ -167,7 +167,7 @@ class Foo void Bar (int i) { string format = ""{0}""; - string s = string.Format(format, i); + string s = string.Format (format, i); } }"); } @@ -196,7 +196,7 @@ class Foo { void Bar (int i) { - string s = FakeFormat(""{0} {1}"", i.ToString(), i); + string s = FakeFormat (""{0} {1}"", i.ToString (), i); } void FakeFormat(string format, string arg0, object arg1) @@ -229,7 +229,7 @@ class Foo { void Bar (int i) { - string s = FakeFormat(""{0} {1}"", i, i); + string s = FakeFormat (""{0} {1}"", i, i); } void FakeFormat(string format, params object[] args) @@ -261,8 +261,8 @@ class Foo void Bar (int i) { var w = new System.IO.StringWriter(); - w.Write(i); - w.WriteLine(i); + w.Write (i); + w.WriteLine (i); } }"); } diff --git a/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/ReferenceToStaticMemberViaDerivedTypeTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/ReferenceToStaticMemberViaDerivedTypeTests.cs index 1deccbf2b4..c46e2b872e 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/ReferenceToStaticMemberViaDerivedTypeTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/ReferenceToStaticMemberViaDerivedTypeTests.cs @@ -46,7 +46,7 @@ class C { void Main() { - B.F(); + B.F (); } }"; TestRefactoringContext context; @@ -64,7 +64,7 @@ class C { void Main() { - A.F(); + A.F (); } }" ); @@ -181,7 +181,7 @@ class D { void Main() { - A.B.F(); + A.B.F (); } }" ); @@ -205,7 +205,7 @@ namespace Second { void Main() { - B.F(); + B.F (); } } }"; @@ -229,7 +229,7 @@ namespace Second { void Main() { - First.A.F(); + First.A.F (); } } }" diff --git a/ICSharpCode.NRefactory.Tests/FormattingTests/TextEditorTestAdapter.cs b/ICSharpCode.NRefactory.Tests/FormattingTests/TextEditorTestAdapter.cs index ad256d7b6b..6d0efcd797 100644 --- a/ICSharpCode.NRefactory.Tests/FormattingTests/TextEditorTestAdapter.cs +++ b/ICSharpCode.NRefactory.Tests/FormattingTests/TextEditorTestAdapter.cs @@ -48,6 +48,9 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests expectedOutput = NormalizeNewlines(expectedOutput); IDocument doc = GetResult(policy, input, mode); if (expectedOutput != doc.Text) { + Console.WriteLine ("expected:"); + Console.WriteLine (expectedOutput); + Console.WriteLine ("got:"); Console.WriteLine (doc.Text); } Assert.AreEqual (expectedOutput, doc.Text);