github pointfreeco/swift-issue-reporting 0.3.0

latest releases: 1.6.1, 1.6.0, 1.5.2...
3 years ago
  • Added XCTUnimplemented, a function for constructing "unimplemented" closures that call XCTFail when invoked.

    Helpful for stubbing dependencies held in value types. For example, a common use of XCTest Dynamic Overlay:

    struct FactClient {
      var fetch: (Int) async throws -> String
    }
    
    extension FactClient {
      struct Unimplemented: Error {
        let endpoint: String
      }
    
      static let unimplemented = Self(
        fetch: { _ in
          XCTFail("Unimplemented: \(Self.self).fetch")
          throw Unimplemented(endpoint: "\(Self.self).fetch")
        }
      )
    }

    Can be simplified using XCTUnimplemented:

    extension FactClient {
      static let unimplemented = Self(
        fetch: XCTUnimplemented("\(Self.self).fetch")
      )
    }
  • Changed: XCTFail now causes a runtime warning when called outside of tests.

Don't miss a new swift-issue-reporting release

NewReleases is sending notifications on new releases.