Skip to content

Commit

Permalink
Address review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
DougGregor committed May 8, 2024
1 parent 165e3fc commit bcbd9ea
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Sources/PackageModel/InstalledSwiftPMConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public struct InstalledSwiftPMConfiguration {
private static var defaultSwiftTestingVersionForTestTemplate: Version {
.init(
major: 0,
minor: 7,
minor: 8,
patch: 0,
prereleaseIdentifier: nil
)
Expand Down
9 changes: 8 additions & 1 deletion Sources/PackageModelSyntax/AddTarget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -203,18 +203,25 @@ public struct AddTarget {
}

// Add appropriate test module dependencies.
let testFuncName: String?
if target.type == .test {
switch configuration.testHarness {
case .none:
testFuncName = nil
break

case .xctest:
importModuleNames.append("XCTest")
testFuncName = "test\(target.name)"

case .swiftTesting:
// Import is handled by the added dependency.
testFuncName = "example"
break
}
} else {
testFuncName = nil

}

let importDecls = importModuleNames.lazy.sorted().map { name in
Expand Down Expand Up @@ -256,7 +263,7 @@ public struct AddTarget {
"""
\(imports)
class \(raw: target.name): XCTestCase {
func test\(raw: target.name)() {
func \(raw: testFuncName!)() {
XCTAssertEqual(42, 17 + 25)
}
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/PackageModelSyntaxTests/ManifestEditTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ class ManifestEditTests: XCTestCase {
let package = Package(
name: "packages",
dependencies: [
.package(url: "https://github.com/apple/swift-testing.git", from: "0.7.0"),
.package(url: "https://github.com/apple/swift-testing.git", from: "0.8.0"),
],
targets: [
.testTarget(
Expand Down
2 changes: 1 addition & 1 deletion Utilities/config.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{"version":1,
"swiftSyntaxVersionForMacroTemplate":{"major":600,"minor":0,"patch":0, "prereleaseIdentifier":"latest"},
"swiftTestingVersionForTestTemplate":{"major":0,"minor":7,"patch":0}}
"swiftTestingVersionForTestTemplate":{"major":0,"minor":8,"patch":0}}

0 comments on commit bcbd9ea

Please sign in to comment.