projects
/
scheme.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Allocate and pass closures on the heap
[scheme.git]
/
tests.scm
diff --git
a/tests.scm
b/tests.scm
index bfd9124510826ea685a814248fd084509510b583..89ca852986f7e921f7a54e1153edc9be0be2f33c 100644
(file)
--- a/
tests.scm
+++ b/
tests.scm
@@
-19,13
+19,13
@@
(define (test-prog prog exit-code)
(display prog)
(newline)
(define (test-prog prog exit-code)
(display prog)
(newline)
- (compile-to-binary prog "/tmp/test-prog")
+ (compile-to-binary prog "/tmp/test-prog"
'darwin
)
(test (system "/tmp/test-prog") exit-code))
(define (test-prog-stdout prog output)
(display prog)
(newline)
(test (system "/tmp/test-prog") exit-code))
(define (test-prog-stdout prog output)
(display prog)
(newline)
- (compile-to-binary prog "/tmp/test-prog")
+ (compile-to-binary prog "/tmp/test-prog"
'darwin
)
(system "/tmp/test-prog > /tmp/test-output.txt")
(let ((str (read-file "/tmp/test-output.txt")))
(test str output)))
(system "/tmp/test-prog > /tmp/test-output.txt")
(let ((str (read-file "/tmp/test-output.txt")))
(test str output)))
@@
-48,3
+48,6
@@
(test-prog '((lambda (x y) (+ x y)) 1 2) 3)
(test-prog '((lambda (x) (+ ((lambda (y) (+ y 1)) 3) x)) 2) 6)
(test-prog '((lambda (x y) (+ x y)) 1 2) 3)
(test-prog '((lambda (x) (+ ((lambda (y) (+ y 1)) 3) x)) 2) 6)
+
+ ; passing closures about
+(test-prog '((lambda (z) ((lambda (x) (x 1)) (lambda (y) (+ z y)))) 2) 3)