Browse Source

extension method test for VB.NET

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@3365 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Markus Palme 17 years ago
parent
commit
9ade2e5281
  1. 22
      src/Libraries/NRefactory/Test/Parser/TypeLevel/MethodDeclarationTests.cs

22
src/Libraries/NRefactory/Test/Parser/TypeLevel/MethodDeclarationTests.cs

@ -344,12 +344,30 @@ namespace ICSharpCode.NRefactory.Tests.Ast @@ -344,12 +344,30 @@ namespace ICSharpCode.NRefactory.Tests.Ast
Assert.AreEqual("ISomeInterface", md.Templates[0].Bases[0].Type);
}
[Test]
public void VBNetExtensionMethodDeclaration()
{
MethodDeclaration md = ParseUtilVBNet.ParseTypeMember<MethodDeclaration>(
@"<Extension> _
Sub Print(s As String)
Console.WriteLine(s)
End Sub");
Assert.AreEqual("Print", md.Name);
// IsExtensionMethod is only valid for c#.
// Assert.IsTrue(md.IsExtensionMethod);
Assert.AreEqual("s", md.Parameters[0].ParameterName);
Assert.AreEqual("String", md.Parameters[0].TypeReference.Type);
}
[Test]
public void VBNetGenericMethodInInterface()
{
const string program = @"Interface MyInterface
Function MyMethod(Of T As {ISomeInterface})(a As T) As T
End Interface";
Function MyMethod(Of T As {ISomeInterface})(a As T) As T
End Interface";
TypeDeclaration td = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(program);
MethodDeclaration md = (MethodDeclaration)td.Children[0];
Assert.AreEqual("T", md.TypeReference.Type);

Loading…
Cancel
Save