Skip to content

Commit

Permalink
Update to latest issue reporting library
Browse files Browse the repository at this point in the history
  • Loading branch information
klundberg committed Jul 24, 2024
1 parent 8d5745c commit 5c9d149
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
8 changes: 4 additions & 4 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"pins" : [
{
"identity" : "xctest-dynamic-overlay",
"identity" : "swift-issue-reporting",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/xctest-dynamic-overlay.git",
"location" : "https://github.com/pointfreeco/swift-issue-reporting.git",
"state" : {
"revision" : "23cbf2294e350076ea4dbd7d5d047c1e76b03631",
"version" : "1.0.2"
"revision" : "357ca1e5dd31f613a1d43320870ebc219386a495",
"version" : "1.2.2"
}
}
],
Expand Down
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ let package = Package(
],
dependencies: [
.package(
url: "https://github.com/pointfreeco/xctest-dynamic-overlay.git",
url: "https://github.com/pointfreeco/swift-issue-reporting.git",
"0.9.0"..<"2.0.0"
),
],
targets: [
.target(
name: "ComposableCoreLocation",
dependencies: [
.product(name: "XCTestDynamicOverlay", package: "xctest-dynamic-overlay"),
.product(name: "IssueReporting", package: "swift-issue-reporting"),
]
),
.testTarget(
Expand Down
24 changes: 12 additions & 12 deletions Sources/ComposableCoreLocation/Failing.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import Combine
import CoreLocation
import XCTestDynamicOverlay
import IssueReporting

extension LocationManager {
/// The failing implementation of the ``LocationManager`` interface. By default this
/// implementation stubs all of its endpoints as functions that immediately call `XCTFail`.
/// implementation stubs all of its endpoints as functions that immediately call `reportIssue`.
///
/// This allows you to test an even deeper property of your features: that they use only the
/// location manager endpoints that you specify and nothing else. This can be useful as a
Expand Down Expand Up @@ -39,43 +39,43 @@ extension LocationManager {
/// ```
public static let failing = Self(
accuracyAuthorization: {
XCTFail("A failing endpoint was accessed: 'LocationManager.accuracyAuthorization'")
reportIssue("A failing endpoint was accessed: 'LocationManager.accuracyAuthorization'")
return nil
},
authorizationStatus: {
XCTFail("A failing endpoint was accessed: 'LocationManager.authorizationStatus'")
reportIssue("A failing endpoint was accessed: 'LocationManager.authorizationStatus'")
return .notDetermined
},
delegate: { .unimplemented("LocationManager.delegate") },
dismissHeadingCalibrationDisplay: {
.unimplemented("LocationManager.dismissHeadingCalibrationDisplay")
},
heading: {
XCTFail("A failing endpoint was accessed: 'LocationManager.heading'")
reportIssue("A failing endpoint was accessed: 'LocationManager.heading'")
return nil
},
headingAvailable: {
XCTFail("A failing endpoint was accessed: 'LocationManager.headingAvailable'")
reportIssue("A failing endpoint was accessed: 'LocationManager.headingAvailable'")
return false
},
isRangingAvailable: {
XCTFail("A failing endpoint was accessed: 'LocationManager.isRangingAvailable'")
reportIssue("A failing endpoint was accessed: 'LocationManager.isRangingAvailable'")
return false
},
location: {
XCTFail("A failing endpoint was accessed: 'LocationManager.location'")
reportIssue("A failing endpoint was accessed: 'LocationManager.location'")
return nil
},
locationServicesEnabled: {
XCTFail("A failing endpoint was accessed: 'LocationManager.locationServicesEnabled'")
reportIssue("A failing endpoint was accessed: 'LocationManager.locationServicesEnabled'")
return false
},
maximumRegionMonitoringDistance: {
XCTFail("A failing endpoint was accessed: 'LocationManager.maximumRegionMonitoringDistance'")
reportIssue("A failing endpoint was accessed: 'LocationManager.maximumRegionMonitoringDistance'")
return CLLocationDistanceMax
},
monitoredRegions: {
XCTFail("A failing endpoint was accessed: 'LocationManager.monitoredRegions'")
reportIssue("A failing endpoint was accessed: 'LocationManager.monitoredRegions'")
return []
},
requestAlwaysAuthorization: { .unimplemented("LocationManager.requestAlwaysAuthorization") },
Expand All @@ -88,7 +88,7 @@ extension LocationManager {
},
set: { _ in .unimplemented("LocationManager.set") },
significantLocationChangeMonitoringAvailable: {
XCTFail()
reportIssue()
return false
},
startMonitoringForRegion: { _ in .unimplemented("LocationManager.startMonitoringForRegion") },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import Combine
import XCTestDynamicOverlay
import IssueReporting

extension AnyPublisher {
static func unimplemented(_ prefix: String, file: StaticString = #file, line: UInt = #line) -> Self {
static func unimplemented(_ prefix: String, fileID: StaticString = #fileID, filePath: StaticString = #filePath, line: UInt = #line) -> Self {
.fireAndForget {
XCTFail("\(prefix.isEmpty ? "" : "\(prefix) - ")An unimplemented publisher ran.", file: file, line: line)
reportIssue("\(prefix.isEmpty ? "" : "\(prefix) - ")An unimplemented publisher ran.", fileID: fileID, filePath: filePath, line: line)
}
}

Expand Down

0 comments on commit 5c9d149

Please sign in to comment.