From: Andrea Corallo Date: Mon, 7 Dec 2020 20:41:49 +0000 (+0100) Subject: * Enumerate type specifier tests to ease debugging X-Git-Tag: emacs-28.0.90~2727^2~274 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=725c7e1416872f199bf544486fc20243a5ada2db;p=emacs.git * Enumerate type specifier tests to ease debugging * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-typespec-tests-alist): Enumerate tests. Acked-by: Andrea Corallo --- diff --git a/test/lisp/emacs-lisp/comp-cstr-tests.el b/test/lisp/emacs-lisp/comp-cstr-tests.el index 6e1d0d463e1..0c1d27e4d17 100644 --- a/test/lisp/emacs-lisp/comp-cstr-tests.el +++ b/test/lisp/emacs-lisp/comp-cstr-tests.el @@ -40,67 +40,121 @@ ',expected-type-spec)))) (defconst comp-cstr-typespec-tests-alist - `((symbol . symbol) + `(;; 1 + (symbol . symbol) + ;; 2 ((or string array) . array) + ;; 3 ((or symbol number) . (or symbol number)) + ;; 4 ((or cons atom) . (or cons atom)) ;; SBCL return T + ;; 5 ((or integer number) . number) + ;; 6 ((or (or integer symbol) number) . (or symbol number)) + ;; 7 ((or (or integer symbol) (or number list)) . (or list symbol number)) + ;; 8 ((or (or integer number) nil) . number) + ;; 9 ((member foo) . (member foo)) + ;; 10 ((member foo bar) . (member foo bar)) + ;; 11 ((or (member foo) (member bar)) . (member foo bar)) + ;; 12 ((or (member foo) symbol) . symbol) ;; SBCL return (OR SYMBOL (MEMBER FOO)) + ;; 13 ((or (member foo) number) . (or (member foo) number)) + ;; 14 ((or (integer 1 3) number) . number) + ;; 15 (integer . integer) + ;; 16 ((integer 1 2) . (integer 1 2)) + ;; 17 ((or (integer -1 0) (integer 3 4)) . (or (integer -1 0) (integer 3 4))) + ;; 18 ((or (integer -1 2) (integer 3 4)) . (integer -1 4)) + ;; 19 ((or (integer -1 3) (integer 3 4)) . (integer -1 4)) + ;; 20 ((or (integer -1 4) (integer 3 4)) . (integer -1 4)) + ;; 21 ((or (integer -1 5) (integer 3 4)) . (integer -1 5)) + ;; 22 ((or (integer -1 *) (integer 3 4)) . (integer -1 *)) + ;; 23 ((or (integer -1 2) (integer * 4)) . (integer * 4)) + ;; 24 ((and string array) . string) + ;; 25 ((and cons atom) . nil) + ;; 26 ((and (member foo) (member foo bar baz)) . (member foo)) + ;; 27 ((and (member foo) (member bar)) . nil) + ;; 28 ((and (member foo) symbol) . (member foo)) + ;; 29 ((and (member foo) string) . nil) + ;; 30 ((and (member foo) (integer 1 2)) . nil) + ;; 31 ((and (member 1 2) (member 3 2)) . (member 2)) + ;; 32 ((and number (integer 1 2)) . number) + ;; 33 ((and integer (integer 1 2)) . integer) + ;; 34 ((and (integer -1 0) (integer 3 5)) . nil) + ;; 35 ((and (integer -1 2) (integer 3 5)) . nil) + ;; 36 ((and (integer -1 3) (integer 3 5)) . (integer 3 3)) + ;; 37 ((and (integer -1 4) (integer 3 5)) . (integer 3 4)) + ;; 38 ((and (integer -1 5) nil) . nil) + ;; 39 ((not symbol) . (not symbol)) + ;; 40 ((or (member foo) (not (member foo bar))) . (not (member bar))) + ;; 41 ((or (member foo bar) (not (member foo))) . t) - ;; Intentionally conservative, see `comp-cstr-union-1-no-mem'. + ;; 42 Intentionally conservative, see `comp-cstr-union-1-no-mem'. ((or symbol (not sequence)) . t) + ;; 43 ((or symbol (not symbol)) . t) - ;; Conservative. + ;; 44 Conservative. ((or symbol (not sequence)) . t) + ;; 45 ((or vector (not sequence)) . (not sequence)) + ;; 46 ((or (integer 1 10) (not (integer * 5))) . (integer 1 *)) + ;; 47 ((or symbol (integer 1 10) (not (integer * 5))) . (or symbol (integer 1 *))) + ;; 48 ((or (not symbol) (integer 1 10) (not (integer * 5))) . (not (or symbol (integer * 0)))) + ;; 49 ((or symbol (not (member foo))) . (not (member foo))) + ;; 50 ((or (not symbol) (not (member foo))) . (not symbol)) - ;; Conservative. + ;; 51 Conservative. ((or (not (member foo)) string) . (not (member foo))) - ;; Conservative. + ;; 52 Conservative. ((or (member foo) (not string)) . (not string)) + ;; 53 ((or (not (integer 1 2)) integer) . integer) + ;; 54 ((or (not (integer 1 2)) (not integer)) . (not integer)) + ;; 55 ((or (integer 1 2) (not integer)) . (not (or integer (integer * 0) (integer 3 *)))) + ;; 56 ((or number (not (integer 1 2))) . t) + ;; 57 ((or atom (not (integer 1 2))) . t) + ;; 58 ((or atom (not (member foo))) . t)) "Alist type specifier -> expected type specifier.") @@ -108,7 +162,7 @@ "Generate all tests from `comp-cstr-typespec-tests-alist'." `(progn ,@(cl-loop - for i from 0 + for i from 1 for (ts . exp-ts) in comp-cstr-typespec-tests-alist append (list (comp-cstr-typespec-test i ts exp-ts)))))