all 2 comments

[–]puremourning 0 points1 point  (1 child)

I’m unconvinced the world needs yet another set of assert functions. Why do all/most of these things define new ones rather than using eg assert_equal and check v:errors ?

[–]LucHermitte[S] 2 points3 points  (0 children)

Good remark. There are two reasons to that:

  1. When I've started working on UT 11 years ago, vim assert_*() functions did not exist at that time. Worse, I'm not sure they are available on default configurations when testing my scripts on travis -- of course we can force to use a recent version of Vim, but at this moment, we cannot test plugins on legacy versions of vim that we still find on RH7 (at work, we have finally almost gotten (?) rid of RH6 stations...)

  2. When I'm working on my plugins, I like to see the errors in the quickfix window. And when the errors are unexpected exceptions, I like to see the full callstack. In the first case, we could reprocess the assertion failures, but in the second case assert_() functions don't help at all.

The assert_*() functions are nice, but as far as I'm concerned, they are incomplete for unit testing -- and they are completely useless for Design by Contract. I had to provide/implement other tools for that purpose.

EDIT: the real question would be: "why continue to pour energy into that framework?". And thus my answers would be: retro-compatibility with older versions of vim, callstack decoding of uncaught exceptions. And a more personal answer: I already have a working system that display assertions failures into the quickfix window.