aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLars Ingebrigtsen2021-01-20 16:47:39 +0100
committerLars Ingebrigtsen2021-01-20 16:47:39 +0100
commitce1a42a6eb41ab7a4473de9e8d8961498568576a (patch)
tree6aec6c94874f613020c9868c8553703b7dcafdb9 /test
parent420661af07448857f0a17e15dc27bceeb6aff541 (diff)
downloademacs-ce1a42a6eb41ab7a4473de9e8d8961498568576a.tar.gz
emacs-ce1a42a6eb41ab7a4473de9e8d8961498568576a.zip
Add tests for symbol-at-point (bug#14234)
Diffstat (limited to 'test')
-rw-r--r--test/lisp/thingatpt-tests.el45
1 files changed, 45 insertions, 0 deletions
diff --git a/test/lisp/thingatpt-tests.el b/test/lisp/thingatpt-tests.el
index c43c81af9fd..8eec853d461 100644
--- a/test/lisp/thingatpt-tests.el
+++ b/test/lisp/thingatpt-tests.el
@@ -146,4 +146,49 @@ position to retrieve THING.")
146 (should (thing-at-point-looking-at "2abcd")) 146 (should (thing-at-point-looking-at "2abcd"))
147 (should (equal (match-data) m2))))) 147 (should (equal (match-data) m2)))))
148 148
149(ert-deftest test-symbol-thing-1 ()
150 (with-temp-buffer
151 (insert "foo bar zot")
152 (goto-char 4)
153 (should (eq (symbol-at-point) 'foo))
154 (forward-char 1)
155 (should (eq (symbol-at-point) 'bar))
156 (forward-char 1)
157 (should (eq (symbol-at-point) 'bar))
158 (forward-char 1)
159 (should (eq (symbol-at-point) 'bar))
160 (forward-char 1)
161 (should (eq (symbol-at-point) 'bar))
162 (forward-char 1)
163 (should (eq (symbol-at-point) 'zot))))
164
165(ert-deftest test-symbol-thing-2 ()
166 (with-temp-buffer
167 (insert " bar ")
168 (goto-char (point-max))
169 (should (eq (symbol-at-point) nil))
170 (forward-char -1)
171 (should (eq (symbol-at-point) 'bar))))
172
173(ert-deftest test-symbol-thing-2 ()
174 (with-temp-buffer
175 (insert " bar ")
176 (goto-char (point-max))
177 (should (eq (symbol-at-point) nil))
178 (forward-char -1)
179 (should (eq (symbol-at-point) 'bar))))
180
181(ert-deftest test-symbol-thing-3 ()
182 (with-temp-buffer
183 (insert "bar")
184 (goto-char 2)
185 (should (eq (symbol-at-point) 'bar))))
186
187(ert-deftest test-symbol-thing-3 ()
188 :expected-result :failed ; FIXME bug#14234
189 (with-temp-buffer
190 (insert "`[[`(")
191 (goto-char 2)
192 (should (eq (symbol-at-point) nil))))
193
149;;; thingatpt.el ends here 194;;; thingatpt.el ends here