source: project/chicken/trunk/tests/test-finalizers.scm @ 12869

Last change on this file since 12869 was 12869, checked in by felix winkelmann, 11 years ago

finalizer bug not fixed, perhaps now

File size: 515 bytes
Line 
1;;;; test-finalizers.scm
2
3(define x (list 1 2 3))
4(define y (list 4 5 6))
5(define x-f #f)
6(define y-f #f)
7
8(begin
9  (set-finalizer! 
10   x
11   (lambda (o)
12     (format #t "Delete: ~A (y: ~a)~%" o y-f)
13     (set! x-f #t)))
14  #t) 
15(begin
16  (set-finalizer! 
17   y 
18   (let ((p x))
19     (lambda (o)
20       (format #t "Delete: ~A: ~A~%" o p)
21       (set! y-f #t))))
22  #t)
23(gc #t)
24(assert (not x-f))
25(assert (not y-f))
26(set! x #f)
27(gc #t)
28(assert (not x-f))
29(assert (not y-f))
30(set! y #f)
31(gc #t)
32(assert y-f)
33(assert x-f)
Note: See TracBrowser for help on using the repository browser.