Projects : gscm : gscm_genesis

tests/storage.scm

Dir - Raw

1;; Very basic storage model tests.
2
3(load "common.scm")
4
5(letrec ((a 0))
6 (letrec ((b (cons a 1)))
7 (set-car! b 2)
8 (assert-equal a 0)))
9
10(letrec ((a 0))
11 (define (b) a)
12 (assert-equal (b) 0)
13 (set! a 1)
14 (assert-equal (b) 1))
15
16(letrec ((a 0))
17 (define b ((lambda (a) (lambda () a))
18 1))
19 (assert-equal (b) 1))
20
21(assert-equal
22 (let* ((a 1) (b a))
23 (set! a 2)
24 b)
25 1)
26
27(let ((a 1))
28 ((lambda () (set! a 2)))
29 (assert-equal a 2))
30
31(let ((a (string #\a)))
32 (let ((b a))
33 (assert (eq? a b))))
34
35(let* ((a (list 1 2))
36 (b (apply list a)))
37 (set-cdr! a '())
38 (assert-equal b '(1 2)))