aboutsummaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
authorHelmut Eller2025-10-18 20:22:17 +0200
committerHelmut Eller2025-10-18 20:22:17 +0200
commit48357dc612ffe2d6b286e3f99a0e7e9c80cfcbb8 (patch)
tree74540366acdd53082889a98a4836c1be5029a52c /test/src
parent08dc7d0c9306a0f9b7d330216098dc762f584624 (diff)
downloademacs-48357dc612ffe2d6b286e3f99a0e7e9c80cfcbb8.tar.gz
emacs-48357dc612ffe2d6b286e3f99a0e7e9c80cfcbb8.zip
Add a test for puthash
It's actually for a bug on the feature/igc branch. * test/src/fns-tests.el (ft-puthash-weak): New test (ft--puthash-weak): New helper.
Diffstat (limited to 'test/src')
-rw-r--r--test/src/fns-tests.el16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el
index e0467c0b871..7e9286a4251 100644
--- a/test/src/fns-tests.el
+++ b/test/src/fns-tests.el
@@ -1330,6 +1330,22 @@
1330(ert-deftest ft-weak-and-removal () (ft--test-weak-removal 'key-and-value)) 1330(ert-deftest ft-weak-and-removal () (ft--test-weak-removal 'key-and-value))
1331(ert-deftest ft-weak-or-removal () (ft--test-weak-removal 'key-or-value)) 1331(ert-deftest ft-weak-or-removal () (ft--test-weak-removal 'key-or-value))
1332 1332
1333(defun ft--test-puthash (weakness)
1334 (let ((h (make-hash-table :weakness weakness))
1335 (a (string ?a))
1336 (b (string ?b))
1337 (c (string ?c)))
1338 (puthash a a h)
1339 (should (eq (gethash a h) a))
1340 (puthash a b h)
1341 (should (eq (gethash a h) b))
1342 (puthash a c h)
1343 (should (eq (gethash a h) c))))
1344
1345(ert-deftest ft-puthash-weak ()
1346 (dolist (w '(nil key value key-and-value key-or-value))
1347 (ft--test-puthash w)))
1348
1333 1349
1334 1350
1335(ert-deftest test-hash-function-that-mutates-hash-table () 1351(ert-deftest test-hash-function-that-mutates-hash-table ()