Browse Source

Support converting VB.NET exit statements to Ruby.

4.0
Matt Ward 14 years ago
parent
commit
f9f6611fd7
  1. 8
      src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/NRefactoryToRubyConverter.cs
  2. 41
      src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/VBExitConversionTests.cs
  3. 1
      src/AddIns/BackendBindings/Ruby/RubyBinding/Test/RubyBinding.Tests.csproj

8
src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/NRefactoryToRubyConverter.cs

@ -401,7 +401,13 @@ namespace ICSharpCode.RubyBinding @@ -401,7 +401,13 @@ namespace ICSharpCode.RubyBinding
expressionStatement.Expression.AcceptVisitor(this, data);
AppendLine();
return null;
}
}
public override object TrackedVisitExitStatement(ExitStatement exitStatement, object data)
{
AppendIndentedLine("break");
return null;
}
public override object TrackedVisitFieldDeclaration(FieldDeclaration fieldDeclaration, object data)
{

41
src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/VBExitConversionTests.cs

@ -0,0 +1,41 @@ @@ -0,0 +1,41 @@
// 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 System;
using ICSharpCode.NRefactory;
using ICSharpCode.RubyBinding;
using NUnit.Framework;
namespace RubyBinding.Tests.Converter
{
[TestFixture]
public class VBExitConversionTests
{
string vb =
"Public Class Class1\r\n" +
" Public Sub Test\r\n" +
" While True\r\n" +
" Exit While\r\n" +
" End While\r\n" +
" End Sub\r\n" +
"End Class\r\n";
[Test]
public void ConvertedRubyCode()
{
NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.VBNet);
converter.IndentString = " ";
string ruby = converter.Convert(vb);
string expectedRuby =
"class Class1\r\n" +
" def Test()\r\n" +
" while true\r\n" +
" break\r\n" +
" end\r\n" +
" end\r\n" +
"end";
Assert.AreEqual(expectedRuby, ruby);
}
}
}

1
src/AddIns/BackendBindings/Ruby/RubyBinding/Test/RubyBinding.Tests.csproj

@ -148,6 +148,7 @@ @@ -148,6 +148,7 @@
<Compile Include="Converter\UnaryOperatorConversionTests.cs" />
<Compile Include="Converter\UsingStatementConversionTestFixture.cs" />
<Compile Include="Converter\VBClassConversionTestFixture.cs" />
<Compile Include="Converter\VBExitConversionTests.cs" />
<Compile Include="Converter\VBStringConcatTestFixture.cs" />
<Compile Include="Converter\WhileLoopConversionTestFixture.cs" />
<Compile Include="Converter\XmlDocCommentConversionTestFixture.cs" />

Loading…
Cancel
Save