repair a test for weak-hash iteration

This commit is contained in:
Matthew Flatt 2020-01-08 06:05:11 -07:00
parent 4bdad475e1
commit 57e19c9d8f

View File

@ -830,8 +830,10 @@
(let ()
(define ht #f)
(let ([lst (build-list 10 add1)])
(set! ht (make-weak-hash `((,lst . val)))))
;; retain the list at first...
(define lst (build-list 10 add1))
(set! ht (make-weak-hash `((,lst . val))))
(define i (unsafe-weak-hash-iterate-first ht))
@ -846,6 +848,10 @@
'((1 2 3 4 5 6 7 8 9 10) . val))
(test #t boolean? (unsafe-weak-hash-iterate-next ht i))
;; drop `lst` on next GC
(test #t list? lst)
(set! lst #f)
(unless (eq? 'cgc (system-type 'gc))
;; collect key, everything should error (but not segfault)
(collect-garbage)(collect-garbage)(collect-garbage)