diff options
| author | Andrea Corallo | 2024-01-25 14:37:17 +0100 |
|---|---|---|
| committer | Andrea Corallo | 2024-01-25 14:42:15 +0100 |
| commit | 5d91cbf9a57d519968a6fb3ad6edfbf9709574a5 (patch) | |
| tree | c331f08180738e7c26bc520a16cd7e9e569b57ee /test/src | |
| parent | b014bca833a17f5b2258e88115f03cffa983d0bd (diff) | |
| download | emacs-5d91cbf9a57d519968a6fb3ad6edfbf9709574a5.tar.gz emacs-5d91cbf9a57d519968a6fb3ad6edfbf9709574a5.zip | |
* Make comp tests robust against sxhash-equal internal changes
* test/src/comp-tests.el (cl-seq): Require.
(comp-tests--types-equal): New function.
(comp-tests-check-ret-type-spec): Make use of.
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/comp-tests.el | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el index 0aa9e76fa2d..4e7ca88d197 100644 --- a/test/src/comp-tests.el +++ b/test/src/comp-tests.el | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | (require 'ert) | 28 | (require 'ert) |
| 29 | (require 'ert-x) | 29 | (require 'ert-x) |
| 30 | (require 'cl-lib) | 30 | (require 'cl-lib) |
| 31 | (require 'cl-seq) | ||
| 31 | (require 'comp) | 32 | (require 'comp) |
| 32 | (require 'comp-cstr) | 33 | (require 'comp-cstr) |
| 33 | 34 | ||
| @@ -903,14 +904,26 @@ Return a list of results." | |||
| 903 | (should (subr-native-elisp-p (symbol-function 'comp-tests-fw-prop-1-f))) | 904 | (should (subr-native-elisp-p (symbol-function 'comp-tests-fw-prop-1-f))) |
| 904 | (should (= (comp-tests-fw-prop-1-f) 6)))) | 905 | (should (= (comp-tests-fw-prop-1-f) 6)))) |
| 905 | 906 | ||
| 907 | (defun comp-tests--types-equal (t1 t2) | ||
| 908 | "Whether the types T1 and T2 are equal." | ||
| 909 | (or (equal t1 t2) ; optimisation for the common case | ||
| 910 | (and (consp t1) (consp t2) | ||
| 911 | (eq (car t1) (car t2)) | ||
| 912 | (if (memq (car t1) '(and or member)) | ||
| 913 | (null (cl-set-exclusive-or (cdr t1) (cdr t2) | ||
| 914 | :test #'comp-tests--types-equal)) | ||
| 915 | (and (= (length t1) (length t2)) | ||
| 916 | (cl-every #'comp-tests--types-equal (cdr t1) (cdr t2))))))) | ||
| 917 | |||
| 906 | (defun comp-tests-check-ret-type-spec (func-form ret-type) | 918 | (defun comp-tests-check-ret-type-spec (func-form ret-type) |
| 907 | (let ((lexical-binding t) | 919 | (let ((lexical-binding t) |
| 908 | (native-comp-speed 2) | 920 | (native-comp-speed 2) |
| 909 | (f-name (cl-second func-form))) | 921 | (f-name (cl-second func-form))) |
| 910 | (eval func-form t) | 922 | (eval func-form t) |
| 911 | (native-compile f-name) | 923 | (native-compile f-name) |
| 912 | (should (equal (cl-third (subr-type (symbol-function f-name))) | 924 | (should (comp-tests--types-equal |
| 913 | ret-type)))) | 925 | (cl-third (subr-type (symbol-function f-name))) |
| 926 | ret-type)))) | ||
| 914 | 927 | ||
| 915 | (cl-eval-when (compile eval load) | 928 | (cl-eval-when (compile eval load) |
| 916 | (cl-defstruct comp-foo a b) | 929 | (cl-defstruct comp-foo a b) |