Skip to content

Commit 5c213b0

Browse files
committed
update integration tests
1 parent e0515bf commit 5c213b0

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

IntegrationTests/Package.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
// swift-tools-version:5.1
1+
// swift-tools-version:5.4
22

33
import PackageDescription
44

55
let package = Package(
66
name: "IntegrationTests",
77
targets: [
88
.testTarget(name: "IntegrationTests", dependencies: [
9-
"SwiftToolsSupport-auto",
10-
"TSCTestSupport"
9+
.product(name: "SwiftToolsSupport-auto", package: "swift-tools-support-core"),
10+
.product(name: "TSCTestSupport", package: "swift-tools-support-core")
1111
]),
1212
]
1313
)
@@ -20,6 +20,6 @@ if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
2020
]
2121
} else {
2222
package.dependencies += [
23-
.package(path: "../TSC"),
23+
.package(name: "swift-tools-support-core", path: "../TSC"),
2424
]
2525
}

IntegrationTests/Tests/IntegrationTests/BasicTests.swift

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,12 @@ final class BasicTests: XCTestCase {
2424
let dealerDir = dir.appending(component: "dealer")
2525
try sh("git", "clone", "https://github.com/apple/example-package-dealer", dealerDir)
2626
let build1Output = try sh(swiftBuild, "--package-path", dealerDir).stdout
27-
2827
// Check the build log.
29-
XCTAssertContents(build1Output) { checker in
30-
checker.check(.contains("Merging module FisherYates"))
31-
checker.check(.contains("Merging module Dealer"))
32-
}
28+
XCTAssertMatch(build1Output, .contains("Build complete"))
3329

34-
// Verify that the build worked.
35-
let dealerOutput = try sh(dealerDir.appending(RelativePath(".build/debug/Dealer"))).stdout
36-
XCTAssertMatch(dealerOutput, .regex("(?:(♡|♠|♢|♣)\\s([0-9JQKA]|10)\\n)+"))
30+
// Verify that the app works.
31+
let dealerOutput = try sh(dealerDir.appending(RelativePath(".build/debug/dealer")), "10").stdout
32+
XCTAssertEqual(dealerOutput.filter(\.isPlayingCardSuit).count, 10)
3733

3834
// Verify that the 'git status' is clean after a build.
3935
try localFileSystem.changeCurrentWorkingDirectory(to: dealerDir)
@@ -42,6 +38,7 @@ final class BasicTests: XCTestCase {
4238

4339
// Verify that another 'swift build' does nothing.
4440
let build2Output = try sh(swiftBuild, "--package-path", dealerDir).stdout
41+
XCTAssertMatch(build2Output, .contains("Build complete"))
4542
XCTAssertNoMatch(build2Output, .contains("Compiling"))
4643
}
4744
}
@@ -317,3 +314,14 @@ final class BasicTests: XCTestCase {
317314
}
318315
}
319316
}
317+
318+
private extension Character {
319+
var isPlayingCardSuit: Bool {
320+
switch self {
321+
case "♠︎", "", "", "♣︎":
322+
return true
323+
default:
324+
return false
325+
}
326+
}
327+
}

0 commit comments

Comments
 (0)