diff options
| author | Andrea Corallo | 2020-11-25 22:41:39 +0100 |
|---|---|---|
| committer | Andrea Corallo | 2020-11-26 22:03:22 +0100 |
| commit | 949b49cf771e8f38b23adb3fa4f9d7a9a5e290da (patch) | |
| tree | 37f2f19ba25e9b89f2b2c5d8b55e749e4fccef3c /test/src | |
| parent | 23c082638e77219b51e14797a0edae27ae59a9d6 (diff) | |
| download | emacs-949b49cf771e8f38b23adb3fa4f9d7a9a5e290da.tar.gz emacs-949b49cf771e8f38b23adb3fa4f9d7a9a5e290da.zip | |
Move some tests from comp-tests.el to comp-cstr-tests.el
* test/lisp/emacs-lisp/comp-cstr-tests.el
(comp-cstr-typespec-tests-alist): Add tests covering what was in:
`range-simple-union', `union-types', `destructure-type-spec'.
* test/src/comp-tests.el (range-simple-intersection, union-types)
(destructure-type-spec): Remove tests.
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/comp-tests.el | 61 |
1 files changed, 1 insertions, 60 deletions
diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el index dd642b6a66e..88c7b8c0d81 100644 --- a/test/src/comp-tests.el +++ b/test/src/comp-tests.el | |||
| @@ -970,20 +970,7 @@ Return a list of results." | |||
| 970 | ;; Range propagation tests. ;; | 970 | ;; Range propagation tests. ;; |
| 971 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 971 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 972 | 972 | ||
| 973 | (comp-deftest range-simple-union () | 973 | ;; FIXME to be removed when movable into comp-cstr-tests.el |
| 974 | (should (equal (comp-range-union '((-1 . 0)) '((3 . 4))) | ||
| 975 | '((-1 . 0) (3 . 4)))) | ||
| 976 | (should (equal (comp-range-union '((-1 . 2)) '((3 . 4))) | ||
| 977 | '((-1 . 4)))) | ||
| 978 | (should (equal (comp-range-union '((-1 . 3)) '((3 . 4))) | ||
| 979 | '((-1 . 4)))) | ||
| 980 | (should (equal (comp-range-union '((-1 . 4)) '((3 . 4))) | ||
| 981 | '((-1 . 4)))) | ||
| 982 | (should (equal (comp-range-union '((-1 . 5)) '((3 . 4))) | ||
| 983 | '((-1 . 5)))) | ||
| 984 | (should (equal (comp-range-union '((-1 . 0)) '()) | ||
| 985 | '((-1 . 0))))) | ||
| 986 | |||
| 987 | (comp-deftest range-simple-intersection () | 974 | (comp-deftest range-simple-intersection () |
| 988 | (should (equal (comp-range-intersection '((-1 . 0)) '((3 . 4))) | 975 | (should (equal (comp-range-intersection '((-1 . 0)) '((3 . 4))) |
| 989 | '())) | 976 | '())) |
| @@ -998,50 +985,4 @@ Return a list of results." | |||
| 998 | (should (equal (comp-range-intersection '((-1 . 0)) '()) | 985 | (should (equal (comp-range-intersection '((-1 . 0)) '()) |
| 999 | '()))) | 986 | '()))) |
| 1000 | 987 | ||
| 1001 | (comp-deftest union-types () | ||
| 1002 | (let ((comp-ctxt (make-comp-ctxt))) | ||
| 1003 | (should (equal (comp-union-typesets '(integer) '(number)) | ||
| 1004 | '(number))) | ||
| 1005 | (should (equal (comp-union-typesets '(integer symbol) '(number)) | ||
| 1006 | '(symbol number))) | ||
| 1007 | (should (equal (comp-union-typesets '(integer symbol) '(number list)) | ||
| 1008 | '(list symbol number))) | ||
| 1009 | (should (equal (comp-union-typesets '(integer symbol) '()) | ||
| 1010 | '(symbol integer))))) | ||
| 1011 | |||
| 1012 | (comp-deftest destructure-type-spec () | ||
| 1013 | (should (equal (comp-type-spec-to-constraint 'symbol) | ||
| 1014 | (make-comp-constraint :typeset '(symbol)))) | ||
| 1015 | (should (equal (comp-type-spec-to-constraint '(or symbol number)) | ||
| 1016 | (make-comp-constraint :typeset '(number symbol)))) | ||
| 1017 | (should-error (comp-type-spec-to-constraint '(symbol number))) | ||
| 1018 | (should (equal (comp-type-spec-to-constraint '(member foo bar)) | ||
| 1019 | (make-comp-constraint :typeset nil :valset '(foo bar)))) | ||
| 1020 | (should (equal (comp-type-spec-to-constraint '(integer 1 2)) | ||
| 1021 | (make-comp-constraint :typeset nil :range '((1 . 2))))) | ||
| 1022 | (should (equal (comp-type-spec-to-constraint '(or (integer 1 2) (integer 4 5))) | ||
| 1023 | (make-comp-constraint :typeset nil :range '((4 . 5) (1 . 2))))) | ||
| 1024 | (should (equal (comp-type-spec-to-constraint '(integer * 2)) | ||
| 1025 | (make-comp-constraint :typeset nil :range '((- . 2))))) | ||
| 1026 | (should (equal (comp-type-spec-to-constraint '(integer 1 *)) | ||
| 1027 | (make-comp-constraint :typeset nil :range '((1 . +))))) | ||
| 1028 | (should (equal (comp-type-spec-to-constraint '(integer * *)) | ||
| 1029 | (make-comp-constraint :typeset nil :range '((- . +))))) | ||
| 1030 | (should (equal (comp-type-spec-to-constraint '(or (integer 1 2) | ||
| 1031 | (member foo bar))) | ||
| 1032 | (make-comp-constraint :typeset nil | ||
| 1033 | :valset '(foo bar) | ||
| 1034 | :range '((1 . 2))))) | ||
| 1035 | (should (equal (comp-type-spec-to-constraint | ||
| 1036 | '(function (t t) cons)) | ||
| 1037 | (make-comp-constraint-f | ||
| 1038 | :args `(,(make-comp-constraint :typeset '(t)) | ||
| 1039 | ,(make-comp-constraint :typeset '(t))) | ||
| 1040 | :ret (make-comp-constraint :typeset '(cons))))) | ||
| 1041 | (should (equal (comp-type-spec-to-constraint | ||
| 1042 | '(function ((or integer symbol)) float)) | ||
| 1043 | (make-comp-constraint-f | ||
| 1044 | :args `(,(make-comp-constraint :typeset '(symbol integer))) | ||
| 1045 | :ret (make-comp-constraint :typeset '(float)))))) | ||
| 1046 | |||
| 1047 | ;;; comp-tests.el ends here | 988 | ;;; comp-tests.el ends here |