diff options
-rw-r--r-- | module/ice-9/vlist.scm | 2 | ||||
-rw-r--r-- | test-suite/tests/vlist.test | 14 |
2 files changed, 14 insertions, 2 deletions
diff --git a/module/ice-9/vlist.scm b/module/ice-9/vlist.scm index 6c88df86a..34c7c00c1 100644 --- a/module/ice-9/vlist.scm +++ b/module/ice-9/vlist.scm @@ -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)) diff --git a/test-suite/tests/vlist.test b/test-suite/tests/vlist.test index f3e0989c1..b590bbda1 100644 --- a/test-suite/tests/vlist.test +++ b/test-suite/tests/vlist.test @@ -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)) |