Skip to content

Commit 8d87be4

Browse files
authored
Merge pull request #210 from tomokitakahashi/fix-warning-on-flatMap
Fix warning for deprecated `flatMap`
2 parents 732d953 + 9375c54 commit 8d87be4

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Sources/XCTest/Private/PerformanceMeter.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ public final class PerformanceMeter {
190190
}
191191

192192
private func recordFailures() {
193-
metrics.flatMap({ $0.failureMessage() }).forEach { message in
193+
metrics.compactMap({ $0.failureMessage() }).forEach { message in
194194
delegate.recordFailure(description: message, file: invocationFile, line: invocationLine)
195195
}
196196
}

Sources/XCTest/Private/TestListing.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ private func moduleName(value: Any) -> String {
5353
extension XCTestSuite: Listable {
5454
private var listables: [Listable] {
5555
return tests
56-
.flatMap({ ($0 as? Listable) })
56+
.compactMap({ ($0 as? Listable) })
5757
}
5858

5959
private var listingName: String {
@@ -69,7 +69,7 @@ extension XCTestSuite: Listable {
6969
}
7070

7171
func dictionaryRepresentation() -> NSDictionary {
72-
let listedTests = NSArray(array: tests.flatMap({ ($0 as? Listable)?.dictionaryRepresentation() }))
72+
let listedTests = NSArray(array: tests.compactMap({ ($0 as? Listable)?.dictionaryRepresentation() }))
7373
return NSDictionary(objects: [NSString(string: listingName),
7474
listedTests],
7575
forKeys: [NSString(string: "name"),
@@ -80,7 +80,7 @@ extension XCTestSuite: Listable {
8080
if name.hasSuffix(".xctest") {
8181
return self
8282
} else {
83-
return tests.flatMap({ ($0 as? XCTestSuite)?.findBundleTestSuite() }).first
83+
return tests.compactMap({ ($0 as? XCTestSuite)?.findBundleTestSuite() }).first
8484
}
8585
}
8686
}

0 commit comments

Comments
 (0)