You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.4 KiB
56 lines
1.4 KiB
// <file> |
|
// <copyright see="prj:///doc/copyright.txt"/> |
|
// <license see="prj:///doc/license.txt"/> |
|
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/> |
|
// <version>$Revision$</version> |
|
// </file> |
|
|
|
using System; |
|
using System.Collections.Generic; |
|
using ICSharpCode.PythonBinding; |
|
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor; |
|
using ICSharpCode.SharpDevelop.Dom; |
|
using ICSharpCode.TextEditor.Document; |
|
using NUnit.Framework; |
|
using PythonBinding.Tests; |
|
|
|
namespace PythonBinding.Tests.Parsing |
|
{ |
|
/// <summary> |
|
/// Tests that a base class is added to the class. |
|
/// </summary> |
|
[TestFixture] |
|
public class ClassWithBaseClassTestFixture |
|
{ |
|
ICompilationUnit compilationUnit; |
|
IClass c; |
|
|
|
[TestFixtureSetUp] |
|
public void SetUpFixture() |
|
{ |
|
string python = "class Test(Base):\r\n" + |
|
"\tdef foo(self):\r\n" + |
|
"\t\tpass"; |
|
|
|
DefaultProjectContent projectContent = new DefaultProjectContent(); |
|
PythonParser parser = new PythonParser(); |
|
compilationUnit = parser.Parse(projectContent, @"C:\test.py", python); |
|
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); |
|
} |
|
} |
|
}
|
|
|