Commit 2250009b authored by pfdietz's avatar pfdietz

Added error tests for various builtin method combinations.

parent 54c44d7f
......@@ -148,3 +148,40 @@
(multiple-value-list (funcall fn #c(9 8)))
(multiple-value-list (funcall fn '(a b c)))))
() (a b c) (1 2 3 4 5 6) (b))
(deftest defgeneric-method-combination.and.9
(handler-case
(let ((fn (eval '(defgeneric dg-mc.and.9 (x)
(:method-combination and)))))
(funcall fn 'x))
(error () :error))
:error)
(deftest defgeneric-method-combination.and.10
(handler-case
(eval '(defgeneric dg-mc.and.10 (x)
(:method-combination and)
(:method ((x t)) t)))
(error () :error))
:error)
(deftest defgeneric-method-combination.and.11
(handler-case
(eval '(defgeneric dg-mc.and.11 (x)
(:method-combination and)
(:method nonsense ((x t)) t)))
(error () :error))
:error)
(deftest defgeneric-method-combination.and.12
(let ((fn (eval '(defgeneric dg-mc.and.12 (x)
(:method-combination and)
(:method :around ((x t)) t)
(:method and ((x integer)) x)))))
(handler-case (funcall fn 'x)
(error () :error)))
:error)
......@@ -152,3 +152,35 @@
(multiple-value-list (funcall fn '(a b c)))))
() (a b c) (1 2 3 4 5 6) ((b)))
(deftest defgeneric-method-combination.append.9
(handler-case
(let ((fn (eval '(defgeneric dg-mc.append.9 (x)
(:method-combination append)))))
(funcall fn '(a)))
(error () :error))
:error)
(deftest defgeneric-method-combination.append.10
(handler-case
(eval '(defgeneric dg-mc.append.10 (x)
(:method-combination append)
(:method ((x t)) '(a))))
(error () :error))
:error)
(deftest defgeneric-method-combination.append.11
(handler-case
(eval '(defgeneric dg-mc.append.11 (x)
(:method-combination append)
(:method nonsense ((x t)) '(a))))
(error () :error))
:error)
(deftest defgeneric-method-combination.append.12
(let ((fn (eval '(defgeneric dg-mc.append.12 (x)
(:method-combination append)
(:method :around ((x t)) '(a))
(:method append ((x integer)) x)))))
(handler-case (funcall fn '(b))
(error () :error)))
:error)
......@@ -151,3 +151,36 @@
(multiple-value-list (funcall fn #c(9 8)))
(multiple-value-list (funcall fn '(a b c)))))
() (a b c) (1 2 3 4 5 6) ((b)))
(deftest defgeneric-method-combination.list.9
(handler-case
(let ((fn (eval '(defgeneric dg-mc.list.9 (x)
(:method-combination list)))))
(funcall fn (list 'a)))
(error () :error))
:error)
(deftest defgeneric-method-combination.list.10
(handler-case
(eval '(defgeneric dg-mc.list.10 (x)
(:method-combination list)
(:method ((x t)) (list 'a))))
(error () :error))
:error)
(deftest defgeneric-method-combination.list.11
(handler-case
(eval '(defgeneric dg-mc.list.11 (x)
(:method-combination list)
(:method nonsense ((x t)) (list 'a))))
(error () :error))
:error)
(deftest defgeneric-method-combination.list.12
(let ((fn (eval '(defgeneric dg-mc.list.12 (x)
(:method-combination list)
(:method :around ((x t)) (list 'a))
(:method list ((x integer)) x)))))
(handler-case (funcall fn (list 'b))
(error () :error)))
:error)
......@@ -139,3 +139,36 @@
(multiple-value-list (funcall fn #c(9 8)))
(multiple-value-list (funcall fn '(a b c)))))
() (a b c) (1 2 3 4 5 6) (1))
(deftest defgeneric-method-combination.max.9
(handler-case
(let ((fn (eval '(defgeneric dg-mc.max.9 (x)
(:method-combination max)))))
(funcall fn (list 'a)))
(error () :error))
:error)
(deftest defgeneric-method-combination.max.10
(handler-case
(eval '(defgeneric dg-mc.max.10 (x)
(:method-combination max)
(:method ((x t)) 0)))
(error () :error))
:error)
(deftest defgeneric-method-combination.max.11
(handler-case
(eval '(defgeneric dg-mc.max.11 (x)
(:method-combination max)
(:method nonsense ((x t)) 0)))
(error () :error))
:error)
(deftest defgeneric-method-combination.max.12
(let ((fn (eval '(defgeneric dg-mc.max.12 (x)
(:method-combination max)
(:method :around ((x t)) 1)
(:method max ((x integer)) x)))))
(handler-case (funcall fn 'a)
(error () :error)))
:error)
......@@ -139,3 +139,37 @@
(multiple-value-list (funcall fn #c(9 8)))
(multiple-value-list (funcall fn '(a b c)))))
() (a b c) (1 2 3 4 5 6) (1))
(deftest defgeneric-method-combination.min.9
(handler-case
(let ((fn (eval '(defgeneric dg-mc.min.9 (x)
(:method-combination min)))))
(funcall fn (list 'a)))
(error () :error))
:error)
(deftest defgeneric-method-combination.min.10
(handler-case
(eval '(defgeneric dg-mc.min.10 (x)
(:method-combination min)
(:method ((x t)) 0)))
(error () :error))
:error)
(deftest defgeneric-method-combination.min.11
(handler-case
(eval '(defgeneric dg-mc.min.11 (x)
(:method-combination min)
(:method nonsense ((x t)) 0)))
(error () :error))
:error)
(deftest defgeneric-method-combination.min.12
(let ((fn (eval '(defgeneric dg-mc.min.12 (x)
(:method-combination min)
(:method :around ((x t)) 1)
(:method min ((x integer)) x)))))
(handler-case (funcall fn 'a)
(error () :error)))
:error)
......@@ -164,3 +164,35 @@
(multiple-value-list (funcall fn '(a b c)))))
() (a b c) (1 2 3 4 5 6) ((b)))
(deftest defgeneric-method-combination.nconc.9
(handler-case
(let ((fn (eval '(defgeneric dg-mc.nconc.9 (x)
(:method-combination nconc)))))
(funcall fn (list 'a)))
(error () :error))
:error)
(deftest defgeneric-method-combination.nconc.10
(handler-case
(eval '(defgeneric dg-mc.nconc.10 (x)
(:method-combination nconc)
(:method ((x t)) (list 'a))))
(error () :error))
:error)
(deftest defgeneric-method-combination.nconc.11
(handler-case
(eval '(defgeneric dg-mc.nconc.11 (x)
(:method-combination nconc)
(:method nonsense ((x t)) (list 'a))))
(error () :error))
:error)
(deftest defgeneric-method-combination.nconc.12
(let ((fn (eval '(defgeneric dg-mc.nconc.12 (x)
(:method-combination nconc)
(:method :around ((x t)) (list 'a))
(:method nconc ((x integer)) x)))))
(handler-case (funcall fn (list 'b))
(error () :error)))
:error)
......@@ -142,3 +142,36 @@
(multiple-value-list (funcall fn #c(9 8)))
(multiple-value-list (funcall fn '(a b c)))))
() (a b c) (1 2 3 4 5 6) (b))
(deftest defgeneric-method-combination.or.9
(handler-case
(let ((fn (eval '(defgeneric dg-mc.or.9 (x)
(:method-combination or)))))
(funcall fn (list 'a)))
(error () :error))
:error)
(deftest defgeneric-method-combination.or.10
(handler-case
(eval '(defgeneric dg-mc.or.10 (x)
(:method-combination or)
(:method ((x t)) 0)))
(error () :error))
:error)
(deftest defgeneric-method-combination.or.11
(handler-case
(eval '(defgeneric dg-mc.or.11 (x)
(:method-combination or)
(:method nonsense ((x t)) 0)))
(error () :error))
:error)
(deftest defgeneric-method-combination.or.12
(let ((fn (eval '(defgeneric dg-mc.or.12 (x)
(:method-combination or)
(:method :around ((x t)) t)
(:method or ((x integer)) x)))))
(handler-case (funcall fn 'a)
(error () :error)))
:error)
......@@ -139,3 +139,37 @@
(multiple-value-list (funcall fn #c(9 8)))
(multiple-value-list (funcall fn '(a b c)))))
() (a b c) (1 2 3 4 5 6) (1))
(deftest defgeneric-method-combination.+.9
(handler-case
(let ((fn (eval '(defgeneric dg-mc.+.9 (x)
(:method-combination +)))))
(funcall fn (list 'a)))
(error () :error))
:error)
(deftest defgeneric-method-combination.+.10
(handler-case
(eval '(defgeneric dg-mc.+.10 (x)
(:method-combination +)
(:method ((x t)) 0)))
(error () :error))
:error)
(deftest defgeneric-method-combination.+.11
(handler-case
(eval '(defgeneric dg-mc.+.11 (x)
(:method-combination +)
(:method nonsense ((x t)) 0)))
(error () :error))
:error)
(deftest defgeneric-method-combination.+.12
(let ((fn (eval '(defgeneric dg-mc.+.12 (x)
(:method-combination +)
(:method :around ((x t)) 1)
(:method + ((x integer)) x)))))
(handler-case (funcall fn 'a)
(error () :error)))
:error)
......@@ -221,3 +221,36 @@
(multiple-value-list (funcall fn #c(9 8)))
(multiple-value-list (funcall fn '(a b c)))))
() (a b c) (1 2 3 4 5 6) (b))
(deftest defgeneric-method-combination.progn.9
(handler-case
(let ((fn (eval '(defgeneric dg-mc.progn.9 (x)
(:method-combination progn)))))
(funcall fn (list 'a)))
(error () :error))
:error)
(deftest defgeneric-method-combination.progn.10
(handler-case
(eval '(defgeneric dg-mc.progn.10 (x)
(:method-combination progn)
(:method ((x t)) 0)))
(error () :error))
:error)
(deftest defgeneric-method-combination.progn.11
(handler-case
(eval '(defgeneric dg-mc.progn.11 (x)
(:method-combination progn)
(:method nonsense ((x t)) 0)))
(error () :error))
:error)
(deftest defgeneric-method-combination.progn.12
(let ((fn (eval '(defgeneric dg-mc.progn.12 (x)
(:method-combination progn)
(:method :around ((x t)) 'a)
(:method progn ((x integer)) x)))))
(handler-case (funcall fn 'b)
(error () :error)))
:error)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment