Skip to content

Commit

Permalink
Move quotes into the format handlers in buttercup--handle-to-throw
Browse files Browse the repository at this point in the history
  • Loading branch information
snogge committed Mar 22, 2023
1 parent 7076260 commit 243d50b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions buttercup.el
Original file line number Diff line number Diff line change
Expand Up @@ -678,10 +678,10 @@ UNEVALUATED-EXPR if it did not raise any signal."
;; buttercup--simple-format for formatting as format-spec
;; does not support functions until Emacs 29
(spec (format-spec-make
?E (format "%S" unevaluated-expr)
?e (lambda () (format "%S" expr-value))
?E (format "`%S'" unevaluated-expr)
?e (lambda () (format "`%S'" expr-value))
?t (lambda () (format "%S" thrown-signal))
?S (lambda () (format "%S" thrown-signal-symbol))
?S (lambda () (format "`%S'" thrown-signal-symbol))
?A (lambda ()
(if expected-signal-args
(format " with args `%S'" thrown-signal-args)
Expand All @@ -697,22 +697,22 @@ UNEVALUATED-EXPR if it did not raise any signal."
(cond
(matched ;; should be the most likely result
`(t . ,(buttercup--simple-format
spec "Expected `%E' not to throw %s%a, but it threw `%S'%A")))
spec "Expected %E not to throw %s%a, but it threw %S%A")))
((null thrown-signal) ; no signal raised
`(nil . ,(buttercup--simple-format
spec "Expected `%E' to throw %s%a, but instead it returned `%e'")))
spec "Expected %E to throw %s%a, but instead it returned %e")))
((and explained-signal-args (not matching-signal-symbol)) ; neither symbol nor args matched
`(nil . ,(buttercup--simple-format
spec
"Expected `%E' to throw %s%a, but instead it threw `%S'%A")))
"Expected %E to throw %s%a, but instead it threw %S%A")))
(explained-signal-args ; symbol matched
`(nil . ,(buttercup--simple-format
spec
"Expected `%E' to throw %s, but the args %q")))
"Expected %E to throw %s, but the args %q")))
((not matching-signal-symbol) ; args matched
`(nil . ,(buttercup--simple-format
spec
"Expected `%E' to throw %s%a, but instead it threw `%S'%A")))
"Expected %E to throw %s%a, but instead it threw %S%A")))
(t `(nil . "Some next level shit"))))))

(buttercup-define-matcher :to-have-been-called (spy)
Expand Down

0 comments on commit 243d50b

Please sign in to comment.