DocumentationCommentStructureTests.vb 5.0 KB
Newer Older
1 2
' Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

3 4
Imports Microsoft.CodeAnalysis.Structure
Imports Microsoft.CodeAnalysis.VisualBasic.Structure
5 6 7
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Outlining
C
CyrusNajmabadi 已提交
8 9
    Public Class DocumentationCommentStructureProviderTests
        Inherits AbstractVisualBasicSyntaxNodeStructureProviderTests(Of DocumentationCommentTriviaSyntax)
10

C
CyrusNajmabadi 已提交
11 12
        Friend Overrides Function CreateProvider() As AbstractSyntaxStructureProvider
            Return New DocumentationCommentStructureProvider()
13 14
        End Function

15
        <Fact, Trait(Traits.Feature, Traits.Features.Outlining)>
16
        Public Async Function TestDocumentationCommentWithoutSummaryTag1() As Task
17 18 19 20 21 22 23 24 25
            Const code = "
{|span:''' $$XML doc comment
''' some description
''' of
''' the comment|}
Class C1
End Class
"

C
CyrusNajmabadi 已提交
26
            Await VerifyBlockSpansAsync(code,
27
                Region("span", "''' XML doc comment ...", autoCollapse:=True))
28
        End Function
29

30
        <Fact, Trait(Traits.Feature, Traits.Features.Outlining)>
31
        Public Async Function TestDocumentationCommentWithoutSummaryTag2() As Task
32 33 34 35 36 37
            Const code = "
{|span:''' $$<param name=""syntaxTree""></param>|}
Class C1
End Class
"

C
CyrusNajmabadi 已提交
38
            Await VerifyBlockSpansAsync(code,
39
                Region("span", "''' <param name=""syntaxTree""></param> ...", autoCollapse:=True))
40
        End Function
41

42
        <Fact, Trait(Traits.Feature, Traits.Features.Outlining)>
43
        Public Async Function TestDocumentationComment() As Task
44 45 46 47 48 49 50 51
            Const code = "
{|span:''' $$<summary>
''' Hello VB!
''' </summary>|}
Class C1
End Class
"

C
CyrusNajmabadi 已提交
52
            Await VerifyBlockSpansAsync(code,
53
                Region("span", "''' <summary> Hello VB!", autoCollapse:=True))
54
        End Function
55

56
        <Fact, Trait(Traits.Feature, Traits.Features.Outlining)>
57
        Public Async Function TestDocumentationCommentWithLongBannerText() As Task
58 59 60 61 62 63 64 65
            Dim code = "
{|span:''' $$<summary>
''' " & New String("x"c, 240) & "
''' </summary>|}
Class C1
End Class
"

C
CyrusNajmabadi 已提交
66
            Await VerifyBlockSpansAsync(code,
67
                Region("span", "''' <summary> " & New String("x"c, 106) & " ...", autoCollapse:=True))
68
        End Function
69

70
        <Fact, Trait(Traits.Feature, Traits.Features.Outlining)>
71
        Public Async Function TestIndentedDocumentationComment() As Task
72 73 74 75 76 77 78
            Const code = "
    {|span:''' $$<summary>
    ''' Hello VB!
    ''' </summary>|}
    Class C1
    End Class
"
79

C
CyrusNajmabadi 已提交
80
            Await VerifyBlockSpansAsync(code,
81
                Region("span", "''' <summary> Hello VB!", autoCollapse:=True))
82
        End Function
83

84
        <Fact, Trait(Traits.Feature, Traits.Features.Outlining)>
85
        Public Async Function TestDocumentationCommentOnASingleLine() As Task
86 87 88 89 90 91
            Const code = "
{|span:''' $$<summary>Hello VB!</summary>|}
Class C1
End Class
"

C
CyrusNajmabadi 已提交
92
            Await VerifyBlockSpansAsync(code,
93
                Region("span", "''' <summary> Hello VB!", autoCollapse:=True))
94
        End Function
95

96
        <Fact, Trait(Traits.Feature, Traits.Features.Outlining)>
97
        Public Async Function TestIndentedDocumentationCommentOnASingleLine() As Task
98 99 100 101 102
            Const code = "
    {|span:''' $$<summary>Hello VB!</summary>|}
    Class C1
    End Class
"
103

C
CyrusNajmabadi 已提交
104
            Await VerifyBlockSpansAsync(code,
105
                Region("span", "''' <summary> Hello VB!", autoCollapse:=True))
106
        End Function
107

108
        <Fact, Trait(Traits.Feature, Traits.Features.Outlining)>
109
        Public Async Function TestMultilineSummaryInDocumentationComment1() As Task
110 111 112 113 114 115 116 117 118
            Const code = "
{|span:''' $$<summary>
''' Hello
''' VB!
''' </summary>|}
Class C1
End Class
"

C
CyrusNajmabadi 已提交
119
            Await VerifyBlockSpansAsync(code,
120
                Region("span", "''' <summary> Hello VB!", autoCollapse:=True))
121
        End Function
122

123
        <Fact, Trait(Traits.Feature, Traits.Features.Outlining)>
124
        Public Async Function TestMultilineSummaryInDocumentationComment2() As Task
125 126 127 128 129 130 131 132 133 134
            Const code = "
{|span:''' $$<summary>
''' Hello
''' 
''' VB!
''' </summary>|}
Class C1
End Class
"

C
CyrusNajmabadi 已提交
135
            Await VerifyBlockSpansAsync(code,
136
                Region("span", "''' <summary> Hello VB!", autoCollapse:=True))
137
        End Function
138 139

        <WorkItem(2129, "https://github.com/dotnet/roslyn/issues/2129")>
140
        <Fact, Trait(Traits.Feature, Traits.Features.Outlining)>
141
        Public Async Function CrefInSummary() As Task
142 143 144 145 146 147 148 149 150 151 152
            Const code = "
Class C
    {|span:''' $$<summary>
    ''' Summary with <see cref=""SeeClass"" />, <seealso cref=""SeeAlsoClass"" />,
    ''' <see langword=""Nothing"" />, <typeparamref name=""T"" />, <paramref name=""t"" />, and <see unsupported-attribute=""not-supported"" />.
    ''' </summary>|}
    Sub M(Of T)(t as T)
    End Sub
End Class
"

C
CyrusNajmabadi 已提交
153
            Await VerifyBlockSpansAsync(code,
154
                Region("span", "''' <summary> Summary with SeeClass , SeeAlsoClass , Nothing , T , t , and not-supported .", autoCollapse:=True))
155
        End Function
156
    End Class
157
End Namespace