diff options
| author | Mattias EngdegÄrd | 2024-01-31 12:21:12 +0100 |
|---|---|---|
| committer | Mattias EngdegÄrd | 2024-01-31 12:48:48 +0100 |
| commit | 7e85311a9113a4720ec9d7b06188646fc7bdae0b (patch) | |
| tree | 119807ece0bb2bf2cac2fedce27c331a27092da8 /test/src | |
| parent | 5f24c9a4c82f7106e22cac8a5201db8307239837 (diff) | |
| download | emacs-7e85311a9113a4720ec9d7b06188646fc7bdae0b.tar.gz emacs-7e85311a9113a4720ec9d7b06188646fc7bdae0b.zip | |
Allow equal user-defined hash table tests with different names
Hash tables using different user-defined tests defined identically
sometimes ended up using the wrong test (bug#68668).
* src/fns.c (get_hash_table_user_test): Take test name into account
when matching the test object.
* test/src/fns-tests.el (fns--define-hash-table-test): New.
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/fns-tests.el | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el index 3893b8b0320..7437c07f156 100644 --- a/test/src/fns-tests.el +++ b/test/src/fns-tests.el | |||
| @@ -1097,6 +1097,16 @@ | |||
| 1097 | (should (= (sxhash-equal (record 'a (make-string 10 ?a))) | 1097 | (should (= (sxhash-equal (record 'a (make-string 10 ?a))) |
| 1098 | (sxhash-equal (record 'a (make-string 10 ?a)))))) | 1098 | (sxhash-equal (record 'a (make-string 10 ?a)))))) |
| 1099 | 1099 | ||
| 1100 | (ert-deftest fns--define-hash-table-test () | ||
| 1101 | ;; Check that we can have two differently-named tests using the | ||
| 1102 | ;; same functions (bug#68668). | ||
| 1103 | (define-hash-table-test 'fns-tests--1 'my-cmp 'my-hash) | ||
| 1104 | (define-hash-table-test 'fns-tests--2 'my-cmp 'my-hash) | ||
| 1105 | (let ((h1 (make-hash-table :test 'fns-tests--1)) | ||
| 1106 | (h2 (make-hash-table :test 'fns-tests--2))) | ||
| 1107 | (should (eq (hash-table-test h1) 'fns-tests--1)) | ||
| 1108 | (should (eq (hash-table-test h2) 'fns-tests--2)))) | ||
| 1109 | |||
| 1100 | (ert-deftest test-secure-hash () | 1110 | (ert-deftest test-secure-hash () |
| 1101 | (should (equal (secure-hash 'md5 "foobar") | 1111 | (should (equal (secure-hash 'md5 "foobar") |
| 1102 | "3858f62230ac3c915f300c664312c63f")) | 1112 | "3858f62230ac3c915f300c664312c63f")) |