bug-mes
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] tests: make tests/vector.test compatible with guile


From: Ekaitz Zarraga
Subject: [PATCH] tests: make tests/vector.test compatible with guile
Date: Thu, 24 Aug 2023 18:01:04 +0000

>From 394ad800c29513f7b6106ab3887340d5fc0ff02d Mon Sep 17 00:00:00 2001
From: Ekaitz Zarraga <ekaitz@elenq.tech>
Date: Thu, 24 Aug 2023 19:54:06 +0200
Subject: [PATCH] tests: make tests/vector.test compatible with guile

* tests/vector.test (make-vector): Don't rely in string comparison.
* mes/module/mes/type-0.mes (unspecified?): Add function.
---
 mes/module/mes/type-0.mes | 3 +++
 tests/vector.test         | 6 +++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/mes/module/mes/type-0.mes b/mes/module/mes/type-0.mes
index beefbf06..ac028e68 100644
--- a/mes/module/mes/type-0.mes
+++ b/mes/module/mes/type-0.mes
@@ -76,6 +76,9 @@
 (define (port? x)
   (eq? (core:type x) <cell:port>))
 
+(define (unspecified? x)
+  (eq? (if #f #f) x))
+
 (define (procedure? p)
   (and (or (builtin? p)
            (and (pair? p) (eq? (car p) 'lambda))
diff --git a/tests/vector.test b/tests/vector.test
index 0bf8c185..e3e6f42e 100755
--- a/tests/vector.test
+++ b/tests/vector.test
@@ -39,7 +39,11 @@ exec ${MES-bin/mes} --no-auto-compile -L ${0%/*} -L module 
-C module -e '(tests
 (pass-if "vector?" (vector? #(1 2 c)))
 (pass-if "vector-length" (seq? (vector-length #(1)) 1))
 
-(pass-if "make-vector" (sequal? (make-vector 3) #(*unspecified* *unspecified* 
*unspecified*)))
+(pass-if "make-vector" (let ((v (make-vector 3)))
+                         (and (= 3 (vector-length v))
+                              (unspecified? (vector-ref v 0))
+                              (unspecified? (vector-ref v 1))
+                              (unspecified? (vector-ref v 2)))))
 (pass-if "make-vector 1" (sequal? (make-vector 3 0) #(0 0 0)))
 
 (pass-if "vector-ref" (seq? (vector-ref #(0 1) 1) 1))
-- 
2.41.0





reply via email to

[Prev in Thread] Current Thread [Next in Thread]