Closed sjgriffin7 closed 10 months ago
REQUIRE_CALL()
and its siblings are valid until the end of the scope, so your function REQUIRE_MethodB()
sets a requirement for a call, that immediately fails because the requirement is checked at the end of the function. I don't expect the sequence to be of importance here.
See NAMED_REQUIRE_CALL
.
Example: https://godbolt.org/z/fY6v39vKa
Excellent, that was the piece of info I was missing. Thanks!
I'm having some issues with refactoring sequenced calls. (Note: I'm using Catch2 as the unit test framework, and currently using C++11)
Ideally, I'd be able to take a test like this:
And add a helper function to reuse
REQUIRE_CALL_V()
statements:My issue arises in the
SECTION("Refactored")
results, which reports unfulfilled expectations forMethodA()
andMethodB()
.Is this something that should work, or are there other recommendations for refactoring? Any details on the inner workings of
trompeloeil::sequence
are also welcome.