Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

warning: no calls to throwing functions occur within 'try' #314

Open
5 tasks done
lwoydziak opened this issue Sep 27, 2022 · 0 comments
Open
5 tasks done

warning: no calls to throwing functions occur within 'try' #314

lwoydziak opened this issue Sep 27, 2022 · 0 comments
Labels
framework bug Breaks tests or user testing code

Comments

@lwoydziak
Copy link

lwoydziak commented Sep 27, 2022

New Issue Checklist

Overview

Constantly recieve warnings when trying to verify a call that can throw:
warning: no calls to throwing functions occur within 'try' expression

Example

Protocol as such:

public protocol Fetchable {
    func fetch(data: Dictionary<String, Any>) throws -> Task<[String: Any], Error>
}

Mocked as such:

let JsonFetcher = mock(Fetchable.self)

Tested:

given(try! JsonFetcher.fetch(data: any())).willReturn(Task {[:]})
_ = try! JsonFetcher.fetch(data: [:])
verify(try JsonFetcher.fetch(data: any())).wasCalled()

For both (given & verify) lines in the test, warnings are generated:

warning: no calls to throwing functions occur within 'try' expression
                given(try! JsonFetcher.fetch(data: any())).willReturn(Task {

and

warning: no calls to throwing functions occur within 'try' expression
                    verify(try JsonFetcher.fetch(data: any())).wasCalled()

Expected Behavior

No warnings

Environment

  • Mockingbird CLI version (mockingbird version)
Using Mockingbird v0.20.0
0.20.0
  • Xcode and Swift version (swift --version)
swift-driver version: 1.62.8 Apple Swift version 5.7 (swiftlang-5.7.0.127.4 clang-1400.0.29.50)
Target: x86_64-apple-macosx12.0
  • Package manager (CocoaPods, Carthage, SPM project, SPM package)
    SPM package
  • Unit testing framework (XCTest, Quick/Nimble)
    Both XCTest and Quick/Nimble exhibit the issue.
  • Custom configuration
    • Mockingbird ignore files - none
    • Supporting source files - see above
@lwoydziak lwoydziak added the framework bug Breaks tests or user testing code label Sep 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
framework bug Breaks tests or user testing code
Projects
None yet
Development

No branches or pull requests

1 participant