mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-10 22:10:21 +02:00
fix "lexical vars are collectable" test
* test-suite/tests/gc.test ("gc"): Fix "lexical vars are collectable" test. (Previously, the binding was getting inlined, so we weren't testing what we meant to test. Besides that, the value was a constant, not a closure, so it wasn't collectable in the first place!)
This commit is contained in:
parent
e5cf97290c
commit
a2b62b48ab
1 changed files with 6 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
||||||
;;;; gc.test --- test guile's garbage collection -*- scheme -*-
|
;;;; gc.test --- test guile's garbage collection -*- scheme -*-
|
||||||
;;;; Copyright (C) 2000, 2001, 2004, 2006, 2007, 2008, 2009,
|
;;;; Copyright (C) 2000, 2001, 2004, 2006, 2007, 2008, 2009,
|
||||||
;;;; 2011 Free Software Foundation, Inc.
|
;;;; 2011, 2012 Free Software Foundation, Inc.
|
||||||
;;;;
|
;;;;
|
||||||
;;;; This library is free software; you can redistribute it and/or
|
;;;; This library is free software; you can redistribute it and/or
|
||||||
;;;; modify it under the terms of the GNU Lesser General Public
|
;;;; modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -87,11 +87,14 @@
|
||||||
total)))
|
total)))
|
||||||
|
|
||||||
(pass-if "Lexical vars are collectable"
|
(pass-if "Lexical vars are collectable"
|
||||||
(procedure?
|
(list?
|
||||||
(compile
|
(compile
|
||||||
'(begin
|
'(begin
|
||||||
(define guardian (make-guardian))
|
(define guardian (make-guardian))
|
||||||
(let ((f (lambda () (display "test\n"))))
|
(let ((f (list 'foo)))
|
||||||
|
;; Introduce a useless second reference to f to prevent the
|
||||||
|
;; optimizer from propagating the lexical binding.
|
||||||
|
f
|
||||||
(guardian f))
|
(guardian f))
|
||||||
(gc)(gc)(gc)
|
(gc)(gc)(gc)
|
||||||
(guardian))))))
|
(guardian))))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue