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

Error using function any(_:of:) when closure use generic types #336

Open
2 of 4 tasks
hrool20 opened this issue Jul 25, 2024 · 0 comments
Open
2 of 4 tasks

Error using function any(_:of:) when closure use generic types #336

hrool20 opened this issue Jul 25, 2024 · 0 comments
Labels
framework bug Breaks tests or user testing code

Comments

@hrool20
Copy link

hrool20 commented Jul 25, 2024

New Issue Checklist

Overview

Cannot use closures and an argument captor at the same time. It forces me to use classes.

Example

I think the problem starts because i need to declare the type of a closure and at the same time use an argument captor to return a value. If i try that, Xcode cannot run the test and it shows an error. And if i see inside any(_:of:), it shows that i'm using the following function

Test any function
image image

But if i don't use the argument captor, the error in the test disappear and i see that any is referring another function

Test any function
image image

The only difference i see inside any functions is that in the first one it requires T to be AnyObject. So, i'm wondering if this is a bug. Or what is the way to declare the type of a closure and also use an argument captor?

Expected Behavior

It should let me run the test without showing an error.

Environment

  • Mockingbird CLI version (0.20.0)
  • Xcode and Swift version (Xcode 15.0.1 | Swift 5.9 (swiftlang-5.9.0.128.108 clang-1500.0.40.1))
  • Package manager (CocoaPods)
  • Unit testing framework (XCTest)
  • Custom configuration
    • Mockingbird ignore files
    • Supporting source files
@hrool20 hrool20 added the framework bug Breaks tests or user testing code label Jul 25, 2024
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