You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running tests using any() on non equatable parameters across different versions of mockingbird produces different results if configuration != debug
#304
Running the same unit test across different versions of mockingbird on a specific configuration (!= debug) produce different results.
How to reproduce the behaviour
To quickly reproduce the behaviour I have created 5 sample project configured respectively with mockingbird 0.16, 0.17, 0.18, 0.19.1 and 0.20 that you can initiate by running install_mockingbird.sh (It will run pod install and install mockingbird).
This happens only with configuration that is different than debug. Please note that in these samples the tests are running for the dev configuration. dev is an exact duplication of debug.
This happens only when you try to verify a call to a function using the parameter any() on a non Equatable parameter. Like an UIImage for example: verify(presenter.display(image: any(UIImage.self))).wasCalled()
Results
Launching unit test with version 0.16 an 0.17 everything works fine:
Launching unit test with version 0.18 produces an error:
Launching unit test with version 0.19 and 0.20 produces a crash:
(NB: Using debug configuration for tests, all is green all the time across all versions.)
Understanding & questions
Obviously I guess that something changed internally in mockingbird between 0.17 and 0.18 and 0.19/0.20. At first I was thinking that non Equatable parameter was not supported anymore with any() but why is it working in debug configuration if so ? Is there some stuff in mockingbird internally that explicitly checked for configuration spelled debug even if another configuration is identical but named differently it will not work ?
It is not an issue, that's why I opened a discussion here and not an issue. It's pure developer curiosity to get back to sleep because I can't figure it out by myself :)
Environment
Mockingbird CLI version (mockingbird 0.16 to 0.20)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Overview
Running the same unit test across different versions of mockingbird on a specific configuration (!= debug) produce different results.
How to reproduce the behaviour
To quickly reproduce the behaviour I have created 5 sample project configured respectively with mockingbird 0.16, 0.17, 0.18, 0.19.1 and 0.20 that you can initiate by running
install_mockingbird.sh
(It will run pod install and install mockingbird).👉 Samples.zip
I should mention two things:
debug
. Please note that in these samples the tests are running for thedev
configuration.dev
is an exact duplication ofdebug
.verify
a call to a function using the parameterany()
on a non Equatable parameter. Like anUIImage
for example:verify(presenter.display(image: any(UIImage.self))).wasCalled()
Results
Launching unit test with version 0.16 an 0.17 everything works fine:
Launching unit test with version 0.18 produces an error:
Launching unit test with version 0.19 and 0.20 produces a crash:
(NB: Using
debug
configuration for tests, all is green all the time across all versions.)Understanding & questions
Obviously I guess that something changed internally in mockingbird between 0.17 and 0.18 and 0.19/0.20. At first I was thinking that non
Equatable
parameter was not supported anymore withany()
but why is it working indebug
configuration if so ? Is there some stuff in mockingbird internally that explicitly checked for configuration spelleddebug
even if another configuration is identical but named differently it will not work ?It is not an issue, that's why I opened a discussion here and not an issue. It's pure developer curiosity to get back to sleep because I can't figure it out by myself :)
Environment
mockingbird 0.16 to 0.20
)xcode 13.4 swift 5.6.1
)Beta Was this translation helpful? Give feedback.
All reactions