eranpeer / FakeIt

C++ mocking made easy. A simple yet very expressive, headers only library for c++ mocking.
MIT License
1.23k stars 169 forks source link

How to get longer Actual Sequence Output? #149

Closed alibabashack closed 5 years ago

alibabashack commented 5 years ago

When FakeIt (used from Catch2) outputs a list of actual invocations on mocks, then the list is truncated after some lines and dots (...) are added. I am unsure who limits the output, Catch or FakeIt. Any ideas how I can get a full list? Thanks! Example of truncated output:

tests/TrxPathIntegration.cpp:115: FAILED:
  Verify( listener.trxGroupStateChanged(01, 00) ... trxArray[0].startDispatch( Any arguments ) ... watchdogTimer.setTimeoutRelative(12345) ... trxArray[0].cancelDispatch( Any arguments ) ... trxArray[1].cancelDispatch( Any arguments ) ... watchdogTimer.setTimeoutRelative(735234) ... watchdogTimer.disable( Any arguments ) ... listener.trxGroupStateChanged(00, 01) )
with message:
  tests/TrxPathIntegration.cpp:115: Verification error
  Expected pattern: listener.trxGroupStateChanged(01, 00) ... trxArray[0].
  startDispatch( Any arguments ) ... watchdogTimer.setTimeoutRelative(12345) ..
  . trxArray[0].cancelDispatch( Any arguments ) ... trxArray[1].cancelDispatch(
  Any arguments ) ... watchdogTimer.setTimeoutRelative(735234) ...
  watchdogTimer.disable( Any arguments ) ... listener.trxGroupStateChanged(00,
  01)
  Expected matches: exactly 1
  Actual matches  : 0
  Actual sequence : total of 7 actual invocations:
    listener.trxGroupStateChanged(01, 00)
    trxArray[0].startDispatch(?)
    watchdogTimer.setTimeoutRelative(12345)
    trxArray[0].cancelDispatch()
    trxArray[1].cancelDispatch()
    ...

===============================================================================
test cases:  68 |  67 passed | 1 failed
assertions: 247 | 246 passed | 1 failed
eranpeer commented 5 years ago

It is limited by FakeIt. The actual invocation list size can be huge hence we must limit the size of formatted output to some reasonable max number. I agree 5 may be too short. I changed it to 50. FakeIt will now print the first 50 actual invocations. Please pull the latest commit.

On Thu, Jul 26, 2018 at 1:49 PM Alexander Graf notifications@github.com wrote:

When FakeIt (used from Catch2) outputs a list of actual invocations on mocks, then the list is truncated after some lines and dots (...) are added. I am unsure who limits the output, Catch or FakeIt. Any ideas how I can get a full list? Thanks! Example of truncated output:

tests/TrxPathIntegration.cpp:115: FAILED: Verify( listener.trxGroupStateChanged(01, 00) ... trxArray[0].startDispatch( Any arguments ) ... watchdogTimer.setTimeoutRelative(12345) ... trxArray[0].cancelDispatch( Any arguments ) ... trxArray[1].cancelDispatch( Any arguments ) ... watchdogTimer.setTimeoutRelative(735234) ... watchdogTimer.disable( Any arguments ) ... listener.trxGroupStateChanged(00, 01) ) with message: tests/TrxPathIntegration.cpp:115: Verification error Expected pattern: listener.trxGroupStateChanged(01, 00) ... trxArray[0]. startDispatch( Any arguments ) ... watchdogTimer.setTimeoutRelative(12345) .. . trxArray[0].cancelDispatch( Any arguments ) ... trxArray[1].cancelDispatch( Any arguments ) ... watchdogTimer.setTimeoutRelative(735234) ... watchdogTimer.disable( Any arguments ) ... listener.trxGroupStateChanged(00, 01) Expected matches: exactly 1 Actual matches : 0 Actual sequence : total of 7 actual invocations: listener.trxGroupStateChanged(01, 00) trxArray[0].startDispatch(?) watchdogTimer.setTimeoutRelative(12345) trxArray[0].cancelDispatch() trxArray[1].cancelDispatch() ...

=============================================================================== test cases: 68 | 67 passed | 1 failed assertions: 247 | 246 passed | 1 failed

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/eranpeer/FakeIt/issues/149, or mute the thread https://github.com/notifications/unsubscribe-auth/ACc8ggb6-491YV6qs9NnnKxiLaNSvNHmks5uKitggaJpZM4VihlZ .

-- Eran 1-424-2504000

alibabashack commented 5 years ago

Thanks for the fast pragmatic fix. 50 invocations are fine for my current use case.