@@ -2143,9 +2143,51 @@ ARGS according to `debugger'."
21432143 (eq 'let (cadr frame))
21442144 (equal '((buttercup--stackframe-marker 1 )) (car (cddr frame)))
21452145 )
2146- ; ; TODO: What about an error in a matcher?
21472146 ; ; TODO: What about :to-throw?
2147+ ; ; buttercup--update-with-funcall (spec ...
2148+ ; ; apply buttercup--funcall
2149+ ; ; buttercup--funcall -- sets the debugger
2150+ ; ; apply FUNCTION
2151+ ; ; FUNCTION -- spec body function
2152+ ; ; condition-case -- from buttercup-with-converted-ert-signals
2153+ ; ; (let ((buttercup--stackframe-marker 1))
2154+ ; ; (buttercup-expect
2155+ ; ; (buttercup--apply-matcher
2156+ ; ; (apply to-throw-matcher
2157+ ; ; (to-throw-matcher
2158+ ; ; We need a new debugger here, the
2159+ ; ; condition-case can not be used to collect
2160+ ; ; backtrace.
2161+ ; ; When the error happens in the matcher function
2162+ ; ; (buttercup-expect
2163+ ; ; (buttercup--apply-matcher
2164+ ; ; (apply some-kind-of-function
2165+ ; ; (matcher
2166+ ; ; ACTUAL CODE
2167+ (and (eq 'buttercup--apply-matcher (cadr frame))
2168+ ; ; The two preceeding frames are not of user interest
2169+ (pop frame-list) (pop frame-list)
2170+ ; ; Add a fake frame for the matcher function
2171+ (push (cons t
2172+ (cons (car (cddr frame))
2173+ (mapcar (lambda (x )
2174+ (if (buttercup--wrapper-fun-p x)
2175+ (buttercup--enclosed-expr x)
2176+ x))
2177+ (cadr (cddr frame)))))
2178+ frame-list))
21482179 ; ; TODO: What about signals in before and after blocks?
2180+ ; ; BEFORE-EACH:
2181+ ; ; buttercup--run-suite
2182+ ; ; (let* ...
2183+ ; ; (dolist (f (buttercup-suite-before-all ...
2184+ ; ; (buttercup--update-with-funcall suite f
2185+ ; ; (apply buttercup--funcall
2186+ ; ; (buttercup-funcall f
2187+ ; ; (f)
2188+ ; ; Currently, buttercup silently ignores error in
2189+ ; ; (before|after)-(all|each). As long as that is the case,
2190+ ; ; there is nothing we can do about stacktraces.
21492191 )
21502192 (cl-return frame-list))
21512193 (push frame frame-list)))
0 commit comments