4 changed files with 50 additions and 10 deletions
@ -0,0 +1,38 @@ |
|||||||
|
// 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.PythonBinding; |
||||||
|
using NUnit.Framework; |
||||||
|
|
||||||
|
namespace PythonBinding.Tests.Converter |
||||||
|
{ |
||||||
|
[TestFixture] |
||||||
|
public class LocalVariableDefinitionsOnSameLineTests |
||||||
|
{ |
||||||
|
string csharp = |
||||||
|
"class Foo\r\n" + |
||||||
|
"{\r\n" + |
||||||
|
" public Foo()\r\n" + |
||||||
|
" {\r\n" + |
||||||
|
" int i = 0, i = 2;\r\n" + |
||||||
|
" }\r\n" + |
||||||
|
"}"; |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void ConvertedPythonCode() |
||||||
|
{ |
||||||
|
NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); |
||||||
|
converter.IndentString = " "; |
||||||
|
string python = converter.Convert(csharp); |
||||||
|
string expectedPython = |
||||||
|
"class Foo(object):\r\n" + |
||||||
|
" def __init__(self):\r\n" + |
||||||
|
" i = 0\r\n" + |
||||||
|
" i = 2"; |
||||||
|
|
||||||
|
Assert.AreEqual(expectedPython, python); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue