@@ -24,16 +24,12 @@ final class BasicTests: XCTestCase {
24
24
let dealerDir = dir. appending ( component: " dealer " )
25
25
try sh ( " git " , " clone " , " https://github.com/apple/example-package-dealer " , dealerDir)
26
26
let build1Output = try sh ( swiftBuild, " --package-path " , dealerDir) . stdout
27
-
28
27
// 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 " ) )
33
29
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 )
37
33
38
34
// Verify that the 'git status' is clean after a build.
39
35
try localFileSystem. changeCurrentWorkingDirectory ( to: dealerDir)
@@ -42,6 +38,7 @@ final class BasicTests: XCTestCase {
42
38
43
39
// Verify that another 'swift build' does nothing.
44
40
let build2Output = try sh ( swiftBuild, " --package-path " , dealerDir) . stdout
41
+ XCTAssertMatch ( build2Output, . contains( " Build complete " ) )
45
42
XCTAssertNoMatch ( build2Output, . contains( " Compiling " ) )
46
43
}
47
44
}
@@ -317,3 +314,14 @@ final class BasicTests: XCTestCase {
317
314
}
318
315
}
319
316
}
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