From: Daniel Kochmański Date: Tue, 18 Aug 2015 11:24:24 +0000 (+0200) Subject: tests: add regressions tests for deftype X-Git-Tag: ECL-16.0.0~1^2~29 X-Git-Url: http://git.pulsar-zone.net/?a=commitdiff_plain;h=0af7015903117b29b832b9c94094220ec0b0d728;p=ecl.git tests: add regressions tests for deftype Signed-off-by: Daniel Kochmański --- diff --git a/src/tests/bugs/test-ansi.lsp b/src/tests/bugs/test-ansi.lsp index e884a39..52bf9e4 100644 --- a/src/tests/bugs/test-ansi.lsp +++ b/src/tests/bugs/test-ansi.lsp @@ -1,5 +1,7 @@ (in-package :cl-test) +;; HyperSpec – 2.* + ;;;;;;;;;;;;;;;;;;;;; ;; Readtable tests ;; ;;;;;;;;;;;;;;;;;;;;; @@ -33,3 +35,52 @@ #\a 3) + +;; HyperSpec – 3.* + +;;;;;;;;;;;;;;;;;;; +;; Deftype tests ;; +;;;;;;;;;;;;;;;;;;; + +(deftest test-ansi.deftype.ordinary.1 + (progn + (deftype ordinary1 () `(member nil t)) + (values (typep T 'ordinary1) + (typep :a 'ordinary1))) + T NIL) + +(deftest test-ansi.deftype.ordinary.2 + (progn + (deftype ordinary2 (a b) + (if a + 'CONS + `(INTEGER 0 ,b))) + (values (typep T '(ordinary2 nil 3)) + (typep 3 '(ordinary2 nil 4)) + (typep T '(ordinary2 T nil)) + (typep '(1 . 2) '(ordinary2 T nil)))) + nil t nil t) + +(deftest test-ansi.deftype.optional + (progn + (deftype optional (a &optional b) + (if a + 'CONS + `(INTEGER 0 ,b))) + (values (typep 5 '(optional nil)) + (typep 5 '(optional nil 4)))) + t nil) + +(deftest test-ansi.deftype.nested + (progn + (deftype nested ((a &optional b) c . d) + (assert (listp d)) + `(member ,a ,b ,c)) + (values + (typep 1 '(nested (1 2) 3 4 5 6)) + (typep 1 '(nested (2 2) 3 4 5 6)) + (typep '* '(nested (3) 3)) + (typep 3 '(nested (2) 3)))) + t nil t t) + +