From 44f811788641891c47445d44b79dcf9c06c32118 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Mon, 27 May 2019 22:57:44 +0200 Subject: [PATCH] test: Resurrect running boot tests on Guile. * module/mes/guile.scm (keyword->string): New function. * scaffold/boot/43-or.scm (foo): Add quoting. * scaffold/boot/45-pass-if.scm (pass-if): Likewise. * scaffold/boot/46-report.scm (pass-if): Likewise. * scaffold/boot/47-pass-if-eq.scm (pass-if): Likewise. * scaffold/boot/48-let.scm (map): Rename from map1. * scaffold/boot/60-let-syntax-expanded.scm: Some work. --- module/mes/guile.scm | 2 ++ scaffold/boot/43-or.scm | 2 +- scaffold/boot/45-pass-if.scm | 2 +- scaffold/boot/46-report.scm | 2 +- scaffold/boot/47-pass-if-eq.scm | 2 +- scaffold/boot/48-let.scm | 8 ++++---- scaffold/boot/51-module.scm | 3 +-- scaffold/boot/60-let-syntax-expanded.scm | 9 +++++++++ 8 files changed, 20 insertions(+), 10 deletions(-) diff --git a/module/mes/guile.scm b/module/mes/guile.scm index 451843b4..26fc2cc7 100644 --- a/module/mes/guile.scm +++ b/module/mes/guile.scm @@ -47,6 +47,7 @@ core:type %compiler equal2? + keyword->string pmatch-car pmatch-cdr ) @@ -85,6 +86,7 @@ (define 15) (define %compiler "gnuc") + (define keyword->string (compose symbol->string keyword->symbol)) (define (core:type x) (cond ((guile:keyword? x) ) diff --git a/scaffold/boot/43-or.scm b/scaffold/boot/43-or.scm index bd8cb1d2..1ad758ec 100644 --- a/scaffold/boot/43-or.scm +++ b/scaffold/boot/43-or.scm @@ -28,7 +28,7 @@ (or #t a)) (define-macro (foo bar) - (list f bar)) + (list 'f bar)) (foo 3) diff --git a/scaffold/boot/45-pass-if.scm b/scaffold/boot/45-pass-if.scm index 1d8a30f5..31ccc7f2 100644 --- a/scaffold/boot/45-pass-if.scm +++ b/scaffold/boot/45-pass-if.scm @@ -26,6 +26,6 @@ (list 'begin (list core:display "test: ") (list core:display name) - (list result t))) + (list (quote result) t))) (pass-if "first dummy" #t) diff --git a/scaffold/boot/46-report.scm b/scaffold/boot/46-report.scm index fa62ca07..2d262164 100644 --- a/scaffold/boot/46-report.scm +++ b/scaffold/boot/46-report.scm @@ -54,7 +54,7 @@ (list 'begin (list display "test: ") (list display name) - (list result t))) + (list (quote result) t))) (pass-if "first dummy" #t) diff --git a/scaffold/boot/47-pass-if-eq.scm b/scaffold/boot/47-pass-if-eq.scm index 5c5807dc..c9e53dd6 100644 --- a/scaffold/boot/47-pass-if-eq.scm +++ b/scaffold/boot/47-pass-if-eq.scm @@ -26,7 +26,7 @@ (list 'begin (list core:display "test: ") (list core:display name) - (list result t))) + (list (quote result) t))) (define-macro (pass-if-eq name expect . body) (list 'pass-if name (list eq? expect (cons 'begin body)))) diff --git a/scaffold/boot/48-let.scm b/scaffold/boot/48-let.scm index fecb2a39..54b01ee1 100644 --- a/scaffold/boot/48-let.scm +++ b/scaffold/boot/48-let.scm @@ -16,15 +16,15 @@ ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Mes. If not, see . -(define (map1 f lst) +(define (map f lst) (if (null? lst) (list) - (cons (f (car lst)) (map1 f (cdr lst))))) + (cons (f (car lst)) (map f (cdr lst))))) (define (cadr x) (car (cdr x))) (define-macro (let bindings . rest) - (cons (cons 'lambda (cons (map1 car bindings) rest)) - (map1 cadr bindings))) + (cons (cons 'lambda (cons (map car bindings) rest)) + (map cadr bindings))) (let ((x 0)) x) (let ((y 0)) y) diff --git a/scaffold/boot/51-module.scm b/scaffold/boot/51-module.scm index 83040145..7d3e30ae 100644 --- a/scaffold/boot/51-module.scm +++ b/scaffold/boot/51-module.scm @@ -17,8 +17,7 @@ ;;; along with GNU Mes. If not, see . (cond-expand - (guile - (set! %load-path (append %load-path '("mes/module")))) + (guile) (mes (define (cons* . rest) (if (null? (cdr rest)) (car rest) diff --git a/scaffold/boot/60-let-syntax-expanded.scm b/scaffold/boot/60-let-syntax-expanded.scm index 52049287..cfb229fb 100644 --- a/scaffold/boot/60-let-syntax-expanded.scm +++ b/scaffold/boot/60-let-syntax-expanded.scm @@ -248,6 +248,15 @@ (or (null? x) (and (pair? x) (list? (cdr x))))) +(cond-expand + (guile) + (mes + (define (boolean? x) + (or (eq? x #f) (eq? x #t))) + (define (char? x) + (and (eq? (core:type x) ) + (> (char->integer x) -1))))) + ;; -*-scheme-*- ;;; GNU Mes --- Maxwell Equations of Software