Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test that took seconds to type check #547

Merged
merged 3 commits into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 27 additions & 9 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
import PackageDescription
import class Foundation.ProcessInfo

let swiftSettings: [SwiftSetting] = [
.unsafeFlags(["-Xfrontend", "-warn-long-expression-type-checking=1000"], .when(configuration: .debug)),
]

let package = Package(
name: "SwiftDocC",
platforms: [
Expand Down Expand Up @@ -41,7 +45,9 @@ let package = Package(
"SymbolKit",
"CLMDB",
.product(name: "Crypto", package: "swift-crypto"),
]),
],
swiftSettings: swiftSettings
),
.testTarget(
name: "SwiftDocCTests",
dependencies: [
Expand All @@ -53,7 +59,9 @@ let package = Package(
.copy("Test Bundles"),
.copy("Converter/Converter Fixtures"),
.copy("Rendering/Rendering Fixtures"),
]),
],
swiftSettings: swiftSettings
),

// Command-line tool library
.target(
Expand All @@ -62,7 +70,9 @@ let package = Package(
"SwiftDocC",
.product(name: "NIOHTTP1", package: "swift-nio"),
.product(name: "ArgumentParser", package: "swift-argument-parser")
]),
],
swiftSettings: swiftSettings
),
.testTarget(
name: "SwiftDocCUtilitiesTests",
dependencies: [
Expand All @@ -73,36 +83,44 @@ let package = Package(
resources: [
.copy("Test Resources"),
.copy("Test Bundles"),
]),

],
swiftSettings: swiftSettings
),
// Test utility library
.target(
name: "SwiftDocCTestUtilities",
dependencies: [
"SymbolKit"
]),
],
swiftSettings: swiftSettings
),

// Command-line tool
.executableTarget(
name: "docc",
dependencies: [
"SwiftDocCUtilities",
]),
],
swiftSettings: swiftSettings
),

// Test app for SwiftDocCUtilities
.executableTarget(
name: "signal-test-app",
dependencies: [
"SwiftDocCUtilities",
],
path: "Tests/signal-test-app"),
path: "Tests/signal-test-app",
swiftSettings: swiftSettings
),

.executableTarget(
name: "generate-symbol-graph",
dependencies: [
"SwiftDocC",
"SymbolKit",
]
],
swiftSettings: swiftSettings
),

]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,18 @@ class ConvertSubcommandSourceRepositoryTests: XCTestCase {
) throws {
setenv(TemplateOption.environmentVariableKey, testTemplateURL.path, 1)

let convertOptions = try Docc.Convert.parse(
[testBundleURL.path]
+ (checkoutPath.map { ["--checkout-path", $0] } ?? [])
+ (sourceService.map { ["--source-service", $0] } ?? [])
+ (sourceServiceBaseURL.map { ["--source-service-base-url", $0] } ?? [])
)
var arguments: [String] = [testBundleURL.path]
if let checkoutPath = checkoutPath {
arguments.append(contentsOf: ["--checkout-path", checkoutPath])
}
if let sourceService = sourceService {
arguments.append(contentsOf: ["--source-service", sourceService])
}
if let sourceServiceBaseURL = sourceServiceBaseURL {
arguments.append(contentsOf: ["--source-service-base-url", sourceServiceBaseURL])
}

let convertOptions = try Docc.Convert.parse(arguments)

let result = try ConvertAction(fromConvertCommand: convertOptions)
try assertion?(result)
Expand Down