From 800faabca3caddfb0dda1fc1bff5a861a82ab0b5 Mon Sep 17 00:00:00 2001
From: "Robert P. Goldman" <rpgoldman@sift.net>
Date: Sun, 30 Apr 2023 12:22:05 -0500
Subject: [PATCH] Fix tests for copy-hash-table and test=.

A current Allegro beta gives different values for these tests that
seem acceptable according to the CL ANSI Spec.

Specifically:

- the `hash-table-size` of a hash-table copy is not always equal to
the size of the original hash-table, but this seems to be permitted by
the spec. Gitlab issue #30.

- Allegro gives a `program-error` in one case where the tests expect a
`type-error`. GitLab issue #31.

- Allegro is more sure about a `subtypep` query than some other lisps
in a way that seems permissible.  GitLab issue #32.
---
 alexandria-1/tests.lisp | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/alexandria-1/tests.lisp b/alexandria-1/tests.lisp
index 3c85d44..112df9b 100644
--- a/alexandria-1/tests.lisp
+++ b/alexandria-1/tests.lisp
@@ -283,7 +283,7 @@
             (eql-copy (copy-hash-table orig :test 'eql))
             (equal-copy (copy-hash-table orig :test 'equal))
             (equalp-copy (copy-hash-table orig :test 'equalp)))
-        (list (eql (hash-table-size eq-copy) (hash-table-size orig))
+        (list #-allegro (eql (hash-table-size eq-copy) (hash-table-size orig))
               (eql (hash-table-rehash-size eq-copy)
                    (hash-table-rehash-size orig))
               (hash-table-count eql-copy)
@@ -293,7 +293,7 @@
               (gethash (copy-seq foo) equal-copy)
               (gethash "FOO" equal-copy)
               (gethash "FOO" equalp-copy))))
-  (t t 2 t nil t t nil t))
+  (#-allegro t t 2 t nil t t nil t))
 
 (deftest copy-hash-table.2
     (let ((ht (make-hash-table))
@@ -1605,8 +1605,13 @@
         (let ((stream (make-broadcast-stream)))
           (read-stream-content-into-byte-vector stream :initial-size 0))
       (type-error ()
-        :type-error))
-  :type-error)
+        :type-error)
+      (program-error ()
+        :program-error))
+  #-allegro
+  :type-error
+  #+allegro
+  :program-error)
 
 ;;;; Macros
 
@@ -1789,8 +1794,7 @@
   t)
 
 (deftest type=.4
-    (type= 'string '(satisfies emptyp))
-  nil
+    (nth-value 0 (type= 'string '(satisfies emptyp)))
   nil)
 
 (deftest type=.5
-- 
GitLab