Changeset 13591


Ignore:
Timestamp:
09/11/11 18:25:02 (12 years ago)
Author:
ehuelsmann
Message:

Promote DEFINE-METHOD-COMBINATION (long form) to 'production' status,
from the experimental status it had so far, by adding tests to ensure
it stays the way it is: working.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/test/lisp/abcl/mop-tests.lisp

    r13590 r13591  
    521521  T)
    522522
     523
     524;; From SBCL: method combination (long form) with arguments
     525
     526(define-method-combination dmc-test.5 ()
     527  ((method-list *))
     528  (:arguments arg1 arg2 &aux (extra :extra))
     529  (print (type-of method-list))
     530  (print method-list)
     531  `(progn ,@(mapcar (lambda (method) `(call-method ,method)) method-list)))
     532
     533(defgeneric dmc-test-mc.5 (p1 p2 s)
     534  (:method-combination dmc-test.5)
     535  (:method ((p1 number) (p2 t) s)
     536    (vector-push-extend (list 'number p1 p2) s))
     537  (:method ((p1 string) (p2 t) s)
     538    (vector-push-extend (list 'string p1 p2) s))
     539  (:method ((p1 t) (p2 t) s) (vector-push-extend (list t p1 p2))))
     540
     541(deftest dmc-test.5a
     542    (let ((v (make-array 0 :adjustable t :fill-pointer t)))
     543      (values (dmc-test-mc.5 1 2 v)
     544              (equal (aref v 0) '(number 1 2))
     545              (equal (aref v 1) '(t 1 2))))
     546  1 T T)
     547
     548
     549
     550(define-method-combination dmc-test.6 ()
     551  ((normal ())
     552   (ignored (:ignore :unused)))
     553  `(list 'result
     554    ,@(mapcar #'(lambda (method) `(call-method ,method)) normal)))
     555
     556(defgeneric dmc-test-mc.6 (x)
     557  (:method-combination dmc-test.6)
     558  (:method :ignore ((x number)) (/ 0)))
     559
     560(deftest dmc-test-mc.6a
     561    (multiple-value-bind
     562          (value error)
     563        (ignore-errors (dmc-test-mc.6 7))
     564      (values (null value)
     565              (typep error 'invalid-method-error)))
     566  T T)
     567
     568
     569(define-method-combination dmc-test.7 ()
     570  ((methods *))
     571  (:arguments x &rest others)
     572  `(progn
     573     ,@(mapcar (lambda (method)
     574                 `(call-method ,method))
     575               methods)
     576     (list ,x (length ',others))))
     577
     578(defgeneric dmc-test-mc.7 (x &rest others)
     579  (:method-combination dmc-test.7))
     580
     581(defmethod dmc-test-mc.7 (x &rest others)
     582  (declare (ignore others))
     583  nil)
     584
     585(deftest dmc-test-mc.7a
     586    (equal (apply #'dmc-test-mc.7 :foo (list 1 2 3 4 5 6 7 8))
     587           '(:foo 8)))
     588
     589
    523590(defclass foo-class (standard-class))
    524591(defmethod mop:validate-superclass ((class foo-class) (superclass standard-object))
Note: See TracChangeset for help on using the changeset viewer.