~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/BitShiftConversionTestFixture.cs

  • Committer: sk
  • Date: 2011-09-10 05:17:57 UTC
  • Revision ID: halega@halega.com-20110910051757-qfouz1llya9m6boy
4.1.0.7915 Release Candidate 1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
 
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
 
3
 
 
4
using System;
 
5
using ICSharpCode.NRefactory;
 
6
using ICSharpCode.RubyBinding;
 
7
using NUnit.Framework;
 
8
 
 
9
namespace RubyBinding.Tests.Converter
 
10
{
 
11
        [TestFixture]
 
12
        public class BitShiftConversionTestFixture
 
13
        {               
 
14
                string csharp = 
 
15
                        "class Foo\r\n" +
 
16
                        "{\r\n" +
 
17
                        "    public int Convert()\r\n" +
 
18
                        "    {\r\n" +
 
19
                        "        int a = (b >> 16) & 0xffff;\r\n" +
 
20
                        "        return a;\r\n" +
 
21
                        "    }\r\n" +
 
22
                        "}";
 
23
                                
 
24
                [Test]
 
25
                public void ConvertedRubyCode()
 
26
                {
 
27
                        NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp);
 
28
                        converter.IndentString = "    ";
 
29
                        string Ruby = converter.Convert(csharp);
 
30
                        string expectedRuby =
 
31
                                "class Foo\r\n" +
 
32
                                "    def Convert()\r\n" +
 
33
                                "        a = (b >> 16) & 0xffff\r\n" +
 
34
                                "        return a\r\n" +
 
35
                                "    end\r\n" +
 
36
                                "end";
 
37
                        
 
38
                        Assert.AreEqual(expectedRuby, Ruby);
 
39
                }
 
40
        }
 
41
}