@@ -21,11 +21,30 @@ import SwiftDocC
21
21
import XCTest
22
22
23
23
final class DoccDocumentationTests : XCTestCase {
24
+
25
+ func testUnsupportedLanguage( ) async throws {
26
+ try await renderDocumentation (
27
+ markedText: " 1️⃣ " ,
28
+ language: . c,
29
+ expectedResponses: [ " 1️⃣ " : . error( . unsupportedLanguage( " C " ) ) ]
30
+ )
31
+ try await renderDocumentation (
32
+ markedText: " 2️⃣ " ,
33
+ language: . cpp,
34
+ expectedResponses: [ " 2️⃣ " : . error( . unsupportedLanguage( " C++ " ) ) ]
35
+ )
36
+ try await renderDocumentation (
37
+ markedText: " 3️⃣ " ,
38
+ language: . objective_c,
39
+ expectedResponses: [ " 3️⃣ " : . error( . unsupportedLanguage( " Objective-C " ) ) ]
40
+ )
41
+ }
42
+
24
43
// MARK: Swift Documentation
25
44
26
45
func testEmptySwiftFile( ) async throws {
27
46
try await renderDocumentation (
28
- swiftFile : " 1️⃣ " ,
47
+ markedText : " 1️⃣ " ,
29
48
expectedResponses: [
30
49
" 1️⃣ " : . error( . noDocumentableSymbols)
31
50
]
@@ -34,7 +53,7 @@ final class DoccDocumentationTests: XCTestCase {
34
53
35
54
func testFunction( ) async throws {
36
55
try await renderDocumentation (
37
- swiftFile : """
56
+ markedText : """
38
57
/// A function that do1️⃣es some important stuff.
39
58
func func2️⃣tion() {
40
59
// Some import3️⃣ant function contents.
@@ -51,7 +70,7 @@ final class DoccDocumentationTests: XCTestCase {
51
70
52
71
func testStructure( ) async throws {
53
72
try await renderDocumentation (
54
- swiftFile : """
73
+ markedText : """
55
74
/// A structure contain1️⃣ing important information.
56
75
public struct Struc2️⃣ture {
57
76
/// The inte3️⃣ger `foo`
@@ -83,7 +102,7 @@ final class DoccDocumentationTests: XCTestCase {
83
102
84
103
func testEmptyStructure( ) async throws {
85
104
try await renderDocumentation (
86
- swiftFile : """
105
+ markedText : """
87
106
pub1️⃣lic struct Struc2️⃣ture {
88
107
3️⃣
89
108
}4️⃣
@@ -99,7 +118,7 @@ final class DoccDocumentationTests: XCTestCase {
99
118
100
119
func testClass( ) async throws {
101
120
try await renderDocumentation (
102
- swiftFile : """
121
+ markedText : """
103
122
/// A class contain1️⃣ing important information.
104
123
public class Cla2️⃣ss {
105
124
/// The inte3️⃣ger `foo`
@@ -132,7 +151,7 @@ final class DoccDocumentationTests: XCTestCase {
132
151
133
152
func testEmptyClass( ) async throws {
134
153
try await renderDocumentation (
135
- swiftFile : """
154
+ markedText : """
136
155
pub1️⃣lic class Cla2️⃣ss {
137
156
3️⃣
138
157
}4️⃣
@@ -148,7 +167,7 @@ final class DoccDocumentationTests: XCTestCase {
148
167
149
168
func testActor( ) async throws {
150
169
try await renderDocumentation (
151
- swiftFile : """
170
+ markedText : """
152
171
/// An actor contain1️⃣ing important information.
153
172
public actor Ac2️⃣tor {
154
173
/// The inte3️⃣ger `foo`
@@ -180,7 +199,7 @@ final class DoccDocumentationTests: XCTestCase {
180
199
181
200
func testEmptyActor( ) async throws {
182
201
try await renderDocumentation (
183
- swiftFile : """
202
+ markedText : """
184
203
pub1️⃣lic class Act2️⃣or {
185
204
3️⃣
186
205
}4️⃣
@@ -196,7 +215,7 @@ final class DoccDocumentationTests: XCTestCase {
196
215
197
216
func testEnumeration( ) async throws {
198
217
try await renderDocumentation (
199
- swiftFile : """
218
+ markedText : """
200
219
/// An enumeration contain1️⃣ing important information.
201
220
public enum En2️⃣um {
202
221
/// The 3️⃣first case.
@@ -272,7 +291,7 @@ final class DoccDocumentationTests: XCTestCase {
272
291
273
292
func testProtocol( ) async throws {
274
293
try await renderDocumentation (
275
- swiftFile : """
294
+ markedText : """
276
295
/// A protocol contain1️⃣ing important information.
277
296
public protocol Proto2️⃣col {
278
297
/// The inte3️⃣ger `foo`
@@ -296,7 +315,7 @@ final class DoccDocumentationTests: XCTestCase {
296
315
297
316
func testEmptyProtocol( ) async throws {
298
317
try await renderDocumentation (
299
- swiftFile : """
318
+ markedText : """
300
319
/// A protocol containing important information
301
320
pub1️⃣lic struct Prot2️⃣ocol {
302
321
3️⃣
@@ -353,7 +372,7 @@ final class DoccDocumentationTests: XCTestCase {
353
372
354
373
func testCursorInImport( ) async throws {
355
374
try await renderDocumentation (
356
- swiftFile : """
375
+ markedText : """
357
376
import Found1️⃣ation
358
377
359
378
/// A structure containing important information
@@ -733,13 +752,14 @@ fileprivate func renderDocumentation(
733
752
}
734
753
735
754
fileprivate func renderDocumentation(
736
- swiftFile markedText: String ,
755
+ markedText: String ,
756
+ language: Language = . swift,
737
757
expectedResponses: [ String : PartialConvertResponse ] ,
738
758
file: StaticString = #filePath,
739
759
line: UInt = #line
740
760
) async throws {
741
761
let testClient = try await TestSourceKitLSPClient ( )
742
- let uri = DocumentURI ( for: . swift )
762
+ let uri = DocumentURI ( for: language )
743
763
let positions = testClient. openDocument ( markedText, uri: uri)
744
764
745
765
await renderDocumentation (
0 commit comments