From ec92a0607972199c551bdf315c78d13acce90c01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helge=20He=C3=9F?= Date: Wed, 25 May 2022 16:26:27 +0200 Subject: [PATCH 1/2] GHActions: Add 5.5/5.6.1 on Linux Drop the 5.3 bionic. --- .github/workflows/swift.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 24b5d40..dc938fa 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -14,7 +14,8 @@ jobs: matrix: image: - swift:5.3.2-xenial - - swift:5.3.2-bionic + - swift:5.5.0-focal + - swift:5.6.1-bionic container: ${{ matrix.image }} steps: - name: Checkout Repository From a0553c0d2e898602fe073d14d4ba753a1d81c193 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helge=20He=C3=9F?= Date: Wed, 25 May 2022 16:27:01 +0200 Subject: [PATCH 2/2] Decode "Application" role heading As reported in https://github.com/DoccZz/docc2html/issues/20 --- Sources/DocCArchive/Schema_0_1/MetaData.swift | 1 + .../DocumentDecodingTests.swift | 33 ++++++++++++++++++- .../Fixtures/Issue20Fail.json | 1 + 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 Tests/DocCArchiveTests/Fixtures/Issue20Fail.json diff --git a/Sources/DocCArchive/Schema_0_1/MetaData.swift b/Sources/DocCArchive/Schema_0_1/MetaData.swift index ae941fb..65fcb9b 100644 --- a/Sources/DocCArchive/Schema_0_1/MetaData.swift +++ b/Sources/DocCArchive/Schema_0_1/MetaData.swift @@ -86,6 +86,7 @@ extension DocCArchive.DocCSchema_0_1 { case typeProperty = "Type Property" case `typealias` = "Type Alias" case `class` = "Class" + case application = "Application" public var description: String { return "" } } diff --git a/Tests/DocCArchiveTests/DocumentDecodingTests.swift b/Tests/DocCArchiveTests/DocumentDecodingTests.swift index 028f2f3..42083fb 100644 --- a/Tests/DocCArchiveTests/DocumentDecodingTests.swift +++ b/Tests/DocCArchiveTests/DocumentDecodingTests.swift @@ -20,9 +20,40 @@ final class DocumentDecodingTests: XCTestCase { ( "testIssue11FailUnorderedList" , testIssue11FailUnorderedList ), ( "testAllDataJSONInSlothCreator" , testAllDataJSONInSlothCreator ), ( "testIssue12FailAsideWarningStyle" , testIssue12FailAsideWarningStyle ), - ( "testTableIssue6" , testTableIssue6 ) + ( "testTableIssue6" , testTableIssue6 ), + ( "testIssue20FailRoleHeadingApp" , testIssue20FailRoleHeadingApp ) ] + + func testIssue20FailRoleHeadingApp() throws { + let url = Fixtures.baseURL.appendingPathComponent("Issue20Fail.json") + let data = try Data(contentsOf: url) + + let document : DocCArchive.Document + + print("Decoding:", url.path) + do { + document = try JSONDecoder().decode(DocCArchive.Document.self, from: data) + } + catch { + print("ERROR:", error) + XCTFail("failed to decode: \(error)") + return + } + + // v0.2.0 as declared + XCTAssertEqual(document.schemaVersion, .init(major: 0, minor: 2, patch: 0)) + + XCTAssertEqual(document.primaryContentSections?.count ?? 0, 0, + "Didn't expect sections?") + + XCTAssertEqual(document.topicSections?.count, 2, + "Missing topic sections") + + XCTAssertEqual(document.metadata.roleHeading, .application, + "Expected application role heading!") + } + func testLinkInlineContentIssue7() throws { let url = Fixtures.baseURL.appendingPathComponent("LinkInlineContentIssue7.json") let data = try Data(contentsOf: url) diff --git a/Tests/DocCArchiveTests/Fixtures/Issue20Fail.json b/Tests/DocCArchiveTests/Fixtures/Issue20Fail.json new file mode 100644 index 0000000..be0d32f --- /dev/null +++ b/Tests/DocCArchiveTests/Fixtures/Issue20Fail.json @@ -0,0 +1 @@ +{"variants":[{"paths":["\/documentation\/robotnavigation"],"traits":[{"interfaceLanguage":"swift"}]}],"schemaVersion":{"major":0,"minor":2,"patch":0},"sections":[],"identifier":{"url":"doc:\/\/com.lennart.RobotNavigation\/documentation\/RobotNavigation","interfaceLanguage":"swift"},"abstract":[{"type":"text","text":""}],"kind":"symbol","metadata":{"roleHeading":"Application","externalID":"RobotNavigation","title":"RobotNavigation","symbolKind":"module","role":"collection","modules":[{"name":"RobotNavigation"}]},"hierarchy":{"paths":[[]]},"topicSections":[{"title":"Classes","identifiers":["doc:\/\/com.lennart.RobotNavigation\/documentation\/RobotNavigation\/AppDelegate","doc:\/\/com.lennart.RobotNavigation\/documentation\/RobotNavigation\/BlePeripheral","doc:\/\/com.lennart.RobotNavigation\/documentation\/RobotNavigation\/NavigationViewController","doc:\/\/com.lennart.RobotNavigation\/documentation\/RobotNavigation\/SceneDelegate","doc:\/\/com.lennart.RobotNavigation\/documentation\/RobotNavigation\/ViewController"]},{"title":"Structures","identifiers":["doc:\/\/com.lennart.RobotNavigation\/documentation\/RobotNavigation\/CBUUIDs"]}],"references":{"doc://com.lennart.RobotNavigation/documentation/RobotNavigation/ViewController":{"role":"symbol","title":"ViewController","fragments":[{"kind":"keyword","text":"class"},{"kind":"text","text":" "},{"kind":"identifier","text":"ViewController"}],"abstract":[],"identifier":"doc:\/\/com.lennart.RobotNavigation\/documentation\/RobotNavigation\/ViewController","kind":"symbol","type":"topic","navigatorTitle":[{"kind":"identifier","text":"ViewController"}],"url":"\/documentation\/robotnavigation\/viewcontroller"},"doc://com.lennart.RobotNavigation/documentation/RobotNavigation/SceneDelegate":{"role":"symbol","title":"SceneDelegate","fragments":[{"kind":"keyword","text":"class"},{"kind":"text","text":" "},{"kind":"identifier","text":"SceneDelegate"}],"abstract":[],"identifier":"doc:\/\/com.lennart.RobotNavigation\/documentation\/RobotNavigation\/SceneDelegate","kind":"symbol","type":"topic","navigatorTitle":[{"kind":"identifier","text":"SceneDelegate"}],"url":"\/documentation\/robotnavigation\/scenedelegate"},"doc://com.lennart.RobotNavigation/documentation/RobotNavigation/NavigationViewController":{"role":"symbol","title":"NavigationViewController","fragments":[{"kind":"keyword","text":"class"},{"kind":"text","text":" "},{"kind":"identifier","text":"NavigationViewController"}],"abstract":[{"type":"text","text":"Description"}],"identifier":"doc:\/\/com.lennart.RobotNavigation\/documentation\/RobotNavigation\/NavigationViewController","kind":"symbol","type":"topic","navigatorTitle":[{"kind":"identifier","text":"NavigationViewController"}],"url":"\/documentation\/robotnavigation\/navigationviewcontroller"},"doc://com.lennart.RobotNavigation/documentation/RobotNavigation/AppDelegate":{"role":"symbol","title":"AppDelegate","fragments":[{"kind":"keyword","text":"class"},{"kind":"text","text":" "},{"kind":"identifier","text":"AppDelegate"}],"abstract":[],"identifier":"doc:\/\/com.lennart.RobotNavigation\/documentation\/RobotNavigation\/AppDelegate","kind":"symbol","type":"topic","navigatorTitle":[{"kind":"identifier","text":"AppDelegate"}],"url":"\/documentation\/robotnavigation\/appdelegate"},"doc://com.lennart.RobotNavigation/documentation/RobotNavigation/CBUUIDs":{"role":"symbol","title":"CBUUIDs","fragments":[{"kind":"keyword","text":"struct"},{"kind":"text","text":" "},{"kind":"identifier","text":"CBUUIDs"}],"abstract":[],"identifier":"doc:\/\/com.lennart.RobotNavigation\/documentation\/RobotNavigation\/CBUUIDs","kind":"symbol","type":"topic","navigatorTitle":[{"kind":"identifier","text":"CBUUIDs"}],"url":"\/documentation\/robotnavigation\/cbuuids"},"doc://com.lennart.RobotNavigation/documentation/RobotNavigation":{"role":"collection","title":"RobotNavigation","abstract":[],"identifier":"doc:\/\/com.lennart.RobotNavigation\/documentation\/RobotNavigation","kind":"symbol","type":"topic","url":"\/documentation\/robotnavigation"},"doc://com.lennart.RobotNavigation/documentation/RobotNavigation/BlePeripheral":{"role":"symbol","title":"BlePeripheral","fragments":[{"kind":"keyword","text":"class"},{"kind":"text","text":" "},{"kind":"identifier","text":"BlePeripheral"}],"abstract":[],"identifier":"doc:\/\/com.lennart.RobotNavigation\/documentation\/RobotNavigation\/BlePeripheral","kind":"symbol","type":"topic","navigatorTitle":[{"kind":"identifier","text":"BlePeripheral"}],"url":"\/documentation\/robotnavigation\/bleperipheral"}}}