[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 9ad997cd689 5/5: * test/src/comp-tests.el: Add some ret type test
From: |
Andrea Corallo |
Subject: |
master 9ad997cd689 5/5: * test/src/comp-tests.el: Add some ret type tests for non builtin types |
Date: |
Tue, 23 May 2023 11:20:56 -0400 (EDT) |
branch: master
commit 9ad997cd68981fe6c6933b6977fdae23e84e6a75
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>
* test/src/comp-tests.el: Add some ret type tests for non builtin types
---
test/src/comp-tests.el | 36 +++++++++++++++++++++++++++++++++++-
1 file changed, 35 insertions(+), 1 deletion(-)
diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el
index 4682cac450e..673a9342f1f 100644
--- a/test/src/comp-tests.el
+++ b/test/src/comp-tests.el
@@ -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)) ()