branch: elpa/buttercup commit 444716bad7454351663cc7ddeb5094332cfc620a Author: Jorgen Schaefer <cont...@jorgenschaefer.de> Commit: Jorgen Schaefer <cont...@jorgenschaefer.de>
Handle windows better in interactive runs. When running tests interactively, Buttercup now does not change the input focus to the *Buttercup* buffer when there was an error. Also, Buttercup now scrolls the test results to the end, as most of the interesting this are shown at the end. Fixes #14 --- buttercup.el | 11 ++++++++--- tests/test-buttercup.el | 6 +++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/buttercup.el b/buttercup.el index f9f0a44..fc990a4 100644 --- a/buttercup.el +++ b/buttercup.el @@ -620,8 +620,9 @@ KEYWORD can have one of the following values: (interactive) (let ((buttercup-suites nil) (lexical-binding t)) - (eval-defun nil) - (buttercup-run) + (save-selected-window + (eval-defun nil) + (buttercup-run)) (message "Suite executed successfully"))) ;;;###autoload @@ -865,7 +866,11 @@ Calls either `buttercup-reporter-batch' or (insert (apply 'format fmt args)))))) (unwind-protect (buttercup-reporter-batch event arg) - (fset 'buttercup--print old-print))))) + (fset 'buttercup--print old-print))) + (let ((w (get-buffer-window (current-buffer)))) + (when w + (with-selected-window w + (goto-char (point-max))))))) ;;;;;;;;;;;;; ;;; Utilities diff --git a/tests/test-buttercup.el b/tests/test-buttercup.el index 5df1952..7d90b08 100644 --- a/tests/test-buttercup.el +++ b/tests/test-buttercup.el @@ -103,10 +103,10 @@ :to-throw 'buttercup-failed "Explanation"))) -(describe "The `buttercup-define-matcher' macro" - (buttercup-define-matcher :test-matcher (a b) - (+ a b)) +(buttercup-define-matcher :test-matcher (a b) + (+ a b)) +(describe "The `buttercup-define-matcher' macro" (it "should create a matcher usable by apply-matcher" (expect (buttercup--apply-matcher :test-matcher '(1 2)) :to-equal