diff options
| author | Andrea Corallo | 2020-11-12 15:11:58 +0100 |
|---|---|---|
| committer | Andrea Corallo | 2020-11-12 23:56:53 +0100 |
| commit | c3daee78004b8bfc3459b0f763540bdf01cc96f8 (patch) | |
| tree | c38995cb4768505bd271ffadad85bbb103a83564 /test | |
| parent | 6f10e0f09fc3adc9a7a114100cd2864a4bd7c708 (diff) | |
| download | emacs-c3daee78004b8bfc3459b0f763540bdf01cc96f8.tar.gz emacs-c3daee78004b8bfc3459b0f763540bdf01cc96f8.zip | |
* Add few more type specifier tests
* test/src/comp-tests.el (comp-tests-type-spec-tests): Add three
tests and uncomment one.
Diffstat (limited to 'test')
| -rw-r--r-- | test/src/comp-tests.el | 61 |
1 files changed, 41 insertions, 20 deletions
diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el index 23c4df88201..61838c670e1 100644 --- a/test/src/comp-tests.el +++ b/test/src/comp-tests.el | |||
| @@ -771,19 +771,19 @@ Return a list of results." | |||
| 771 | (native-compile (cadr func-form)))) | 771 | (native-compile (cadr func-form)))) |
| 772 | 772 | ||
| 773 | (defconst comp-tests-type-spec-tests | 773 | (defconst comp-tests-type-spec-tests |
| 774 | `(((defun comp-tests-ret-type-spec-0-f (x) | 774 | `(((defun comp-tests-ret-type-spec-f (x) |
| 775 | x) | 775 | x) |
| 776 | (t)) | 776 | t) |
| 777 | 777 | ||
| 778 | ((defun comp-tests-ret-type-spec-1-f () | 778 | ((defun comp-tests-ret-type-spec-f () |
| 779 | 1) | 779 | 1) |
| 780 | (integer 1 1)) | 780 | (integer 1 1)) |
| 781 | 781 | ||
| 782 | ((defun comp-tests-ret-type-spec-2-f (x) | 782 | ((defun comp-tests-ret-type-spec-f (x) |
| 783 | (if x 1 3)) | 783 | (if x 1 3)) |
| 784 | (or (integer 1 1) (integer 3 3))) | 784 | (or (integer 1 1) (integer 3 3))) |
| 785 | 785 | ||
| 786 | ((defun comp-tests-ret-type-spec-3-f (x) | 786 | ((defun comp-tests-ret-type-spec-f (x) |
| 787 | (let (y) | 787 | (let (y) |
| 788 | (if x | 788 | (if x |
| 789 | (setf y 1) | 789 | (setf y 1) |
| @@ -791,7 +791,7 @@ Return a list of results." | |||
| 791 | y)) | 791 | y)) |
| 792 | (integer 1 2)) | 792 | (integer 1 2)) |
| 793 | 793 | ||
| 794 | ((defun comp-tests-ret-type-spec-4-f (x) | 794 | ((defun comp-tests-ret-type-spec-f (x) |
| 795 | (let (y) | 795 | (let (y) |
| 796 | (if x | 796 | (if x |
| 797 | (setf y 1) | 797 | (setf y 1) |
| @@ -799,48 +799,48 @@ Return a list of results." | |||
| 799 | y)) | 799 | y)) |
| 800 | (or (integer 1 1) (integer 3 3))) | 800 | (or (integer 1 1) (integer 3 3))) |
| 801 | 801 | ||
| 802 | ((defun comp-tests-ret-type-spec-5-f (x) | 802 | ((defun comp-tests-ret-type-spec-f (x) |
| 803 | (if x | 803 | (if x |
| 804 | (list x) | 804 | (list x) |
| 805 | 3)) | 805 | 3)) |
| 806 | (or cons (integer 3 3))) | 806 | (or cons (integer 3 3))) |
| 807 | 807 | ||
| 808 | ((defun comp-tests-ret-type-spec-6-f (x) | 808 | ((defun comp-tests-ret-type-spec-f (x) |
| 809 | (if x | 809 | (if x |
| 810 | 'foo | 810 | 'foo |
| 811 | 3)) | 811 | 3)) |
| 812 | (or (member foo) (integer 3 3))) | 812 | (or (member foo) (integer 3 3))) |
| 813 | 813 | ||
| 814 | ((defun comp-tests-ret-type-spec-7-1-f (x) | 814 | ((defun comp-tests-ret-type-spec-f (x) |
| 815 | (if (eq x 3) | 815 | (if (eq x 3) |
| 816 | x | 816 | x |
| 817 | 'foo)) | 817 | 'foo)) |
| 818 | (or (member foo) (integer 3 3))) | 818 | (or (member foo) (integer 3 3))) |
| 819 | 819 | ||
| 820 | ((defun comp-tests-ret-type-spec-7-2-f (x) | 820 | ((defun comp-tests-ret-type-spec-f (x) |
| 821 | (if (eq 3 x) | 821 | (if (eq 3 x) |
| 822 | x | 822 | x |
| 823 | 'foo)) | 823 | 'foo)) |
| 824 | (or (member foo) (integer 3 3))) | 824 | (or (member foo) (integer 3 3))) |
| 825 | 825 | ||
| 826 | ((defun comp-tests-ret-type-spec-8-1-f (x) | 826 | ((defun comp-tests-ret-type-spec-f (x) |
| 827 | (if (= x 3) | 827 | (if (= x 3) |
| 828 | x | 828 | x |
| 829 | 'foo)) | 829 | 'foo)) |
| 830 | (or (member foo) (integer 3 3))) | 830 | (or (member foo) (integer 3 3))) |
| 831 | 831 | ||
| 832 | ((defun comp-tests-ret-type-spec-8-2-f (x) | 832 | ((defun comp-tests-ret-type-spec-f (x) |
| 833 | (if (= 3 x) | 833 | (if (= 3 x) |
| 834 | x | 834 | x |
| 835 | 'foo)) | 835 | 'foo)) |
| 836 | (or (member foo) (integer 3 3))) | 836 | (or (member foo) (integer 3 3))) |
| 837 | 837 | ||
| 838 | ;; FIXME returning ATM (or t (member foo)) | 838 | ;; FIXME would be nice to have (or number (member foo)) |
| 839 | ;; ((defun comp-tests-ret-type-spec-8-3-f (x) | 839 | ((defun comp-tests-ret-type-spec-8-3-f (x) |
| 840 | ;; (if (= x 3) | 840 | (if (= x 3) |
| 841 | ;; 'foo | 841 | 'foo |
| 842 | ;; x)) | 842 | x)) |
| 843 | ;; (or number (member foo))) | 843 | t) |
| 844 | 844 | ||
| 845 | ((defun comp-tests-ret-type-spec-8-4-f (x y) | 845 | ((defun comp-tests-ret-type-spec-8-4-f (x y) |
| 846 | (if (= x y) | 846 | (if (= x y) |
| @@ -852,9 +852,30 @@ Return a list of results." | |||
| 852 | (comp-hint-fixnum y)) | 852 | (comp-hint-fixnum y)) |
| 853 | (integer ,most-negative-fixnum ,most-positive-fixnum)) | 853 | (integer ,most-negative-fixnum ,most-positive-fixnum)) |
| 854 | 854 | ||
| 855 | ((defun comp-tests-ret-type-spec-9-1-f (x) | 855 | ((defun comp-tests-ret-type-spec-f (x) |
| 856 | (comp-hint-cons x)) | 856 | (comp-hint-cons x)) |
| 857 | (cons)))) | 857 | cons) |
| 858 | |||
| 859 | ((defun comp-tests-ret-type-spec-f (x) | ||
| 860 | (let (y) | ||
| 861 | (when x | ||
| 862 | (setf y 4)) | ||
| 863 | y)) | ||
| 864 | (or null (integer 4 4))) | ||
| 865 | |||
| 866 | ((defun comp-tests-ret-type-spec-f () | ||
| 867 | (let (x | ||
| 868 | (y 3)) | ||
| 869 | (setf x y) | ||
| 870 | y)) | ||
| 871 | (integer 3 3)) | ||
| 872 | |||
| 873 | ((defun comp-tests-ret-type-spec-f (x) | ||
| 874 | (let ((y 3)) | ||
| 875 | (when x | ||
| 876 | (setf y x)) | ||
| 877 | y)) | ||
| 878 | t))) | ||
| 858 | 879 | ||
| 859 | (comp-deftest ret-type-spec () | 880 | (comp-deftest ret-type-spec () |
| 860 | "Some derived return type specifier tests." | 881 | "Some derived return type specifier tests." |