jorgenschaefer / emacs-buttercup

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

Documentation request: equivalent of ERT's skip-unless #173

Open cpitclaudel opened 4 years ago

cpitclaudel commented 4 years ago

ERT has a convenient (skip-unless …) form that makes a test conditional. What's the equivalent in buttercup?

Signaling from it (e.g. (signal 'buttercup-pending "SKIPPED (interactive-only)")) works fine, but signaling from describe doesn't print anything next to the section title; that is, this code:

(describe "Mode Line"
  (signal 'buttercup-pending "SKIPPED (interactive-only)")

outputs this:


Mode Line

I also tried adding the signal form to a before-each, but that didn't seem to do anything.

snogge commented 4 years ago

There is the (undoumented) assume macro, which does more or less the same as your signalcommand. It is not possible to use in describe, only in it.

It should be possible to use assumein a before-each, but due to how the test runner is implemented it will still run the it form. If the it form signals an error the spec should be marked as failing rather than skipped.
But your experiments show differently, I'll have to investigate further at a later time.

Se also #119.

I have some ideas on how to address this, but it will require some rework of the internal plumbing which always feels a bit risky.