test-apply-hook.ss 598 B

1234567891011121314151617181920212223
  1. (import (mit apply-hook)
  2. (srfi :64))
  3. (test-begin "apply-hook-test")
  4. (define fbe-ah (make-apply-hook (lambda (x) (cons 'ah-proc x)) 'ah-extra))
  5. (test-equal "apply" '(ah-proc . x) (fbe-ah 'x))
  6. (test-equal "apply-get-proc" '(ah-proc . get-proc) (fbe-ah 'get-proc))
  7. (test-equal "arity" '(1 . 1) (procedure-arity fbe-ah))
  8. (test-equal "hook?-false" #f (apply-hook? (lambda x x)))
  9. (test-equal "hook?-true" #t (apply-hook? fbe-ah))
  10. (test-equal "extra" 'ah-extra (apply-hook-extra fbe-ah))
  11. (test-equal "proc" '(ah-proc . x) ((apply-hook-procedure fbe-ah) 'x))
  12. (test-end "apply-hook-test")