aboutsummaryrefslogtreecommitdiffstats
path: root/csc/compare-test.csc
diff options
context:
space:
mode:
authorRose Hogenson <rhogenson@posteo.net>2022-07-26 19:24:10 -0700
committerRose Hogenson <rhogenson@posteo.net>2022-07-26 19:24:10 -0700
commitbecfaeb778a3c8ba241e2155b998d6b27dcfad0c (patch)
tree97ca02178660fe958026a707905eac1c5ebd188d /csc/compare-test.csc
parentFix an issue with how the linker combined files. (diff)
downloadchromatopelma-becfaeb778a3c8ba241e2155b998d6b27dcfad0c.tar.zst
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.
Diffstat (limited to 'csc/compare-test.csc')
-rw-r--r--csc/compare-test.csc76
1 files changed, 39 insertions, 37 deletions
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 <test-type>
- (make-test-type a b)
- test-type?
- %test-type
- (a test-type-a)
- (b test-type-b))
+ (define-match-record-type <test-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 .
<test-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 '()))))))