// // // // // $Revision$ // using System; using System.Collections.Generic; using ICSharpCode.RubyBinding; using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor; using ICSharpCode.SharpDevelop.Dom; using NUnit.Framework; using RubyBinding.Tests; namespace RubyBinding.Tests.Parsing { /// /// Tests that a base class is added to the class. /// [TestFixture] public class ParseClassWithBaseClassTestFixture { ICompilationUnit compilationUnit; IClass c; [TestFixtureSetUp] public void SetUpFixture() { string Ruby = "class Test < Base\r\n" + "\tdef foo(i)\r\n" + "\tend\r\n" + "end"; DefaultProjectContent projectContent = new DefaultProjectContent(); RubyParser parser = new RubyParser(); compilationUnit = parser.Parse(projectContent, @"C:\test.rb", Ruby); if (compilationUnit.Classes.Count > 0) { c = compilationUnit.Classes[0]; } } [Test] public void HasBaseClass() { IReturnType matchedBaseType = null; foreach (IReturnType baseType in c.BaseTypes) { if (baseType.Name == "Base") { matchedBaseType = baseType; break; } } Assert.IsNotNull(matchedBaseType); } } }