]> git.eshelyaron.com Git - emacs.git/commitdiff
* test/src/comp-tests.el: Add some ret type tests for non builtin types
authorAndrea Corallo <akrl@sdf.org>
Tue, 23 May 2023 13:13:08 +0000 (15:13 +0200)
committerAndrea Corallo <akrl@sdf.org>
Tue, 23 May 2023 14:39:06 +0000 (16:39 +0200)
test/src/comp-tests.el

index 4682cac450ec7d9f1c9916d4cd04645e9e5ee08b..673a9342f1fcb72c0ab193dfb9252a420bdcfab3 100644 (file)
@@ -875,6 +875,8 @@ Return a list of results."
                    ret-type))))
 
 (cl-eval-when (compile eval load)
+  (cl-defstruct comp-foo a b)
+  (cl-defstruct (comp-bar (:include comp-foo)) c)
   (defconst comp-tests-type-spec-tests
     ;; Why we quote everything here, you ask?  So that values of
     ;; `most-positive-fixnum' and `most-negative-fixnum', which can be
@@ -1404,7 +1406,39 @@ Return a list of results."
          (if (eq x 0)
             (error "")
           (1+ x)))
-       'number)))
+       'number)
+
+      ;; 75
+      ((defun comp-tests-ret-type-spec-f ()
+         (make-comp-foo))
+       'comp-foo)
+
+      ;; 76
+      ((defun comp-tests-ret-type-spec-f ()
+         (make-comp-bar))
+       'comp-bar)
+
+      ;; 77
+      ((defun comp-tests-ret-type-spec-f (x)
+          (setf (comp-foo-a x) 2)
+          x)
+       'comp-foo)
+
+      ;; 78
+      ((defun comp-tests-ret-type-spec-f (x)
+          (if x
+              (if (> x 11)
+                 x
+               (make-comp-foo))
+            (make-comp-bar)))
+       '(or comp-foo float (integer 12 *)))
+
+      ;; 79
+      ((defun comp-tests-ret-type-spec-f (x)
+         (if (comp-foo-p x)
+             x
+           (error "")))
+       'comp-foo)))
 
   (defun comp-tests-define-type-spec-test (number x)
     `(comp-deftest ,(intern (format "ret-type-spec-%d" number)) ()