Skip to content

Commit d3c6cec

Browse files
committed
Test whether generated HTML output contains subdirectories
1 parent 445bbd8 commit d3c6cec

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Tests/EndToEndTests/GenerateSubcommandTests.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import class Foundation.Bundle
22
import XCTest
33

44
final class GenerateSubcommandTests: XCTestCase {
5-
func testHTMLGeneration() throws {
5+
func testHTML() throws {
66
let command = Bundle.productsDirectory.appendingPathComponent("swift-doc")
77
let outputDirectory = try temporaryDirectory()
88

@@ -29,6 +29,13 @@ final class GenerateSubcommandTests: XCTestCase {
2929
let css = try String(contentsOf: outputDirectory.appendingPathComponent("all.css"))
3030
XCTAssertTrue(css.contains(":root"))
3131
}
32+
33+
do {
34+
let contents = try FileManager.default.contentsOfDirectory(at: outputDirectory, includingPropertiesForKeys: [.isDirectoryKey], options: [.skipsHiddenFiles])
35+
let subdirectories = contents.filter { $0.hasDirectoryPath }
36+
.filter { FileManager.default.fileExists(atPath: $0.appendingPathComponent("index.html").path) }
37+
XCTAssertGreaterThanOrEqual(subdirectories.count, 1, "output should contain one or more subdirectories containing index.html")
38+
}
3239
}
3340
}
3441
}

0 commit comments

Comments
 (0)