|
| 1 | +// This source file is part of the Swift.org open source project |
| 2 | +// |
| 3 | +// Copyright (c) 2022 Apple Inc. and the Swift project authors |
| 4 | +// Licensed under Apache License v2.0 with Runtime Library Exception |
| 5 | +// |
| 6 | +// See https://swift.org/LICENSE.txt for license information |
| 7 | +// See https://swift.org/CONTRIBUTORS.txt for Swift project authors |
| 8 | + |
| 9 | +import XCTest |
| 10 | + |
| 11 | +final class DocCConvertSynthesizedSymbolsTests: ConcurrencyRequiringTestCase { |
| 12 | + func testGenerateDocumentationWithSkipSynthesizedSymbolsEnabled() throws { |
| 13 | + let result = try swiftPackage( |
| 14 | + "generate-documentation", "--experimental-skip-synthesized-symbols", |
| 15 | + workingDirectory: try setupTemporaryDirectoryForFixture(named: "PackageWithConformanceSymbols") |
| 16 | + ) |
| 17 | + |
| 18 | + result.assertExitStatusEquals(0) |
| 19 | + let doccArchiveURL = try XCTUnwrap(result.referencedDocCArchives.first) |
| 20 | + let dataDirectoryContents = try filesIn(.dataSubdirectory, of: doccArchiveURL) |
| 21 | + XCTAssertEqual( |
| 22 | + Set(dataDirectoryContents.map(\.lastTwoPathComponents)), |
| 23 | + [ |
| 24 | + "documentation/packagewithconformancesymbols.json", |
| 25 | + "packagewithconformancesymbols/foo.json" |
| 26 | + ] |
| 27 | + ) |
| 28 | + } |
| 29 | + |
| 30 | + func testGenerateDocumentationWithSynthesizedSymbols() throws { |
| 31 | + let result = try swiftPackage( |
| 32 | + "generate-documentation", |
| 33 | + workingDirectory: try setupTemporaryDirectoryForFixture(named: "PackageWithConformanceSymbols") |
| 34 | + ) |
| 35 | + |
| 36 | + result.assertExitStatusEquals(0) |
| 37 | + let doccArchiveURL = try XCTUnwrap(result.referencedDocCArchives.first) |
| 38 | + let dataDirectoryContents = try filesIn(.dataSubdirectory, of: doccArchiveURL) |
| 39 | + XCTAssertEqual( |
| 40 | + Set(dataDirectoryContents.map(\.lastTwoPathComponents)), |
| 41 | + [ |
| 42 | + "documentation/packagewithconformancesymbols.json", |
| 43 | + "packagewithconformancesymbols/foo.json", |
| 44 | + "foo/equatable-implementations.json", |
| 45 | + "foo/!=(_:_:).json" |
| 46 | + ] |
| 47 | + ) |
| 48 | + } |
| 49 | +} |
0 commit comments