jorgenschaefer / emacs-buttercup

Behavior-Driven Emacs Lisp Testing
GNU General Public License v3.0
362 stars 44 forks source link

Document the matchers #35

Open Fuco1 opened 8 years ago

Fuco1 commented 8 years ago

When I do C-h v :to-equal I get:

:to-be's value is :to-be

Documentation:
Not documented as a variable.

We can add documentation using

(put :to-equal 'variable-documentation "This is a buttercup matcher, it does so and so")
:to-equal's value is :to-equal

Documentation:
This is a buttercup matcher, it does so and so

There is a slight chance someone else would want to document this variable. In which case, we could check if the above property exists and append. In case they document after us, we probably can't do much about it, but I think the chances of that are rather slim.

Then buttercup-define-matcher could accept optional docstring as 3rd argument (just like defun) so we won't break existing custom matchers.

You can put this on the backburner if you want, I know how to implement it but probably won't get to it soon (certainly not before I finish the file system thing).

This could be really handy if we start adding more "complex" matchers where the wording might be confusing for some (or even the already existing :to-be-close-to taking the precision argument isn't completely obvious).

I'm really enjoying buttercup by the way!

jorgenschaefer commented 8 years ago

Great idea, thank you. This would make a good addition to some syntax as in #29