diff options
| author | Andrea Corallo | 2023-05-23 15:13:08 +0200 |
|---|---|---|
| committer | Andrea Corallo | 2023-05-23 16:39:06 +0200 |
| commit | 9ad997cd68981fe6c6933b6977fdae23e84e6a75 (patch) | |
| tree | d35f07b4ab1238f37699b074988942dd822223df /test/src | |
| parent | 6c781b5d252057e04c612d0a2e3e10b91a1cfa96 (diff) | |
| download | emacs-9ad997cd68981fe6c6933b6977fdae23e84e6a75.tar.gz emacs-9ad997cd68981fe6c6933b6977fdae23e84e6a75.zip | |
* test/src/comp-tests.el: Add some ret type tests for non builtin types
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/comp-tests.el | 36 |
1 files changed, 35 insertions, 1 deletions
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." | |||
| 875 | ret-type)))) | 875 | ret-type)))) |
| 876 | 876 | ||
| 877 | (cl-eval-when (compile eval load) | 877 | (cl-eval-when (compile eval load) |
| 878 | (cl-defstruct comp-foo a b) | ||
| 879 | (cl-defstruct (comp-bar (:include comp-foo)) c) | ||
| 878 | (defconst comp-tests-type-spec-tests | 880 | (defconst comp-tests-type-spec-tests |
| 879 | ;; Why we quote everything here, you ask? So that values of | 881 | ;; Why we quote everything here, you ask? So that values of |
| 880 | ;; `most-positive-fixnum' and `most-negative-fixnum', which can be | 882 | ;; `most-positive-fixnum' and `most-negative-fixnum', which can be |
| @@ -1404,7 +1406,39 @@ Return a list of results." | |||
| 1404 | (if (eq x 0) | 1406 | (if (eq x 0) |
| 1405 | (error "") | 1407 | (error "") |
| 1406 | (1+ x))) | 1408 | (1+ x))) |
| 1407 | 'number))) | 1409 | 'number) |
| 1410 | |||
| 1411 | ;; 75 | ||
| 1412 | ((defun comp-tests-ret-type-spec-f () | ||
| 1413 | (make-comp-foo)) | ||
| 1414 | 'comp-foo) | ||
| 1415 | |||
| 1416 | ;; 76 | ||
| 1417 | ((defun comp-tests-ret-type-spec-f () | ||
| 1418 | (make-comp-bar)) | ||
| 1419 | 'comp-bar) | ||
| 1420 | |||
| 1421 | ;; 77 | ||
| 1422 | ((defun comp-tests-ret-type-spec-f (x) | ||
| 1423 | (setf (comp-foo-a x) 2) | ||
| 1424 | x) | ||
| 1425 | 'comp-foo) | ||
| 1426 | |||
| 1427 | ;; 78 | ||
| 1428 | ((defun comp-tests-ret-type-spec-f (x) | ||
| 1429 | (if x | ||
| 1430 | (if (> x 11) | ||
| 1431 | x | ||
| 1432 | (make-comp-foo)) | ||
| 1433 | (make-comp-bar))) | ||
| 1434 | '(or comp-foo float (integer 12 *))) | ||
| 1435 | |||
| 1436 | ;; 79 | ||
| 1437 | ((defun comp-tests-ret-type-spec-f (x) | ||
| 1438 | (if (comp-foo-p x) | ||
| 1439 | x | ||
| 1440 | (error ""))) | ||
| 1441 | 'comp-foo))) | ||
| 1408 | 1442 | ||
| 1409 | (defun comp-tests-define-type-spec-test (number x) | 1443 | (defun comp-tests-define-type-spec-test (number x) |
| 1410 | `(comp-deftest ,(intern (format "ret-type-spec-%d" number)) () | 1444 | `(comp-deftest ,(intern (format "ret-type-spec-%d" number)) () |