diff options
| author | Alan Mackenzie | 2023-09-04 12:51:24 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2023-09-04 12:51:24 +0000 |
| commit | afcb6d0bc7abcdbca6b18d020deeff24d1ad197f (patch) | |
| tree | 1561281df0284ced50d19005770c00023e7a617e /test/src | |
| parent | 55a0f0e047034b3a458b6fdbe245f33b83fd88b0 (diff) | |
| download | emacs-afcb6d0bc7abcdbca6b18d020deeff24d1ad197f.tar.gz emacs-afcb6d0bc7abcdbca6b18d020deeff24d1ad197f.zip | |
Correct the handling of symbols with position in equal
* src/fns.c (internal_equal): Only regard symbols with position
as their symbols when symbols-with-pos-enabled is non-nil.
* doc/lispref/symbols.texi (Symbols with Position): Expand the
description of symbols with position, in particular the way
they work with eq and equal.
* doc/lispref/objects.texi (Equality Predicates): Describe how
eq and equal handle symbols with position.
* test/src/fns-tests.el (fns-tests-equal-symbols-with-position):
New tests for symbols with position.
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/fns-tests.el | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el index 79ae4393f40..9c09e4f0c33 100644 --- a/test/src/fns-tests.el +++ b/test/src/fns-tests.el | |||
| @@ -98,6 +98,26 @@ | |||
| 98 | (should-not (equal-including-properties #("a" 0 1 (k "v")) | 98 | (should-not (equal-including-properties #("a" 0 1 (k "v")) |
| 99 | #("b" 0 1 (k "v"))))) | 99 | #("b" 0 1 (k "v"))))) |
| 100 | 100 | ||
| 101 | (ert-deftest fns-tests-equal-symbols-with-position () | ||
| 102 | "Test `eq' and `equal' on symbols with position." | ||
| 103 | (let ((foo1 (position-symbol 'foo 42)) | ||
| 104 | (foo2 (position-symbol 'foo 666)) | ||
| 105 | (foo3 (position-symbol 'foo 42))) | ||
| 106 | (let (symbols-with-pos-enabled) | ||
| 107 | (should (eq foo1 foo1)) | ||
| 108 | (should (equal foo1 foo1)) | ||
| 109 | (should-not (eq foo1 foo2)) | ||
| 110 | (should-not (equal foo1 foo2)) | ||
| 111 | (should-not (eq foo1 foo3)) | ||
| 112 | (should (equal foo1 foo3))) | ||
| 113 | (let ((symbols-with-pos-enabled t)) | ||
| 114 | (should (eq foo1 foo1)) | ||
| 115 | (should (equal foo1 foo1)) | ||
| 116 | (should (eq foo1 foo2)) | ||
| 117 | (should (equal foo1 foo2)) | ||
| 118 | (should (eq foo1 foo3)) | ||
| 119 | (should (equal foo1 foo3))))) | ||
| 120 | |||
| 101 | (ert-deftest fns-tests-reverse () | 121 | (ert-deftest fns-tests-reverse () |
| 102 | (should-error (reverse)) | 122 | (should-error (reverse)) |
| 103 | (should-error (reverse 1)) | 123 | (should-error (reverse 1)) |