test-deferred-warnings.script 2.75 KB
Newer Older
1 2
;;; -*- Lisp -*-

3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
(in-package :asdf-test)

(def-test-system :unintern-foo
  :components ((:file "unintern-foo")))
(def-test-system :use-foo-only
  :depends-on (:unintern-foo)
  :components ((:file "use-foo")))
(def-test-system :use-then-defun-foo
  :depends-on (:unintern-foo)
  :serial t
  :components ((:file "use-foo") (:file "defun-foo")))
(def-test-system :use-then-defmacro-foo
  :depends-on (:unintern-foo)
  :serial t
  :components ((:file "use-foo") (:file "defmacro-foo")))
(def-test-system :use-setf-foo-only
  :depends-on (:unintern-foo)
  :components ((:file "use-setf-foo")))
(def-test-system :use-setf-then-defun-foo
  :depends-on (:unintern-foo)
23
  :serial t
24 25 26 27 28 29
  :components ((:file "use-setf-foo") (:file "defun-setf-foo")))
(def-test-system :use-setf-then-defsetf-foo
  :depends-on (:unintern-foo)
  :serial t
  :components ((:file "use-setf-foo") (:file "defsetf-foo")))

30
(DBG :tdw0 *compile-file-warnings-behaviour*)
31 32 33
(assert
 (handler-case
     (let ((*compile-file-warnings-behaviour* :ignore))
34 35 36 37 38 39 40 41 42
       (load-system :use-foo-only :force t))
   (error (c)
     (DBG :cfwbi c)
     nil)))

(assert
 (handler-case
     (let ((*compile-file-warnings-behaviour* :ignore))
       (load-system :use-setf-foo-only :force t)
43
       t)
44 45 46
   (error (c)
     (DBG :cfwbi c)
     nil)))
47

48 49 50 51
(DBG :tdw1 *warnings-file-type*)
(assert
 (handler-case
     (let ((*warnings-file-type* nil))
52
       (load-system :use-foo-only :force t)
53 54 55 56 57
       t)
   (error ()
     (DBG :wftn c)
     nil)))

58 59 60
(unless *warnings-file-type*
  (leave-test 0 "Your Lisp does not support deferred-warnings"))

61 62 63
(assert
 (handler-case
     (let ((*compile-file-warnings-behaviour* :error))
64
       (perform 'compile-op :use-foo-only)
65 66 67 68 69 70
       nil)
   (compile-warned-error () t)))

(assert
 (handler-case
     (let ((*compile-file-warnings-behaviour* :error))
71
       (perform 'compile-op :use-setf-foo-only)
72 73
       nil)
   (compile-warned-error () t)))
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101

(let ((*compile-file-warnings-behaviour* :error))
  (load-system :use-then-defun-foo))

(setf *compile-file-warnings-behaviour* :error)

(load-system :use-setf-then-defun-foo)

;;#+clozure (trace load compile-file check-deferred-warnings check-lisp-compile-warnings)

;; FIXME: on CCL, the defmacro warning is found while loading the defmacro fasl.
;; We should probably beef up the detection in reify-deferred-warnings,
;; possibly file a bug.
#-clozure
(assert
 (handler-case
     (load-system :use-then-defmacro-foo :force t)
   ((or compile-file-error compile-warned-error) () t)
   ;;(t (c) (DBG :utdf0 c))
   (:no-error (&rest values) (DBG :utdf1 values) nil)))

#-clozure
(assert
 (handler-case
     (load-system :use-setf-then-defsetf-foo :force t)
   ((or compile-file-error compile-warned-error) () t)
   ;;(t (c) (DBG :ustdf0 c))
   (:no-error (&rest values) (DBG :ustdf1 values) nil)))