Browse Source

[Refactoring] Script now corrects the formatting of inserted &

replaced nodes.
newNRvisualizers
Mike Krüger 13 years ago
parent
commit
fc72147b88
  1. 12
      ICSharpCode.NRefactory.CSharp/Formatter/AstFormattingVisitor.cs
  2. 1
      ICSharpCode.NRefactory.CSharp/Formatter/FormattingOptionsFactory.cs
  3. 15
      ICSharpCode.NRefactory.CSharp/Refactoring/Script.cs
  4. 6
      ICSharpCode.NRefactory.Tests/CSharp/CodeActions/AddCatchTypeTests.cs
  5. 12
      ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ConvertAnonymousDelegateToLambdaTests.cs
  6. 8
      ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ConvertConditionalToIfTests.cs
  7. 12
      ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ConvertLamdaToAnonymousDelegateTests.cs
  8. 21
      ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ConvertSwitchToIfTests.cs
  9. 2
      ICSharpCode.NRefactory.Tests/CSharp/CodeActions/DeclareLocalVariableTests.cs
  10. 4
      ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ExtensionMethodInvocationToStaticMethodInvocationTests.cs
  11. 68
      ICSharpCode.NRefactory.Tests/CSharp/CodeActions/MoveToOuterScopeTests.cs
  12. 6
      ICSharpCode.NRefactory.Tests/CSharp/CodeActions/RemoveRedundantCatchTypeTests.cs
  13. 3
      ICSharpCode.NRefactory.Tests/CSharp/CodeActions/SplitDeclarationAndAssignmentTests.cs
  14. 12
      ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/AccessToModifiedClosureTests.cs
  15. 9
      ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/ConstantConditionIssueTests.cs
  16. 12
      ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/ExpressionIsAlwaysOfProvidedTypeIssueTests.cs
  17. 3
      ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/InspectionActionTestBase.cs
  18. 12
      ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/RedundantToStringTests.cs
  19. 10
      ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/ReferenceToStaticMemberViaDerivedTypeTests.cs
  20. 3
      ICSharpCode.NRefactory.Tests/FormattingTests/TextEditorTestAdapter.cs

12
ICSharpCode.NRefactory.CSharp/Formatter/AstFormattingVisitor.cs

@ -739,15 +739,15 @@ namespace ICSharpCode.NRefactory.CSharp
} }
var lastLoc = fieldDeclaration.StartLocation; var lastLoc = fieldDeclaration.StartLocation;
curIndent.Push(IndentType.Block);
foreach (var initializer in fieldDeclaration.Variables) { foreach (var initializer in fieldDeclaration.Variables) {
if (lastLoc.Line != initializer.StartLocation.Line) { if (lastLoc.Line != initializer.StartLocation.Line) {
curIndent.Push(IndentType.Block);
FixStatementIndentation(initializer.StartLocation); FixStatementIndentation(initializer.StartLocation);
curIndent.Pop ();
lastLoc = initializer.StartLocation; lastLoc = initializer.StartLocation;
} }
initializer.AcceptVisitor(this); initializer.AcceptVisitor(this);
} }
curIndent.Pop ();
} }
public override void VisitFixedFieldDeclaration(FixedFieldDeclaration fixedFieldDeclaration) public override void VisitFixedFieldDeclaration(FixedFieldDeclaration fixedFieldDeclaration)
@ -1179,8 +1179,10 @@ namespace ICSharpCode.NRefactory.CSharp
nextStatementIndent = " "; 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)) { 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); curIndent.Push(IndentType.Block);
pushed = true;
} }
if (isBlock) { if (isBlock) {
VisitBlockWithoutFixingBraces((BlockStatement)node, false); VisitBlockWithoutFixingBraces((BlockStatement)node, false);
@ -1190,7 +1192,7 @@ namespace ICSharpCode.NRefactory.CSharp
} }
node.AcceptVisitor(this); 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(); curIndent.Pop();
} }
switch (braceForcement) { switch (braceForcement) {
@ -2105,6 +2107,10 @@ namespace ICSharpCode.NRefactory.CSharp
void FixStatementIndentation(TextLocation location) void FixStatementIndentation(TextLocation location)
{ {
if (location.Line < 1 || location.Column < 1) {
Console.WriteLine("invalid location!");
return;
}
int offset = document.GetOffset(location); int offset = document.GetOffset(location);
if (offset <= 0) { if (offset <= 0) {
Console.WriteLine("possible wrong offset"); Console.WriteLine("possible wrong offset");

1
ICSharpCode.NRefactory.CSharp/Formatter/FormattingOptionsFactory.cs

@ -82,6 +82,7 @@ namespace ICSharpCode.NRefactory.CSharp
StatementBraceStyle = BraceStyle.EndOfLine, StatementBraceStyle = BraceStyle.EndOfLine,
ElseNewLinePlacement = NewLinePlacement.SameLine, ElseNewLinePlacement = NewLinePlacement.SameLine,
ElseIfNewLinePlacement = NewLinePlacement.SameLine,
CatchNewLinePlacement = NewLinePlacement.SameLine, CatchNewLinePlacement = NewLinePlacement.SameLine,
FinallyNewLinePlacement = NewLinePlacement.SameLine, FinallyNewLinePlacement = NewLinePlacement.SameLine,
WhileNewLinePlacement = NewLinePlacement.SameLine, WhileNewLinePlacement = NewLinePlacement.SameLine,

15
ICSharpCode.NRefactory.CSharp/Refactoring/Script.cs

@ -152,6 +152,7 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring
text += Options.EolMarker; text += Options.EolMarker;
InsertText(startOffset, text); InsertText(startOffset, text);
output.RegisterTrackedSegments(this, startOffset); output.RegisterTrackedSegments(this, startOffset);
CorrectFormatting (node, insertNode);
} }
public void InsertAfter(AstNode node, AstNode insertNode) public void InsertAfter(AstNode node, AstNode insertNode)
@ -164,6 +165,7 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring
var insertOffset = GetCurrentOffset(node.EndLocation); var insertOffset = GetCurrentOffset(node.EndLocation);
InsertText(insertOffset, text); InsertText(insertOffset, text);
output.RegisterTrackedSegments(this, insertOffset); output.RegisterTrackedSegments(this, insertOffset);
CorrectFormatting (node, insertNode);
} }
public void AddTo(BlockStatement bodyStatement, AstNode 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); var output = OutputNode(1 + GetIndentLevelAt(startOffset), insertNode, true);
InsertText(startOffset, output.Text); InsertText(startOffset, output.Text);
output.RegisterTrackedSegments(this, startOffset); output.RegisterTrackedSegments(this, startOffset);
CorrectFormatting (null, insertNode);
} }
public virtual Task Link (params AstNode[] nodes) public virtual Task Link (params AstNode[] nodes)
@ -196,6 +199,18 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring
output.TrimStart (); output.TrimStart ();
Replace (startOffset, segment.Length, output.Text); Replace (startOffset, segment.Length, output.Text);
output.RegisterTrackedSegments(this, startOffset); 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); public abstract void Remove (AstNode node, bool removeEmptyLine = true);

6
ICSharpCode.NRefactory.Tests/CSharp/CodeActions/AddCatchTypeTests.cs

@ -50,8 +50,7 @@ class TestClass
public void F() public void F()
{ {
try { try {
} } catch (System.Exception e) {
catch (System.Exception e) {
} }
} }
}"); }");
@ -107,8 +106,7 @@ class TestClass
public void F() public void F()
{ {
try { try {
} } catch (Exception e) {
catch (Exception e) {
} }
} }
}"); }");

12
ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ConvertAnonymousDelegateToLambdaTests.cs

@ -47,9 +47,9 @@ class A
{ {
void F () void F ()
{ {
System.Action<int, int> action = (i1, i2) => { System.Action<int, int> action = (i1, i2) => {
System.Console.WriteLine (i1); System.Console.WriteLine (i1);
}; };
} }
}"); }");
} }
@ -69,9 +69,9 @@ class A
{ {
void F () void F ()
{ {
var action = (int i1, int i2) => { var action = (int i1, int i2) => {
System.Console.WriteLine (i1); System.Console.WriteLine (i1);
}; };
} }
}"); }");
} }

8
ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ConvertConditionalToIfTests.cs

@ -239,10 +239,10 @@ class TestClass
{ {
int a; int a;
if (i < 10) if (i < 10)
if (i > 0) if (i > 0)
a = 0; a = 0;
else else
a = 1; a = 1;
} }
}"); }");
} }

12
ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ConvertLamdaToAnonymousDelegateTests.cs

@ -47,8 +47,8 @@ class A
void F () void F ()
{ {
System.Action<int, int> = delegate (int i1, int i2) { System.Action<int, int> = delegate (int i1, int i2) {
System.Console.WriteLine (i1); System.Console.WriteLine (i1);
}; };
} }
}"); }");
} }
@ -69,8 +69,8 @@ class A
void F () void F ()
{ {
System.Action<int, int> = delegate (int i1, int i2) { System.Action<int, int> = delegate (int i1, int i2) {
System.Console.WriteLine (i1); System.Console.WriteLine (i1);
}; };
} }
}"); }");
} }
@ -91,8 +91,8 @@ class A
void F () void F ()
{ {
System.Action = delegate { System.Action = delegate {
System.Console.WriteLine (); System.Console.WriteLine ();
}; };
} }
}"); }");
} }

21
ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ConvertSwitchToIfTests.cs

@ -61,11 +61,9 @@ class TestClass
{ {
if (a == 0) { if (a == 0) {
return 0; return 0;
} else } else if (a == 1 || a == 2) {
if (a == 1 || a == 2) {
return 1; return 1;
} else } else if (a == 3 || a == 4 || a == 5) {
if (a == 3 || a == 4 || a == 5) {
return 1; return 1;
} else { } else {
return 2; return 2;
@ -101,11 +99,9 @@ class TestClass
{ {
if (a == 0) { if (a == 0) {
return 0; return 0;
} else } else if (a == 1 || a == 2) {
if (a == 1 || a == 2) {
return 1; return 1;
} else } else if (a == 3 || a == 4 || a == 5) {
if (a == 3 || a == 4 || a == 5) {
return 1; return 1;
} }
} }
@ -142,10 +138,8 @@ class TestClass
{ {
if (a == 0) { if (a == 0) {
int b = 1; int b = 1;
} else } else if (a == 1 || a == 2) {
if (a == 1 || a == 2) { } else if (a == 3 || a == 4 || a == 5) {
} else
if (a == 3 || a == 4 || a == 5) {
} else { } else {
} }
} }
@ -176,8 +170,7 @@ class TestClass
{ {
if (a == 0) { if (a == 0) {
return 0; return 0;
} else } else if (a == (1 == 1 ? 1 : 2)) {
if (a == (1 == 1 ? 1 : 2)) {
return 1; return 1;
} else { } else {
return 2; return 2;

2
ICSharpCode.NRefactory.Tests/CSharp/CodeActions/DeclareLocalVariableTests.cs

@ -206,7 +206,7 @@ namespace ICSharpCode.NRefactory.CSharp.CodeActions
void DoStuff() void DoStuff()
{ {
System.Func<int> getInt = GetInt; System.Func<int> getInt = GetInt;
if (getInt() == 0) { if (getInt () == 0) {
} }
} }

4
ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ExtensionMethodInvocationToStaticMethodInvocationTests.cs

@ -82,7 +82,7 @@ class C
void F() void F()
{ {
A a = new A(); A a = new A();
if(a.$Ext (1)) if (a.$Ext (1))
return; return;
} }
}", @" }", @"
@ -99,7 +99,7 @@ class C
void F() void F()
{ {
A a = new A(); A a = new A();
if(B.Ext (a, 1)) if (B.Ext (a, 1))
return; return;
} }
}"); }");

68
ICSharpCode.NRefactory.Tests/CSharp/CodeActions/MoveToOuterScopeTests.cs

@ -54,13 +54,13 @@ class A
public void SimpleCase() public void SimpleCase()
{ {
TestStatements(@" TestStatements(@"
while (true) { while (true) {
int $i = 2; int $i = 2;
} }
", @" ", @"
int i = 2; int i = 2;
while (true) { while (true) {
} }
"); ");
} }
@ -81,14 +81,14 @@ class A
public void MovesOnlyTheCurrentVariableInitialization() public void MovesOnlyTheCurrentVariableInitialization()
{ {
TestStatements(@" TestStatements(@"
while (true) { while (true) {
int $i = 2, j = 3; int $i = 2, j = 3;
} }
", @" ", @"
int i = 2; int i = 2;
while (true) { while (true) {
int j = 3; int j = 3;
} }
"); ");
} }
@ -96,13 +96,13 @@ while (true) {
public void MovesAllInitializersWhenOnType() public void MovesAllInitializersWhenOnType()
{ {
TestStatements(@" TestStatements(@"
while (true) { while (true) {
i$nt i = 2, j = 3; i$nt i = 2, j = 3;
} }
", @" ", @"
int i = 2, j = 3; int i = 2, j = 3;
while (true) { while (true) {
} }
"); ");
} }
@ -110,16 +110,16 @@ while (true) {
public void OnlyMovesDeclarationWhenInitializerDependsOnOtherStatements() public void OnlyMovesDeclarationWhenInitializerDependsOnOtherStatements()
{ {
TestStatements(@" TestStatements(@"
while (true) { while (true) {
int i = 2; int i = 2;
int j$ = i; int j$ = i;
} }
", @" ", @"
int j; int j;
while (true) { while (true) {
int i = 2; int i = 2;
j = i; j = i;
} }
"); ");
} }
@ -127,13 +127,13 @@ while (true) {
public void HandlesLambdaDelegate() public void HandlesLambdaDelegate()
{ {
TestStatements(@" TestStatements(@"
var action = new Action<int>(i => { var action = new Action<int>(i => {
int j$ = 2; int j$ = 2;
}); });
", @" ", @"
int j = 2; int j = 2;
var action = new Action<int>(i => { var action = new Action<int>(i => {
}); });
"); ");
} }
} }

6
ICSharpCode.NRefactory.Tests/CSharp/CodeActions/RemoveRedundantCatchTypeTests.cs

@ -52,8 +52,7 @@ class TestClass
public void F() public void F()
{ {
try { try {
} } catch {
catch {
} }
} }
}"); }");
@ -79,8 +78,7 @@ class TestClass
public void F() public void F()
{ {
try { try {
} } catch {
catch {
System.Console.WriteLine (""Hi""); System.Console.WriteLine (""Hi"");
} }
} }

3
ICSharpCode.NRefactory.Tests/CSharp/CodeActions/SplitDeclarationAndAssignmentTests.cs

@ -100,7 +100,8 @@ namespace ICSharpCode.NRefactory.CSharp.CodeActions
" void Test ()" + Environment.NewLine + " void Test ()" + Environment.NewLine +
" {" + Environment.NewLine + " {" + Environment.NewLine +
" int i;" + 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 + " }" + Environment.NewLine +
"}", result); "}", result);
} }

12
ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/AccessToModifiedClosureTests.cs

@ -403,7 +403,7 @@ class TestClass
foreach (var i in a) { foreach (var i in a) {
var f = new System.Func<int, int> (x => { var f = new System.Func<int, int> (x => {
var f2 = new System.Func<int, int> (y => y - i); var f2 = new System.Func<int, int> (y => y - i);
return f2(x) + i; return f2 (x) + i;
}); });
} }
} }
@ -417,7 +417,7 @@ class TestClass
var i1 = i; var i1 = i;
var f = new System.Func<int, int> (x => { var f = new System.Func<int, int> (x => {
var f2 = new System.Func<int, int> (y => y - i1); var f2 = new System.Func<int, int> (y => y - i1);
return f2(x) + i1; return f2 (x) + i1;
}); });
} }
} }
@ -432,7 +432,7 @@ class TestClass
var f = new System.Func<int, int> (x => { var f = new System.Func<int, int> (x => {
var i1 = i; var i1 = i;
var f2 = new System.Func<int, int> (y => y - i1); var f2 = new System.Func<int, int> (y => y - i1);
return f2(x) + i; return f2 (x) + i;
}); });
} }
} }
@ -579,7 +579,7 @@ class TestClass
{ {
void TestMethod2 (int b, System.Func<int, int> a) void TestMethod2 (int b, System.Func<int, int> a)
{ {
TestMethod2 (b++, c => c + b); TestMethod2 (b++, c => c + b);
} }
}"; }";
var input2 = @" var input2 = @"
@ -587,7 +587,7 @@ class TestClass
{ {
void TestMethod3 (System.Func<int, int> a, int b) void TestMethod3 (System.Func<int, int> a, int b)
{ {
TestMethod3 (c => c + b, b++); TestMethod3 (c => c + b, b++);
} }
}"; }";
var output2 = @" var output2 = @"
@ -596,7 +596,7 @@ class TestClass
void TestMethod3 (System.Func<int, int> a, int b) void TestMethod3 (System.Func<int, int> a, int b)
{ {
var b1 = b; var b1 = b;
TestMethod3 (c => c + b1, b++); TestMethod3 (c => c + b1, b++);
} }
}"; }";
Test (input1, 0); Test (input1, 0);

9
ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/ConstantConditionIssueTests.cs

@ -114,7 +114,8 @@ class TestClass
{ {
void TestMethod () void TestMethod ()
{ {
for (int i = 0; true; i++) ; for (int i = 0; true; i++)
;
} }
}"; }";
Test<ConstantConditionIssue> (input, 1, output); Test<ConstantConditionIssue> (input, 1, output);
@ -128,7 +129,8 @@ class TestClass
{ {
void TestMethod () void TestMethod ()
{ {
while (1 > 0) ; while (1 > 0)
;
} }
}"; }";
var output = @" var output = @"
@ -136,7 +138,8 @@ class TestClass
{ {
void TestMethod () void TestMethod ()
{ {
while (true) ; while (true)
;
} }
}"; }";
Test<ConstantConditionIssue> (input, 1, output); Test<ConstantConditionIssue> (input, 1, output);

12
ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/ExpressionIsAlwaysOfProvidedTypeIssueTests.cs

@ -39,7 +39,8 @@ class TestClass
{ {
void TestMethod (" + variableType + @" x) void TestMethod (" + variableType + @" x)
{ {
if (x is " + providedType + @") ; if (x is " + providedType + @")
;
} }
}"; }";
var output = @" var output = @"
@ -47,7 +48,8 @@ class TestClass
{ {
void TestMethod (" + variableType + @" x) void TestMethod (" + variableType + @" x)
{ {
if (x != null) ; if (x != null)
;
} }
}"; }";
Test<ExpressionIsAlwaysOfProvidedTypeIssue> (input, 1, output); Test<ExpressionIsAlwaysOfProvidedTypeIssue> (input, 1, output);
@ -73,7 +75,8 @@ class TestClass
{ {
void TestMethod<T> (T x) where T : TestClass void TestMethod<T> (T x) where T : TestClass
{ {
if (x is TestClass) ; if (x is TestClass)
;
} }
}"; }";
var output = @" var output = @"
@ -81,7 +84,8 @@ class TestClass
{ {
void TestMethod<T> (T x) where T : TestClass void TestMethod<T> (T x) where T : TestClass
{ {
if (x != null) ; if (x != null)
;
} }
}"; }";
Test<ExpressionIsAlwaysOfProvidedTypeIssue> (input, 1, output); Test<ExpressionIsAlwaysOfProvidedTypeIssue> (input, 1, output);

3
ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/InspectionActionTestBase.cs

@ -59,6 +59,9 @@ namespace ICSharpCode.NRefactory.CSharp.CodeIssues
} }
bool pass = expectedOutput == ctx.Text; bool pass = expectedOutput == ctx.Text;
if (!pass) { if (!pass) {
Console.WriteLine ("expected:");
Console.WriteLine (expectedOutput);
Console.WriteLine ("got:");
Console.WriteLine (ctx.Text); Console.WriteLine (ctx.Text);
} }
Assert.AreEqual (expectedOutput, ctx.Text); Assert.AreEqual (expectedOutput, ctx.Text);

12
ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/RedundantToStringTests.cs

@ -140,7 +140,7 @@ class Foo
{ {
void Bar (int i) 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) void Bar (int i)
{ {
string format = ""{0}""; 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) 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) void FakeFormat(string format, string arg0, object arg1)
@ -229,7 +229,7 @@ class Foo
{ {
void Bar (int i) 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) void FakeFormat(string format, params object[] args)
@ -261,8 +261,8 @@ class Foo
void Bar (int i) void Bar (int i)
{ {
var w = new System.IO.StringWriter(); var w = new System.IO.StringWriter();
w.Write(i); w.Write (i);
w.WriteLine(i); w.WriteLine (i);
} }
}"); }");
} }

10
ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/ReferenceToStaticMemberViaDerivedTypeTests.cs

@ -46,7 +46,7 @@ class C
{ {
void Main() void Main()
{ {
B.F(); B.F ();
} }
}"; }";
TestRefactoringContext context; TestRefactoringContext context;
@ -64,7 +64,7 @@ class C
{ {
void Main() void Main()
{ {
A.F(); A.F ();
} }
}" }"
); );
@ -181,7 +181,7 @@ class D
{ {
void Main() void Main()
{ {
A.B.F(); A.B.F ();
} }
}" }"
); );
@ -205,7 +205,7 @@ namespace Second
{ {
void Main() void Main()
{ {
B.F(); B.F ();
} }
} }
}"; }";
@ -229,7 +229,7 @@ namespace Second
{ {
void Main() void Main()
{ {
First.A.F(); First.A.F ();
} }
} }
}" }"

3
ICSharpCode.NRefactory.Tests/FormattingTests/TextEditorTestAdapter.cs

@ -48,6 +48,9 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests
expectedOutput = NormalizeNewlines(expectedOutput); expectedOutput = NormalizeNewlines(expectedOutput);
IDocument doc = GetResult(policy, input, mode); IDocument doc = GetResult(policy, input, mode);
if (expectedOutput != doc.Text) { if (expectedOutput != doc.Text) {
Console.WriteLine ("expected:");
Console.WriteLine (expectedOutput);
Console.WriteLine ("got:");
Console.WriteLine (doc.Text); Console.WriteLine (doc.Text);
} }
Assert.AreEqual (expectedOutput, doc.Text); Assert.AreEqual (expectedOutput, doc.Text);

Loading…
Cancel
Save