Add --exists to unstub #6
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Additionally assert that the given command was stubbed
Also avoids error message when parameter was not given and program was not stubbed
@lox I'm totally unsure how to implement this. Reasoning was that if you put
unstub foointeardownyou get an error on stderr if you already unstubbed foo in the test. But you usually want it there to cleanup stuff and/or do a final verification.My first attempt was
--allow-missingwhich is the current behavior minus the message:status=0, output=""and without that param it would fail withstatus=1and a message. However this changes existing behavior because the current version does not fail if the command does not exist (anymore)Probably better solution:
unstubfails if command does not existunstub --allow-missingavoids thisunstub_allremoves all stubs without issuing messages and errorsunstub_verifyremoves and verifies all set stubsThis is a breaking change, but allows for clean tests:
unstubfor use IN tests if one wants to do that, the parameter for compatibility and the other 2 for cleanup (if unstub is used in the tests) or verification (if it isn't)