Skip to content

Commit

Permalink
Move tests in swift-formatTests to SwiftFormatTests
Browse files Browse the repository at this point in the history
Windows doesn’t support test targets that depend on executables. Move `FileIterator` into `SwiftFormat` so we can test it as part of `SwiftFormatTests` and can remove `swift-formatTests`.
  • Loading branch information
ahoppen committed Sep 30, 2024
1 parent 9fb082f commit abff181
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 9 deletions.
6 changes: 1 addition & 5 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,7 @@ let package = Package(
.product(name: "SwiftSyntax", package: "swift-syntax"),
.product(name: "SwiftSyntaxBuilder", package: "swift-syntax"),
]
),
.testTarget(
name: "swift-formatTests",
dependencies: ["swift-format"]
),
)
]
)

Expand Down
3 changes: 2 additions & 1 deletion Sources/SwiftFormat/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ add_library(SwiftFormat
Rules/UseSynthesizedInitializer.swift
Rules/UseTripleSlashForDocumentationComments.swift
Rules/UseWhereClausesInForLoops.swift
Rules/ValidateDocumentationComments.swift)
Rules/ValidateDocumentationComments.swift
Utilities/FileIterator.swift)
target_link_libraries(SwiftFormat PUBLIC
SwiftMarkdown::Markdown
SwiftSyntax::SwiftSyntax
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Foundation

/// Iterator for looping over lists of files and directories. Directories are automatically
/// traversed recursively, and we check for files with a ".swift" extension.
@_spi(Testing)
@_spi(Internal)
public struct FileIterator: Sequence, IteratorProtocol {

/// List of file and directory URLs to iterate over.
Expand Down
1 change: 0 additions & 1 deletion Sources/swift-format/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ add_executable(swift-format
Utilities/Diagnostic.swift
Utilities/DiagnosticsEngine.swift
Utilities/FileHandleTextOutputStream.swift
Utilities/FileIterator.swift
Utilities/FormatError.swift
Utilities/StderrDiagnosticPrinter.swift
Utilities/TTY.swift)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import XCTest

@_spi(Testing) import swift_format
@_spi(Internal) import SwiftFormat

final class FileIteratorTests: XCTestCase {
private var tmpdir: URL!
Expand Down

0 comments on commit abff181

Please sign in to comment.