[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 5d91cbf9a57: * Make comp tests robust against sxhash-equal intern
From: |
Andrea Corallo |
Subject: |
master 5d91cbf9a57: * Make comp tests robust against sxhash-equal internal changes |
Date: |
Thu, 25 Jan 2024 08:44:06 -0500 (EST) |
branch: master
commit 5d91cbf9a57d519968a6fb3ad6edfbf9709574a5
Author: Andrea Corallo <acorallo@gnu.org>
Commit: Andrea Corallo <acorallo@gnu.org>
* 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.
---
test/src/comp-tests.el | 17 +++++++++++++++--
1 file 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 @@
(require 'ert)
(require 'ert-x)
(require 'cl-lib)
+(require 'cl-seq)
(require 'comp)
(require 'comp-cstr)
@@ -903,14 +904,26 @@ Return a list of results."
(should (subr-native-elisp-p (symbol-function 'comp-tests-fw-prop-1-f)))
(should (= (comp-tests-fw-prop-1-f) 6))))
+(defun comp-tests--types-equal (t1 t2)
+ "Whether the types T1 and T2 are equal."
+ (or (equal t1 t2) ; optimisation for the common case
+ (and (consp t1) (consp t2)
+ (eq (car t1) (car t2))
+ (if (memq (car t1) '(and or member))
+ (null (cl-set-exclusive-or (cdr t1) (cdr t2)
+ :test #'comp-tests--types-equal))
+ (and (= (length t1) (length t2))
+ (cl-every #'comp-tests--types-equal (cdr t1) (cdr t2)))))))
+
(defun comp-tests-check-ret-type-spec (func-form ret-type)
(let ((lexical-binding t)
(native-comp-speed 2)
(f-name (cl-second func-form)))
(eval func-form t)
(native-compile f-name)
- (should (equal (cl-third (subr-type (symbol-function f-name)))
- ret-type))))
+ (should (comp-tests--types-equal
+ (cl-third (subr-type (symbol-function f-name)))
+ ret-type))))
(cl-eval-when (compile eval load)
(cl-defstruct comp-foo a b)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 5d91cbf9a57: * Make comp tests robust against sxhash-equal internal changes,
Andrea Corallo <=