提交 7369e3f5 编写于 作者: J Jonathon Marolf

Porting VB Classification Tests

上级 94d03c21
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.VisualStudio.IntegrationTest.Utilities;
using Xunit;
namespace Roslyn.VisualStudio.IntegrationTests.VisualBasic
{
[Collection(nameof(SharedIntegrationHostFixture))]
public class BasicClassification : AbstractEditorTest
{
protected override string LanguageName => LanguageNames.VisualBasic;
public BasicClassification(VisualStudioInstanceFactory instanceFactory)
: base(instanceFactory, nameof(BasicClassification))
{
}
[Fact, Trait(Traits.Feature, Traits.Features.Classification)]
public void Verify_Color_Of_Some_Tokens()
{
Editor.SetText(@"Imports System
Imports MathAlias = System.Math
Namespace Acme
''' <summary>innertext
''' </summary>
''' <!--comment-->
''' <![CDATA[cdata]]>
''' <typeparam name=""attribute"" />
Public Class Program
Public Shared Sub Main(args As String())
Console.WriteLine(""Hello World"") 'comment
End Sub
End Class
End Namespace");
PlaceCaret("MathAlias");
VerifyCurrentTokenType(tokenType: "identifier");
PlaceCaret("Namespace");
VerifyCurrentTokenType(tokenType: "keyword");
PlaceCaret("summary");
VerifyCurrentTokenType(tokenType: "xml doc comment - name");
PlaceCaret("innertext");
VerifyCurrentTokenType(tokenType: "xml doc comment - text");
PlaceCaret("!--");
VerifyCurrentTokenType(tokenType: "xml doc comment - delimiter");
PlaceCaret("comment");
VerifyCurrentTokenType(tokenType: "xml doc comment - comment");
PlaceCaret("CDATA");
VerifyCurrentTokenType(tokenType: "xml doc comment - delimiter");
PlaceCaret("cdata");
VerifyCurrentTokenType(tokenType: "xml doc comment - cdata section");
PlaceCaret("attribute");
VerifyCurrentTokenType(tokenType: "identifier");
PlaceCaret("Class");
VerifyCurrentTokenType(tokenType: "keyword");
PlaceCaret("Program");
VerifyCurrentTokenType(tokenType: "class name");
PlaceCaret("Hello");
VerifyCurrentTokenType(tokenType: "string");
PlaceCaret("comment");
VerifyCurrentTokenType(tokenType: "comment");
}
[Fact, Trait(Traits.Feature, Traits.Features.Classification)]
public void Semantic_Classification()
{
Editor.SetText(@"
Imports System
Class Foo
Inherits Attribute
End Class");
PlaceCaret("Foo");
VerifyCurrentTokenType(tokenType: "class name");
PlaceCaret("Attribute");
VerifyCurrentTokenType(tokenType: "class name");
}
}
}
......@@ -39,6 +39,7 @@
<Compile Include="VisualBasic\BasicAddMissingReference.cs" />
<Compile Include="VisualBasic\BasicAutomaticBraceCompletion.cs" />
<Compile Include="VisualBasic\BasicBuild.cs" />
<Compile Include="VisualBasic\BasicClassification.cs" />
<Compile Include="VisualBasic\BasicGenerateEqualsAndGetHashCodeDialog.cs" />
<Compile Include="VisualBasic\BasicGenerateConstructorDialog.cs" />
<Compile Include="VisualBasic\BasicChangeSignatureDialog.cs" />
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册