test-around-compile.script 847 Bytes
Newer Older
1
;;; -*- Lisp -*-
2

3 4 5 6
(defun call-in-base-2 (thunk)
  (let ((*read-base* 2))
    (funcall thunk)))

7 8 9 10 11 12
(DBG "Testing around-compile with a function name")
(def-test-system test-around-compile
  :around-compile call-in-base-2
  ;; :depends-on ((:version :asdf "2.017.18")) ; no :around-compile before that.
  :components ((:file "test")))
(load-system 'test-around-compile :force t)
13
(assert-equal 3 (funcall 'add10 1)) ;; add10 must have been compiled in base 2
14 15 16 17 18 19

(fmakunbound 'add10)

(DBG "Testing around-compile with a lambda")
(def-test-system test-around-compile-lambda
  :around-compile (lambda (thunk)
20
                    (let ((*read-base* 9))
21 22 23
                      (funcall thunk)))
  :components ((:file "test")))
(load-system 'test-around-compile-lambda :force t)
24
(assert-equal 10 (funcall 'add10 1)) ;; add10 must have been compiled in base 16