Skip to content

Commit ea5c14a

Browse files
authored
Remove miscellaneous unused test code (#1262)
* Remove no-longer-relevant `allTests` definition * Remove unused imports in tests * Pass unused `file` and `line` parameters in test helper * Remove unused `file` and `line` parameters from test helper * Remove two unused test helpers * Remove three unused properties in tests
1 parent 7a3058b commit ea5c14a

19 files changed

+19
-75
lines changed

Tests/SwiftDocCTests/Infrastructure/DocumentationBundleTests.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
/*
22
This source file is part of the Swift.org open source project
33

4-
Copyright (c) 2021 Apple Inc. and the Swift project authors
4+
Copyright (c) 2021-2025 Apple Inc. and the Swift project authors
55
Licensed under Apache License v2.0 with Runtime Library Exception
66

77
See https://swift.org/LICENSE.txt for license information
88
See https://swift.org/CONTRIBUTORS.txt for Swift project authors
99
*/
1010

1111
import XCTest
12-
@testable import SwiftDocC
1312

1413
class DocumentationBundleTests: XCTestCase {
1514
// Test whether the bundle correctly loads a documentation source folder.

Tests/SwiftDocCTests/Infrastructure/InheritIntroducedAvailabilityTests.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,14 @@ class InheritIntroducedAvailabilityTests: XCTestCase {
3434
typealias Domain = SymbolGraph.Symbol.Availability.Domain
3535
typealias Version = SymbolGraph.SemanticVersion
3636

37-
var testBundle: DocumentationBundle!
3837
var context: DocumentationContext!
3938

4039
override func setUp() async throws {
4140
try await super.setUp()
42-
(testBundle, context) = try await testBundleAndContext(named: "LegacyBundle_DoNotUseInNewTests")
41+
(_, context) = try await testBundleAndContext(named: "LegacyBundle_DoNotUseInNewTests")
4342
}
4443

4544
override func tearDown() {
46-
testBundle = nil
4745
context = nil
4846
super.tearDown()
4947
}

Tests/SwiftDocCTests/Infrastructure/NodeURLGeneratorTests.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
This source file is part of the Swift.org open source project
33

4-
Copyright (c) 2021-2024 Apple Inc. and the Swift project authors
4+
Copyright (c) 2021-2025 Apple Inc. and the Swift project authors
55
Licensed under Apache License v2.0 with Runtime Library Exception
66

77
See https://swift.org/LICENSE.txt for license information
@@ -14,8 +14,6 @@ import XCTest
1414
@testable import SwiftDocC
1515

1616
class NodeURLGeneratorTests: XCTestCase {
17-
let generator = NodeURLGenerator()
18-
1917
let unchangedURLs = [
2018
URL(string: "doc://com.bundle/folder-prefix/type/symbol")!,
2119
URL(string: "doc://com.bundle/fol.der-pref.ix./type-swift.class/symbol.name.")!,

Tests/SwiftDocCTests/Model/ParametersAndReturnValidatorTests.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -910,9 +910,7 @@ class ParametersAndReturnValidatorTests: XCTestCase {
910910
docComment: String,
911911
docCommentModuleName: String? = "ModuleName",
912912
parameters: [(name: String, externalName: String?)],
913-
returnValue: SymbolGraph.Symbol.DeclarationFragments.Fragment,
914-
file: StaticString = #filePath,
915-
line: UInt = #line
913+
returnValue: SymbolGraph.Symbol.DeclarationFragments.Fragment
916914
) async throws -> String {
917915
let fileSystem = try TestFileSystem(folders: [
918916
Folder(name: "path", content: [

Tests/SwiftDocCTests/Model/TaskGroupTests.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
This source file is part of the Swift.org open source project
33

4-
Copyright (c) 2021-2024 Apple Inc. and the Swift project authors
4+
Copyright (c) 2021-2025 Apple Inc. and the Swift project authors
55
Licensed under Apache License v2.0 with Runtime Library Exception
66

77
See https://swift.org/LICENSE.txt for license information
@@ -68,10 +68,6 @@ class SectionExtractionTests: XCTestCase {
6868
}
6969
}
7070

71-
private func testNode(with document: Document) -> DocumentationNode {
72-
return DocumentationNode(reference: ResolvedTopicReference(bundleID: "org.swift.docc", path: "/blah", sourceLanguage: .swift), kind: .article, sourceLanguage: .swift, name: .conceptual(title: "Title"), markup: document, semantic: Semantic())
73-
}
74-
7571
func testSection() {
7672
// Empty -> nil
7773
do {

Tests/SwiftDocCTests/Rendering/SymbolAvailabilityTests.swift

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,32 +16,6 @@ import SwiftDocCTestUtilities
1616

1717
class SymbolAvailabilityTests: XCTestCase {
1818

19-
private func symbolAvailability(
20-
defaultAvailability: [DefaultAvailability.ModuleAvailability] = [],
21-
symbolGraphOperatingSystemPlatformName: String,
22-
symbols: [SymbolGraph.Symbol],
23-
symbolName: String
24-
) async throws -> [SymbolGraph.Symbol.Availability.AvailabilityItem] {
25-
let catalog = Folder(
26-
name: "unit-test.docc",
27-
content: [
28-
InfoPlist(defaultAvailability: [
29-
"ModuleName": defaultAvailability
30-
]),
31-
JSONFile(name: "ModuleName.symbols.json", content: makeSymbolGraph(
32-
moduleName: "ModuleName",
33-
platform: SymbolGraph.Platform(architecture: nil, vendor: nil, operatingSystem: SymbolGraph.OperatingSystem(name: symbolGraphOperatingSystemPlatformName), environment: nil),
34-
symbols: symbols,
35-
relationships: []
36-
)),
37-
]
38-
)
39-
let (_, context) = try await loadBundle(catalog: catalog)
40-
let reference = try XCTUnwrap(context.soleRootModuleReference).appendingPath(symbolName)
41-
let symbol = try XCTUnwrap(context.entity(with: reference).semantic as? Symbol)
42-
return try XCTUnwrap(symbol.availability?.availability)
43-
}
44-
4519
private func renderNodeAvailability(
4620
defaultAvailability: [DefaultAvailability.ModuleAvailability] = [],
4721
symbolGraphOperatingSystemPlatformName: String,

Tests/SwiftDocCTests/Utility/LMDBTests.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
This source file is part of the Swift.org open source project
33

4-
Copyright (c) 2021 Apple Inc. and the Swift project authors
4+
Copyright (c) 2021-2025 Apple Inc. and the Swift project authors
55
Licensed under Apache License v2.0 with Runtime Library Exception
66

77
See https://swift.org/LICENSE.txt for license information
@@ -258,10 +258,6 @@ final class SwiftLMDBTests: XCTestCase {
258258
XCTAssertEqual(value, [1,2,3,4,5,6,7,8,9,10,11,12,13,14])
259259
#endif
260260
}
261-
262-
static var allTests = [
263-
("testVersion", testVersion),
264-
]
265261
}
266262

267263
// MARK: - Custom Objects

Tests/SwiftDocCTests/Utility/SemanticVersion+ComparableTests.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
This source file is part of the Swift.org open source project
33

4-
Copyright (c) 2021 Apple Inc. and the Swift project authors
4+
Copyright (c) 2021-2025 Apple Inc. and the Swift project authors
55
Licensed under Apache License v2.0 with Runtime Library Exception
66

77
See https://swift.org/LICENSE.txt for license information
@@ -10,7 +10,6 @@
1010

1111
import XCTest
1212
import SymbolKit
13-
@testable import SwiftDocC
1413

1514
class SemanticVersion_ComparableTests: XCTestCase {
1615
private typealias Version = SymbolGraph.SemanticVersion

Tests/SwiftDocCUtilitiesTests/ArgumentParsing/MergeSubcommandTests.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
This source file is part of the Swift.org open source project
33

4-
Copyright (c) 2024 Apple Inc. and the Swift project authors
4+
Copyright (c) 2024-2025 Apple Inc. and the Swift project authors
55
Licensed under Apache License v2.0 with Runtime Library Exception
66

77
See https://swift.org/LICENSE.txt for license information
@@ -11,7 +11,6 @@
1111
import XCTest
1212
import ArgumentParser
1313
@testable import SwiftDocCUtilities
14-
@testable import SwiftDocC
1514
import SwiftDocCTestUtilities
1615

1716
class MergeSubcommandTests: XCTestCase {

Tests/SwiftDocCUtilitiesTests/DirectoryMonitorTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
This source file is part of the Swift.org open source project
33

4-
Copyright (c) 2021 Apple Inc. and the Swift project authors
4+
Copyright (c) 2021-2025 Apple Inc. and the Swift project authors
55
Licensed under Apache License v2.0 with Runtime Library Exception
66

77
See https://swift.org/LICENSE.txt for license information
@@ -91,7 +91,7 @@ class DirectoryMonitorTests: XCTestCase {
9191
/// - Warning: Please do not overuse this method as it takes 10s of wait time and can potentially slow down running the test suite.
9292
private func monitorNoUpdates(url: URL, testBlock: @escaping () throws -> Void, file: StaticString = #filePath, line: UInt = #line) throws {
9393
let monitor = try DirectoryMonitor(root: url) { rootURL, url in
94-
XCTFail("Did produce file update event for a hidden file")
94+
XCTFail("Did produce file update event for a hidden file", file: file, line: line)
9595
}
9696

9797
try monitor.start()

0 commit comments

Comments
 (0)