branch: elpa/buttercup commit d00c1642a664f57d4a7d257a9f0edf6ba7e84b2c Author: Jorgen Schaefer <cont...@jorgenschaefer.de> Commit: Jorgen Schaefer <cont...@jorgenschaefer.de>
Display description for pending specs There are various reasons why a spec might be pending. With the support for skipping specs from the command line, there are now at least two: Marked as pending, or skipped. This change enables buttercup to display the reason for why a test was not run. Users can now use this functionality to signal buttercup-pending with an argument to show why something was skipped. Fixes #22 --- buttercup.el | 14 +++++++------- tests/test-buttercup.el | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/buttercup.el b/buttercup.el index 6e23e4f..90c074e 100644 --- a/buttercup.el +++ b/buttercup.el @@ -360,7 +360,7 @@ form.") (if body `(buttercup-it ,description (lambda () ,@body)) `(buttercup-it ,description (lambda () - (signal 'buttercup-pending t))))) + (signal 'buttercup-pending "PENDING"))))) (defun buttercup-it (description body-function) "Function to handle an `it' form." @@ -433,7 +433,7 @@ A disabled suite is not run." A disabled suite is not run." (buttercup-describe description (lambda () - (signal 'buttercup-pending t)))) + (signal 'buttercup-pending "PENDING")))) ;;;;;;;;;;;;;;;;;;;;;; ;;; Pending Specs: xit @@ -450,7 +450,7 @@ A disabled spec is not run." A disabled spec is not run." (buttercup-it description (lambda () - (signal 'buttercup-pending t)))) + (signal 'buttercup-pending "PENDING")))) ;;;;;;;;; ;;; Spies @@ -665,7 +665,7 @@ current directory." (when (string-match p (buttercup-spec-full-name (car suites-or-specs))) (throw 'return t))) (setf (buttercup-spec-function (car suites-or-specs)) - (lambda () (signal 'buttercup-pending t)))))) + (lambda () (signal 'buttercup-pending "SKIPPED")))))) (setq suites-or-specs (cdr suites-or-specs))))) (buttercup-run))) @@ -743,9 +743,9 @@ Do not change the global value.") (pcase description (`(error (buttercup-failed . ,failure-description)) (setq description failure-description)) - (`(error (buttercup-pending . t)) + (`(error (buttercup-pending . ,pending-description)) (setq status 'pending - description "Pending")))) + description pending-description)))) (cond ((buttercup-suite-p suite-or-spec) (when (eq (buttercup-suite-status suite-or-spec) 'passed) @@ -833,7 +833,7 @@ Calls either `buttercup-reporter-batch' or (append buttercup-reporter-batch--failures (list arg)))) ((eq (buttercup-spec-status arg) 'pending) - (buttercup--print " PENDING\n")) + (buttercup--print " %s\n" (buttercup-spec-failure-description arg))) (t (error "Unknown spec status %s" (buttercup-spec-status arg))))) diff --git a/tests/test-buttercup.el b/tests/test-buttercup.el index 7d90b08..ec8d037 100644 --- a/tests/test-buttercup.el +++ b/tests/test-buttercup.el @@ -317,7 +317,7 @@ (expect (macroexpand '(it "description")) :to-equal '(buttercup-it "description" - (lambda () (signal 'buttercup-pending t)))))) + (lambda () (signal 'buttercup-pending "PENDING")))))) (describe "The `buttercup-it' function" (it "should fail if not called from within a describe form"