From c28644c957d9fabf883990ff145cec19ed12ff10 Mon Sep 17 00:00:00 2001 From: Joseph Turner Date: Mon, 30 Dec 2024 00:40:33 -0800 Subject: [PATCH] Test that persist-copy recursively copies hash tables --- test/persist-tests.el | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/persist-tests.el b/test/persist-tests.el index 6bf2ed3708..adf37a5bf0 100644 --- a/test/persist-tests.el +++ b/test/persist-tests.el @@ -151,3 +151,14 @@ (ert-deftest test-persist-reset () (should-not (eq persist--test-reset-variable initial-value)) (should-not (eq initial-value (persist-default 'persist--test-reset-variable)))))) + +(ert-deftest test-persist-copy-hash-table () + "`persist-copy' should copy hash keys and values." + (let* ((hash (make-hash-table)) + (rec (record 'a)) + (_ (puthash 'foo rec hash)) + (copy-hash (persist-copy hash))) + (setf (aref (gethash 'foo copy-hash) 0) 'b) + (should-not (persist-equal hash copy-hash)) + (should-not (eq (gethash 'foo hash) + (gethash 'foo copy-hash))))) -- 2.46.0