Merge pull request #210 from tomokitakahashi/fix-warning-on-flatMap
Fix warning for deprecated `flatMap`
diff --git a/Sources/XCTest/Private/PerformanceMeter.swift b/Sources/XCTest/Private/PerformanceMeter.swift
index a44144a..afb3e19 100644
--- a/Sources/XCTest/Private/PerformanceMeter.swift
+++ b/Sources/XCTest/Private/PerformanceMeter.swift
@@ -190,7 +190,7 @@
}
private func recordFailures() {
- metrics.flatMap({ $0.failureMessage() }).forEach { message in
+ metrics.compactMap({ $0.failureMessage() }).forEach { message in
delegate.recordFailure(description: message, file: invocationFile, line: invocationLine)
}
}
diff --git a/Sources/XCTest/Private/TestListing.swift b/Sources/XCTest/Private/TestListing.swift
index 2d32092..dcd54f4 100644
--- a/Sources/XCTest/Private/TestListing.swift
+++ b/Sources/XCTest/Private/TestListing.swift
@@ -53,7 +53,7 @@
extension XCTestSuite: Listable {
private var listables: [Listable] {
return tests
- .flatMap({ ($0 as? Listable) })
+ .compactMap({ ($0 as? Listable) })
}
private var listingName: String {
@@ -69,7 +69,7 @@
}
func dictionaryRepresentation() -> NSDictionary {
- let listedTests = NSArray(array: tests.flatMap({ ($0 as? Listable)?.dictionaryRepresentation() }))
+ let listedTests = NSArray(array: tests.compactMap({ ($0 as? Listable)?.dictionaryRepresentation() }))
return NSDictionary(objects: [NSString(string: listingName),
listedTests],
forKeys: [NSString(string: "name"),
@@ -80,7 +80,7 @@
if name.hasSuffix(".xctest") {
return self
} else {
- return tests.flatMap({ ($0 as? XCTestSuite)?.findBundleTestSuite() }).first
+ return tests.compactMap({ ($0 as? XCTestSuite)?.findBundleTestSuite() }).first
}
}
}