From 1f14a62e0a2a10bcccf4bb1e68f96dd4391efaa9 Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga 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) )) +(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))