PageRenderTime 6ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/test-suite/schemerunme/global_vars_proxy.scm

#
Lisp | 31 lines | 24 code | 7 blank | 0 comment | 0 complexity | 45fc36a5b59ebf761bcfecd7e55382dc MD5 | raw file
 1(define-macro (check test)
 2  `(if (not ,test) (error "Error in test" ',test)))
 3
 4(b "hello")
 5(check (string=? (b) "hello"))
 6
 7(define sa (make <A>))
 8(slot-set! sa 'x 5)
 9(a sa)
10(check (= (slot-ref (a) 'x) 5))
11
12(ap sa)
13(check (= (slot-ref (ap) 'x) 5))
14(slot-set! sa 'x 10)
15(check (= (slot-ref (ap) 'x) 10))
16
17(define sa2 (make <A>))
18(slot-set! sa2 'x -4)
19(cap sa2)
20(check (= (slot-ref (cap) 'x) -4))
21(slot-set! sa2 'x -7)
22(check (= (slot-ref (cap) 'x) -7))
23
24(check (= (slot-ref (ar) 'x) 5))
25(ar sa2)
26(check (= (slot-ref (ar) 'x) -7))
27
28(x 4)
29(check (= (x) 4))
30
31(exit 0)