1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-03-27 01:01:52 -07:00

* test/src/fns-tests.el (ft-weak-equal-table): New test.

This commit is contained in:
Helmut Eller 2026-01-05 18:35:27 +01:00
parent 473bc17d91
commit 390087bf08

View file

@ -1399,9 +1399,26 @@
(should (< (hash-table-count h) n))))
(ert-deftest ft-ephemeron-table ()
:expected-result (if (fboundp 'igc--collect) :failed :passed)
(dolist (w '(key value key-and-value key-or-value))
(ft--test-ephemeron-table w)))
(ert-deftest ft-weak-equal-table ()
:expected-result (if (fboundp 'igc--collect) :failed :passed)
(let* ((h (make-hash-table :weakness 'key-or-value :test #'equal))
(n 10)
(root nil))
(dotimes (i n)
(let* ((key (list 'key i))
(val (list 'val i)))
(puthash key val h)))
(should (= (hash-table-count h) n))
(ft--gc 'key)
(setq root (gethash '(key 0) h))
(ft--gc 'key-or-value)
(should (< (hash-table-count h) n))
(should (equal root (gethash '(key 0) h)))))
(ert-deftest test-hash-function-that-mutates-hash-table ()