From 168c279cbc4a774c135b24684a4216ab6bee3a6a Mon Sep 17 00:00:00 2001 From: Marcel Jackwerth Date: Tue, 5 Jun 2018 13:04:48 +0200 Subject: [PATCH] Make Expectation constructor public Some libraries (like `RxNimble`) create their own expectations. This [extension from RxNimble](https://github.com/RxSwiftCommunity/RxNimble/blob/602c14aae95db274004cc77ff1779a5feaf6f6fc/Source/Expectation%2BExt.swift#L4-L6) seems to have worked in earlier versions of Swift but not anymore: > Initializer for struct 'Expectation' must use "self.init(...)" or "self = ..." because it is not in module 'Nimble' --- Sources/Nimble/Expectation.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Sources/Nimble/Expectation.swift b/Sources/Nimble/Expectation.swift index e3f616a92..8612e459f 100644 --- a/Sources/Nimble/Expectation.swift +++ b/Sources/Nimble/Expectation.swift @@ -75,6 +75,10 @@ public struct Expectation { public let expression: Expression + public init(expression: Expression) { + self.expression = expression + } + public func verify(_ pass: Bool, _ message: FailureMessage) { let handler = NimbleEnvironment.activeInstance.assertionHandler handler.assert(pass, message: message, location: expression.location)