fixing code and adding some more test cases

This commit is contained in:
Danny Yoo 2011-04-27 22:09:40 -04:00
parent e13f26ff61
commit d2fa527872
2 changed files with 51 additions and 1 deletions

View File

@ -1538,7 +1538,7 @@
;; Finally, make sure any multiple values are off the stack.
(if (> (length ids) 1)
(make-instruction-sequence
`(,(make-PopEnvironment (make-Const (length ids))
`(,(make-PopEnvironment (make-Const (sub1 (length ids)))
(make-Const 0))))
empty-instruction-sequence)))))

View File

@ -1170,6 +1170,56 @@
-1
#:with-bootstrapping? #t)
(test '(begin (define-values () (values))
'ok)
'ok
#:with-bootstrapping? #t)
(test '(begin (define-values (x y z) (values 3 4 5))
x)
3
#:with-bootstrapping? #t)
(test '(begin (define-values (x y z) (values 3 4 5))
y)
4
#:with-bootstrapping? #t)
(test '(begin (define-values (x y z) (values 3 4 5))
z)
5
#:with-bootstrapping? #t)
(test '(begin (define-values (x) "hello")
x)
"hello"
#:with-bootstrapping? #t)
(test '(begin (define-values (x) (values "hello"))
x)
"hello"
#:with-bootstrapping? #t)
(test '(begin (define (f x)
(values (* x 2)
(/ x 2)))
(define-values (a b) (f 16))
(list a b))
(list 32 8)
#:with-bootstrapping? #t)
#;(test (read (open-input-file "tests/conform/program0.sch"))
(port->string (open-input-file "tests/conform/expected0.txt")))