kana / vim-vspec

Vim plugin: Testing framework for Vim script
http://www.vim.org/scripts/script.php?script_id=3012
222 stars 13 forks source link

Add API to inspect something which causes a failure #21

Closed kana closed 6 years ago

kana commented 11 years ago

When an expectation is failed, the default "Expected: XXX, Actual: YYY" message sometimes doesn't help much to understand the cause of the failure. So that it would be useful to output more messages about the failure by inspecting the current state, such as buffers, key mappings, and so on.

kana commented 11 years ago

An idea:

after
  if example.failed
    ... (inspect the current buffer and/or other stuffs)
    ... (then output additional messages)
  endif
end
klen commented 11 years ago

:+1: I need this. My travis tests are failed and I cannot understand why (second test): https://travis-ci.org/klen/python-mode

kana commented 11 years ago

@klen It seems to be another kind of problems. vim-vspec tried reporting a runtime error (which is not an expectation failure), but the traceback from Python was truncated between the first line and the second line. If the full traceback is available, it's not so hard to understand the cause of the problem, isn't it?

klen commented 11 years ago

Yes, it is. Traceback could help actually.

kana commented 10 years ago

For your information, I fixed to properly show a full traceback.

kana commented 6 years ago

It seems to be impossible with :after. The state that must be inspected might not be available in :after. So that adding more :Expects (and debug output from arbitrary line) seems to be a better solution.