method-qualifiers.lsp 1.2 KB
Newer Older
1 2 3 4 5
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Sun May 11 07:14:12 2003
;;;; Contains: Tests of METHOD-QUALIFIERS

6

7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52

(defgeneric mq-generic-function (x))

(defparameter *mq-method-1*
  (defmethod mq-generic-function ((x integer)) (1+ x)))

(deftest method-qualifiers.1
  (method-qualifiers *mq-method-1*)
  nil)

(defclass mq-class-01 ()
  (a b c))

(defparameter *mq-method-2*
  (defmethod mq-generic-function :before ((x mq-class-01))
    'foo))

(deftest method-qualifiers.2
  (method-qualifiers *mq-method-2*)
  (:before))

(defclass mq-class-02 ()
  (e f g))

(defparameter *mq-method-3*
  (defmethod mq-generic-function :after ((x mq-class-02))
    'foo))

(deftest method-qualifiers.3
  (method-qualifiers *mq-method-3*)
  (:after))

(defclass mq-class-03 ()
  (h i j))

(defparameter *mq-method-4*
  (defmethod mq-generic-function :around ((x mq-class-03))
    'foo))

(deftest method-qualifiers.4
  (method-qualifiers *mq-method-4*)
  (:around))

;;; Need tests on user-defined method combinations

(deftest method-qualifiers.error.1
53 54
  (signals-error (method-qualifiers) program-error)
  t)
55 56

(deftest method-qualifiers.error.2
57 58
  (signals-error (method-qualifiers *mq-method-4* nil) program-error)
  t)