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.
This commit is contained in:
@@ -98,6 +98,26 @@
|
||||
(should-not (equal-including-properties #("a" 0 1 (k "v"))
|
||||
#("b" 0 1 (k "v")))))
|
||||
|
||||
(ert-deftest fns-tests-equal-symbols-with-position ()
|
||||
"Test `eq' and `equal' on symbols with position."
|
||||
(let ((foo1 (position-symbol 'foo 42))
|
||||
(foo2 (position-symbol 'foo 666))
|
||||
(foo3 (position-symbol 'foo 42)))
|
||||
(let (symbols-with-pos-enabled)
|
||||
(should (eq foo1 foo1))
|
||||
(should (equal foo1 foo1))
|
||||
(should-not (eq foo1 foo2))
|
||||
(should-not (equal foo1 foo2))
|
||||
(should-not (eq foo1 foo3))
|
||||
(should (equal foo1 foo3)))
|
||||
(let ((symbols-with-pos-enabled t))
|
||||
(should (eq foo1 foo1))
|
||||
(should (equal foo1 foo1))
|
||||
(should (eq foo1 foo2))
|
||||
(should (equal foo1 foo2))
|
||||
(should (eq foo1 foo3))
|
||||
(should (equal foo1 foo3)))))
|
||||
|
||||
(ert-deftest fns-tests-reverse ()
|
||||
(should-error (reverse))
|
||||
(should-error (reverse 1))
|
||||
|
||||
Reference in New Issue
Block a user