source: trunk/source/tests/ansi-tests/next-method-p.lsp @ 8991

Last change on this file since 8991 was 8991, checked in by gz, 12 years ago

Check in the gcl ansi test suite (original, in preparation for making local changes)

File size: 1.7 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Sat May 31 08:04:45 2003
4;;;; Contains: Tests of NEXT-METHOD-P
5
6(in-package :cl-test)
7
8(defgeneric nmp-gf-01 (x)
9  (:method ((x integer)) (notnot-mv (next-method-p)))
10  (:method ((x number)) 'foo)
11  (:method ((x symbol)) (next-method-p)))
12
13(deftest next-method-p.1
14  (nmp-gf-01 10)
15  t)
16
17(deftest next-method-p.2
18  (nmp-gf-01 1.2)
19  foo)
20
21(deftest next-method-p.3
22  (nmp-gf-01 'a)
23  nil)
24
25(defgeneric nmp-gf-02 (x y)
26  (:method ((x integer) (y symbol)) (notnot-mv (next-method-p)))
27  (:method ((x number) (y (eql nil))) 'foo))
28
29(deftest next-method-p.4
30  (nmp-gf-02 10 nil)
31  t)
32
33(deftest next-method-p.5
34  (nmp-gf-02 10 'a)
35  nil)
36
37(defgeneric nmp-gf-03 (x y)
38  (:method ((x integer) (y symbol)) #'next-method-p)
39  (:method ((x t) (y (eql nil))) (constantly 1)))
40
41(deftest next-method-p.6
42  (notnot-mv (funcall (the function (nmp-gf-03 10 nil))))
43  t)
44 
45(deftest next-method-p.7
46  (funcall (nmp-gf-03 10 'a))
47  nil)
48
49(defgeneric nmp-gf-04 (x y))
50(defmethod nmp-gf-04 ((x integer) (y symbol)) #'next-method-p)
51(defmethod nmp-gf-04 ((x t) (y (eql nil))) (constantly 2))
52
53(deftest next-method-p.8
54  (notnot-mv (funcall (the function (nmp-gf-04 10 nil))))
55  t)
56 
57(deftest next-method-p.9
58  (funcall (nmp-gf-04 10 'a))
59  nil)
60
61;; With AROUND methods
62
63(defgeneric nmp-gf-05 (x))
64(defmethod nmp-gf-05 :around ((x number)) (notnot-mv (next-method-p)))
65(defmethod nmp-gf-05 ((x integer)) 'foo)
66
67(deftest next-method-p.10
68  (nmp-gf-05 10)
69  t)
70
71;; Need to also test next-method-p in builtin method combinations
72
73;;; Error tests
74
75(deftest next-method-p.error.1
76  (signals-error
77   (progn
78     (eval '(defmethod nmp-gf-06 ((x t)) (next-method-p nil)))
79     (nmp-gf-06 nil))
80   program-error)
81  t)
Note: See TracBrowser for help on using the repository browser.