Browse Source

- added test for GenericConstraints

- added test for bug in ForNextStatement output of C#
- fixed bug in ForNextStatement output of C#

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@6306 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
pull/1/head
Siegfried Pammer 15 years ago
parent
commit
5fedaf0638
  1. 8
      src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs
  2. 4
      src/Libraries/NRefactory/Test/Output/CSharp/VBNetToCSharpConverterTest.cs
  3. 27
      src/Libraries/NRefactory/Test/Output/VBNet/CSharpToVBNetConverterTest.cs

8
src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs

@ -1964,8 +1964,12 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -1964,8 +1964,12 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
if ((pe == null || !(pe.Value is int) || ((int)pe.Value) >= 0)
&& !(forNextStatement.Step is UnaryOperatorExpression))
outputFormatter.PrintToken(Tokens.LessEqual);
else
outputFormatter.PrintToken(Tokens.GreaterEqual);
else {
if (forNextStatement.Step is UnaryOperatorExpression && ((UnaryOperatorExpression)forNextStatement.Step).Op == UnaryOperatorType.Plus)
outputFormatter.PrintToken(Tokens.LessEqual);
else
outputFormatter.PrintToken(Tokens.GreaterEqual);
}
outputFormatter.Space();
TrackVisit(forNextStatement.End, data);
outputFormatter.PrintToken(Tokens.Semicolon);

4
src/Libraries/NRefactory/Test/Output/CSharp/VBNetToCSharpConverterTest.cs

@ -351,6 +351,10 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter @@ -351,6 +351,10 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
"Next",
"for (long l = 10; l >= 0; l += -1) {\n" +
"}");
TestStatement("For i As Integer = 0 To 10 Step +2\n" +
"Next",
"for (int i = 0; i <= 10; i += +2) {\n" +
"}");
}
[Test]

27
src/Libraries/NRefactory/Test/Output/VBNet/CSharpToVBNetConverterTest.cs

@ -671,5 +671,32 @@ End Namespace @@ -671,5 +671,32 @@ End Namespace
End Function"
);
}
[Test]
public void GenericConstraint()
{
TestProgram(
@"using System;
using System.Collections;
using System.Text;
namespace Generics
{
public class List<T> : CollectionBase where T : IDisposable
{
}
}",
@"Imports System
Imports System.Collections
Imports System.Text
Namespace Generics
Public Class List(Of T As IDisposable)
Inherits CollectionBase
End Class
End Namespace
"
);
}
}
}

Loading…
Cancel
Save