diff options
| author | Yuan Fu | 2022-10-05 14:22:03 -0700 |
|---|---|---|
| committer | Yuan Fu | 2022-10-05 14:22:03 -0700 |
| commit | 7ebbd4efc3d45403cf845d35c36c21756baeeba8 (patch) | |
| tree | f53223ce7dbd64c079aced6e1a77964d1a8eaa3f /test/src | |
| parent | cb183f6467401fb5ed2b7fc98ca75be9d943cbe3 (diff) | |
| parent | 95efafb72664049f8ac825047df3645656cf76f4 (diff) | |
| download | emacs-7ebbd4efc3d45403cf845d35c36c21756baeeba8.tar.gz emacs-7ebbd4efc3d45403cf845d35c36c21756baeeba8.zip | |
Merge branch 'master' into feature/tree-sitter
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/buffer-tests.el | 193 | ||||
| -rw-r--r-- | test/src/casefiddle-tests.el | 6 | ||||
| -rw-r--r-- | test/src/comp-tests.el | 157 | ||||
| -rw-r--r-- | test/src/data-tests.el | 3 | ||||
| -rw-r--r-- | test/src/emacs-module-resources/mod-test.c | 1 | ||||
| -rw-r--r-- | test/src/eval-tests.el | 20 | ||||
| -rw-r--r-- | test/src/fns-tests.el | 118 | ||||
| -rw-r--r-- | test/src/image-tests.el | 190 | ||||
| -rw-r--r-- | test/src/print-tests.el | 6 | ||||
| -rw-r--r-- | test/src/process-tests.el | 4 |
10 files changed, 368 insertions, 330 deletions
diff --git a/test/src/buffer-tests.el b/test/src/buffer-tests.el index 3c6a9208ffa..558d05de14a 100644 --- a/test/src/buffer-tests.el +++ b/test/src/buffer-tests.el | |||
| @@ -22,6 +22,199 @@ | |||
| 22 | (require 'ert) | 22 | (require 'ert) |
| 23 | (require 'ert-x) | 23 | (require 'ert-x) |
| 24 | (require 'cl-lib) | 24 | (require 'cl-lib) |
| 25 | (require 'let-alist) | ||
| 26 | |||
| 27 | (defun overlay-tests-start-recording-modification-hooks (overlay) | ||
| 28 | "Start recording modification hooks on OVERLAY. | ||
| 29 | |||
| 30 | Always overwrites the `insert-in-front-hooks', | ||
| 31 | `modification-hooks' and `insert-behind-hooks' properties. Any | ||
| 32 | recorded history from a previous call is erased. | ||
| 33 | |||
| 34 | The history is stored in a property on the overlay itself. Call | ||
| 35 | `overlay-tests-get-recorded-modification-hooks' to retrieve the | ||
| 36 | recorded calls conveniently." | ||
| 37 | (dolist (hooks-property '(insert-in-front-hooks | ||
| 38 | modification-hooks | ||
| 39 | insert-behind-hooks)) | ||
| 40 | (overlay-put | ||
| 41 | overlay | ||
| 42 | hooks-property | ||
| 43 | (list (lambda (ov &rest args) | ||
| 44 | (message " %S called on %S with args %S" hooks-property ov args) | ||
| 45 | (should inhibit-modification-hooks) | ||
| 46 | (should (eq ov overlay)) | ||
| 47 | (push (list hooks-property args) | ||
| 48 | (overlay-get overlay | ||
| 49 | 'recorded-modification-hook-calls))))) | ||
| 50 | (overlay-put overlay 'recorded-modification-hook-calls nil))) | ||
| 51 | |||
| 52 | (defun overlay-tests-get-recorded-modification-hooks (overlay) | ||
| 53 | "Extract the recorded calls made to modification hooks on OVERLAY. | ||
| 54 | |||
| 55 | Must be preceded by a call to | ||
| 56 | `overlay-tests-start-recording-modification-hooks' on OVERLAY. | ||
| 57 | |||
| 58 | Returns a list. Each element of the list represents a recorded | ||
| 59 | call to a particular modification hook. | ||
| 60 | |||
| 61 | Each call is itself a sub-list where the first element is a | ||
| 62 | symbol matching the modification hook property (one of | ||
| 63 | `insert-in-front-hooks', `modification-hooks' or | ||
| 64 | `insert-behind-hooks') and the second element is the list of | ||
| 65 | arguments passed to the hook. The first hook argument, the | ||
| 66 | overlay itself, is omitted to make test result verification | ||
| 67 | easier." | ||
| 68 | (reverse (overlay-get overlay | ||
| 69 | 'recorded-modification-hook-calls))) | ||
| 70 | |||
| 71 | (ert-deftest overlay-modification-hooks () | ||
| 72 | "Test the basic functionality of overlay modification hooks. | ||
| 73 | |||
| 74 | This exercises hooks registered on the `insert-in-front-hooks', | ||
| 75 | `modification-hooks' and `insert-behind-hooks' overlay | ||
| 76 | properties." | ||
| 77 | ;; This is a data driven test loop. Each test case is described | ||
| 78 | ;; by an alist. The test loop initializes a new temporary buffer | ||
| 79 | ;; for each case, creates an overlay, registers modification hooks | ||
| 80 | ;; on the overlay, modifies the buffer, and then verifies which | ||
| 81 | ;; modification hooks (if any) were called for the overlay, as | ||
| 82 | ;; well as which arguments were passed to the hooks. | ||
| 83 | ;; | ||
| 84 | ;; The following keys are available in the alist: | ||
| 85 | ;; | ||
| 86 | ;; `buffer-text': the initial buffer text of the temporary buffer. | ||
| 87 | ;; Defaults to "1234". | ||
| 88 | ;; | ||
| 89 | ;; `overlay-beg' and `overlay-end': the begin and end positions of | ||
| 90 | ;; the overlay under test. Defaults to 2 and 4 respectively. | ||
| 91 | ;; | ||
| 92 | ;; `insert-at': move to the given position and insert the string | ||
| 93 | ;; "x" into the test case's buffer. | ||
| 94 | ;; | ||
| 95 | ;; `replace': replace the first occurrence of the given string in | ||
| 96 | ;; the test case's buffer with "x". The test will fail if the | ||
| 97 | ;; string is not found. | ||
| 98 | ;; | ||
| 99 | ;; `expected-calls': a description of the expected buffer | ||
| 100 | ;; modification hooks. See | ||
| 101 | ;; `overlay-tests-get-recorded-modification-hooks' for the format. | ||
| 102 | ;; May be omitted, in which case the test will insist that no | ||
| 103 | ;; modification hooks are called. | ||
| 104 | ;; | ||
| 105 | ;; The test will fail itself in the degenerate case where no | ||
| 106 | ;; buffer modifications are requested. | ||
| 107 | (dolist (test-case | ||
| 108 | '( | ||
| 109 | ;; Remember that the default buffer text is "1234" and | ||
| 110 | ;; the default overlay begins at position 2 and ends at | ||
| 111 | ;; position 4. Most of the test cases below assume | ||
| 112 | ;; this. | ||
| 113 | |||
| 114 | ;; TODO: (info "(elisp) Special Properties") says this | ||
| 115 | ;; about `modification-hooks': "Furthermore, insertion | ||
| 116 | ;; will not modify any existing character, so this hook | ||
| 117 | ;; will only be run when removing some characters, | ||
| 118 | ;; replacing them with others, or changing their | ||
| 119 | ;; text-properties." So, why are modification-hooks | ||
| 120 | ;; being called when inserting at position 3 below? | ||
| 121 | ((insert-at . 1)) | ||
| 122 | ((insert-at . 2) | ||
| 123 | (expected-calls . ((insert-in-front-hooks (nil 2 2)) | ||
| 124 | (insert-in-front-hooks (t 2 3 0))))) | ||
| 125 | ((insert-at . 3) | ||
| 126 | (expected-calls . ((modification-hooks (nil 3 3)) | ||
| 127 | (modification-hooks (t 3 4 0))))) | ||
| 128 | ((insert-at . 4) | ||
| 129 | (expected-calls . ((insert-behind-hooks (nil 4 4)) | ||
| 130 | (insert-behind-hooks (t 4 5 0))))) | ||
| 131 | ((insert-at . 5)) | ||
| 132 | |||
| 133 | ;; Replacing text never calls `insert-in-front-hooks' | ||
| 134 | ;; or `insert-behind-hooks'. It calls | ||
| 135 | ;; `modification-hooks' if the overlay covers any text | ||
| 136 | ;; that has changed. | ||
| 137 | ((replace . "1")) | ||
| 138 | ((replace . "2") | ||
| 139 | (expected-calls . ((modification-hooks (nil 2 3)) | ||
| 140 | (modification-hooks (t 2 3 1))))) | ||
| 141 | ((replace . "3") | ||
| 142 | (expected-calls . ((modification-hooks (nil 3 4)) | ||
| 143 | (modification-hooks (t 3 4 1))))) | ||
| 144 | ((replace . "4")) | ||
| 145 | ((replace . "12") | ||
| 146 | (expected-calls . ((modification-hooks (nil 1 3)) | ||
| 147 | (modification-hooks (t 1 2 2))))) | ||
| 148 | ((replace . "23") | ||
| 149 | (expected-calls . ((modification-hooks (nil 2 4)) | ||
| 150 | (modification-hooks (t 2 3 2))))) | ||
| 151 | ((replace . "34") | ||
| 152 | (expected-calls . ((modification-hooks (nil 3 5)) | ||
| 153 | (modification-hooks (t 3 4 2))))) | ||
| 154 | ((replace . "123") | ||
| 155 | (expected-calls . ((modification-hooks (nil 1 4)) | ||
| 156 | (modification-hooks (t 1 2 3))))) | ||
| 157 | ((replace . "234") | ||
| 158 | (expected-calls . ((modification-hooks (nil 2 5)) | ||
| 159 | (modification-hooks (t 2 3 3))))) | ||
| 160 | ((replace . "1234") | ||
| 161 | (expected-calls . ((modification-hooks (nil 1 5)) | ||
| 162 | (modification-hooks (t 1 2 4))))) | ||
| 163 | |||
| 164 | ;; Inserting at the position of a zero-length overlay | ||
| 165 | ;; calls both `insert-in-front-hooks' and | ||
| 166 | ;; `insert-behind-hooks'. | ||
| 167 | ((buffer-text . "") (overlay-beg . 1) (overlay-end . 1) | ||
| 168 | (insert-at . 1) | ||
| 169 | (expected-calls . ((insert-in-front-hooks | ||
| 170 | (nil 1 1)) | ||
| 171 | (insert-behind-hooks | ||
| 172 | (nil 1 1)) | ||
| 173 | (insert-in-front-hooks | ||
| 174 | (t 1 2 0)) | ||
| 175 | (insert-behind-hooks | ||
| 176 | (t 1 2 0))))))) | ||
| 177 | (message "BEGIN overlay-modification-hooks test-case %S" test-case) | ||
| 178 | |||
| 179 | ;; All three hooks ignore the overlay's `front-advance' and | ||
| 180 | ;; `rear-advance' option, so test both ways while expecting the same | ||
| 181 | ;; result. | ||
| 182 | (dolist (advance '(nil t)) | ||
| 183 | (message " advance is %S" advance) | ||
| 184 | (let-alist test-case | ||
| 185 | (with-temp-buffer | ||
| 186 | ;; Set up the temporary buffer and overlay as specified by | ||
| 187 | ;; the test case. | ||
| 188 | (insert (or .buffer-text "1234")) | ||
| 189 | (let ((overlay (make-overlay | ||
| 190 | (or .overlay-beg 2) | ||
| 191 | (or .overlay-end 4) | ||
| 192 | nil | ||
| 193 | advance advance))) | ||
| 194 | (message " (buffer-string) is %S" (buffer-string)) | ||
| 195 | (message " overlay is %S" overlay) | ||
| 196 | (overlay-tests-start-recording-modification-hooks overlay) | ||
| 197 | |||
| 198 | ;; Modify the buffer, possibly inducing calls to the | ||
| 199 | ;; overlay's modification hooks. | ||
| 200 | (should (or .insert-at .replace)) | ||
| 201 | (when .insert-at | ||
| 202 | (goto-char .insert-at) | ||
| 203 | (insert "x") | ||
| 204 | (message " inserted \"x\" at %S, buffer-string now %S" | ||
| 205 | .insert-at (buffer-string))) | ||
| 206 | (when .replace | ||
| 207 | (goto-char (point-min)) | ||
| 208 | (search-forward .replace) | ||
| 209 | (replace-match "x") | ||
| 210 | (message " replaced %S with \"x\"" .replace)) | ||
| 211 | |||
| 212 | ;; Verify that the expected and actual modification hook | ||
| 213 | ;; calls match. | ||
| 214 | (should (equal | ||
| 215 | .expected-calls | ||
| 216 | (overlay-tests-get-recorded-modification-hooks | ||
| 217 | overlay))))))))) | ||
| 25 | 218 | ||
| 26 | (ert-deftest overlay-modification-hooks-message-other-buf () | 219 | (ert-deftest overlay-modification-hooks-message-other-buf () |
| 27 | "Test for bug#21824. | 220 | "Test for bug#21824. |
diff --git a/test/src/casefiddle-tests.el b/test/src/casefiddle-tests.el index eb096f21129..652af417293 100644 --- a/test/src/casefiddle-tests.el +++ b/test/src/casefiddle-tests.el | |||
| @@ -57,7 +57,7 @@ | |||
| 57 | errors))) | 57 | errors))) |
| 58 | (setq expected (cdr expected))))) | 58 | (setq expected (cdr expected))))) |
| 59 | (when errors | 59 | (when errors |
| 60 | (ert-fail (mapconcat (lambda (line) line) (nreverse errors) ""))))) | 60 | (ert-fail (mapconcat #'identity (nreverse errors)))))) |
| 61 | 61 | ||
| 62 | 62 | ||
| 63 | (defconst casefiddle-tests--characters | 63 | (defconst casefiddle-tests--characters |
| @@ -98,7 +98,7 @@ | |||
| 98 | errors))) | 98 | errors))) |
| 99 | (setq props (cdr props) tabs (cdr tabs) expected (cdr expected))))) | 99 | (setq props (cdr props) tabs (cdr tabs) expected (cdr expected))))) |
| 100 | (when errors | 100 | (when errors |
| 101 | (mapconcat (lambda (line) line) (nreverse errors) ""))))) | 101 | (mapconcat #'identity (nreverse errors)))))) |
| 102 | 102 | ||
| 103 | 103 | ||
| 104 | (ert-deftest casefiddle-tests-casing-character () | 104 | (ert-deftest casefiddle-tests-casing-character () |
| @@ -116,7 +116,7 @@ | |||
| 116 | errors))) | 116 | errors))) |
| 117 | (setq funcs (cdr funcs) expected (cdr expected))))) | 117 | (setq funcs (cdr funcs) expected (cdr expected))))) |
| 118 | (when errors | 118 | (when errors |
| 119 | (mapconcat (lambda (line) line) (nreverse errors) ""))))) | 119 | (mapconcat (lambda (line) line) (nreverse errors)))))) |
| 120 | 120 | ||
| 121 | 121 | ||
| 122 | (ert-deftest casefiddle-tests-casing-word () | 122 | (ert-deftest casefiddle-tests-casing-word () |
diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el index 1b239cec795..1edbd1777c6 100644 --- a/test/src/comp-tests.el +++ b/test/src/comp-tests.el | |||
| @@ -860,21 +860,26 @@ Return a list of results." | |||
| 860 | 860 | ||
| 861 | (cl-eval-when (compile eval load) | 861 | (cl-eval-when (compile eval load) |
| 862 | (defconst comp-tests-type-spec-tests | 862 | (defconst comp-tests-type-spec-tests |
| 863 | `( | 863 | ;; Why we quote everything here, you ask? So that values of |
| 864 | ;; `most-positive-fixnum' and `most-negative-fixnum', which can be | ||
| 865 | ;; architecture-dependent, do not end up hardcoded in the | ||
| 866 | ;; resulting byte-compiled file, and thus we could run the same | ||
| 867 | ;; .elc file on several architectures without fear. | ||
| 868 | '( | ||
| 864 | ;; 1 | 869 | ;; 1 |
| 865 | ((defun comp-tests-ret-type-spec-f (x) | 870 | ((defun comp-tests-ret-type-spec-f (x) |
| 866 | x) | 871 | x) |
| 867 | t) | 872 | 't) |
| 868 | 873 | ||
| 869 | ;; 2 | 874 | ;; 2 |
| 870 | ((defun comp-tests-ret-type-spec-f () | 875 | ((defun comp-tests-ret-type-spec-f () |
| 871 | 1) | 876 | 1) |
| 872 | (integer 1 1)) | 877 | '(integer 1 1)) |
| 873 | 878 | ||
| 874 | ;; 3 | 879 | ;; 3 |
| 875 | ((defun comp-tests-ret-type-spec-f (x) | 880 | ((defun comp-tests-ret-type-spec-f (x) |
| 876 | (if x 1 3)) | 881 | (if x 1 3)) |
| 877 | (or (integer 1 1) (integer 3 3))) | 882 | '(or (integer 1 1) (integer 3 3))) |
| 878 | 883 | ||
| 879 | ;; 4 | 884 | ;; 4 |
| 880 | ((defun comp-tests-ret-type-spec-f (x) | 885 | ((defun comp-tests-ret-type-spec-f (x) |
| @@ -883,7 +888,7 @@ Return a list of results." | |||
| 883 | (setf y 1) | 888 | (setf y 1) |
| 884 | (setf y 2)) | 889 | (setf y 2)) |
| 885 | y)) | 890 | y)) |
| 886 | (integer 1 2)) | 891 | '(integer 1 2)) |
| 887 | 892 | ||
| 888 | ;; 5 | 893 | ;; 5 |
| 889 | ((defun comp-tests-ret-type-spec-f (x) | 894 | ((defun comp-tests-ret-type-spec-f (x) |
| @@ -892,73 +897,73 @@ Return a list of results." | |||
| 892 | (setf y 1) | 897 | (setf y 1) |
| 893 | (setf y 3)) | 898 | (setf y 3)) |
| 894 | y)) | 899 | y)) |
| 895 | (or (integer 1 1) (integer 3 3))) | 900 | '(or (integer 1 1) (integer 3 3))) |
| 896 | 901 | ||
| 897 | ;; 6 | 902 | ;; 6 |
| 898 | ((defun comp-tests-ret-type-spec-f (x) | 903 | ((defun comp-tests-ret-type-spec-f (x) |
| 899 | (if x | 904 | (if x |
| 900 | (list x) | 905 | (list x) |
| 901 | 3)) | 906 | 3)) |
| 902 | (or cons (integer 3 3))) | 907 | '(or cons (integer 3 3))) |
| 903 | 908 | ||
| 904 | ;; 7 | 909 | ;; 7 |
| 905 | ((defun comp-tests-ret-type-spec-f (x) | 910 | ((defun comp-tests-ret-type-spec-f (x) |
| 906 | (if x | 911 | (if x |
| 907 | 'foo | 912 | 'foo |
| 908 | 3)) | 913 | 3)) |
| 909 | (or (member foo) (integer 3 3))) | 914 | '(or (member foo) (integer 3 3))) |
| 910 | 915 | ||
| 911 | ;; 8 | 916 | ;; 8 |
| 912 | ((defun comp-tests-ret-type-spec-f (x) | 917 | ((defun comp-tests-ret-type-spec-f (x) |
| 913 | (if (eq x 3) | 918 | (if (eq x 3) |
| 914 | x | 919 | x |
| 915 | 'foo)) | 920 | 'foo)) |
| 916 | (or (member foo) (integer 3 3))) | 921 | '(or (member foo) (integer 3 3))) |
| 917 | 922 | ||
| 918 | ;; 9 | 923 | ;; 9 |
| 919 | ((defun comp-tests-ret-type-spec-f (x) | 924 | ((defun comp-tests-ret-type-spec-f (x) |
| 920 | (if (eq 3 x) | 925 | (if (eq 3 x) |
| 921 | x | 926 | x |
| 922 | 'foo)) | 927 | 'foo)) |
| 923 | (or (member foo) (integer 3 3))) | 928 | '(or (member foo) (integer 3 3))) |
| 924 | 929 | ||
| 925 | ;; 10 | 930 | ;; 10 |
| 926 | ((defun comp-tests-ret-type-spec-f (x) | 931 | ((defun comp-tests-ret-type-spec-f (x) |
| 927 | (if (eql x 3) | 932 | (if (eql x 3) |
| 928 | x | 933 | x |
| 929 | 'foo)) | 934 | 'foo)) |
| 930 | (or (member foo) (integer 3 3))) | 935 | '(or (member foo) (integer 3 3))) |
| 931 | 936 | ||
| 932 | ;; 11 | 937 | ;; 11 |
| 933 | ((defun comp-tests-ret-type-spec-f (x) | 938 | ((defun comp-tests-ret-type-spec-f (x) |
| 934 | (if (eql 3 x) | 939 | (if (eql 3 x) |
| 935 | x | 940 | x |
| 936 | 'foo)) | 941 | 'foo)) |
| 937 | (or (member foo) (integer 3 3))) | 942 | '(or (member foo) (integer 3 3))) |
| 938 | 943 | ||
| 939 | ;; 12 | 944 | ;; 12 |
| 940 | ((defun comp-tests-ret-type-spec-f (x) | 945 | ((defun comp-tests-ret-type-spec-f (x) |
| 941 | (if (eql x 3) | 946 | (if (eql x 3) |
| 942 | 'foo | 947 | 'foo |
| 943 | x)) | 948 | x)) |
| 944 | (not (integer 3 3))) | 949 | '(not (integer 3 3))) |
| 945 | 950 | ||
| 946 | ;; 13 | 951 | ;; 13 |
| 947 | ((defun comp-tests-ret-type-spec-f (x y) | 952 | ((defun comp-tests-ret-type-spec-f (x y) |
| 948 | (if (= x y) | 953 | (if (= x y) |
| 949 | x | 954 | x |
| 950 | 'foo)) | 955 | 'foo)) |
| 951 | (or (member foo) marker number)) | 956 | '(or (member foo) marker number)) |
| 952 | 957 | ||
| 953 | ;; 14 | 958 | ;; 14 |
| 954 | ((defun comp-tests-ret-type-spec-f (x) | 959 | ((defun comp-tests-ret-type-spec-f (x) |
| 955 | (comp-hint-fixnum x)) | 960 | (comp-hint-fixnum x)) |
| 956 | (integer ,most-negative-fixnum ,most-positive-fixnum)) | 961 | `(integer ,most-negative-fixnum ,most-positive-fixnum)) |
| 957 | 962 | ||
| 958 | ;; 15 | 963 | ;; 15 |
| 959 | ((defun comp-tests-ret-type-spec-f (x) | 964 | ((defun comp-tests-ret-type-spec-f (x) |
| 960 | (comp-hint-cons x)) | 965 | (comp-hint-cons x)) |
| 961 | cons) | 966 | 'cons) |
| 962 | 967 | ||
| 963 | ;; 16 | 968 | ;; 16 |
| 964 | ((defun comp-tests-ret-type-spec-f (x) | 969 | ((defun comp-tests-ret-type-spec-f (x) |
| @@ -966,7 +971,7 @@ Return a list of results." | |||
| 966 | (when x | 971 | (when x |
| 967 | (setf y 4)) | 972 | (setf y 4)) |
| 968 | y)) | 973 | y)) |
| 969 | (or null (integer 4 4))) | 974 | '(or null (integer 4 4))) |
| 970 | 975 | ||
| 971 | ;; 17 | 976 | ;; 17 |
| 972 | ((defun comp-tests-ret-type-spec-f () | 977 | ((defun comp-tests-ret-type-spec-f () |
| @@ -974,7 +979,7 @@ Return a list of results." | |||
| 974 | (y 3)) | 979 | (y 3)) |
| 975 | (setf x y) | 980 | (setf x y) |
| 976 | y)) | 981 | y)) |
| 977 | (integer 3 3)) | 982 | '(integer 3 3)) |
| 978 | 983 | ||
| 979 | ;; 18 | 984 | ;; 18 |
| 980 | ((defun comp-tests-ret-type-spec-f (x) | 985 | ((defun comp-tests-ret-type-spec-f (x) |
| @@ -982,120 +987,120 @@ Return a list of results." | |||
| 982 | (when x | 987 | (when x |
| 983 | (setf y x)) | 988 | (setf y x)) |
| 984 | y)) | 989 | y)) |
| 985 | t) | 990 | 't) |
| 986 | 991 | ||
| 987 | ;; 19 | 992 | ;; 19 |
| 988 | ((defun comp-tests-ret-type-spec-f (x y) | 993 | ((defun comp-tests-ret-type-spec-f (x y) |
| 989 | (eq x y)) | 994 | (eq x y)) |
| 990 | boolean) | 995 | 'boolean) |
| 991 | 996 | ||
| 992 | ;; 20 | 997 | ;; 20 |
| 993 | ((defun comp-tests-ret-type-spec-f (x) | 998 | ((defun comp-tests-ret-type-spec-f (x) |
| 994 | (when x | 999 | (when x |
| 995 | 'foo)) | 1000 | 'foo)) |
| 996 | (or (member foo) null)) | 1001 | '(or (member foo) null)) |
| 997 | 1002 | ||
| 998 | ;; 21 | 1003 | ;; 21 |
| 999 | ((defun comp-tests-ret-type-spec-f (x) | 1004 | ((defun comp-tests-ret-type-spec-f (x) |
| 1000 | (unless x | 1005 | (unless x |
| 1001 | 'foo)) | 1006 | 'foo)) |
| 1002 | (or (member foo) null)) | 1007 | '(or (member foo) null)) |
| 1003 | 1008 | ||
| 1004 | ;; 22 | 1009 | ;; 22 |
| 1005 | ((defun comp-tests-ret-type-spec-f (x) | 1010 | ((defun comp-tests-ret-type-spec-f (x) |
| 1006 | (when (> x 3) | 1011 | (when (> x 3) |
| 1007 | x)) | 1012 | x)) |
| 1008 | (or null float (integer 4 *))) | 1013 | '(or null float (integer 4 *))) |
| 1009 | 1014 | ||
| 1010 | ;; 23 | 1015 | ;; 23 |
| 1011 | ((defun comp-tests-ret-type-spec-f (x) | 1016 | ((defun comp-tests-ret-type-spec-f (x) |
| 1012 | (when (>= x 3) | 1017 | (when (>= x 3) |
| 1013 | x)) | 1018 | x)) |
| 1014 | (or null float (integer 3 *))) | 1019 | '(or null float (integer 3 *))) |
| 1015 | 1020 | ||
| 1016 | ;; 24 | 1021 | ;; 24 |
| 1017 | ((defun comp-tests-ret-type-spec-f (x) | 1022 | ((defun comp-tests-ret-type-spec-f (x) |
| 1018 | (when (< x 3) | 1023 | (when (< x 3) |
| 1019 | x)) | 1024 | x)) |
| 1020 | (or null float (integer * 2))) | 1025 | '(or null float (integer * 2))) |
| 1021 | 1026 | ||
| 1022 | ;; 25 | 1027 | ;; 25 |
| 1023 | ((defun comp-tests-ret-type-spec-f (x) | 1028 | ((defun comp-tests-ret-type-spec-f (x) |
| 1024 | (when (<= x 3) | 1029 | (when (<= x 3) |
| 1025 | x)) | 1030 | x)) |
| 1026 | (or null float (integer * 3))) | 1031 | '(or null float (integer * 3))) |
| 1027 | 1032 | ||
| 1028 | ;; 26 | 1033 | ;; 26 |
| 1029 | ((defun comp-tests-ret-type-spec-f (x) | 1034 | ((defun comp-tests-ret-type-spec-f (x) |
| 1030 | (when (> 3 x) | 1035 | (when (> 3 x) |
| 1031 | x)) | 1036 | x)) |
| 1032 | (or null float (integer * 2))) | 1037 | '(or null float (integer * 2))) |
| 1033 | 1038 | ||
| 1034 | ;; 27 | 1039 | ;; 27 |
| 1035 | ((defun comp-tests-ret-type-spec-f (x) | 1040 | ((defun comp-tests-ret-type-spec-f (x) |
| 1036 | (when (>= 3 x) | 1041 | (when (>= 3 x) |
| 1037 | x)) | 1042 | x)) |
| 1038 | (or null float (integer * 3))) | 1043 | '(or null float (integer * 3))) |
| 1039 | 1044 | ||
| 1040 | ;; 28 | 1045 | ;; 28 |
| 1041 | ((defun comp-tests-ret-type-spec-f (x) | 1046 | ((defun comp-tests-ret-type-spec-f (x) |
| 1042 | (when (< 3 x) | 1047 | (when (< 3 x) |
| 1043 | x)) | 1048 | x)) |
| 1044 | (or null float (integer 4 *))) | 1049 | '(or null float (integer 4 *))) |
| 1045 | 1050 | ||
| 1046 | ;; 29 | 1051 | ;; 29 |
| 1047 | ((defun comp-tests-ret-type-spec-f (x) | 1052 | ((defun comp-tests-ret-type-spec-f (x) |
| 1048 | (when (<= 3 x) | 1053 | (when (<= 3 x) |
| 1049 | x)) | 1054 | x)) |
| 1050 | (or null float (integer 3 *))) | 1055 | '(or null float (integer 3 *))) |
| 1051 | 1056 | ||
| 1052 | ;; 30 | 1057 | ;; 30 |
| 1053 | ((defun comp-tests-ret-type-spec-f (x) | 1058 | ((defun comp-tests-ret-type-spec-f (x) |
| 1054 | (let ((y 3)) | 1059 | (let ((y 3)) |
| 1055 | (when (> x y) | 1060 | (when (> x y) |
| 1056 | x))) | 1061 | x))) |
| 1057 | (or null float (integer 4 *))) | 1062 | '(or null float (integer 4 *))) |
| 1058 | 1063 | ||
| 1059 | ;; 31 | 1064 | ;; 31 |
| 1060 | ((defun comp-tests-ret-type-spec-f (x) | 1065 | ((defun comp-tests-ret-type-spec-f (x) |
| 1061 | (let ((y 3)) | 1066 | (let ((y 3)) |
| 1062 | (when (> y x) | 1067 | (when (> y x) |
| 1063 | x))) | 1068 | x))) |
| 1064 | (or null float (integer * 2))) | 1069 | '(or null float (integer * 2))) |
| 1065 | 1070 | ||
| 1066 | ;; 32 | 1071 | ;; 32 |
| 1067 | ((defun comp-tests-ret-type-spec-f (x) | 1072 | ((defun comp-tests-ret-type-spec-f (x) |
| 1068 | (when (and (> x 3) | 1073 | (when (and (> x 3) |
| 1069 | (< x 10)) | 1074 | (< x 10)) |
| 1070 | x)) | 1075 | x)) |
| 1071 | (or null float (integer 4 9))) | 1076 | '(or null float (integer 4 9))) |
| 1072 | 1077 | ||
| 1073 | ;; 33 | 1078 | ;; 33 |
| 1074 | ((defun comp-tests-ret-type-spec-f (x) | 1079 | ((defun comp-tests-ret-type-spec-f (x) |
| 1075 | (when (or (> x 3) | 1080 | (when (or (> x 3) |
| 1076 | (< x 10)) | 1081 | (< x 10)) |
| 1077 | x)) | 1082 | x)) |
| 1078 | (or null float integer)) | 1083 | '(or null float integer)) |
| 1079 | 1084 | ||
| 1080 | ;; 34 | 1085 | ;; 34 |
| 1081 | ((defun comp-tests-ret-type-spec-f (x) | 1086 | ((defun comp-tests-ret-type-spec-f (x) |
| 1082 | (when (or (< x 3) | 1087 | (when (or (< x 3) |
| 1083 | (> x 10)) | 1088 | (> x 10)) |
| 1084 | x)) | 1089 | x)) |
| 1085 | (or null float (integer * 2) (integer 11 *))) | 1090 | '(or null float (integer * 2) (integer 11 *))) |
| 1086 | 1091 | ||
| 1087 | ;; 35 No float range support. | 1092 | ;; 35 No float range support. |
| 1088 | ((defun comp-tests-ret-type-spec-f (x) | 1093 | ((defun comp-tests-ret-type-spec-f (x) |
| 1089 | (when (> x 1.0) | 1094 | (when (> x 1.0) |
| 1090 | x)) | 1095 | x)) |
| 1091 | (or null marker number)) | 1096 | '(or null marker number)) |
| 1092 | 1097 | ||
| 1093 | ;; 36 | 1098 | ;; 36 |
| 1094 | ((defun comp-tests-ret-type-spec-f (x y) | 1099 | ((defun comp-tests-ret-type-spec-f (x y) |
| 1095 | (when (and (> x 3) | 1100 | (when (and (> x 3) |
| 1096 | (> y 2)) | 1101 | (> y 2)) |
| 1097 | (+ x y))) | 1102 | (+ x y))) |
| 1098 | (or null float (integer 7 *))) | 1103 | '(or null float (integer 7 *))) |
| 1099 | 1104 | ||
| 1100 | ;; 37 | 1105 | ;; 37 |
| 1101 | ;; SBCL: (OR REAL NULL) | 1106 | ;; SBCL: (OR REAL NULL) |
| @@ -1103,14 +1108,14 @@ Return a list of results." | |||
| 1103 | (when (and (<= x 3) | 1108 | (when (and (<= x 3) |
| 1104 | (<= y 2)) | 1109 | (<= y 2)) |
| 1105 | (+ x y))) | 1110 | (+ x y))) |
| 1106 | (or null float (integer * 5))) | 1111 | '(or null float (integer * 5))) |
| 1107 | 1112 | ||
| 1108 | ;; 38 | 1113 | ;; 38 |
| 1109 | ((defun comp-tests-ret-type-spec-f (x y) | 1114 | ((defun comp-tests-ret-type-spec-f (x y) |
| 1110 | (when (and (< 1 x 5) | 1115 | (when (and (< 1 x 5) |
| 1111 | (< 1 y 5)) | 1116 | (< 1 y 5)) |
| 1112 | (+ x y))) | 1117 | (+ x y))) |
| 1113 | (or null float (integer 4 8))) | 1118 | '(or null float (integer 4 8))) |
| 1114 | 1119 | ||
| 1115 | ;; 39 | 1120 | ;; 39 |
| 1116 | ;; SBCL gives: (OR REAL NULL) | 1121 | ;; SBCL gives: (OR REAL NULL) |
| @@ -1118,7 +1123,7 @@ Return a list of results." | |||
| 1118 | (when (and (<= 1 x 10) | 1123 | (when (and (<= 1 x 10) |
| 1119 | (<= 2 y 3)) | 1124 | (<= 2 y 3)) |
| 1120 | (+ x y))) | 1125 | (+ x y))) |
| 1121 | (or null float (integer 3 13))) | 1126 | '(or null float (integer 3 13))) |
| 1122 | 1127 | ||
| 1123 | ;; 40 | 1128 | ;; 40 |
| 1124 | ;; SBCL: (OR REAL NULL) | 1129 | ;; SBCL: (OR REAL NULL) |
| @@ -1126,42 +1131,42 @@ Return a list of results." | |||
| 1126 | (when (and (<= 1 x 10) | 1131 | (when (and (<= 1 x 10) |
| 1127 | (<= 2 y 3)) | 1132 | (<= 2 y 3)) |
| 1128 | (- x y))) | 1133 | (- x y))) |
| 1129 | (or null float (integer -2 8))) | 1134 | '(or null float (integer -2 8))) |
| 1130 | 1135 | ||
| 1131 | ;; 41 | 1136 | ;; 41 |
| 1132 | ((defun comp-tests-ret-type-spec-f (x y) | 1137 | ((defun comp-tests-ret-type-spec-f (x y) |
| 1133 | (when (and (<= 1 x) | 1138 | (when (and (<= 1 x) |
| 1134 | (<= 2 y 3)) | 1139 | (<= 2 y 3)) |
| 1135 | (- x y))) | 1140 | (- x y))) |
| 1136 | (or null float (integer -2 *))) | 1141 | '(or null float (integer -2 *))) |
| 1137 | 1142 | ||
| 1138 | ;; 42 | 1143 | ;; 42 |
| 1139 | ((defun comp-tests-ret-type-spec-f (x y) | 1144 | ((defun comp-tests-ret-type-spec-f (x y) |
| 1140 | (when (and (<= 1 x 10) | 1145 | (when (and (<= 1 x 10) |
| 1141 | (<= 2 y)) | 1146 | (<= 2 y)) |
| 1142 | (- x y))) | 1147 | (- x y))) |
| 1143 | (or null float (integer * 8))) | 1148 | '(or null float (integer * 8))) |
| 1144 | 1149 | ||
| 1145 | ;; 43 | 1150 | ;; 43 |
| 1146 | ((defun comp-tests-ret-type-spec-f (x y) | 1151 | ((defun comp-tests-ret-type-spec-f (x y) |
| 1147 | (when (and (<= x 10) | 1152 | (when (and (<= x 10) |
| 1148 | (<= 2 y)) | 1153 | (<= 2 y)) |
| 1149 | (- x y))) | 1154 | (- x y))) |
| 1150 | (or null float (integer * 8))) | 1155 | '(or null float (integer * 8))) |
| 1151 | 1156 | ||
| 1152 | ;; 44 | 1157 | ;; 44 |
| 1153 | ((defun comp-tests-ret-type-spec-f (x y) | 1158 | ((defun comp-tests-ret-type-spec-f (x y) |
| 1154 | (when (and (<= x 10) | 1159 | (when (and (<= x 10) |
| 1155 | (<= y 3)) | 1160 | (<= y 3)) |
| 1156 | (- x y))) | 1161 | (- x y))) |
| 1157 | (or null float integer)) | 1162 | '(or null float integer)) |
| 1158 | 1163 | ||
| 1159 | ;; 45 | 1164 | ;; 45 |
| 1160 | ((defun comp-tests-ret-type-spec-f (x y) | 1165 | ((defun comp-tests-ret-type-spec-f (x y) |
| 1161 | (when (and (<= 2 x) | 1166 | (when (and (<= 2 x) |
| 1162 | (<= 3 y)) | 1167 | (<= 3 y)) |
| 1163 | (- x y))) | 1168 | (- x y))) |
| 1164 | (or null float integer)) | 1169 | '(or null float integer)) |
| 1165 | 1170 | ||
| 1166 | ;; 46 | 1171 | ;; 46 |
| 1167 | ;; SBCL: (OR (RATIONAL (6) (30)) (SINGLE-FLOAT 6.0 30.0) | 1172 | ;; SBCL: (OR (RATIONAL (6) (30)) (SINGLE-FLOAT 6.0 30.0) |
| @@ -1174,63 +1179,63 @@ Return a list of results." | |||
| 1174 | (< 1 j 5) | 1179 | (< 1 j 5) |
| 1175 | (< 1 k 5)) | 1180 | (< 1 k 5)) |
| 1176 | (+ x y z i j k))) | 1181 | (+ x y z i j k))) |
| 1177 | (or null float (integer 12 24))) | 1182 | '(or null float (integer 12 24))) |
| 1178 | 1183 | ||
| 1179 | ;; 47 | 1184 | ;; 47 |
| 1180 | ((defun comp-tests-ret-type-spec-f (x) | 1185 | ((defun comp-tests-ret-type-spec-f (x) |
| 1181 | (when (<= 1 x 5) | 1186 | (when (<= 1 x 5) |
| 1182 | (1+ x))) | 1187 | (1+ x))) |
| 1183 | (or null float (integer 2 6))) | 1188 | '(or null float (integer 2 6))) |
| 1184 | 1189 | ||
| 1185 | ;;48 | 1190 | ;;48 |
| 1186 | ((defun comp-tests-ret-type-spec-f (x) | 1191 | ((defun comp-tests-ret-type-spec-f (x) |
| 1187 | (when (<= 1 x 5) | 1192 | (when (<= 1 x 5) |
| 1188 | (1- x))) | 1193 | (1- x))) |
| 1189 | (or null float (integer 0 4))) | 1194 | '(or null float (integer 0 4))) |
| 1190 | 1195 | ||
| 1191 | ;; 49 | 1196 | ;; 49 |
| 1192 | ((defun comp-tests-ret-type-spec-f () | 1197 | ((defun comp-tests-ret-type-spec-f () |
| 1193 | (error "Foo")) | 1198 | (error "Foo")) |
| 1194 | nil) | 1199 | 'nil) |
| 1195 | 1200 | ||
| 1196 | ;; 50 | 1201 | ;; 50 |
| 1197 | ((defun comp-tests-ret-type-spec-f (x) | 1202 | ((defun comp-tests-ret-type-spec-f (x) |
| 1198 | (if (stringp x) | 1203 | (if (stringp x) |
| 1199 | x | 1204 | x |
| 1200 | 'bar)) | 1205 | 'bar)) |
| 1201 | (or (member bar) string)) | 1206 | '(or (member bar) string)) |
| 1202 | 1207 | ||
| 1203 | ;; 51 | 1208 | ;; 51 |
| 1204 | ((defun comp-tests-ret-type-spec-f (x) | 1209 | ((defun comp-tests-ret-type-spec-f (x) |
| 1205 | (if (stringp x) | 1210 | (if (stringp x) |
| 1206 | 'bar | 1211 | 'bar |
| 1207 | x)) | 1212 | x)) |
| 1208 | (not string)) | 1213 | '(not string)) |
| 1209 | 1214 | ||
| 1210 | ;; 52 | 1215 | ;; 52 |
| 1211 | ((defun comp-tests-ret-type-spec-f (x) | 1216 | ((defun comp-tests-ret-type-spec-f (x) |
| 1212 | (if (integerp x) | 1217 | (if (integerp x) |
| 1213 | x | 1218 | x |
| 1214 | 'bar)) | 1219 | 'bar)) |
| 1215 | (or (member bar) integer)) | 1220 | '(or (member bar) integer)) |
| 1216 | 1221 | ||
| 1217 | ;; 53 | 1222 | ;; 53 |
| 1218 | ((defun comp-tests-ret-type-spec-f (x) | 1223 | ((defun comp-tests-ret-type-spec-f (x) |
| 1219 | (when (integerp x) | 1224 | (when (integerp x) |
| 1220 | x)) | 1225 | x)) |
| 1221 | (or null integer)) | 1226 | '(or null integer)) |
| 1222 | 1227 | ||
| 1223 | ;; 54 | 1228 | ;; 54 |
| 1224 | ((defun comp-tests-ret-type-spec-f (x) | 1229 | ((defun comp-tests-ret-type-spec-f (x) |
| 1225 | (unless (symbolp x) | 1230 | (unless (symbolp x) |
| 1226 | x)) | 1231 | x)) |
| 1227 | t) | 1232 | 't) |
| 1228 | 1233 | ||
| 1229 | ;; 55 | 1234 | ;; 55 |
| 1230 | ((defun comp-tests-ret-type-spec-f (x) | 1235 | ((defun comp-tests-ret-type-spec-f (x) |
| 1231 | (unless (integerp x) | 1236 | (unless (integerp x) |
| 1232 | x)) | 1237 | x)) |
| 1233 | (not integer)) | 1238 | '(not integer)) |
| 1234 | 1239 | ||
| 1235 | ;; 56 | 1240 | ;; 56 |
| 1236 | ((defun comp-tests-ret-type-spec-f (x) | 1241 | ((defun comp-tests-ret-type-spec-f (x) |
| @@ -1238,7 +1243,7 @@ Return a list of results." | |||
| 1238 | (1 (message "one")) | 1243 | (1 (message "one")) |
| 1239 | (5 (message "five"))) | 1244 | (5 (message "five"))) |
| 1240 | x) | 1245 | x) |
| 1241 | t | 1246 | 't |
| 1242 | ;; FIXME improve `comp-cond-cstrs-target-mvar' to cross block | 1247 | ;; FIXME improve `comp-cond-cstrs-target-mvar' to cross block |
| 1243 | ;; boundary if necessary as this should return: | 1248 | ;; boundary if necessary as this should return: |
| 1244 | ;; (or (integer 1 1) (integer 5 5)) | 1249 | ;; (or (integer 1 1) (integer 5 5)) |
| @@ -1250,7 +1255,7 @@ Return a list of results." | |||
| 1250 | (eql x 3)) | 1255 | (eql x 3)) |
| 1251 | (error "Not foo or 3")) | 1256 | (error "Not foo or 3")) |
| 1252 | x) | 1257 | x) |
| 1253 | (or (member foo) (integer 3 3))) | 1258 | '(or (member foo) (integer 3 3))) |
| 1254 | 1259 | ||
| 1255 | ;;58 | 1260 | ;;58 |
| 1256 | ((defun comp-tests-ret-type-spec-f (x y) | 1261 | ((defun comp-tests-ret-type-spec-f (x y) |
| @@ -1259,7 +1264,7 @@ Return a list of results." | |||
| 1259 | (<= x y)) | 1264 | (<= x y)) |
| 1260 | x | 1265 | x |
| 1261 | (error ""))) | 1266 | (error ""))) |
| 1262 | (integer 0 *)) | 1267 | '(integer 0 *)) |
| 1263 | 1268 | ||
| 1264 | ;; 59 | 1269 | ;; 59 |
| 1265 | ((defun comp-tests-ret-type-spec-f (x y) | 1270 | ((defun comp-tests-ret-type-spec-f (x y) |
| @@ -1268,7 +1273,7 @@ Return a list of results." | |||
| 1268 | (<= x y)) | 1273 | (<= x y)) |
| 1269 | x | 1274 | x |
| 1270 | (error ""))) | 1275 | (error ""))) |
| 1271 | (or float (integer 3 10))) | 1276 | '(or float (integer 3 10))) |
| 1272 | 1277 | ||
| 1273 | ;; 60 | 1278 | ;; 60 |
| 1274 | ((defun comp-tests-ret-type-spec-f (x y) | 1279 | ((defun comp-tests-ret-type-spec-f (x y) |
| @@ -1277,56 +1282,56 @@ Return a list of results." | |||
| 1277 | (>= x y)) | 1282 | (>= x y)) |
| 1278 | x | 1283 | x |
| 1279 | (error ""))) | 1284 | (error ""))) |
| 1280 | (or float (integer 3 10))) | 1285 | '(or float (integer 3 10))) |
| 1281 | 1286 | ||
| 1282 | ;; 61 | 1287 | ;; 61 |
| 1283 | ((defun comp-tests-ret-type-spec-f (x) | 1288 | ((defun comp-tests-ret-type-spec-f (x) |
| 1284 | (if (= x 1.0) | 1289 | (if (= x 1.0) |
| 1285 | x | 1290 | x |
| 1286 | (error ""))) | 1291 | (error ""))) |
| 1287 | (or (member 1.0) (integer 1 1))) | 1292 | '(or (member 1.0) (integer 1 1))) |
| 1288 | 1293 | ||
| 1289 | ;; 62 | 1294 | ;; 62 |
| 1290 | ((defun comp-tests-ret-type-spec-f (x) | 1295 | ((defun comp-tests-ret-type-spec-f (x) |
| 1291 | (if (= x 1.0) | 1296 | (if (= x 1.0) |
| 1292 | x | 1297 | x |
| 1293 | (error ""))) | 1298 | (error ""))) |
| 1294 | (or (member 1.0) (integer 1 1))) | 1299 | '(or (member 1.0) (integer 1 1))) |
| 1295 | 1300 | ||
| 1296 | ;; 63 | 1301 | ;; 63 |
| 1297 | ((defun comp-tests-ret-type-spec-f (x) | 1302 | ((defun comp-tests-ret-type-spec-f (x) |
| 1298 | (if (= x 1.1) | 1303 | (if (= x 1.1) |
| 1299 | x | 1304 | x |
| 1300 | (error ""))) | 1305 | (error ""))) |
| 1301 | (member 1.1)) | 1306 | '(member 1.1)) |
| 1302 | 1307 | ||
| 1303 | ;; 64 | 1308 | ;; 64 |
| 1304 | ((defun comp-tests-ret-type-spec-f (x) | 1309 | ((defun comp-tests-ret-type-spec-f (x) |
| 1305 | (if (= x 1) | 1310 | (if (= x 1) |
| 1306 | x | 1311 | x |
| 1307 | (error ""))) | 1312 | (error ""))) |
| 1308 | (or (member 1.0) (integer 1 1))) | 1313 | '(or (member 1.0) (integer 1 1))) |
| 1309 | 1314 | ||
| 1310 | ;; 65 | 1315 | ;; 65 |
| 1311 | ((defun comp-tests-ret-type-spec-f (x) | 1316 | ((defun comp-tests-ret-type-spec-f (x) |
| 1312 | (if (= x 1) | 1317 | (if (= x 1) |
| 1313 | x | 1318 | x |
| 1314 | (error ""))) | 1319 | (error ""))) |
| 1315 | (or (member 1.0) (integer 1 1))) | 1320 | '(or (member 1.0) (integer 1 1))) |
| 1316 | 1321 | ||
| 1317 | ;; 66 | 1322 | ;; 66 |
| 1318 | ((defun comp-tests-ret-type-spec-f (x) | 1323 | ((defun comp-tests-ret-type-spec-f (x) |
| 1319 | (if (eql x 0.0) | 1324 | (if (eql x 0.0) |
| 1320 | x | 1325 | x |
| 1321 | (error ""))) | 1326 | (error ""))) |
| 1322 | float) | 1327 | 'float) |
| 1323 | 1328 | ||
| 1324 | ;; 67 | 1329 | ;; 67 |
| 1325 | ((defun comp-tests-ret-type-spec-f (x) | 1330 | ((defun comp-tests-ret-type-spec-f (x) |
| 1326 | (if (equal x '(1 2 3)) | 1331 | (if (equal x '(1 2 3)) |
| 1327 | x | 1332 | x |
| 1328 | (error ""))) | 1333 | (error ""))) |
| 1329 | cons) | 1334 | 'cons) |
| 1330 | 1335 | ||
| 1331 | ;; 68 | 1336 | ;; 68 |
| 1332 | ((defun comp-tests-ret-type-spec-f (x) | 1337 | ((defun comp-tests-ret-type-spec-f (x) |
| @@ -1335,7 +1340,7 @@ Return a list of results." | |||
| 1335 | x | 1340 | x |
| 1336 | (error ""))) | 1341 | (error ""))) |
| 1337 | ;; Conservative (see cstr relax in `comp-cstr-='). | 1342 | ;; Conservative (see cstr relax in `comp-cstr-='). |
| 1338 | (or (member 1.0) (integer 1 1))) | 1343 | '(or (member 1.0) (integer 1 1))) |
| 1339 | 1344 | ||
| 1340 | ;; 69 | 1345 | ;; 69 |
| 1341 | ((defun comp-tests-ret-type-spec-f (x) | 1346 | ((defun comp-tests-ret-type-spec-f (x) |
| @@ -1344,7 +1349,7 @@ Return a list of results." | |||
| 1344 | x | 1349 | x |
| 1345 | (error ""))) | 1350 | (error ""))) |
| 1346 | ;; Conservative (see cstr relax in `comp-cstr-='). | 1351 | ;; Conservative (see cstr relax in `comp-cstr-='). |
| 1347 | (or (member 1.0) (integer 1 1))) | 1352 | '(or (member 1.0) (integer 1 1))) |
| 1348 | 1353 | ||
| 1349 | ;; 70 | 1354 | ;; 70 |
| 1350 | ((defun comp-tests-ret-type-spec-f (x y) | 1355 | ((defun comp-tests-ret-type-spec-f (x y) |
| @@ -1353,14 +1358,14 @@ Return a list of results." | |||
| 1353 | (= x y)) | 1358 | (= x y)) |
| 1354 | x | 1359 | x |
| 1355 | (error ""))) | 1360 | (error ""))) |
| 1356 | (or float integer)) | 1361 | '(or float integer)) |
| 1357 | 1362 | ||
| 1358 | ;; 71 | 1363 | ;; 71 |
| 1359 | ((defun comp-tests-ret-type-spec-f (x) | 1364 | ((defun comp-tests-ret-type-spec-f (x) |
| 1360 | (if (= x 0.0) | 1365 | (if (= x 0.0) |
| 1361 | x | 1366 | x |
| 1362 | (error ""))) | 1367 | (error ""))) |
| 1363 | (or (member -0.0 0.0) (integer 0 0))) | 1368 | '(or (member -0.0 0.0) (integer 0 0))) |
| 1364 | 1369 | ||
| 1365 | ;; 72 | 1370 | ;; 72 |
| 1366 | ((defun comp-tests-ret-type-spec-f (x) | 1371 | ((defun comp-tests-ret-type-spec-f (x) |
| @@ -1369,27 +1374,27 @@ Return a list of results." | |||
| 1369 | (unless (eql x -0.0) | 1374 | (unless (eql x -0.0) |
| 1370 | (error "")) | 1375 | (error "")) |
| 1371 | x) | 1376 | x) |
| 1372 | float) | 1377 | 'float) |
| 1373 | 1378 | ||
| 1374 | ;; 73 | 1379 | ;; 73 |
| 1375 | ((defun comp-tests-ret-type-spec-f (x) | 1380 | ((defun comp-tests-ret-type-spec-f (x) |
| 1376 | (when (eql x 1.0) | 1381 | (when (eql x 1.0) |
| 1377 | (error "")) | 1382 | (error "")) |
| 1378 | x) | 1383 | x) |
| 1379 | t) | 1384 | 't) |
| 1380 | 1385 | ||
| 1381 | ;; 74 | 1386 | ;; 74 |
| 1382 | ((defun comp-tests-ret-type-spec-f (x) | 1387 | ((defun comp-tests-ret-type-spec-f (x) |
| 1383 | (if (eq x 0) | 1388 | (if (eq x 0) |
| 1384 | (error "") | 1389 | (error "") |
| 1385 | (1+ x))) | 1390 | (1+ x))) |
| 1386 | number))) | 1391 | 'number))) |
| 1387 | 1392 | ||
| 1388 | (defun comp-tests-define-type-spec-test (number x) | 1393 | (defun comp-tests-define-type-spec-test (number x) |
| 1389 | `(comp-deftest ,(intern (format "ret-type-spec-%d" number)) () | 1394 | `(comp-deftest ,(intern (format "ret-type-spec-%d" number)) () |
| 1390 | ,(format "Type specifier test number %d." number) | 1395 | ,(format "Type specifier test number %d." number) |
| 1391 | (let ((comp-ctxt (make-comp-cstr-ctxt))) | 1396 | (let ((comp-ctxt (make-comp-cstr-ctxt))) |
| 1392 | (comp-tests-check-ret-type-spec ',(car x) ',(cadr x)))))) | 1397 | (comp-tests-check-ret-type-spec ',(car x) ,(cadr x)))))) |
| 1393 | 1398 | ||
| 1394 | (defmacro comp-tests-define-type-spec-tests () | 1399 | (defmacro comp-tests-define-type-spec-tests () |
| 1395 | "Define all type specifier tests." | 1400 | "Define all type specifier tests." |
diff --git a/test/src/data-tests.el b/test/src/data-tests.el index 0f84b2fb776..463a894d095 100644 --- a/test/src/data-tests.el +++ b/test/src/data-tests.el | |||
| @@ -200,8 +200,7 @@ this is exactly representable and is greater than | |||
| 200 | nibbles) | 200 | nibbles) |
| 201 | (setf v (nthcdr 4 v))) | 201 | (setf v (nthcdr 4 v))) |
| 202 | (mapconcat (lambda (n) (format "%X" n)) | 202 | (mapconcat (lambda (n) (format "%X" n)) |
| 203 | (nreverse nibbles) | 203 | (nreverse nibbles)))) |
| 204 | ""))) | ||
| 205 | 204 | ||
| 206 | (defun test-bool-vector-count-consecutive-tc (desc) | 205 | (defun test-bool-vector-count-consecutive-tc (desc) |
| 207 | "Run a test case for `bool-vector-count-consecutive'. | 206 | "Run a test case for `bool-vector-count-consecutive'. |
diff --git a/test/src/emacs-module-resources/mod-test.c b/test/src/emacs-module-resources/mod-test.c index 187af821c22..b47a0b7a39b 100644 --- a/test/src/emacs-module-resources/mod-test.c +++ b/test/src/emacs-module-resources/mod-test.c | |||
| @@ -24,7 +24,6 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 24 | 24 | ||
| 25 | #include <errno.h> | 25 | #include <errno.h> |
| 26 | #include <limits.h> | 26 | #include <limits.h> |
| 27 | #include <stdbool.h> | ||
| 28 | #include <stdint.h> | 27 | #include <stdint.h> |
| 29 | #include <stdio.h> | 28 | #include <stdio.h> |
| 30 | #include <stdlib.h> | 29 | #include <stdlib.h> |
diff --git a/test/src/eval-tests.el b/test/src/eval-tests.el index 1b2ad99360b..bb2f04e8ee1 100644 --- a/test/src/eval-tests.el +++ b/test/src/eval-tests.el | |||
| @@ -108,26 +108,6 @@ Bug#24912." | |||
| 108 | (should-error (eval (cons 'cond clauses) nil)) | 108 | (should-error (eval (cons 'cond clauses) nil)) |
| 109 | (should-error (eval (cons 'cond clauses) t)))) | 109 | (should-error (eval (cons 'cond clauses) t)))) |
| 110 | 110 | ||
| 111 | (defun eval-tests--exceed-specbind-limit () | ||
| 112 | (defvar eval-tests--var1) | ||
| 113 | (defvar eval-tests--var2) | ||
| 114 | ;; Bind two variables, to make extra sure we hit the | ||
| 115 | ;; `max-specpdl-size' limit before the `max-lisp-eval-depth' limit. | ||
| 116 | (let ((eval-tests--var1 1) | ||
| 117 | (eval-tests--var2 2)) | ||
| 118 | ;; Recurse until we hit the limit. | ||
| 119 | (eval-tests--exceed-specbind-limit))) | ||
| 120 | |||
| 121 | (ert-deftest eval-exceed-specbind-with-signal-hook () | ||
| 122 | "Test for Bug#30481. | ||
| 123 | Check that Emacs doesn't crash when exceeding specbind limit with | ||
| 124 | `signal-hook-function' bound. NOTE: Without the fix for | ||
| 125 | Bug#30481, this test can appear to pass, but cause a | ||
| 126 | crash/abort/malloc assert failure on the next test." | ||
| 127 | (let ((max-specpdl-size (/ max-lisp-eval-depth 2)) | ||
| 128 | (signal-hook-function #'ignore)) | ||
| 129 | (should-error (eval-tests--exceed-specbind-limit)))) | ||
| 130 | |||
| 131 | (ert-deftest defvar/bug31072 () | 111 | (ert-deftest defvar/bug31072 () |
| 132 | "Check that Bug#31072 is fixed." | 112 | "Check that Bug#31072 is fixed." |
| 133 | (should-error (eval '(defvar 1) t) :type 'wrong-type-argument)) | 113 | (should-error (eval '(defvar 1) t) :type 'wrong-type-argument)) |
diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el index a84cce3ad4e..9a2bd5cef34 100644 --- a/test/src/fns-tests.el +++ b/test/src/fns-tests.el | |||
| @@ -131,47 +131,54 @@ | |||
| 131 | (should (equal [t t t t t nil nil nil nil nil] (vconcat (nreverse A)))))) | 131 | (should (equal [t t t t t nil nil nil nil nil] (vconcat (nreverse A)))))) |
| 132 | 132 | ||
| 133 | (defconst fns-tests--string-lessp-cases | 133 | (defconst fns-tests--string-lessp-cases |
| 134 | '((a 97 error) | 134 | `(("abc" < "abd") |
| 135 | (97 "a" error) | 135 | (abc < "abd") |
| 136 | ("abc" "abd" t) | 136 | (abc < abd) |
| 137 | ("abd" "abc" nil) | 137 | ("" = "") |
| 138 | (abc "abd" t) | 138 | ("" < " ") |
| 139 | ("abd" abc nil) | 139 | ("abc" < "abcd") |
| 140 | (abc abd t) | 140 | ("abc" = "abc") |
| 141 | (abd abc nil) | 141 | (abc = abc) |
| 142 | ("" "" nil) | 142 | ("" < "\0") |
| 143 | ("" " " t) | 143 | ("~" < "\x80") |
| 144 | (" " "" nil) | 144 | ("\x80" = "\x80") |
| 145 | ("abc" "abcd" t) | 145 | ("\xfe" < "\xff") |
| 146 | ("abcd" "abc" nil) | 146 | ("Munchen" < "München") |
| 147 | ("abc" "abc" nil) | 147 | ("München" = "München") |
| 148 | (abc abc nil) | 148 | ("Ré" < "Réunion") |
| 149 | ("\0" "" nil) | 149 | ("abc" = ,(string-to-multibyte "abc")) |
| 150 | ("" "\0" t) | 150 | (,(string-to-multibyte "abc") = ,(string-to-multibyte "abc")) |
| 151 | ("~" "\x80" t) | 151 | ("abc" < ,(string-to-multibyte "abd")) |
| 152 | ("\x80" "\x80" nil) | 152 | (,(string-to-multibyte "abc") < "abd") |
| 153 | ("\xfe" "\xff" t) | 153 | (,(string-to-multibyte "abc") < ,(string-to-multibyte "abd")) |
| 154 | ("Munchen" "München" t) | 154 | (,(string-to-multibyte "\x80") = ,(string-to-multibyte "\x80")) |
| 155 | ("München" "Munchen" nil) | 155 | |
| 156 | ("München" "München" nil) | 156 | ;; Cases concerning the ordering of raw bytes: these are |
| 157 | ("Ré" "Réunion" t))) | 157 | ;; troublesome because the current `string<' order is not very useful as |
| 158 | 158 | ;; it equates unibyte 80..FF with multibyte U+0080..00FF, and is also | |
| 159 | ;; inconsistent with `string=' (see bug#58168). | ||
| 160 | ;;("\x80" < ,(string-to-multibyte "\x80")) | ||
| 161 | ;;("\xff" < ,(string-to-multibyte "\x80")) | ||
| 162 | ;;("ü" < "\xfc") | ||
| 163 | ;;("ü" < ,(string-to-multibyte "\xfc")) | ||
| 164 | ) | ||
| 165 | "List of (A REL B) where REL is the relation (`<' or `=') between A and B.") | ||
| 159 | 166 | ||
| 160 | (ert-deftest fns-tests-string-lessp () | 167 | (ert-deftest fns-tests-string-lessp () |
| 161 | ;; Exercise both `string-lessp' and its alias `string<', both directly | 168 | ;; Exercise both `string-lessp' and its alias `string<', both directly |
| 162 | ;; and in a function (exercising its bytecode). | 169 | ;; and in a function (exercising its bytecode). |
| 163 | (dolist (lessp (list #'string-lessp #'string< | 170 | (dolist (fun (list #'string-lessp #'string< |
| 164 | (lambda (a b) (string-lessp a b)) | 171 | (lambda (a b) (string-lessp a b)) |
| 165 | (lambda (a b) (string< a b)))) | 172 | (lambda (a b) (string< a b)))) |
| 166 | (ert-info ((prin1-to-string lessp) :prefix "function: ") | 173 | (ert-info ((prin1-to-string fun) :prefix "function: ") |
| 174 | (should-error (funcall fun 'a 97)) | ||
| 175 | (should-error (funcall fun 97 "a")) | ||
| 167 | (dolist (case fns-tests--string-lessp-cases) | 176 | (dolist (case fns-tests--string-lessp-cases) |
| 168 | (ert-info ((prin1-to-string case) :prefix "case: ") | 177 | (ert-info ((prin1-to-string case) :prefix "case: ") |
| 169 | (pcase case | 178 | (pcase-let ((`(,x ,rel ,y) case)) |
| 170 | (`(,x ,y error) | 179 | (cl-assert (memq rel '(< =))) |
| 171 | (should-error (funcall lessp x y))) | 180 | (should (equal (funcall fun x y) (eq rel '<))) |
| 172 | (`(,x ,y ,expected) | 181 | (should (equal (funcall fun y x) nil)))))))) |
| 173 | (should (equal (funcall lessp x y) expected))))))))) | ||
| 174 | |||
| 175 | 182 | ||
| 176 | (ert-deftest fns-tests-compare-strings () | 183 | (ert-deftest fns-tests-compare-strings () |
| 177 | (should-error (compare-strings)) | 184 | (should-error (compare-strings)) |
| @@ -614,9 +621,9 @@ | |||
| 614 | (should (string= (mapconcat #'identity '("Ä" "ø" "☭" "தமிழ்") "_漢字_") | 621 | (should (string= (mapconcat #'identity '("Ä" "ø" "☭" "தமிழ்") "_漢字_") |
| 615 | "Ä_漢字_ø_漢字_☭_漢字_தமிழ்")) | 622 | "Ä_漢字_ø_漢字_☭_漢字_தமிழ்")) |
| 616 | ;; vector | 623 | ;; vector |
| 617 | (should (string= (mapconcat #'identity ["a" "b"] "") "ab")) | 624 | (should (string= (mapconcat #'identity ["a" "b"]) "ab")) |
| 618 | ;; bool-vector | 625 | ;; bool-vector |
| 619 | (should (string= (mapconcat #'identity [nil nil] "") "")) | 626 | (should (string= (mapconcat #'identity [nil nil]) "")) |
| 620 | (should-error (mapconcat #'identity [nil nil t]) | 627 | (should-error (mapconcat #'identity [nil nil t]) |
| 621 | :type 'wrong-type-argument)) | 628 | :type 'wrong-type-argument)) |
| 622 | 629 | ||
| @@ -1412,6 +1419,41 @@ | |||
| 1412 | (should (equal (take 5 list) '(a b c b c))) | 1419 | (should (equal (take 5 list) '(a b c b c))) |
| 1413 | (should (equal (take 10 list) '(a b c b c b c b c b))) | 1420 | (should (equal (take 10 list) '(a b c b c b c b c b))) |
| 1414 | 1421 | ||
| 1415 | (should (equal (ntake 10 list) '(a b))))) | 1422 | (should (equal (ntake 10 list) '(a b)))) |
| 1423 | |||
| 1424 | ;; Bignum N argument. | ||
| 1425 | (let ((list (list 'a 'b 'c))) | ||
| 1426 | (should (equal (take (+ most-positive-fixnum 1) list) '(a b c))) | ||
| 1427 | (should (equal (take (- most-negative-fixnum 1) list) nil)) | ||
| 1428 | (should (equal (ntake (+ most-positive-fixnum 1) list) '(a b c))) | ||
| 1429 | (should (equal (ntake (- most-negative-fixnum 1) list) nil)) | ||
| 1430 | (should (equal list '(a b c))))) | ||
| 1431 | |||
| 1432 | (ert-deftest fns--copy-alist () | ||
| 1433 | (dolist (orig '(nil | ||
| 1434 | ((a . 1) (b . 2) (a . 3)) | ||
| 1435 | (a (b . 3) ((c) (d))))) | ||
| 1436 | (ert-info ((prin1-to-string orig) :prefix "orig: ") | ||
| 1437 | (let ((copy (copy-alist orig))) | ||
| 1438 | (should (equal orig copy)) | ||
| 1439 | (while orig | ||
| 1440 | (should-not (eq orig copy)) | ||
| 1441 | ;; Check that cons pairs are copied but nothing else. | ||
| 1442 | (let ((orig-elt (car orig)) | ||
| 1443 | (copy-elt (car copy))) | ||
| 1444 | (if (atom orig-elt) | ||
| 1445 | (should (eq orig-elt copy-elt)) | ||
| 1446 | (should-not (eq orig-elt copy-elt)) | ||
| 1447 | (should (eq (car orig-elt) (car copy-elt))) | ||
| 1448 | (should (eq (cdr orig-elt) (cdr copy-elt))))) | ||
| 1449 | (setq orig (cdr orig)) | ||
| 1450 | (setq copy (cdr copy)))))) | ||
| 1451 | |||
| 1452 | (should-error (copy-alist 'a) | ||
| 1453 | :type 'wrong-type-argument) | ||
| 1454 | (should-error (copy-alist [(a . 1) (b . 2) (a . 3)]) | ||
| 1455 | :type 'wrong-type-argument) | ||
| 1456 | (should-error (copy-alist "abc") | ||
| 1457 | :type 'wrong-type-argument)) | ||
| 1416 | 1458 | ||
| 1417 | ;;; fns-tests.el ends here | 1459 | ;;; fns-tests.el ends here |
diff --git a/test/src/image-tests.el b/test/src/image-tests.el index 36278f4b9fa..d1a4dad37b9 100644 --- a/test/src/image-tests.el +++ b/test/src/image-tests.el | |||
| @@ -19,25 +19,17 @@ | |||
| 19 | ;; You should have received a copy of the GNU General Public License | 19 | ;; You should have received a copy of the GNU General Public License |
| 20 | ;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. | 20 | ;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. |
| 21 | 21 | ||
| 22 | ;;; Commentary: | ||
| 23 | |||
| 24 | ;; Most of these tests will only run in a GUI session, and not with | ||
| 25 | ;; "make check". Run them manually in an interactive session with | ||
| 26 | ;; `M-x eval-buffer' followed by `M-x ert'. | ||
| 27 | |||
| 28 | ;;; Code: | 22 | ;;; Code: |
| 29 | 23 | ||
| 30 | (require 'ert) | 24 | (require 'ert) |
| 31 | 25 | ||
| 32 | (defmacro image-skip-unless (format) | 26 | (declare-function image-size "image.c" (spec &optional pixels frame)) |
| 33 | `(skip-unless (and (display-images-p) | 27 | (declare-function image-mask-p "image.c" (spec &optional frame)) |
| 34 | (image-type-available-p ,format)))) | 28 | (declare-function image-metadata "image.c" (spec &optional frame)) |
| 35 | |||
| 36 | ;;;; Images | ||
| 37 | 29 | ||
| 38 | (defconst image-tests--images | 30 | (defconst image-tests--images |
| 39 | `((gif . ,(expand-file-name "test/data/image/black.gif" | 31 | `((gif . ,(expand-file-name "test/data/image/black.gif" |
| 40 | source-directory)) | 32 | source-directory)) |
| 41 | (jpeg . ,(expand-file-name "test/data/image/black.jpg" | 33 | (jpeg . ,(expand-file-name "test/data/image/black.jpg" |
| 42 | source-directory)) | 34 | source-directory)) |
| 43 | (pbm . ,(find-image '((:file "splash.svg" :type svg)))) | 35 | (pbm . ,(find-image '((:file "splash.svg" :type svg)))) |
| @@ -51,197 +43,23 @@ | |||
| 51 | (xbm . ,(find-image '((:file "gnus/gnus.xbm" :type xbm)))) | 43 | (xbm . ,(find-image '((:file "gnus/gnus.xbm" :type xbm)))) |
| 52 | (xpm . ,(find-image '((:file "splash.xpm" :type xpm)))))) | 44 | (xpm . ,(find-image '((:file "splash.xpm" :type xpm)))))) |
| 53 | 45 | ||
| 54 | ;;;; image-test-size | ||
| 55 | |||
| 56 | (declare-function image-size "image.c" (spec &optional pixels frame)) | ||
| 57 | |||
| 58 | (ert-deftest image-tests-image-size/gif () | ||
| 59 | (image-skip-unless 'gif) | ||
| 60 | (pcase (image-size (create-image (cdr (assq 'gif image-tests--images)))) | ||
| 61 | (`(,a . ,b) | ||
| 62 | (should (floatp a)) | ||
| 63 | (should (floatp b))))) | ||
| 64 | |||
| 65 | (ert-deftest image-tests-image-size/jpeg () | ||
| 66 | (image-skip-unless 'jpeg) | ||
| 67 | (pcase (image-size (create-image (cdr (assq 'jpeg image-tests--images)))) | ||
| 68 | (`(,a . ,b) | ||
| 69 | (should (floatp a)) | ||
| 70 | (should (floatp b))))) | ||
| 71 | |||
| 72 | (ert-deftest image-tests-image-size/pbm () | ||
| 73 | (image-skip-unless 'pbm) | ||
| 74 | (pcase (image-size (cdr (assq 'pbm image-tests--images))) | ||
| 75 | (`(,a . ,b) | ||
| 76 | (should (floatp a)) | ||
| 77 | (should (floatp b))))) | ||
| 78 | |||
| 79 | (ert-deftest image-tests-image-size/png () | ||
| 80 | (image-skip-unless 'png) | ||
| 81 | (pcase (image-size (cdr (assq 'png image-tests--images))) | ||
| 82 | (`(,a . ,b) | ||
| 83 | (should (floatp a)) | ||
| 84 | (should (floatp b))))) | ||
| 85 | |||
| 86 | (ert-deftest image-tests-image-size/svg () | ||
| 87 | (image-skip-unless 'svg) | ||
| 88 | (pcase (image-size (cdr (assq 'svg image-tests--images))) | ||
| 89 | (`(,a . ,b) | ||
| 90 | (should (floatp a)) | ||
| 91 | (should (floatp b))))) | ||
| 92 | |||
| 93 | (ert-deftest image-tests-image-size/tiff () | ||
| 94 | (image-skip-unless 'tiff) | ||
| 95 | (pcase (image-size (create-image (cdr (assq 'tiff image-tests--images)))) | ||
| 96 | (`(,a . ,b) | ||
| 97 | (should (floatp a)) | ||
| 98 | (should (floatp b))))) | ||
| 99 | |||
| 100 | (ert-deftest image-tests-image-size/webp () | ||
| 101 | (image-skip-unless 'webp) | ||
| 102 | (pcase (image-size (create-image (cdr (assq 'webp image-tests--images)))) | ||
| 103 | (`(,a . ,b) | ||
| 104 | (should (floatp a)) | ||
| 105 | (should (floatp b))))) | ||
| 106 | |||
| 107 | (ert-deftest image-tests-image-size/xbm () | ||
| 108 | (image-skip-unless 'xbm) | ||
| 109 | (pcase (image-size (cdr (assq 'xbm image-tests--images))) | ||
| 110 | (`(,a . ,b) | ||
| 111 | (should (floatp a)) | ||
| 112 | (should (floatp b))))) | ||
| 113 | |||
| 114 | (ert-deftest image-tests-image-size/xpm () | ||
| 115 | (image-skip-unless 'xpm) | ||
| 116 | (pcase (image-size (cdr (assq 'xpm image-tests--images))) | ||
| 117 | (`(,a . ,b) | ||
| 118 | (should (floatp a)) | ||
| 119 | (should (floatp b))))) | ||
| 120 | |||
| 121 | (ert-deftest image-tests-image-size/error-on-invalid-spec () | ||
| 122 | (skip-unless (display-images-p)) | ||
| 123 | (should-error (image-size 'invalid-spec))) | ||
| 124 | |||
| 125 | (ert-deftest image-tests-image-size/error-on-nongraphical-display () | 46 | (ert-deftest image-tests-image-size/error-on-nongraphical-display () |
| 126 | (skip-unless (not (display-images-p))) | 47 | (skip-unless (not (display-images-p))) |
| 127 | (should-error (image-size 'invalid-spec))) | 48 | (should-error (image-size 'invalid-spec))) |
| 128 | 49 | ||
| 129 | ;;;; image-mask-p | ||
| 130 | |||
| 131 | (declare-function image-mask-p "image.c" (spec &optional frame)) | ||
| 132 | |||
| 133 | (ert-deftest image-tests-image-mask-p/gif () | ||
| 134 | (image-skip-unless 'gif) | ||
| 135 | (should-not (image-mask-p (create-image | ||
| 136 | (cdr (assq 'gif image-tests--images)))))) | ||
| 137 | |||
| 138 | (ert-deftest image-tests-image-mask-p/jpeg () | ||
| 139 | (image-skip-unless 'jpeg) | ||
| 140 | (should-not (image-mask-p (create-image | ||
| 141 | (cdr (assq 'jpeg image-tests--images)))))) | ||
| 142 | |||
| 143 | (ert-deftest image-tests-image-mask-p/pbm () | ||
| 144 | (image-skip-unless 'pbm) | ||
| 145 | (should-not (image-mask-p (cdr (assq 'pbm image-tests--images))))) | ||
| 146 | |||
| 147 | (ert-deftest image-tests-image-mask-p/png () | ||
| 148 | (image-skip-unless 'png) | ||
| 149 | (should-not (image-mask-p (cdr (assq 'png image-tests--images))))) | ||
| 150 | |||
| 151 | (ert-deftest image-tests-image-mask-p/svg () | ||
| 152 | (image-skip-unless 'svg) | ||
| 153 | (should-not (image-mask-p (cdr (assq 'svg image-tests--images))))) | ||
| 154 | |||
| 155 | (ert-deftest image-tests-image-mask-p/tiff () | ||
| 156 | (image-skip-unless 'tiff) | ||
| 157 | (should-not (image-mask-p (create-image | ||
| 158 | (cdr (assq 'tiff image-tests--images)))))) | ||
| 159 | |||
| 160 | (ert-deftest image-tests-image-mask-p/webp () | ||
| 161 | (image-skip-unless 'webp) | ||
| 162 | (should-not (image-mask-p (create-image | ||
| 163 | (cdr (assq 'webp image-tests--images)))))) | ||
| 164 | |||
| 165 | (ert-deftest image-tests-image-mask-p/xbm () | ||
| 166 | (image-skip-unless 'xbm) | ||
| 167 | (should-not (image-mask-p (cdr (assq 'xbm image-tests--images))))) | ||
| 168 | |||
| 169 | (ert-deftest image-tests-image-mask-p/xpm () | ||
| 170 | (image-skip-unless 'xpm) | ||
| 171 | (should-not (image-mask-p (cdr (assq 'xpm image-tests--images))))) | ||
| 172 | |||
| 173 | (ert-deftest image-tests-image-mask-p/error-on-invalid-spec () | ||
| 174 | (skip-unless (display-images-p)) | ||
| 175 | (should-error (image-mask-p 'invalid-spec))) | ||
| 176 | |||
| 177 | (ert-deftest image-tests-image-mask-p/error-on-nongraphical-display () | 50 | (ert-deftest image-tests-image-mask-p/error-on-nongraphical-display () |
| 178 | (skip-unless (not (display-images-p))) | 51 | (skip-unless (not (display-images-p))) |
| 179 | (should-error (image-mask-p (cdr (assq 'xpm image-tests--images))))) | 52 | (should-error (image-mask-p (cdr (assq 'xpm image-tests--images))))) |
| 180 | 53 | ||
| 181 | ;;;; image-metadata | ||
| 182 | |||
| 183 | (declare-function image-metadata "image.c" (spec &optional frame)) | ||
| 184 | |||
| 185 | ;; TODO: These tests could be expanded with files that actually | ||
| 186 | ;; contain metadata. | ||
| 187 | |||
| 188 | (ert-deftest image-tests-image-metadata/gif () | ||
| 189 | (image-skip-unless 'gif) | ||
| 190 | (should-not (image-metadata | ||
| 191 | (create-image (cdr (assq 'gif image-tests--images)))))) | ||
| 192 | |||
| 193 | (ert-deftest image-tests-image-metadata/jpeg () | ||
| 194 | (image-skip-unless 'jpeg) | ||
| 195 | (should-not (image-metadata | ||
| 196 | (create-image (cdr (assq 'jpeg image-tests--images)))))) | ||
| 197 | |||
| 198 | (ert-deftest image-tests-image-metadata/pbm () | ||
| 199 | (image-skip-unless 'pbm) | ||
| 200 | (should-not (image-metadata (cdr (assq 'pbm image-tests--images))))) | ||
| 201 | |||
| 202 | (ert-deftest image-tests-image-metadata/png () | ||
| 203 | (image-skip-unless 'png) | ||
| 204 | (should-not (image-metadata (cdr (assq 'png image-tests--images))))) | ||
| 205 | |||
| 206 | (ert-deftest image-tests-image-metadata/svg () | ||
| 207 | (image-skip-unless 'svg) | ||
| 208 | (should-not (image-metadata (cdr (assq 'svg image-tests--images))))) | ||
| 209 | |||
| 210 | (ert-deftest image-tests-image-metadata/tiff () | ||
| 211 | (image-skip-unless 'tiff) | ||
| 212 | (should-not (image-metadata | ||
| 213 | (create-image (cdr (assq 'tiff image-tests--images)))))) | ||
| 214 | |||
| 215 | (ert-deftest image-tests-image-metadata/webp () | ||
| 216 | (image-skip-unless 'webp) | ||
| 217 | (should-not (image-metadata | ||
| 218 | (create-image (cdr (assq 'webp image-tests--images)))))) | ||
| 219 | |||
| 220 | (ert-deftest image-tests-image-metadata/xbm () | ||
| 221 | (image-skip-unless 'xbm) | ||
| 222 | (should-not (image-metadata (cdr (assq 'xbm image-tests--images))))) | ||
| 223 | |||
| 224 | (ert-deftest image-tests-image-metadata/xpm () | ||
| 225 | (image-skip-unless 'xpm) | ||
| 226 | (should-not (image-metadata (cdr (assq 'xpm image-tests--images))))) | ||
| 227 | |||
| 228 | (ert-deftest image-tests-image-metadata/nil-on-invalid-spec () | ||
| 229 | (skip-unless (display-images-p)) | ||
| 230 | (should-not (image-metadata 'invalid-spec))) | ||
| 231 | |||
| 232 | (ert-deftest image-tests-image-metadata/error-on-nongraphical-display () | 54 | (ert-deftest image-tests-image-metadata/error-on-nongraphical-display () |
| 233 | (skip-unless (not (display-images-p))) | 55 | (skip-unless (not (display-images-p))) |
| 234 | (should-error (image-metadata (cdr (assq 'xpm image-tests--images))))) | 56 | (should-error (image-metadata (cdr (assq 'xpm image-tests--images))))) |
| 235 | 57 | ||
| 236 | ;;;; ImageMagick | ||
| 237 | |||
| 238 | (ert-deftest image-tests-imagemagick-types () | 58 | (ert-deftest image-tests-imagemagick-types () |
| 239 | (skip-unless (fboundp 'imagemagick-types)) | 59 | (skip-unless (fboundp 'imagemagick-types)) |
| 240 | (when (fboundp 'imagemagick-types) | 60 | (when (fboundp 'imagemagick-types) |
| 241 | (should (listp (imagemagick-types))))) | 61 | (should (listp (imagemagick-types))))) |
| 242 | 62 | ||
| 243 | ;;;; Initialization | ||
| 244 | |||
| 245 | (ert-deftest image-tests-init-image-library () | 63 | (ert-deftest image-tests-init-image-library () |
| 246 | (skip-unless (fboundp 'init-image-library)) | 64 | (skip-unless (fboundp 'init-image-library)) |
| 247 | (declare-function init-image-library "image.c" (type)) | 65 | (declare-function init-image-library "image.c" (type)) |
diff --git a/test/src/print-tests.el b/test/src/print-tests.el index 5c349342eb3..faab196f22f 100644 --- a/test/src/print-tests.el +++ b/test/src/print-tests.el | |||
| @@ -190,7 +190,8 @@ otherwise, use a different charset." | |||
| 190 | "Printing observes `print-continuous-numbering'." | 190 | "Printing observes `print-continuous-numbering'." |
| 191 | ;; cl-print does not support print-continuous-numbering. | 191 | ;; cl-print does not support print-continuous-numbering. |
| 192 | :expected-result (if (eq (symbol-function #'print-tests--prin1-to-string) | 192 | :expected-result (if (eq (symbol-function #'print-tests--prin1-to-string) |
| 193 | #'cl-prin1-to-string) :failed :passed) | 193 | #'cl-prin1-to-string) |
| 194 | :failed :passed) | ||
| 194 | (let* ((x (list 1)) | 195 | (let* ((x (list 1)) |
| 195 | (y "hello") | 196 | (y "hello") |
| 196 | (g (gensym)) | 197 | (g (gensym)) |
| @@ -201,7 +202,8 @@ otherwise, use a different charset." | |||
| 201 | (print-number-table nil)) | 202 | (print-number-table nil)) |
| 202 | (should (string-match | 203 | (should (string-match |
| 203 | "(#1=(1) #1# #2=\"hello\" #2#)(#3=#:g[[:digit:]]+ #3#)(#1# #2# #3#)#2#$" | 204 | "(#1=(1) #1# #2=\"hello\" #2#)(#3=#:g[[:digit:]]+ #3#)(#1# #2# #3#)#2#$" |
| 204 | (mapconcat #'print-tests--prin1-to-string `((,x ,x ,y ,y) (,g ,g) (,x ,y ,g) ,y) "")))) | 205 | (mapconcat #'print-tests--prin1-to-string |
| 206 | `((,x ,x ,y ,y) (,g ,g) (,x ,y ,g) ,y))))) | ||
| 205 | 207 | ||
| 206 | ;; This is the special case for byte-compile-output-docform | 208 | ;; This is the special case for byte-compile-output-docform |
| 207 | ;; mentioned in a comment in print_preprocess. When | 209 | ;; mentioned in a comment in print_preprocess. When |
diff --git a/test/src/process-tests.el b/test/src/process-tests.el index 6e1e148332c..7d3d9eb72b8 100644 --- a/test/src/process-tests.el +++ b/test/src/process-tests.el | |||
| @@ -134,12 +134,12 @@ process to complete." | |||
| 134 | (should (equal 1 (with-current-buffer stdout-buffer | 134 | (should (equal 1 (with-current-buffer stdout-buffer |
| 135 | (point-max)))) | 135 | (point-max)))) |
| 136 | (should (equal "hello stdout!\n" | 136 | (should (equal "hello stdout!\n" |
| 137 | (mapconcat #'identity (nreverse stdout-output) ""))) | 137 | (mapconcat #'identity (nreverse stdout-output)))) |
| 138 | (should stderr-sentinel-called) | 138 | (should stderr-sentinel-called) |
| 139 | (should (equal 1 (with-current-buffer stderr-buffer | 139 | (should (equal 1 (with-current-buffer stderr-buffer |
| 140 | (point-max)))) | 140 | (point-max)))) |
| 141 | (should (equal "hello stderr!\n" | 141 | (should (equal "hello stderr!\n" |
| 142 | (mapconcat #'identity (nreverse stderr-output) "")))))) | 142 | (mapconcat #'identity (nreverse stderr-output))))))) |
| 143 | 143 | ||
| 144 | (ert-deftest set-process-filter-t () | 144 | (ert-deftest set-process-filter-t () |
| 145 | "Test setting process filter to t and back." ;; Bug#36591 | 145 | "Test setting process filter to t and back." ;; Bug#36591 |