diff --git a/buttercup.el b/buttercup.el index f42d901..abea84e 100644 --- a/buttercup.el +++ b/buttercup.el @@ -678,7 +678,10 @@ UNEVALUATED-EXPR if it did not raise any signal." ?e (lambda () (format "%S" expr-value)) ?t (lambda () (format "%S" thrown-signal)) ?S (lambda () (format "%S" thrown-signal-symbol)) - ?A (lambda () (format "%S" thrown-signal-args)) + ?A (lambda () + (if expected-signal-args + (format " with args `%S'" thrown-signal-args) + "")) ?s (if expected-signal-symbol (format "a child signal of `%S'" expected-signal-symbol) "a signal") @@ -693,11 +696,11 @@ UNEVALUATED-EXPR if it did not raise any signal." :expect-match-phrase (buttercup--simple-format spec - "Expected `%E' to throw %s%a, but instead it threw `%S' with args %A") + "Expected `%E' to throw %s%a, but instead it threw `%S'%A") :expect-mismatch-phrase (buttercup--simple-format spec - "Expected `%E' not to throw %s%a, but it threw `%S' with args %A")))))) + "Expected `%E' not to throw %s%a, but it threw `%S'%A")))))) (buttercup-define-matcher :to-have-been-called (spy) (cl-assert (symbolp (funcall spy))) diff --git a/tests/test-buttercup.el b/tests/test-buttercup.el index 373e9e0..cdd74d2 100644 --- a/tests/test-buttercup.el +++ b/tests/test-buttercup.el @@ -603,49 +603,49 @@ text properties using `ansi-color-apply'." (list 'overflow-error (concat "Foo" "bar")) '(myfunc) nil) :to-equal - '(t . "Expected `(myfunc)' not to throw a child signal of `overflow-error' with args `(\"Foobar\")', but it threw `overflow-error' with args (\"Foobar\")"))) + '(t . "Expected `(myfunc)' not to throw a child signal of `overflow-error' with args `(\"Foobar\")', but it threw `overflow-error' with args `(\"Foobar\")'"))) (it "should match the error symbol without args" (expect (buttercup--handle-to-throw '(overflow-error "Foobar") '(overflow-error) '(myfunc) nil) :to-equal - '(t . "Expected `(myfunc)' not to throw a child signal of `overflow-error', but it threw `overflow-error' with args (\"Foobar\")"))) + '(t . "Expected `(myfunc)' not to throw a child signal of `overflow-error', but it threw `overflow-error'"))) (it "should match the with no error signal specified" (expect (buttercup--handle-to-throw '(overflow-error "Foobar") '() '(myfunc) nil) :to-equal - '(t . "Expected `(myfunc)' not to throw a signal, but it threw `overflow-error' with args (\"Foobar\")"))) + '(t . "Expected `(myfunc)' not to throw a signal, but it threw `overflow-error'"))) (it "should match a child signal" (expect (buttercup--handle-to-throw '(overflow-error "Foobar") '(arith-error) '(myfunc) nil) :to-equal - '(t . "Expected `(myfunc)' not to throw a child signal of `arith-error', but it threw `overflow-error' with args (\"Foobar\")"))) + '(t . "Expected `(myfunc)' not to throw a child signal of `arith-error', but it threw `overflow-error'"))) (it "should match child signals and equal arguments" (expect (buttercup--handle-to-throw '(overflow-error "Foobar") `(arith-error ,(concat "Foo" "bar")) '(myfunc) nil) :to-equal - '(t . "Expected `(myfunc)' not to throw a child signal of `arith-error' with args `(\"Foobar\")', but it threw `overflow-error' with args (\"Foobar\")"))) + '(t . "Expected `(myfunc)' not to throw a child signal of `arith-error' with args `(\"Foobar\")', but it threw `overflow-error' with args `(\"Foobar\")'"))) (it "should not match with different arguments" (expect (buttercup--handle-to-throw '(overflow-error "Foobar") (list 'overflow-error (concat "Foo" "bar" "baz")) '(myfunc) nil) :to-equal - '(nil . "Expected `(myfunc)' to throw a child signal of `overflow-error' with args `(\"Foobarbaz\")', but instead it threw `overflow-error' with args (\"Foobar\")"))) + '(nil . "Expected `(myfunc)' to throw a child signal of `overflow-error' with args `(\"Foobarbaz\")', but instead it threw `overflow-error' with args `(\"Foobar\")'"))) (it "should not match an unrelated symbol" (expect (buttercup--handle-to-throw '(void-variable "Foobar") (list 'overflow-error (concat "Foo" "bar")) '(myfunc) nil) :to-equal - '(nil . "Expected `(myfunc)' to throw a child signal of `overflow-error' with args `(\"Foobar\")', but instead it threw `void-variable' with args (\"Foobar\")"))) + '(nil . "Expected `(myfunc)' to throw a child signal of `overflow-error' with args `(\"Foobar\")', but instead it threw `void-variable' with args `(\"Foobar\")'"))) (it "should not match a parent signal" (expect (buttercup--handle-to-throw '(arith-error "Foobar") - `(overflow-error ) + `(overflow-error) '(myfunc) nil) :to-equal - '(nil . "Expected `(myfunc)' to throw a child signal of `overflow-error', but instead it threw `arith-error' with args (\"Foobar\")"))) + '(nil . "Expected `(myfunc)' to throw a child signal of `overflow-error', but instead it threw `arith-error'"))) (describe "should not match when no signal is raised" (it "and not mention unspecified signal" ;; since this test does not need to signal an error, it can apply the full matcher