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/format-test.csc | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'csc/format-test.csc') diff --git a/csc/format-test.csc b/csc/format-test.csc index 6efaa87..1906af6 100644 --- a/csc/format-test.csc +++ b/csc/format-test.csc @@ -1,24 +1,26 @@ -(import (scheme base) - (only (csc strings) str-quote) - (only (csc testing) assert-equal test) - (csc format)) +(define-library (csc format-test) + (import (scheme base) + (only (csc strings) str-quote) + (only (csc testing) assert-equal test) + (csc format)) + (begin -(test sprintf-single-string - (assert-equal "test-string" (sprintf "test-string"))) + (test sprintf-single-string + (assert-equal "test-string" (sprintf "test-string"))) -(test sprintf-list - (assert-equal "(1 2 3)" (sprintf "{}" '(1 2 3)))) + (test sprintf-list + (assert-equal "(1 2 3)" (sprintf "{}" '(1 2 3)))) -(test sprintf-complex - (assert-equal "this (1 2 3) is 1 a bbb test" (sprintf "this {} is {} a {} test" '(1 2 3) 1 "bbb"))) + (test sprintf-complex + (assert-equal "this (1 2 3) is 1 a bbb test" (sprintf "this {} is {} a {} test" '(1 2 3) 1 "bbb"))) -(test sprintf-escape-open - (assert-equal "{" (sprintf "{{"))) + (test sprintf-escape-open + (assert-equal "{" (sprintf "{{"))) -(test sprintf-escape-close - (assert-equal "}" (sprintf "}}"))) + (test sprintf-escape-close + (assert-equal "}" (sprintf "}}"))))) -- cgit v1.3.1