mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-30 06:50:31 +02:00
Fix a bug in `vhash-delete'.
* module/ice-9/vlist.scm (vhash-delete): Honor HASH. * test-suite/tests/vlist.test ("vhash")["vhash-delete honors HASH"]: New test.
This commit is contained in:
parent
1e1808c920
commit
da0c22b5d3
2 changed files with 14 additions and 2 deletions
|
@ -536,7 +536,7 @@ with @var{equal?}."
|
|||
(v (cdr k+v)))
|
||||
(if (equal? k key)
|
||||
result
|
||||
(vhash-cons k v result))))
|
||||
(vhash-cons k v result hash))))
|
||||
vlist-null
|
||||
vhash)
|
||||
vhash))
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
;;;;
|
||||
;;;; Ludovic Courtès <ludo@gnu.org>
|
||||
;;;;
|
||||
;;;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
|
||||
;;;; Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
|
||||
;;;;
|
||||
;;;; This library is free software; you can redistribute it and/or
|
||||
;;;; modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -282,6 +282,18 @@
|
|||
#t
|
||||
keys)))))
|
||||
|
||||
(pass-if "vhash-delete honors HASH"
|
||||
;; In 2.0.0, `vhash-delete' would construct a new vhash without
|
||||
;; using the supplied hash procedure, which could lead to
|
||||
;; inconsistencies.
|
||||
(let* ((s "hello")
|
||||
(vh (fold vhash-consq
|
||||
(vhash-consq s "world" vlist-null)
|
||||
(iota 300)
|
||||
(iota 300))))
|
||||
(and (vhash-assq s vh)
|
||||
(pair? (vhash-assq s (vhash-delete 123 vh eq? hashq))))))
|
||||
|
||||
(pass-if "vhash-fold"
|
||||
(let* ((keys '(a b c d e f g d h i))
|
||||
(values '(1 2 3 4 5 6 7 0 8 9))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue