From becfaeb778a3c8ba241e2155b998d6b27dcfad0c Mon Sep 17 00:00:00 2001 From: Rose Hogenson Date: Tue, 26 Jul 2022 19:24:10 -0700 Subject: Fix a potential R7RS issue. I was using the load procedure to load a program, but by a strict reading of R7RS, load can only handle expressions and definitions, not imports. So instead I'm defining each test as a library, and using the environment procedure to load them at runtime. --- csc/compare-test.csc | 76 +++++++++++++++++++++++++++------------------------- 1 file changed, 39 insertions(+), 37 deletions(-) (limited to 'csc/compare-test.csc') diff --git a/csc/compare-test.csc b/csc/compare-test.csc index 379f21b..b710115 100644 --- a/csc/compare-test.csc +++ b/csc/compare-test.csc @@ -1,16 +1,18 @@ -(import (scheme base) - (only (csc match) - define-match-record-type) - (only (csc testing) - assert - test) - (csc compare)) +(define-library (csc compare-test) + (import (scheme base) + (only (csc match) + define-match-record-type) + (only (csc testing) + assert + test) + (csc compare)) + (begin -(test diff-list - (assert - (string=? - " ( + (test diff-list + (assert + (string=? + " ( 1 - 2 3 @@ -18,21 +20,21 @@ 4 ) " - (diff '(1 2 3 4) '(1 3 3.5 4))))) + (diff '(1 2 3 4) '(1 3 3.5 4))))) -(define-match-record-type - (make-test-type a b) - test-type? - %test-type - (a test-type-a) - (b test-type-b)) + (define-match-record-type + (make-test-type a b) + test-type? + %test-type + (a test-type-a) + (b test-type-b)) -(test diff-record - (assert - (string=? - " ( + (test diff-record + (assert + (string=? + " ( (!type . ) @@ -45,13 +47,13 @@ ) ) " - (diff (make-test-type 5 5) (make-test-type 5 6) (cons test-type? %test-type))))) + (diff (make-test-type 5 5) (make-test-type 5 6) (cons test-type? %test-type))))) -(test diff-multiline-string - (assert - (string=? - " ( + (test diff-multiline-string + (assert + (string=? + " ( (!type . string ) @@ -64,12 +66,12 @@ ) ) " - (diff "line-one\nline-two\nline-three" "line-one\nline-three")))) + (diff "line-one\nline-two\nline-three" "line-one\nline-three")))) -(test diff-vector - (assert - (string=? + (test diff-vector + (assert + (string=? " ( (!type . vector @@ -83,14 +85,14 @@ ) ) " - (diff #(1 2 3) #(1 3))))) + (diff #(1 2 3) #(1 3))))) -(test diff-symbol-list - (assert - (string=? - "- symbol + (test diff-symbol-list + (assert + (string=? + "- symbol + ( + ) " - (diff 'symbol '())))) + (diff 'symbol '())))))) -- cgit v1.3.1