@@ -21,11 +21,30 @@ import SwiftDocC
2121import XCTest
2222
2323final 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+
2443 // MARK: Swift Documentation
2544
2645 func testEmptySwiftFile( ) async throws {
2746 try await renderDocumentation (
28- swiftFile : " 1️⃣ " ,
47+ markedText : " 1️⃣ " ,
2948 expectedResponses: [
3049 " 1️⃣ " : . error( . noDocumentableSymbols)
3150 ]
@@ -34,7 +53,7 @@ final class DoccDocumentationTests: XCTestCase {
3453
3554 func testFunction( ) async throws {
3655 try await renderDocumentation (
37- swiftFile : """
56+ markedText : """
3857 /// A function that do1️⃣es some important stuff.
3958 func func2️⃣tion() {
4059 // Some import3️⃣ant function contents.
@@ -51,7 +70,7 @@ final class DoccDocumentationTests: XCTestCase {
5170
5271 func testStructure( ) async throws {
5372 try await renderDocumentation (
54- swiftFile : """
73+ markedText : """
5574 /// A structure contain1️⃣ing important information.
5675 public struct Struc2️⃣ture {
5776 /// The inte3️⃣ger `foo`
@@ -83,7 +102,7 @@ final class DoccDocumentationTests: XCTestCase {
83102
84103 func testEmptyStructure( ) async throws {
85104 try await renderDocumentation (
86- swiftFile : """
105+ markedText : """
87106 pub1️⃣lic struct Struc2️⃣ture {
88107 3️⃣
89108 }4️⃣
@@ -99,7 +118,7 @@ final class DoccDocumentationTests: XCTestCase {
99118
100119 func testClass( ) async throws {
101120 try await renderDocumentation (
102- swiftFile : """
121+ markedText : """
103122 /// A class contain1️⃣ing important information.
104123 public class Cla2️⃣ss {
105124 /// The inte3️⃣ger `foo`
@@ -132,7 +151,7 @@ final class DoccDocumentationTests: XCTestCase {
132151
133152 func testEmptyClass( ) async throws {
134153 try await renderDocumentation (
135- swiftFile : """
154+ markedText : """
136155 pub1️⃣lic class Cla2️⃣ss {
137156 3️⃣
138157 }4️⃣
@@ -148,7 +167,7 @@ final class DoccDocumentationTests: XCTestCase {
148167
149168 func testActor( ) async throws {
150169 try await renderDocumentation (
151- swiftFile : """
170+ markedText : """
152171 /// An actor contain1️⃣ing important information.
153172 public actor Ac2️⃣tor {
154173 /// The inte3️⃣ger `foo`
@@ -180,7 +199,7 @@ final class DoccDocumentationTests: XCTestCase {
180199
181200 func testEmptyActor( ) async throws {
182201 try await renderDocumentation (
183- swiftFile : """
202+ markedText : """
184203 pub1️⃣lic class Act2️⃣or {
185204 3️⃣
186205 }4️⃣
@@ -196,7 +215,7 @@ final class DoccDocumentationTests: XCTestCase {
196215
197216 func testEnumeration( ) async throws {
198217 try await renderDocumentation (
199- swiftFile : """
218+ markedText : """
200219 /// An enumeration contain1️⃣ing important information.
201220 public enum En2️⃣um {
202221 /// The 3️⃣first case.
@@ -272,7 +291,7 @@ final class DoccDocumentationTests: XCTestCase {
272291
273292 func testProtocol( ) async throws {
274293 try await renderDocumentation (
275- swiftFile : """
294+ markedText : """
276295 /// A protocol contain1️⃣ing important information.
277296 public protocol Proto2️⃣col {
278297 /// The inte3️⃣ger `foo`
@@ -296,7 +315,7 @@ final class DoccDocumentationTests: XCTestCase {
296315
297316 func testEmptyProtocol( ) async throws {
298317 try await renderDocumentation (
299- swiftFile : """
318+ markedText : """
300319 /// A protocol containing important information
301320 pub1️⃣lic struct Prot2️⃣ocol {
302321 3️⃣
@@ -353,7 +372,7 @@ final class DoccDocumentationTests: XCTestCase {
353372
354373 func testCursorInImport( ) async throws {
355374 try await renderDocumentation (
356- swiftFile : """
375+ markedText : """
357376 import Found1️⃣ation
358377
359378 /// A structure containing important information
@@ -733,13 +752,14 @@ fileprivate func renderDocumentation(
733752}
734753
735754fileprivate func renderDocumentation(
736- swiftFile markedText: String ,
755+ markedText: String ,
756+ language: Language = . swift,
737757 expectedResponses: [ String : PartialConvertResponse ] ,
738758 file: StaticString = #filePath,
739759 line: UInt = #line
740760) async throws {
741761 let testClient = try await TestSourceKitLSPClient ( )
742- let uri = DocumentURI ( for: . swift )
762+ let uri = DocumentURI ( for: language )
743763 let positions = testClient. openDocument ( markedText, uri: uri)
744764
745765 await renderDocumentation (
0 commit comments