-(restart-case
- (handler-case
- (error 'picky-condition)
- (picky-condition (c)
- (assert (eq (car (compute-restarts)) (car (compute-restarts c))))))
- (picky-restart ()
- :report "Do nothing."
- :test (lambda (c)
- (typep c '(or null picky-condition)))
- 'ok))
+
+(with-test (:name (:picky-condition compute-restarts))
+ (restart-case
+ (handler-case
+ (error 'picky-condition)
+ (picky-condition (c)
+ ;; The PICKY-RESTART should be applicable for the
+ ;; PICKY-CONDITION and all other cases.
+ (assert (eq (restart-name (first (compute-restarts))) 'picky-restart))
+ (assert (eq (restart-name (first (compute-restarts c))) 'picky-restart))
+ (assert (eq (car (compute-restarts)) (car (compute-restarts c))))
+ ;; ANOTHER-PICKY-RESTART should not be applicable for the
+ ;; PICKY-CONDITION, but all other cases.
+ (assert (not (find 'another-picky-restart (compute-restarts c)
+ :key #'restart-name)))
+ (assert (find 'another-picky-restart (compute-restarts)
+ :key #'restart-name))
+ :ok))
+ (picky-restart ()
+ :report "Do nothing."
+ :test (lambda (c) (typep c '(or null picky-condition))))
+ (another-picky-restart ()
+ :report "Do nothing as well"
+ :test (lambda (c) (typep c '(not picky-condition))))))