test-around-compile.script 841 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 13 14 15 16 17 18 19 20 21 22 23 24
(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)
(assert (= 3 (funcall 'add10 1))) ;; add10 must have been compiled in base 2

(fmakunbound 'add10)

(DBG "Testing around-compile with a lambda")
(def-test-system test-around-compile-lambda
  :around-compile (lambda (thunk)
                    (let ((*read-base* 2))
                      (funcall thunk)))
  :components ((:file "test")))
(load-system 'test-around-compile-lambda :force t)
(assert (= 3 (funcall 'add10 1))) ;; add10 must have been compiled in base 2