Skip to content

Commit cf24fca

Browse files
Fix SwiftDocC integration test (#101)
The integration test as currently written fails to actually compile any documentation because the Symbol Graph files for the test Swift Package are never built. This updates the test to build Symbol Graph files for the test package, convert it, and assert that produced DocC documentation contains the expected `data` subdirectory. Resolves rdar://91638258.
1 parent c503412 commit cf24fca

File tree

3 files changed

+20
-35
lines changed

3 files changed

+20
-35
lines changed

test-swift-docc/DocCTest/Package.swift

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,9 @@ import PackageDescription
66
let package = Package(
77
name: "DocCTest",
88
products: [
9-
// Products define the executables and libraries a package produces, and make them visible to other packages.
10-
.library(
11-
name: "DocCTest",
12-
targets: ["DocCTest"]),
13-
],
14-
dependencies: [
15-
// Dependencies declare other packages that this package depends on.
16-
// .package(url: /* package url */, from: "1.0.0"),
9+
.library(name: "DocCTest", targets: ["DocCTest"]),
1710
],
1811
targets: [
19-
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
20-
// Targets can depend on other targets in this package, and on products in packages this package depends on.
21-
.target(
22-
name: "DocCTest",
23-
dependencies: []),
24-
.testTarget(
25-
name: "DocCTestTests",
26-
dependencies: ["DocCTest"]),
12+
.target(name: "DocCTest"),
2713
]
2814
)

test-swift-docc/DocCTest/Tests/DocCTestTests/DocCTestTests.swift

Lines changed: 0 additions & 11 deletions
This file was deleted.

test-swift-docc/test-swift-docc.txt

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
1-
// Check Swift-DocC can compile and preview documentation.
2-
//
3-
// RNU: rm -rf %S/Output
4-
// RUN: %{docc} convert %S/DocCTest/Sources/DocCTest/DocCTest.docc --output-path %S/Output
5-
// RUN: ls %S/Output
6-
7-
// REQUIRES: rdar91638258
8-
1+
// Check that Swift-DocC can compile documentation.
2+
//
3+
// Clear any existing state:
4+
// RUN: rm -rf %t.dir
5+
// RUN: mkdir -p %t.dir
6+
//
7+
// Build symbol graphs for the test package:
8+
// RUN: mkdir %t.dir/symbol-graph-directory
9+
// RUN: mkdir %t.dir/swiftpm-build-directory
10+
// RUN: %{swift} build --target DocCTest --package-path %S/DocCTest --build-path %t.dir/swiftpm-build-directory -Xswiftc -emit-symbol-graph -Xswiftc -emit-symbol-graph-dir -Xswiftc %t.dir/symbol-graph-directory
11+
//
12+
// Convert the documentation
13+
// RUN: %{docc} convert %S/DocCTest/Sources/DocCTest/DocCTest.docc --output-path %t.dir/DocCTest.doccarchive --additional-symbol-graph-dir %t.dir/symbol-graph-directory
14+
//
15+
// Assert that the produced documentation archive has a 'data' subdirectory as expected
16+
// RUN: ls %t.dir/DocCTest.doccarchive/data
17+
// RUN: ls %t.dir/DocCTest.doccarchive/data/documentation/docctest
18+
// RUN: ls %t.dir/DocCTest.doccarchive/data/documentation/docctest/docctest/variable.json

0 commit comments

Comments
 (0)