Browse Source

Merge NRefactory a92606c..56fde51

pull/106/head
Daniel Grunwald 15 years ago
parent
commit
090a37534b
  1. 8
      ICSharpCode.Decompiler/Ast/AstBuilder.cs
  2. 10
      NRefactory/ICSharpCode.NRefactory.Demo/ICSharpCode.NRefactory.Demo.csproj
  3. 2
      NRefactory/ICSharpCode.NRefactory.Demo/VBAstView.Designer.cs
  4. 8
      NRefactory/ICSharpCode.NRefactory.Demo/VBAstView.cs
  5. 0
      NRefactory/ICSharpCode.NRefactory.Demo/VBAstView.resx
  6. 4
      NRefactory/ICSharpCode.NRefactory.Demo/VBDemo.Designer.cs
  7. 10
      NRefactory/ICSharpCode.NRefactory.Tests/CSharp/InsertParenthesesVisitorTests.cs
  8. 9
      NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/TypeDeclarationTests.cs
  9. 2
      NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Resolver/ResolverTestBase.cs
  10. 285
      NRefactory/ICSharpCode.NRefactory.Tests/FormattingTests/TestBlankLineFormatting.cs
  11. 405
      NRefactory/ICSharpCode.NRefactory.Tests/FormattingTests/TestBraceStlye.cs
  12. 143
      NRefactory/ICSharpCode.NRefactory.Tests/FormattingTests/TestFormattingBugs.cs
  13. 1792
      NRefactory/ICSharpCode.NRefactory.Tests/FormattingTests/TestSpacingVisitor.cs
  14. 1491
      NRefactory/ICSharpCode.NRefactory.Tests/FormattingTests/TestStatementIndentation.cs
  15. 512
      NRefactory/ICSharpCode.NRefactory.Tests/FormattingTests/TestTypeLevelIndentation.cs
  16. 261
      NRefactory/ICSharpCode.NRefactory.Tests/FormattingTests/TextEditorTestAdapter.cs
  17. 21
      NRefactory/ICSharpCode.NRefactory.Tests/ICSharpCode.NRefactory.Tests.csproj
  18. 10
      NRefactory/ICSharpCode.NRefactory.VB.Tests/General/UnitTest.cs
  19. 6
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Lexer/LexerContextTests.cs
  20. 2
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Output/CodeDOM/CodeDOMParenthesizedExpressionTest.cs
  21. 2
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Output/CodeDOM/CodeDOMPrimitiveExpressionTest.cs
  22. 2
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Output/CodeDOM/CodeDOMTypeReferenceTest.cs
  23. 2
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Output/CodeDOM/InvocationExpressionTest.cs
  24. 2
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Output/SpecialOutputVisitorTest.cs
  25. 2
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Output/VBNet/VBNetOutputTest.cs
  26. 6
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/CheckParentVisitor.cs
  27. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/AddressOfExpressionTests.cs
  28. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/ArrayCreateExpressionTests.cs
  29. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/AssignmentExpressionTests.cs
  30. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/BaseReferenceExpressionTests.cs
  31. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/BinaryOperatorExpressionTests.cs
  32. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/CastExpressionTests.cs
  33. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/ClassReferenceExpressionTests.cs
  34. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/ConditionalExpressionTests.cs
  35. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/GlobalReferenceExpressionTests.cs
  36. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/IdentifierExpressionTests.cs
  37. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/InvocationExpressionTests.cs
  38. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/LambdaExpressionTests.cs
  39. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/MemberReferenceExpressionTests.cs
  40. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/ObjectCreateExpressionTests.cs
  41. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/ParenthesizedExpressionTest.cs
  42. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/PrimitiveExpressionTests.cs
  43. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/QueryExpressionTests.cs
  44. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/ThisReferenceExpressionTests.cs
  45. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/TypeOfExpressionTests.cs
  46. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/TypeOfIsExpressionTests.cs
  47. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/TypeReferenceExpressionTests.cs
  48. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/UnaryOperatorExpressionTests.cs
  49. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/XmlExpressionTests.cs
  50. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/XmlMemberAccessExpressionTests.cs
  51. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/GlobalScope/AttributeSectionTests.cs
  52. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/GlobalScope/DelegateDeclarationTests.cs
  53. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/GlobalScope/NamespaceDeclarationTests.cs
  54. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/GlobalScope/OptionDeclarationTests.cs
  55. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/GlobalScope/TypeDeclarationTests.cs
  56. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/GlobalScope/UsingDeclarationTests.cs
  57. 6
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/LocationAssignmentCheckVisitor.cs
  58. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/ParseUtil.cs
  59. 2
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/SnippetParserTests.cs
  60. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/AddHandlerStatementTests.cs
  61. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/BlockStatementTests.cs
  62. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ContinueStatementTests.cs
  63. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/DoLoopStatementTests.cs
  64. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/EndStatementTests.cs
  65. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/EraseStatementTests.cs
  66. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ErrorStatementTests.cs
  67. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ExpressionStatementTests.cs
  68. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ForNextStatementTests.cs
  69. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ForeachStatementTests.cs
  70. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/GotoStatementTests.cs
  71. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/IfElseStatementTests.cs
  72. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/LabelStatementTests.cs
  73. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/LocalVariableDeclarationTests.cs
  74. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/LockStatementTests.cs
  75. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/OnErrorStatementTest.cs
  76. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/RaiseEventStatementTest.cs
  77. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ReDimStatementTests.cs
  78. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/RemoveHandlerStatement.cs
  79. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ResumeStatement.cs
  80. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ReturnStatementTests.cs
  81. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/StopStatementTests.cs
  82. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/SwitchStatementTests.cs
  83. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ThrowStatementTests.cs
  84. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/TryCatchStatementTests.cs
  85. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/UsingStatementTests.cs
  86. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/WithStatementTests.cs
  87. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/TypeLevel/ConstructorDeclarationTests.cs
  88. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/TypeLevel/CustomEventTests.cs
  89. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/TypeLevel/DeclareDeclarationTests.cs
  90. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/TypeLevel/EventDeclarationTests.cs
  91. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/TypeLevel/FieldDeclarationTests.cs
  92. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/TypeLevel/MethodDeclarationTests.cs
  93. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/TypeLevel/OperatorDeclarationTests.cs
  94. 4
      NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/TypeLevel/PropertyDeclarationTests.cs
  95. 6
      NRefactory/ICSharpCode.NRefactory.VB/Ast/AbstractNode.cs
  96. 2
      NRefactory/ICSharpCode.NRefactory.VB/Ast/Enums.cs
  97. 8
      NRefactory/ICSharpCode.NRefactory.VB/Ast/General/BlockStatement.cs
  98. 4
      NRefactory/ICSharpCode.NRefactory.VB/Ast/General/CompilationUnit.cs
  99. 4
      NRefactory/ICSharpCode.NRefactory.VB/Ast/General/Expression.cs
  100. 4
      NRefactory/ICSharpCode.NRefactory.VB/Ast/General/LocalVariableDeclaration.cs
  101. Some files were not shown because too many files have changed in this diff Show More

8
ICSharpCode.Decompiler/Ast/AstBuilder.cs

@ -88,10 +88,10 @@ namespace ICSharpCode.Decompiler.Ast @@ -88,10 +88,10 @@ namespace ICSharpCode.Decompiler.Ast
var outputFormatter = new TextOutputFormatter(output);
var formattingPolicy = new CSharpFormattingPolicy();
// disable whitespace in front of parentheses:
formattingPolicy.BeforeMethodCallParentheses = false;
formattingPolicy.BeforeMethodDeclarationParentheses = false;
formattingPolicy.BeforeConstructorDeclarationParentheses = false;
formattingPolicy.BeforeDelegateDeclarationParentheses = false;
formattingPolicy.SpaceBeforeMethodCallParentheses = false;
formattingPolicy.SpaceBeforeMethodDeclarationParentheses = false;
formattingPolicy.SpaceBeforeConstructorDeclarationParentheses = false;
formattingPolicy.SpaceBeforeDelegateDeclarationParentheses = false;
astCompileUnit.AcceptVisitor(new OutputVisitor(outputFormatter, formattingPolicy), null);
}

10
NRefactory/ICSharpCode.NRefactory.Demo/ICSharpCode.NRefactory.Demo.csproj

@ -46,11 +46,11 @@ @@ -46,11 +46,11 @@
<Compile Include="VBEditDialog.Designer.cs">
<DependentUpon>VBEditDialog.cs</DependentUpon>
</Compile>
<Compile Include="VBDomView.cs">
<Compile Include="VBAstView.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="VBDomView.Designer.cs">
<DependentUpon>VBDomView.cs</DependentUpon>
<Compile Include="VBAstView.Designer.cs">
<DependentUpon>VBAstView.cs</DependentUpon>
</Compile>
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
@ -81,8 +81,8 @@ @@ -81,8 +81,8 @@
<EmbeddedResource Include="VBEditDialog.resx">
<DependentUpon>VBEditDialog.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="VBDomView.resx">
<DependentUpon>VBDomView.cs</DependentUpon>
<EmbeddedResource Include="VBAstView.resx">
<DependentUpon>VBAstView.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>

2
NRefactory/ICSharpCode.NRefactory.Demo/VBDomView.Designer.cs → NRefactory/ICSharpCode.NRefactory.Demo/VBAstView.Designer.cs generated

@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
namespace ICSharpCode.NRefactory.Demo
{
partial class VBDomView : System.Windows.Forms.UserControl
partial class VBAstView : System.Windows.Forms.UserControl
{
/// <summary>
/// Designer variable used to keep track of non-visual components.

8
NRefactory/ICSharpCode.NRefactory.Demo/VBDomView.cs → NRefactory/ICSharpCode.NRefactory.Demo/VBAstView.cs

@ -6,12 +6,12 @@ using System.Collections; @@ -6,12 +6,12 @@ using System.Collections;
using System.Windows.Forms;
using System.Reflection;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using ICSharpCode.NRefactory.VB;
namespace ICSharpCode.NRefactory.Demo
{
public partial class VBDomView
public partial class VBAstView
{
CompilationUnit unit;
@ -34,7 +34,7 @@ namespace ICSharpCode.NRefactory.Demo @@ -34,7 +34,7 @@ namespace ICSharpCode.NRefactory.Demo
tree.SelectedNode = tree.Nodes[0];
}
public VBDomView()
public VBAstView()
{
InitializeComponent();
}
@ -89,7 +89,7 @@ namespace ICSharpCode.NRefactory.Demo @@ -89,7 +89,7 @@ namespace ICSharpCode.NRefactory.Demo
((ElementNode)node).Update();
}
public void ApplyTransformation(IDomVisitor visitor)
public void ApplyTransformation(IAstVisitor visitor)
{
if (tree.SelectedNode == tree.Nodes[0]) {
unit.AcceptVisitor(visitor, null);

0
NRefactory/ICSharpCode.NRefactory.Demo/VBDomView.resx → NRefactory/ICSharpCode.NRefactory.Demo/VBAstView.resx

4
NRefactory/ICSharpCode.NRefactory.Demo/VBDemo.Designer.cs generated

@ -35,7 +35,7 @@ namespace ICSharpCode.NRefactory.Demo @@ -35,7 +35,7 @@ namespace ICSharpCode.NRefactory.Demo
this.codeView = new System.Windows.Forms.TextBox();
this.editNodeButton = new System.Windows.Forms.Button();
this.clearSpecialsButton = new System.Windows.Forms.Button();
this.syntaxTree = new ICSharpCode.NRefactory.Demo.VBDomView();
this.syntaxTree = new ICSharpCode.NRefactory.Demo.VBAstView();
this.generateCodeButton = new System.Windows.Forms.Button();
this.parseButton = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
@ -154,7 +154,7 @@ namespace ICSharpCode.NRefactory.Demo @@ -154,7 +154,7 @@ namespace ICSharpCode.NRefactory.Demo
}
private System.Windows.Forms.Button clearSpecialsButton;
private System.Windows.Forms.Button editNodeButton;
private ICSharpCode.NRefactory.Demo.VBDomView syntaxTree;
private ICSharpCode.NRefactory.Demo.VBAstView syntaxTree;
private System.Windows.Forms.TextBox codeView;
private System.Windows.Forms.Button generateCodeButton;
private System.Windows.Forms.Button parseButton;

10
NRefactory/ICSharpCode.NRefactory.Tests/CSharp/InsertParenthesesVisitorTests.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under MIT X11 license (for details please see \doc\license.txt)
using System;
@ -146,10 +146,10 @@ namespace ICSharpCode.NRefactory.CSharp @@ -146,10 +146,10 @@ namespace ICSharpCode.NRefactory.CSharp
Assert.AreEqual("a is int? ? b : c", InsertRequired(expr));
Assert.AreEqual("(a is int?) ? b : c", InsertReadable(expr));
policy.ConditionalOperatorBeforeConditionSpace = false;
policy.ConditionalOperatorAfterConditionSpace = false;
policy.ConditionalOperatorBeforeSeparatorSpace = false;
policy.ConditionalOperatorAfterSeparatorSpace = false;
policy.SpaceBeforeConditionalOperatorCondition = false;
policy.SpaceAfterConditionalOperatorCondition = false;
policy.SpaceBeforeConditionalOperatorSeparator = false;
policy.SpaceAfterConditionalOperatorSeparator = false;
Assert.AreEqual("a is int? ?b:c", InsertRequired(expr));
Assert.AreEqual("(a is int?)?b:c", InsertReadable(expr));

9
NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/TypeDeclarationTests.cs

@ -272,5 +272,14 @@ public abstract class MyClass : MyBase, Interface1, My.Test.Interface2 @@ -272,5 +272,14 @@ public abstract class MyClass : MyBase, Interface1, My.Test.Interface2
Assert.AreEqual("N", ns.Name);
Assert.AreEqual("MyClass", ((TypeDeclaration)ns.Members.Single()).Name);
}
[Test]
public void EnumWithInitializer()
{
TypeDeclaration td = ParseUtilCSharp.ParseGlobal<TypeDeclaration>("enum MyEnum { Val1 = 10 }");
EnumMemberDeclaration member = (EnumMemberDeclaration)td.Members.Single();
Assert.AreEqual("Val1", member.Name);
Assert.AreEqual(10, ((PrimitiveExpression)member.Initializer).Value);
}
}
}

2
NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Resolver/ResolverTestBase.cs

@ -171,7 +171,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver @@ -171,7 +171,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver
protected T Resolve<T>(string code) where T : ResolveResult
{
ResolveResult rr = Resolve(code);
Assert.IsInstanceOf(typeof(T), rr);
Assert.IsTrue(rr is T, "Resolve should be " + typeof(T).Name + ", but was " + (rr != null ? rr.GetType().Name : "null"));
return (T)rr;
}

285
NRefactory/ICSharpCode.NRefactory.Tests/FormattingTests/TestBlankLineFormatting.cs

@ -0,0 +1,285 @@ @@ -0,0 +1,285 @@
//
// TastBlankLineFormatting.cs
//
// Author:
// Mike Krüger <mkrueger@novell.com>
//
// Copyright (c) 2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.CSharp;
namespace ICSharpCode.NRefactory.FormattingTests
{
[TestFixture()]
public class TestBlankLineFormatting : TestBase
{
[Test()]
public void TestBlankLinesAfterUsings ()
{
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.BlankLinesAfterUsings = 2;
var adapter = Test (policy, @"using System;
using System.Text;
namespace Test
{
}",
@"using System;
using System.Text;
namespace Test
{
}");
policy.BlankLinesAfterUsings = 0;
Continue (policy, adapter,
@"using System;
using System.Text;
namespace Test
{
}");
}
[Test()]
public void TestBlankLinesBeforeUsings ()
{
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.BlankLinesAfterUsings = 0;
policy.BlankLinesBeforeUsings = 2;
var adapter = Test (policy, @"using System;
using System.Text;
namespace Test
{
}",
@"
using System;
using System.Text;
namespace Test
{
}");
policy.BlankLinesBeforeUsings = 0;
Continue (policy, adapter,
@"using System;
using System.Text;
namespace Test
{
}");
}
[Test()]
public void TestBlankLinesBeforeFirstDeclaration ()
{
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.BlankLinesBeforeFirstDeclaration = 2;
var adapter = Test (policy, @"namespace Test
{
class Test
{
}
}",
@"namespace Test
{
class Test
{
}
}");
policy.BlankLinesBeforeFirstDeclaration = 0;
Continue (policy, adapter,
@"namespace Test
{
class Test
{
}
}");
}
[Test()]
public void TestBlankLinesBetweenTypes ()
{
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.BlankLinesBetweenTypes = 1;
var adapter = Test (policy, @"namespace Test
{
class Test1
{
}
class Test2
{
}
class Test3
{
}
}",
@"namespace Test
{
class Test1
{
}
class Test2
{
}
class Test3
{
}
}");
policy.BlankLinesBetweenTypes = 0;
Continue (policy, adapter, @"namespace Test
{
class Test1
{
}
class Test2
{
}
class Test3
{
}
}");
}
[Test()]
public void TestBlankLinesBetweenFields ()
{
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.BlankLinesBetweenFields = 1;
var adapter = Test (policy, @"class Test
{
int a;
int b;
int c;
}",
@"class Test
{
int a;
int b;
int c;
}");
policy.BlankLinesBetweenFields = 0;
Continue (policy, adapter, @"class Test
{
int a;
int b;
int c;
}");
}
[Test()]
public void TestBlankLinesBetweenEventFields ()
{
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.BlankLinesBetweenEventFields = 1;
var adapter = Test (policy, @"class Test
{
public event EventHandler a;
public event EventHandler b;
public event EventHandler c;
}",
@"class Test
{
public event EventHandler a;
public event EventHandler b;
public event EventHandler c;
}");
policy.BlankLinesBetweenEventFields = 0;
Continue (policy, adapter,
@"class Test
{
public event EventHandler a;
public event EventHandler b;
public event EventHandler c;
}");
}
[Test()]
public void TestBlankLinesBetweenMembers ()
{
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.BlankLinesBetweenMembers = 1;
var adapter = Test (policy,@"class Test
{
void AMethod ()
{
}
void BMethod ()
{
}
void CMethod ()
{
}
}", @"class Test
{
void AMethod ()
{
}
void BMethod ()
{
}
void CMethod ()
{
}
}");
policy.BlankLinesBetweenMembers = 0;
Continue (policy, adapter, @"class Test
{
void AMethod ()
{
}
void BMethod ()
{
}
void CMethod ()
{
}
}");
}
}
}

405
NRefactory/ICSharpCode.NRefactory.Tests/FormattingTests/TestBraceStlye.cs

@ -23,245 +23,184 @@ @@ -23,245 +23,184 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
/*
using System;
using System.IO;
using NUnit.Framework;
using MonoDevelop.Ide.Gui;
using MonoDevelop.Projects;
using MonoDevelop.Core;
using MonoDevelop.Ide.CodeCompletion;
using MonoDevelop.Ide.Gui.Content;
using MonoDevelop.Projects.Dom.Parser;
using MonoDevelop.CSharp.Parser;
using MonoDevelop.CSharp.Resolver;
using MonoDevelop.CSharp.Completion;
using Mono.TextEditor;
using MonoDevelop.CSharp.Formatting;
using ICSharpCode.NRefactory.CSharp;
namespace MonoDevelop.CSharpBinding.FormattingTests
namespace ICSharpCode.NRefactory.FormattingTests
{
[TestFixture()]
public class TestBraceStyle : UnitTests.TestBase
public class TestBraceStyle : TestBase
{
[Test()]
[Ignore("currently failing because namespaces are not inserted")]
public void TestNamespaceBraceStyle ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text = @"namespace A
{
namespace B {
class Test {}
}
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.NamespaceBraceStyle = BraceStyle.EndOfLine;
policy.ClassBraceStyle = BraceStyle.DoNotChange;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"namespace A {
var adapter = Test (policy, @"namespace A
{
namespace B {
class Test {}
}
}",
@"namespace A {
namespace B {
class Test {}
}
}", data.Document.Text);
}");
policy.NamespaceBraceStyle = BraceStyle.NextLineShifted;
compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"namespace A
Continue (policy, adapter,
@"namespace A
{
namespace B
{
class Test {}
}
}", data.Document.Text);
}");
}
[Test()]
public void TestClassBraceStlye ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text = @"class Test {}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.ClassBraceStyle = BraceStyle.EndOfLine;
policy.ClassBraceStyle = BraceStyle.EndOfLine;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"class Test {
}", data.Document.Text);
Test (policy,
@"class Test {}",
@"class Test {
}");
}
[Test()]
public void TestStructBraceStyle ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text = @"struct Test {}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.StructBraceStyle = BraceStyle.NextLine;
policy.StructBraceStyle = BraceStyle.NextLine;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"struct Test
Test (policy,
@"struct Test {}",
@"struct Test
{
}", data.Document.Text);
}");
}
[Test()]
public void TestInterfaceBraceStyle ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text = @"interface Test {}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.InterfaceBraceStyle = BraceStyle.NextLine;
policy.InterfaceBraceStyle = BraceStyle.NextLine;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"interface Test
Test (policy,
@"interface Test {}",
@"interface Test
{
}", data.Document.Text);
}");
}
[Test()]
public void TestEnumBraceStyle ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text = @"enum Test {
A
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.EnumBraceStyle = BraceStyle.NextLineShifted;
policy.EnumBraceStyle = BraceStyle.NextLineShifted;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"enum Test
Test (policy, @"enum Test {
A
}",
@"enum Test
{
A
}", data.Document.Text);
}");
}
[Test()]
public void TestMethodBraceStlye ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text = @"class Test
{
Test MyMethod() {}
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.MethodBraceStyle = BraceStyle.NextLine;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Console.WriteLine (data.Document.Text);
Assert.AreEqual (@"class Test
Test (policy, @"class Test
{
Test MyMethod()
Test MyMethod() {}
}",
@"class Test
{
Test MyMethod ()
{
}
}", data.Document.Text);
}");
}
[Test()]
public void TestConstructorBraceStyle ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text = @"class Test
{
Test() {}
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.ConstructorBraceStyle = BraceStyle.NextLine;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Console.WriteLine (data.Document.Text);
Assert.AreEqual (@"class Test
Test (policy, @"class Test
{
Test()
Test() {}
}",
@"class Test
{
Test ()
{
}
}", data.Document.Text);
}");
}
[Test()]
public void TestDestructorBraceStyle ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text = @"class Test
{
~Test() {}
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.DestructorBraceStyle = BraceStyle.NextLine;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Console.WriteLine (data.Document.Text);
Assert.AreEqual (@"class Test
Test (policy, @"class Test
{
~Test() {}
}",
@"class Test
{
~Test()
~Test ()
{
}
}", data.Document.Text);
}");
}
[Test()]
public void TestPropertyBraceStyle ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text = @"class Test
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.PropertyBraceStyle = BraceStyle.NextLine;
Test (policy, @"class Test
{
Test A {
get;
set;
}
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.PropertyBraceStyle = BraceStyle.NextLine;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Console.WriteLine (data.Document.Text);
Assert.AreEqual (@"class Test
}",
@"class Test
{
Test A
{
get;
set;
}
}", data.Document.Text);
}");
}
[Test()]
public void TestPropertyGetBraceStyle ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text = @"class Test
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.PropertyGetBraceStyle = BraceStyle.NextLine;
Test (policy, @"class Test
{
Test A {
get {
@ -269,16 +208,8 @@ namespace B { @@ -269,16 +208,8 @@ namespace B {
}
set;
}
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.PropertyGetBraceStyle = BraceStyle.NextLine;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Console.WriteLine (data.Document.Text);
Assert.AreEqual (@"class Test
}",
@"class Test
{
Test A {
get
@ -287,32 +218,26 @@ namespace B { @@ -287,32 +218,26 @@ namespace B {
}
set;
}
}", data.Document.Text);
}");
}
[Test()]
public void TestAllowPropertyGetBlockInline ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text = @"class Test
{
Test A {
get { return null; }
set { ; }
}
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.PropertyBraceStyle = BraceStyle.DoNotChange;
policy.AllowPropertyGetBlockInline = true;
policy.AllowPropertySetBlockInline = false;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Console.WriteLine (data.Document.Text);
Assert.AreEqual (@"class Test
var adapter = Test (policy, @"class Test
{
Test A {
get { return null; }
set { ; }
}
}",
@"class Test
{
Test A {
get { return null; }
@ -320,13 +245,11 @@ namespace B { @@ -320,13 +245,11 @@ namespace B {
;
}
}
}", data.Document.Text);
}");
policy.AllowPropertyGetBlockInline = false;
compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"class Test
Continue (policy, adapter,
@"class Test
{
Test A {
get {
@ -336,32 +259,25 @@ namespace B { @@ -336,32 +259,25 @@ namespace B {
;
}
}
}", data.Document.Text);
}");
}
[Test()]
public void TestAllowPropertySetBlockInline ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text = @"class Test
{
Test A {
get { return null; }
set { ; }
}
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.PropertyBraceStyle = BraceStyle.DoNotChange;
policy.AllowPropertyGetBlockInline = false;
policy.AllowPropertySetBlockInline = true;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Console.WriteLine (data.Document.Text);
Assert.AreEqual (@"class Test
var adapter = Test (policy, @"class Test
{
Test A {
get { return null; }
set { ; }
}
}",
@"class Test
{
Test A {
get {
@ -369,13 +285,11 @@ namespace B { @@ -369,13 +285,11 @@ namespace B {
}
set { ; }
}
}", data.Document.Text);
}");
policy.AllowPropertySetBlockInline = false;
compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"class Test
Continue (policy, adapter,
@"class Test
{
Test A {
get {
@ -385,15 +299,16 @@ namespace B { @@ -385,15 +299,16 @@ namespace B {
;
}
}
}", data.Document.Text);
}");
}
[Test()]
public void TestPropertySetBraceStyle ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text = @"class Test
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.PropertySetBraceStyle = BraceStyle.NextLine;
Test (policy, @"class Test
{
Test A {
get;
@ -401,16 +316,8 @@ namespace B { @@ -401,16 +316,8 @@ namespace B {
;
}
}
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.PropertySetBraceStyle = BraceStyle.NextLine;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Console.WriteLine (data.Document.Text);
Assert.AreEqual (@"class Test
}",
@"class Test
{
Test A {
get;
@ -419,15 +326,18 @@ namespace B { @@ -419,15 +326,18 @@ namespace B {
;
}
}
}", data.Document.Text);
}");
}
[Test()]
public void TestEventBraceStyle ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text = @"class Test
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.EventBraceStyle = BraceStyle.NextLine;
policy.EventAddBraceStyle = BraceStyle.NextLine;
policy.EventRemoveBraceStyle = BraceStyle.NextLine;
Test (policy, @"class Test
{
public event EventHandler Handler {
add {
@ -435,18 +345,8 @@ namespace B { @@ -435,18 +345,8 @@ namespace B {
remove {
}
}
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.EventBraceStyle = BraceStyle.NextLine;
policy.EventAddBraceStyle = BraceStyle.NextLine;
policy.EventRemoveBraceStyle = BraceStyle.NextLine;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Console.WriteLine (data.Document.Text);
Assert.AreEqual (@"class Test
}",
@"class Test
{
public event EventHandler Handler
{
@ -457,31 +357,24 @@ namespace B { @@ -457,31 +357,24 @@ namespace B {
{
}
}
}", data.Document.Text);
}");
}
[Test()]
public void TestAllowEventAddBlockInline ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text = @"class Test
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.AllowEventAddBlockInline = true;
policy.AllowEventRemoveBlockInline = false;
Test (policy, @"class Test
{
public event EventHandler Handler {
add { ; }
remove { ; }
}
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.AllowEventAddBlockInline = true;
policy.AllowEventRemoveBlockInline = false;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Console.WriteLine (data.Document.Text);
Assert.AreEqual (@"class Test
}",
@"class Test
{
public event EventHandler Handler {
add { ; }
@ -489,31 +382,24 @@ namespace B { @@ -489,31 +382,24 @@ namespace B {
;
}
}
}", data.Document.Text);
}");
}
[Test()]
public void TestAllowEventRemoveBlockInline ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text = @"class Test
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.AllowEventAddBlockInline = false;
policy.AllowEventRemoveBlockInline = true;
Test (policy, @"class Test
{
public event EventHandler Handler {
add { ; }
remove { ; }
}
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.AllowEventAddBlockInline = false;
policy.AllowEventRemoveBlockInline = true;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Console.WriteLine (data.Document.Text);
Assert.AreEqual (@"class Test
}",
@"class Test
{
public event EventHandler Handler {
add {
@ -521,10 +407,7 @@ namespace B { @@ -521,10 +407,7 @@ namespace B {
}
remove { ; }
}
}", data.Document.Text);
}");
}
}
}*/
}

143
NRefactory/ICSharpCode.NRefactory.Tests/FormattingTests/TestFormattingBugs.cs

@ -23,27 +23,16 @@ @@ -23,27 +23,16 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
/*
using System;
using System.IO;
using NUnit.Framework;
using MonoDevelop.Ide.Gui;
using MonoDevelop.Projects;
using MonoDevelop.Core;
using MonoDevelop.Ide.CodeCompletion;
using MonoDevelop.Ide.Gui.Content;
using MonoDevelop.Projects.Dom.Parser;
using MonoDevelop.CSharp.Parser;
using MonoDevelop.CSharp.Resolver;
using MonoDevelop.CSharp.Completion;
using Mono.TextEditor;
using MonoDevelop.CSharp.Formatting;
using System.Collections.Generic;
using MonoDevelop.Refactoring;
using ICSharpCode.NRefactory.CSharp;
namespace MonoDevelop.CSharpBinding.FormattingTests
namespace ICSharpCode.NRefactory.FormattingTests
{
[TestFixture()]
public class TestFormattingBugs : UnitTests.TestBase
public class TestFormattingBugs : TestBase
{
/// <summary>
/// Bug 325187 - Bug in smart indent
@ -71,8 +60,7 @@ Console.WriteLine (""Bad indent"");", @@ -71,8 +60,7 @@ Console.WriteLine (""Bad indent"");",
/// Bug 415469 - return ternary in a switch is not tabbed properly
/// </summary>
[Test()]
[Ignore("currently failing because of 'string' has the wrong offset - mcs bug")]
public void TestBug415469 ()
public void TestBug415469 ()
{
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
@ -111,52 +99,99 @@ using (IDisposable b = null) { @@ -111,52 +99,99 @@ using (IDisposable b = null) {
}");
}
/// <summary>
/// Bug 655635 - Auto format document doesn't indent comments as well
/// </summary>
[Test()]
public void TestBug655635 ()
{
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
TestStatementFormatting (policy,
@"try {
// Comment 1
myObject.x = Run ();
} catch (InvalidOperationException e) {
Console.WriteLine (e.Message);
}", @"try {
// Comment 1
myObject.x = Run ();
} catch (InvalidOperationException e) {
Console.WriteLine (e.Message);
}");
}
static void TestStatementFormatting (CSharpFormattingPolicy policy, string input, string expectedOutput)
void TestStatementFormatting (CSharpFormattingPolicy policy, string input, string expectedOutput)
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text =
@"class Test
var result = GetResult (policy, @"class Test
{
MyType TestMethod ()
{
" + input + @"
}
}";
Console.WriteLine (data.Document.Text);
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
DomSpacingVisitor domSpacingVisitor = new DomSpacingVisitor (policy, data);
domSpacingVisitor.AutoAcceptChanges = false;
compilationUnit.AcceptVisitor (domSpacingVisitor, null);
DomIndentationVisitor domIndentationVisitor = new DomIndentationVisitor (policy, data);
domIndentationVisitor.AutoAcceptChanges = false;
compilationUnit.AcceptVisitor (domIndentationVisitor, null);
List<Change> changes = new List<Change> ();
changes.AddRange (domSpacingVisitor.Changes);
changes.AddRange (domIndentationVisitor.Changes);
RefactoringService.AcceptChanges (null, null, changes);
for (int i = 0; i < data.Document.LineCount; i++) {
LineSegment line = data.Document.GetLine (i);
if (line.EditableLength < 2)
continue;
data.Remove (line.Offset, 2);
}
string text = data.Document.GetTextBetween (data.Document.GetLine (4).Offset,
data.Document.GetLine (data.Document.LineCount - 2).Offset).Trim ();
Console.WriteLine (text);
}");
int start = result.GetLineOffset (5);
int end = result.GetLineOffset (result.LineCount - 1);
string text = result.GetTextAt (start, end - start).Trim ();
expectedOutput = expectedOutput.Replace ("\n", "\n\t\t");
Assert.AreEqual (expectedOutput, text);
}
/// <summary>
/// Bug 659675 - on-the-fly code formatting breaks @-prefixed identifiers
/// </summary>
[Test()]
public void TestBug659675 ()
{
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
TestStatementFormatting (policy, "@string=@int;", "@string = @int;");
}
/// <summary>
/// Bug 670213 - Document formatter deletes valid text!
/// </summary>
[Test()]
public void TestBug670213 ()
{
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.MethodBraceStyle = BraceStyle.EndOfLine;
Test (policy, @"class Test
{
Test MyMethod() // Comment
{
}
}",
@"class Test
{
Test MyMethod () { // Comment
}
}");
}
/// <summary>
/// Bug 677261 - Format Document with constructor with over-indented opening curly brace
/// </summary>
[Test()]
public void TestBug677261 ()
{
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.ConstructorBraceStyle = BraceStyle.EndOfLine;
Test (policy, @"class Test
{
Test ()
{
}
}",
@"class Test
{
Test () {
}
}");
}
}
}
*/

1792
NRefactory/ICSharpCode.NRefactory.Tests/FormattingTests/TestSpacingVisitor.cs

File diff suppressed because it is too large Load Diff

1491
NRefactory/ICSharpCode.NRefactory.Tests/FormattingTests/TestStatementIndentation.cs

File diff suppressed because it is too large Load Diff

512
NRefactory/ICSharpCode.NRefactory.Tests/FormattingTests/TestTypeLevelIndentation.cs

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
//
// TestTypeLevelIndentation.cs
//
//
// Author:
// Mike Krüger <mkrueger@novell.com>
//
@ -23,164 +23,196 @@ @@ -23,164 +23,196 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
/*
using System;
using System.IO;
using NUnit.Framework;
using MonoDevelop.Ide.Gui;
using MonoDevelop.Projects;
using MonoDevelop.Core;
using MonoDevelop.Ide.CodeCompletion;
using MonoDevelop.Ide.Gui.Content;
using MonoDevelop.Projects.Dom.Parser;
using MonoDevelop.CSharp.Parser;
using MonoDevelop.CSharp.Resolver;
using MonoDevelop.CSharp.Completion;
using Mono.TextEditor;
using MonoDevelop.CSharp.Formatting;
using ICSharpCode.NRefactory.CSharp;
namespace MonoDevelop.CSharpBinding.FormattingTests
namespace ICSharpCode.NRefactory.FormattingTests
{
[TestFixture()]
public class TestTypeLevelIndentation : UnitTests.TestBase
public class TestTypeLevelIndentation : TestBase
{
[Test()]
public void TestClassIndentation ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text =
@" class Test {}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.ClassBraceStyle = BraceStyle.DoNotChange;
Test (policy,
@" class Test {}",
@"class Test {}");
}
[Test()]
public void TestClassIndentationInNamespaces ()
{
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.NamespaceBraceStyle = BraceStyle.EndOfLine;
policy.ClassBraceStyle = BraceStyle.DoNotChange;
Test (policy,
@"namespace A { class Test {} }",
@"namespace A {
class Test {}
}");
}
[Test()]
public void TestNoIndentationInNamespaces ()
{
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.NamespaceBraceStyle = BraceStyle.EndOfLine;
policy.ClassBraceStyle = BraceStyle.DoNotChange;
policy.IndentNamespaceBody = false;
Test (policy,
@"namespace A { class Test {} }",
@"namespace A {
class Test {}
}");
}
[Test()]
public void TestClassIndentationInNamespacesCase2 ()
{
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.ClassBraceStyle = BraceStyle.DoNotChange;
policy.NamespaceBraceStyle = BraceStyle.NextLine;
policy.ClassBraceStyle = BraceStyle.NextLine;
policy.ConstructorBraceStyle = BraceStyle.NextLine;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"class Test {}", data.Document.Text);
Test (policy,
@"using System;
namespace MonoDevelop.CSharp.Formatting {
public class FormattingProfileService {
public FormattingProfileService () {
}
}
}",
@"using System;
namespace MonoDevelop.CSharp.Formatting
{
public class FormattingProfileService
{
public FormattingProfileService ()
{
}
}
}");
}
[Test()]
public void TestIndentClassBody ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text =
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.IndentClassBody = true;
Test (policy,
@"class Test
{
Test a;
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.IndentClassBody = true;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"class Test
}", @"class Test
{
Test a;
}", data.Document.Text);
}");
policy.IndentClassBody = false;
compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"class Test
Test (policy,
@"class Test
{
Test a;
}",
@"class Test
{
Test a;
}", data.Document.Text);
}");
}
[Test()]
public void TestIndentInterfaceBody ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text =
@"interface Test
{
Test Foo ();
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.IndentInterfaceBody = true;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"interface Test
Test (policy,
@"interface Test
{
Test Foo ();
}", @"interface Test
{
Test Foo ();
}", data.Document.Text);
}");
policy.IndentInterfaceBody = false;
compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"interface Test
Test (policy,
@"interface Test
{
Test Foo ();
}", @"interface Test
{
Test Foo ();
}", data.Document.Text);
}");
}
[Test()]
public void TestIndentStructBody ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text =
@"struct Test
{
Test a;
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.IndentStructBody = true;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"struct Test
Test (policy,
@"struct Test
{
Test a;
}", data.Document.Text);
Test Foo ();
}", @"struct Test
{
Test Foo ();
}");
policy.IndentStructBody = false;
compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"struct Test
Test (policy,
@"struct Test
{
Test a;
}", data.Document.Text);
Test Foo ();
}", @"struct Test
{
Test Foo ();
}");
}
[Test()]
public void TestIndentEnumBody ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text =
@"enum Test
{
A
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.IndentEnumBody = true;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"enum Test
Test (policy,
@"enum Test
{
A
}", @"enum Test
{
A
}", data.Document.Text);
}");
policy.IndentEnumBody = false;
compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"enum Test
Test (policy,
@"enum Test
{
A
}", @"enum Test
{
A
}", data.Document.Text);
}");
}
[Test()]
public void TestIndentMethodBody ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text =
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.IndentMethodBody = true;
Test (policy,
@"class Test
{
Test Foo ()
@ -188,40 +220,42 @@ A @@ -188,40 +220,42 @@ A
;
;
}
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.IndentMethodBody = true;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"class Test
}",
@"class Test
{
Test Foo ()
{
;
;
}
}", data.Document.Text);
}");
policy.IndentMethodBody = false;
compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"class Test
Test (policy,
@"class Test
{
Test Foo ()
{
;
;
}
}",
@"class Test
{
Test Foo ()
{
;
;
}
}", data.Document.Text);
}");
}
[Test()]
public void TestIndentMethodBodyOperatorCase ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text =
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.IndentMethodBody = true;
var adapter = Test (policy,
@"class Test
{
static Test operator+(Test left, Test right)
@ -229,78 +263,104 @@ A @@ -229,78 +263,104 @@ A
;
;
}
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.IndentMethodBody = true;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"class Test
}",
@"class Test
{
static Test operator+(Test left, Test right)
static Test operator+ (Test left, Test right)
{
;
;
}
}", data.Document.Text);
}");
policy.IndentMethodBody = false;
compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"class Test
Continue (policy, adapter, @"class Test
{
static Test operator+(Test left, Test right)
static Test operator+ (Test left, Test right)
{
;
;
}
}", data.Document.Text);
}");
}
[Test()]
public void TestIndentPropertyBody ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text =
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.IndentPropertyBody = true;
var adapter = Test (policy,
@"class Test
{
Test TestMe {
get;
set;
}
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.IndentPropertyBody = true;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"class Test
}",
@"class Test
{
Test TestMe {
get;
set;
}
}", data.Document.Text);
}");
policy.IndentPropertyBody = false;
compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"class Test
Continue (policy, adapter,
@"class Test
{
Test TestMe {
get;
set;
}
}", data.Document.Text);
}");
}
[Test()]
public void TestIndentPropertyOneLine ()
{
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.PropertyFormatting = PropertyFormatting.AllowOneLine;
policy.AllowPropertyGetBlockInline = true;
policy.AllowPropertySetBlockInline = true;
Test (policy,
@"class Test
{
Test TestMe { get;set; }
}",
@"class Test
{
Test TestMe { get; set; }
}");
}
[Test()]
public void TestIndentPropertyOneLineCase2 ()
{
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.PropertyFormatting = PropertyFormatting.AllowOneLine;
policy.AllowPropertyGetBlockInline = true;
policy.AllowPropertySetBlockInline = true;
Test (policy,
@"class Test
{
Test TestMe { get { ; }set{;} }
}",
@"class Test
{
Test TestMe { get { ; } set { ; } }
}");
}
[Test()]
public void TestIndentPropertyBodyIndexerCase ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text =
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.IndentPropertyBody = true;
var adapter = Test (policy,
@"class Test
{
Test this[int a] {
@ -311,16 +371,10 @@ set { @@ -311,16 +371,10 @@ set {
;
}
}
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.IndentPropertyBody = true;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"class Test
}",
@"class Test
{
Test this[int a] {
Test this [int a] {
get {
return null;
}
@ -328,13 +382,12 @@ set { @@ -328,13 +382,12 @@ set {
;
}
}
}", data.Document.Text);
}");
policy.IndentPropertyBody = false;
compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"class Test
Continue (policy, adapter,
@"class Test
{
Test this[int a] {
Test this [int a] {
get {
return null;
}
@ -342,117 +395,129 @@ set { @@ -342,117 +395,129 @@ set {
;
}
}
}", data.Document.Text);
}");
}
[Test()]
public void TestPropertyAlignment ()
{
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.PropertyFormatting = PropertyFormatting.AllowOneLine;
var adapter = Test (policy,
@"class Test
{
Test TestMe { get; set; }
}",
@"class Test
{
Test TestMe { get; set; }
}");
policy.PropertyFormatting = PropertyFormatting.ForceNewLine;
Continue (policy, adapter,
@"class Test
{
Test TestMe {
get;
set;
}
}");
policy.PropertyFormatting = PropertyFormatting.ForceOneLine;
Continue (policy, adapter,
@"class Test
{
Test TestMe { get; set; }
}");
}
[Test()]
[Ignore("currently failing because namespaces are not inserted")]
public void TestIndentNamespaceBody ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text =
@" namespace Test {
class FooBar {}
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.ClassBraceStyle = BraceStyle.DoNotChange;
policy.ClassBraceStyle = BraceStyle.DoNotChange;
policy.NamespaceBraceStyle = BraceStyle.EndOfLine;
policy.IndentNamespaceBody = true;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"namespace Test {
var adapter = Test (policy,
@" namespace Test {
class FooBar {}
}",
@"namespace Test {
class FooBar {}
}", data.Document.Text);
}");
policy.IndentNamespaceBody = false;
compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"namespace Test {
Continue (policy, adapter,
@"namespace Test {
class FooBar {}
}", data.Document.Text);
}");
}
[Test()]
public void TestMethodIndentation ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text =
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.MethodBraceStyle = BraceStyle.DoNotChange;
Test (policy,
@"class Test
{
MyType TestMethod () {}
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.MethodBraceStyle = BraceStyle.DoNotChange;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"class Test
}",
@"class Test
{
MyType TestMethod () {}
}", data.Document.Text);
}");
}
[Test()]
public void TestPropertyIndentation ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text =
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.PropertyBraceStyle = BraceStyle.DoNotChange;
Test (policy,
@"class Test
{
public int Prop { get; set; }
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.PropertyBraceStyle = BraceStyle.DoNotChange;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"class Test
}",@"class Test
{
public int Prop { get; set; }
}", data.Document.Text);
}");
}
[Test()]
public void TestPropertyIndentationCase2 ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text =
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
Test (policy,
@"class Test
{
public int Prop {
get;
set;
}
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"class Test
}",
@"class Test
{
public int Prop {
get;
set;
}
}", data.Document.Text);
}");
}
[Test()]
public void TestIndentEventBody ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text =
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.IndentEventBody = true;
var adapter = Test (policy,
@"class Test
{
public event EventHandler TestMe {
@ -463,14 +528,8 @@ remove { @@ -463,14 +528,8 @@ remove {
;
}
}
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.IndentEventBody = true;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"class Test
}",
@"class Test
{
public event EventHandler TestMe {
add {
@ -480,11 +539,10 @@ remove { @@ -480,11 +539,10 @@ remove {
;
}
}
}", data.Document.Text);
}");
policy.IndentEventBody = false;
compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"class Test
Continue (policy, adapter,
@"class Test
{
public event EventHandler TestMe {
add {
@ -494,7 +552,7 @@ remove { @@ -494,7 +552,7 @@ remove {
;
}
}
}", data.Document.Text);
}");
}
}
}*/
}

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

@ -0,0 +1,261 @@ @@ -0,0 +1,261 @@
using System;
using System.Collections.Generic;
using ICSharpCode.NRefactory.CSharp;
using System.IO;
using NUnit.Framework;
namespace ICSharpCode.NRefactory.FormattingTests
{
/// <summary>
/// Text editor test adapter. Only implemented for testing purposes. Don't use in production code.
/// </summary>
class TextEditorTestAdapter : ITextEditorAdapter
{
string text;
public string Text {
get {
return this.text;
}
}
List<Delimiter> delimiters;
struct Delimiter
{
public readonly int Offset;
public readonly int Length;
public int EndOffset {
get { return Offset + Length; }
}
public Delimiter (int offset, int length)
{
Offset = offset;
Length = length;
}
public override string ToString ()
{
return string.Format ("[Delimiter: Offset={0}, Length={1}]", Offset, Length);
}
}
static IEnumerable<Delimiter> FindDelimiter (string text)
{
for (int i = 0; i < text.Length; i++) {
switch (text [i]) {
case '\r':
if (i + 1 < text.Length && text [i + 1] == '\n') {
yield return new Delimiter (i, 2);
i++;
} else {
yield return new Delimiter (i, 1);
}
break;
case '\n':
yield return new Delimiter (i, 1);
break;
}
}
}
public TextEditorTestAdapter (string text)
{
this.text = text;
delimiters = new List<Delimiter> (FindDelimiter (text));
}
class Segment
{
public readonly int Offset;
public readonly int Length;
public readonly int DelimiterLength;
public Segment (int offset, int length, int delimiterLength)
{
this.Offset = offset;
this.Length = length;
this.DelimiterLength = delimiterLength;
}
public override string ToString ()
{
return string.Format ("[Segment: Offset={0}, Length={1}, DelimiterLength={2}]", Offset, Length, DelimiterLength);
}
}
Segment Get (int number)
{
number--;
if (number < 0 || number - 1 >= delimiters.Count)
return null;
int startOffset = number > 0 ? delimiters [number - 1].EndOffset : 0;
int endOffset;
int delimiterLength;
if (number < delimiters.Count) {
endOffset = delimiters [number].EndOffset;
delimiterLength = delimiters [number].Length;
} else {
endOffset = text.Length;
delimiterLength = 0;
}
return new Segment (startOffset, endOffset - startOffset, delimiterLength);
}
public void ApplyChanges (List<Change> changes)
{
changes.Sort ((x, y) => x.Offset.CompareTo (y.Offset));
changes.Reverse ();
foreach (var change in changes) {
text = text.Substring (0, change.Offset) + change.InsertedText + text.Substring (change.Offset + change.RemovedChars);
}
delimiters = new List<Delimiter> (FindDelimiter (text));
}
#region ITextEditorAdapter implementation
public int LocationToOffset (int line, int col)
{
Segment seg = Get (line);
if (seg == null)
return 0;
return seg.Offset + col - 1;
}
public char GetCharAt (int offset)
{
if (offset < 0 || offset >= text.Length)
return '\0';
return text [offset];
}
public string GetTextAt (int offset, int length)
{
if (offset < 0 || offset + length >= text.Length)
return "";
if (length <= 0)
return "";
return text.Substring (offset, length);
}
public int GetEditableLength (int lineNumber)
{
var seg = Get (lineNumber);
if (seg == null)
return 0;
return seg.Length - seg.DelimiterLength;
}
public string GetIndentation (int lineNumber)
{
var seg = Get (lineNumber);
if (seg == null)
return "";
int start = seg.Offset;
int end = seg.Offset;
int endOffset = seg.Offset + seg.Length - seg.DelimiterLength;
while (end < endOffset && (text[end] == ' ' || text[end] == '\t'))
end++;
return start < end ? text.Substring (start, end - start) : "";
}
public int GetLineOffset (int lineNumber)
{
var seg = Get (lineNumber);
if (seg == null)
return 0;
return seg.Offset;
}
public int GetLineLength (int lineNumber)
{
var seg = Get (lineNumber);
if (seg == null)
return 0;
return seg.Length;
}
public int GetLineEndOffset (int lineNumber)
{
var seg = Get (lineNumber);
if (seg == null)
return 0;
return seg.Offset + seg.Length;
}
public bool TabsToSpaces {
get {
return false;
}
}
public int TabSize {
get {
return 4;
}
}
public string EolMarker {
get {
return Environment.NewLine;
}
}
public int Length {
get {
return text.Length;
}
}
public int LineCount {
get {
return delimiters.Count + 1;
}
}
#endregion
}
public abstract class TestBase
{
protected static ITextEditorAdapter GetResult (CSharpFormattingPolicy policy, string input)
{
var adapter = new TextEditorTestAdapter (input);
var visitior = new AstFormattingVisitor (policy, adapter);
var compilationUnit = new CSharpParser ().Parse (new StringReader (adapter.Text));
compilationUnit.AcceptVisitor (visitior, null);
adapter.ApplyChanges (visitior.Changes);
return adapter;
}
protected static ITextEditorAdapter Test (CSharpFormattingPolicy policy, string input, string expectedOutput)
{
var adapter = new TextEditorTestAdapter (input);
var visitior = new AstFormattingVisitor (policy, adapter);
var compilationUnit = new CSharpParser ().Parse (new StringReader (adapter.Text));
compilationUnit.AcceptVisitor (visitior, null);
adapter.ApplyChanges (visitior.Changes);
Assert.AreEqual (expectedOutput, adapter.Text);
return adapter;
}
protected static void Continue (CSharpFormattingPolicy policy, ITextEditorAdapter adapter, string expectedOutput)
{
var visitior = new AstFormattingVisitor (policy, adapter);
var compilationUnit = new CSharpParser ().Parse (new StringReader (adapter.Text));
compilationUnit.AcceptVisitor (visitior, null);
((TextEditorTestAdapter)adapter).ApplyChanges (visitior.Changes);
Assert.AreEqual (expectedOutput, adapter.Text);
}
}
}

21
NRefactory/ICSharpCode.NRefactory.Tests/ICSharpCode.NRefactory.Tests.csproj

@ -11,7 +11,6 @@ @@ -11,7 +11,6 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<ProductVersion>10.0.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
<PlatformTarget>x86</PlatformTarget>
@ -33,23 +32,17 @@ @@ -33,23 +32,17 @@
<DefineConstants>TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<WarningLevel>4</WarningLevel>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="nunit.framework">
<HintPath>..\lib\nunit.framework.dll</HintPath>
<HintPath>..\..\Mono.Cecil\Test\libs\nunit-2.4.8\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
@ -155,6 +148,8 @@ @@ -155,6 +148,8 @@
<Compile Include="Untested.cs" />
<Compile Include="Utils\CSharpPrimitiveCastTests.cs" />
<Compile Include="Utils\TreeTraversalTests.cs" />
<Compile Include="FormattingTests\TextEditorTestAdapter.cs" />
<Compile Include="FormattingTests\TestBlankLineFormatting.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ICSharpCode.NRefactory\ICSharpCode.NRefactory.csproj">
@ -163,11 +158,11 @@ @@ -163,11 +158,11 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="CSharp\Analysis" />
<Folder Include="CSharp\Parser\Expression" />
<Folder Include="CSharp\Parser\GeneralScope" />
<Folder Include="CSharp\Parser\TypeMembers" />
<Folder Include="CSharp\Parser\Statements" />
<Folder Include="CSharp\" />
<Folder Include="CSharp\Parser\" />
<Folder Include="CSharp\Parser\" />
<Folder Include="CSharp\Parser\" />
<Folder Include="CSharp\Parser\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>

10
NRefactory/ICSharpCode.NRefactory.VB.Tests/General/UnitTest.cs

@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
using System;
using System.Reflection;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Visitors;
@ -58,10 +58,10 @@ namespace ICSharpCode.NRefactory.VB.Tests @@ -58,10 +58,10 @@ namespace ICSharpCode.NRefactory.VB.Tests
// }
[Test]
public void TestIDomVisitor()
public void TestIAstVisitor()
{
Type[] allTypes = typeof(AbstractNode).Assembly.GetTypes();
Type visitor = typeof(IDomVisitor);
Type visitor = typeof(IAstVisitor);
foreach (Type type in allTypes) {
if (type.IsClass && !type.IsAbstract && !type.IsNested && type.GetInterface(typeof(INode).FullName) != null && !type.Name.StartsWith("Null")) {
@ -79,10 +79,10 @@ namespace ICSharpCode.NRefactory.VB.Tests @@ -79,10 +79,10 @@ namespace ICSharpCode.NRefactory.VB.Tests
}
[Test]
public void TestAbstractDomVisitorVisitor()
public void TestAbstractAstVisitorVisitor()
{
Type[] allTypes = typeof(AbstractNode).Assembly.GetTypes();
Type visitor = typeof(AbstractDomVisitor);
Type visitor = typeof(AbstractAstVisitor);
foreach (Type type in allTypes) {
if (type.IsClass && !type.IsAbstract && !type.IsNested && type.GetInterface(typeof(INode).FullName) != null && !type.Name.StartsWith("Null")) {

6
NRefactory/ICSharpCode.NRefactory.VB.Tests/Lexer/LexerContextTests.cs

@ -481,12 +481,14 @@ End Module", @@ -481,12 +481,14 @@ End Module",
enter Expression
enter Expression
enter Expression
enter Expression
exit Expression
exit Expression
exit Expression
exit Expression
enter Expression
enter Expression
enter Expression
enter Expression
exit Expression
exit Expression
exit Expression
exit Expression

2
NRefactory/ICSharpCode.NRefactory.VB.Tests/Output/CodeDOM/CodeDOMParenthesizedExpressionTest.cs

@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
using System;
using System.CodeDom;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using ICSharpCode.NRefactory.VB.Visitors;
using NUnit.Framework;

2
NRefactory/ICSharpCode.NRefactory.VB.Tests/Output/CodeDOM/CodeDOMPrimitiveExpressionTest.cs

@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
using System;
using System.CodeDom;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using ICSharpCode.NRefactory.VB.Visitors;
using NUnit.Framework;

2
NRefactory/ICSharpCode.NRefactory.VB.Tests/Output/CodeDOM/CodeDOMTypeReferenceTest.cs

@ -5,7 +5,7 @@ using System; @@ -5,7 +5,7 @@ using System;
using System.CodeDom;
using System.Collections.Generic;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using ICSharpCode.NRefactory.VB.Visitors;
using NUnit.Framework;

2
NRefactory/ICSharpCode.NRefactory.VB.Tests/Output/CodeDOM/InvocationExpressionTest.cs

@ -5,7 +5,7 @@ using System; @@ -5,7 +5,7 @@ using System;
using System.CodeDom;
using System.Collections.Generic;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using ICSharpCode.NRefactory.VB.Visitors;
using NUnit.Framework;

2
NRefactory/ICSharpCode.NRefactory.VB.Tests/Output/SpecialOutputVisitorTest.cs

@ -5,7 +5,7 @@ using System; @@ -5,7 +5,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.PrettyPrinter;
using ICSharpCode.NRefactory.VB.Visitors;

2
NRefactory/ICSharpCode.NRefactory.VB.Tests/Output/VBNet/VBNetOutputTest.cs

@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
using System;
using System.IO;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.PrettyPrinter;
using ICSharpCode.NRefactory.VB.Visitors;

6
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/CheckParentVisitor.cs

@ -4,15 +4,15 @@ @@ -4,15 +4,15 @@
using NUnit.Framework;
using System;
using System.Collections.Generic;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using ICSharpCode.NRefactory.VB.Visitors;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
/// <summary>
/// Ensures that all nodes have the Parent property correctly set.
/// </summary>
public class CheckParentVisitor : NodeTrackingDomVisitor
public class CheckParentVisitor : NodeTrackingAstVisitor
{
Stack<INode> nodeStack = new Stack<INode>();

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/AddressOfExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class AddressOfExpressionTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/ArrayCreateExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class ArrayCreateExpressionTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/AssignmentExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class AssignmentExpressionTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/BaseReferenceExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class BaseReferenceExpressionTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/BinaryOperatorExpressionTests.cs

@ -5,10 +5,10 @@ using System; @@ -5,10 +5,10 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using ICSharpCode.NRefactory.VB.PrettyPrinter;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class BinaryOperatorExpressionTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/CastExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class CastExpressionTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/ClassReferenceExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class ClassReferenceExpressionTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/ConditionalExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class ConditionalExpressionTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/GlobalReferenceExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class GlobalReferenceExpressionTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/IdentifierExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class IdentifierExpressionTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/InvocationExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class InvocationExpressionTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/LambdaExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class LambdaExpressionTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/MemberReferenceExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class MemberReferenceExpressionTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/ObjectCreateExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class ObjectCreateExpressionTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/ParenthesizedExpressionTest.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class ParenthesizedExpressionTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/PrimitiveExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class PrimitiveExpressionTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/QueryExpressionTests.cs

@ -5,11 +5,11 @@ using System; @@ -5,11 +5,11 @@ using System;
using System.IO;
using System.Linq;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using ICSharpCode.NRefactory.VB.Parser;
using NUnit.Framework;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class QueryExpressionTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/ThisReferenceExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class ThisReferenceExpressionTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/TypeOfExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class TypeOfExpressionTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/TypeOfIsExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class TypeOfIsExpressionTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/TypeReferenceExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class TypeReferenceExpressionTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/UnaryOperatorExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class UnaryOperatorExpressionTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/XmlExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class XmlExpressionTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/XmlMemberAccessExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class XmlMemberAccessExpressionTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/GlobalScope/AttributeSectionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class AttributeSectionTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/GlobalScope/DelegateDeclarationTests.cs

@ -2,10 +2,10 @@ @@ -2,10 +2,10 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using NUnit.Framework;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class DelegateDeclarationTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/GlobalScope/NamespaceDeclarationTests.cs

@ -2,10 +2,10 @@ @@ -2,10 +2,10 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using NUnit.Framework;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class NamespaceDeclarationTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/GlobalScope/OptionDeclarationTests.cs

@ -4,10 +4,10 @@ @@ -4,10 +4,10 @@
using System;
using System.IO;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using NUnit.Framework;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class OptionDeclarationTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/GlobalScope/TypeDeclarationTests.cs

@ -2,10 +2,10 @@ @@ -2,10 +2,10 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using NUnit.Framework;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class TypeDeclarationTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/GlobalScope/UsingDeclarationTests.cs

@ -4,10 +4,10 @@ @@ -4,10 +4,10 @@
using System;
using System.IO;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using NUnit.Framework;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class UsingDeclarationTests

6
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/LocationAssignmentCheckVisitor.cs

@ -2,13 +2,13 @@ @@ -2,13 +2,13 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using ICSharpCode.NRefactory.VB.Visitors;
using NUnit.Framework;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
public class LocationAssignmentCheckVisitor : NodeTrackingDomVisitor
public class LocationAssignmentCheckVisitor : NodeTrackingAstVisitor
{
protected override void BeginVisit(INode node)
{

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/ParseUtil.cs

@ -4,10 +4,10 @@ @@ -4,10 +4,10 @@
using System;
using System.IO;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using NUnit.Framework;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
public class ParseUtil
{

2
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/SnippetParserTests.cs

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using System;
using NUnit.Framework;

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/AddHandlerStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class AddHandlerStatementTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/BlockStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class BlockStatementTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ContinueStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class ContinueStatementTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/DoLoopStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class DoLoopStatementTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/EndStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class EndStatementTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/EraseStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class EraseStatementTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ErrorStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class ErrorStatementTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ExpressionStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class ExpressionStatementTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ForNextStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class ForNextStatementTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ForeachStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class ForeachStatementTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/GotoStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class GotoStatementTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/IfElseStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class IfElseStatementTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/LabelStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class LabelStatementTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/LocalVariableDeclarationTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class LocalVariableDeclarationTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/LockStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class LockStatementTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/OnErrorStatementTest.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class OnErrorStatementTest

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/RaiseEventStatementTest.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class RaiseEventStatementTest

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ReDimStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class ReDimStatementTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/RemoveHandlerStatement.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class RemoveHandlerStatementTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ResumeStatement.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class ResumeStatementTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ReturnStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class ReturnStatementTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/StopStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class StopStatementTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/SwitchStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class SwitchStatementTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ThrowStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class ThrowStatementTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/TryCatchStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class TryCatchStatementTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/UsingStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class UsingStatementTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/WithStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class WithStatementTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/TypeLevel/ConstructorDeclarationTests.cs

@ -2,10 +2,10 @@ @@ -2,10 +2,10 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using NUnit.Framework;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class ConstructorDeclarationTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/TypeLevel/CustomEventTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class CustomEventTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/TypeLevel/DeclareDeclarationTests.cs

@ -2,10 +2,10 @@ @@ -2,10 +2,10 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using NUnit.Framework;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class DeclareDeclarationTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/TypeLevel/EventDeclarationTests.cs

@ -2,10 +2,10 @@ @@ -2,10 +2,10 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using NUnit.Framework;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class EventDeclarationTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/TypeLevel/FieldDeclarationTests.cs

@ -2,10 +2,10 @@ @@ -2,10 +2,10 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using NUnit.Framework;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class FieldDeclarationTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/TypeLevel/MethodDeclarationTests.cs

@ -2,10 +2,10 @@ @@ -2,10 +2,10 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using NUnit.Framework;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class MethodDeclarationTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/TypeLevel/OperatorDeclarationTests.cs

@ -2,10 +2,10 @@ @@ -2,10 +2,10 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using NUnit.Framework;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class OperatorDeclarationTests

4
NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/TypeLevel/PropertyDeclarationTests.cs

@ -3,10 +3,10 @@ @@ -3,10 +3,10 @@
using System;
using System.IO;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using NUnit.Framework;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class PropertyDeclarationTests

6
NRefactory/ICSharpCode.NRefactory.VB/Dom/AbstractNode.cs → NRefactory/ICSharpCode.NRefactory.VB/Ast/AbstractNode.cs

@ -7,7 +7,7 @@ using System.Collections.Generic; @@ -7,7 +7,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
namespace ICSharpCode.NRefactory.VB.Dom
namespace ICSharpCode.NRefactory.VB.Ast
{
public abstract class AbstractNode : INode
{
@ -35,9 +35,9 @@ namespace ICSharpCode.NRefactory.VB.Dom @@ -35,9 +35,9 @@ namespace ICSharpCode.NRefactory.VB.Dom
children.Add(childNode);
}
public abstract object AcceptVisitor(IDomVisitor visitor, object data);
public abstract object AcceptVisitor(IAstVisitor visitor, object data);
public virtual object AcceptChildren(IDomVisitor visitor, object data)
public virtual object AcceptChildren(IAstVisitor visitor, object data)
{
foreach (INode child in children) {
Debug.Assert(child != null);

2
NRefactory/ICSharpCode.NRefactory.VB/Dom/Enums.cs → NRefactory/ICSharpCode.NRefactory.VB/Ast/Enums.cs

@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
using System;
namespace ICSharpCode.NRefactory.VB.Dom
namespace ICSharpCode.NRefactory.VB.Ast
{
[Flags]
public enum Modifiers

8
NRefactory/ICSharpCode.NRefactory.VB/Dom/General/BlockStatement.cs → NRefactory/ICSharpCode.NRefactory.VB/Ast/General/BlockStatement.cs

@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
using System;
namespace ICSharpCode.NRefactory.VB.Dom
namespace ICSharpCode.NRefactory.VB.Ast
{
public class BlockStatement : Statement
{
@ -15,7 +15,7 @@ namespace ICSharpCode.NRefactory.VB.Dom @@ -15,7 +15,7 @@ namespace ICSharpCode.NRefactory.VB.Dom
}
}
public override object AcceptVisitor(IDomVisitor visitor, object data)
public override object AcceptVisitor(IAstVisitor visitor, object data)
{
return visitor.VisitBlockStatement(this, data);
}
@ -37,11 +37,11 @@ namespace ICSharpCode.NRefactory.VB.Dom @@ -37,11 +37,11 @@ namespace ICSharpCode.NRefactory.VB.Dom
}
}
public override object AcceptVisitor(IDomVisitor visitor, object data)
public override object AcceptVisitor(IAstVisitor visitor, object data)
{
return data;
}
public override object AcceptChildren(IDomVisitor visitor, object data)
public override object AcceptChildren(IAstVisitor visitor, object data)
{
return data;
}

4
NRefactory/ICSharpCode.NRefactory.VB/Dom/General/CompilationUnit.cs → NRefactory/ICSharpCode.NRefactory.VB/Ast/General/CompilationUnit.cs

@ -4,14 +4,14 @@ @@ -4,14 +4,14 @@
using System;
using System.Collections;
namespace ICSharpCode.NRefactory.VB.Dom
namespace ICSharpCode.NRefactory.VB.Ast
{
public class CompilationUnit : AbstractNode
{
// Children in C#: UsingAliasDeclaration, UsingDeclaration, AttributeSection, NamespaceDeclaration
// Children in VB: OptionStatements, ImportsStatement, AttributeSection, NamespaceDeclaration
public override object AcceptVisitor(IDomVisitor visitor, object data)
public override object AcceptVisitor(IAstVisitor visitor, object data)
{
return visitor.VisitCompilationUnit(this, data);
}

4
NRefactory/ICSharpCode.NRefactory.VB/Dom/General/Expression.cs → NRefactory/ICSharpCode.NRefactory.VB/Ast/General/Expression.cs

@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
using System;
namespace ICSharpCode.NRefactory.VB.Dom
namespace ICSharpCode.NRefactory.VB.Ast
{
public abstract class Expression : AbstractNode, INullable
{
@ -90,7 +90,7 @@ namespace ICSharpCode.NRefactory.VB.Dom @@ -90,7 +90,7 @@ namespace ICSharpCode.NRefactory.VB.Dom
}
}
public override object AcceptVisitor(IDomVisitor visitor, object data)
public override object AcceptVisitor(IAstVisitor visitor, object data)
{
return null;
}

4
NRefactory/ICSharpCode.NRefactory.VB/Dom/General/LocalVariableDeclaration.cs → NRefactory/ICSharpCode.NRefactory.VB/Ast/General/LocalVariableDeclaration.cs

@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
namespace ICSharpCode.NRefactory.VB.Dom
namespace ICSharpCode.NRefactory.VB.Ast
{
public class LocalVariableDeclaration : Statement
{
@ -83,7 +83,7 @@ namespace ICSharpCode.NRefactory.VB.Dom @@ -83,7 +83,7 @@ namespace ICSharpCode.NRefactory.VB.Dom
return null;
}
public override object AcceptVisitor(IDomVisitor visitor, object data)
public override object AcceptVisitor(IAstVisitor visitor, object data)
{
return visitor.VisitLocalVariableDeclaration(this, data);
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save