28 |
(cons 'syntax-error "Missing or extra expression")) |
(cons 'syntax-error "Missing or extra expression")) |
29 |
(define exception:missing-expr |
(define exception:missing-expr |
30 |
(cons 'syntax-error "Missing expression")) |
(cons 'syntax-error "Missing expression")) |
31 |
|
(define exception:missing-body-expr |
32 |
|
(cons 'syntax-error "Missing body expression")) |
33 |
(define exception:extra-expr |
(define exception:extra-expr |
34 |
(cons 'syntax-error "Extra expression")) |
(cons 'syntax-error "Extra expression")) |
35 |
(define exception:illegal-empty-combination |
(define exception:illegal-empty-combination |
590 |
(eval '(case 1 (else #f) ((1) #t)) |
(eval '(case 1 (else #f) ((1) #t)) |
591 |
(interaction-environment))))) |
(interaction-environment))))) |
592 |
|
|
593 |
(with-test-prefix "define" |
(with-test-prefix "top-level define" |
594 |
|
|
595 |
(with-test-prefix "currying" |
(with-test-prefix "currying" |
596 |
|
|
597 |
(pass-if "(define ((foo)) #f)" |
(pass-if "(define ((foo)) #f)" |
598 |
(define ((foo)) #t) |
(eval '(begin |
599 |
((foo)))) |
(define ((foo)) #t) |
600 |
|
((foo))) |
601 |
|
(interaction-environment)))) |
602 |
|
|
603 |
(with-test-prefix "missing or extra expressions" |
(with-test-prefix "missing or extra expressions" |
604 |
|
|
607 |
(eval '(define) |
(eval '(define) |
608 |
(interaction-environment))))) |
(interaction-environment))))) |
609 |
|
|
610 |
|
(with-test-prefix "internal define" |
611 |
|
|
612 |
|
(pass-if "internal defines become letrec" |
613 |
|
(eval '(let ((a identity) (b identity) (c identity)) |
614 |
|
(define (a x) (if (= x 0) 'a (b (- x 1)))) |
615 |
|
(define (b x) (if (= x 0) 'b (c (- x 1)))) |
616 |
|
(define (c x) (if (= x 0) 'c (a (- x 1)))) |
617 |
|
(and (eq? 'a (a 0) (a 3)) |
618 |
|
(eq? 'b (a 1) (a 4)) |
619 |
|
(eq? 'c (a 2) (a 5)))) |
620 |
|
(interaction-environment))) |
621 |
|
|
622 |
|
(expect-fail "internal defines with begin" |
623 |
|
(false-if-exception |
624 |
|
(eval '(let ((a identity) (b identity) (c identity)) |
625 |
|
(define (a x) (if (= x 0) 'a (b (- x 1)))) |
626 |
|
(begin |
627 |
|
(define (b x) (if (= x 0) 'b (c (- x 1))))) |
628 |
|
(define (c x) (if (= x 0) 'c (a (- x 1)))) |
629 |
|
(and (eq? 'a (a 0) (a 3)) |
630 |
|
(eq? 'b (a 1) (a 4)) |
631 |
|
(eq? 'c (a 2) (a 5)))) |
632 |
|
(interaction-environment)))) |
633 |
|
|
634 |
|
(expect-fail "internal defines with empty begin" |
635 |
|
(false-if-exception |
636 |
|
(eval '(let ((a identity) (b identity) (c identity)) |
637 |
|
(define (a x) (if (= x 0) 'a (b (- x 1)))) |
638 |
|
(begin) |
639 |
|
(define (b x) (if (= x 0) 'b (c (- x 1)))) |
640 |
|
(define (c x) (if (= x 0) 'c (a (- x 1)))) |
641 |
|
(and (eq? 'a (a 0) (a 3)) |
642 |
|
(eq? 'b (a 1) (a 4)) |
643 |
|
(eq? 'c (a 2) (a 5)))) |
644 |
|
(interaction-environment)))) |
645 |
|
|
646 |
|
(pass-if-exception "missing body expression" |
647 |
|
exception:missing-body-expr |
648 |
|
(eval '(let () (define x #t)) |
649 |
|
(interaction-environment)))) |
650 |
|
|
651 |
(with-test-prefix "set!" |
(with-test-prefix "set!" |
652 |
|
|
653 |
(with-test-prefix "missing or extra expressions" |
(with-test-prefix "missing or extra expressions" |