aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTino Calancha2016-10-27 18:06:54 +0900
committerTino Calancha2016-10-27 18:06:54 +0900
commit0465bf511521ea780a61f1a0eb67731280e689a5 (patch)
treee0a72556168c98938ea33fc36c6babe2382a739a
parent4e45b55a9566189af6e40449954504ea7c47fa90 (diff)
downloademacs-0465bf511521ea780a61f1a0eb67731280e689a5.tar.gz
emacs-0465bf511521ea780a61f1a0eb67731280e689a5.zip
Add more tests for Bug#24627
* test/lisp/thingatpt-tests.el (thing-at-point-bug24627): Add tests for 'list-at-point'.
-rw-r--r--test/lisp/thingatpt-tests.el26
1 files changed, 24 insertions, 2 deletions
diff --git a/test/lisp/thingatpt-tests.el b/test/lisp/thingatpt-tests.el
index 2b8e06721a8..71d2c88d84b 100644
--- a/test/lisp/thingatpt-tests.el
+++ b/test/lisp/thingatpt-tests.el
@@ -84,12 +84,26 @@ position to retrieve THING.")
84 (goto-char (nth 1 test)) 84 (goto-char (nth 1 test))
85 (should (equal (thing-at-point (nth 2 test)) (nth 3 test)))))) 85 (should (equal (thing-at-point (nth 2 test)) (nth 3 test))))))
86 86
87;; These tests reflect the actual behaviour of
88;; `thing-at-point-bounds-of-list-at-point'.
87(ert-deftest thing-at-point-bug24627 () 89(ert-deftest thing-at-point-bug24627 ()
88 "Test for http://debbugs.gnu.org/24627 ." 90 "Test for http://debbugs.gnu.org/24627 ."
89 :expected-result :failed 91 :expected-result :failed
90 (let ((file 92 (let ((string-result '(("(a \"b\" c)" . (a "b" c))
93 (";(a \"b\" c)")
94 ("(a \"b\" c\n)" . (a "b" c))
95 ("\"(a b c)\"")
96 ("(a ;(b c d)\ne)" . (a e))
97 ("(foo\n(a ;(b c d)\ne) bar)" . (a e))
98 ("(foo\na ;(b c d)\ne bar)" . (foo a e bar))
99 ("(foo\n(a \"(b c d)\"\ne) bar)" . (a "(b c d)" e))
100 ("(b\n(a ;(foo c d)\ne) bar)" . (a e))
101 ("(princ \"(a b c)\")" . (princ "(a b c)"))
102 ("(defun foo ()\n \"Test function.\"\n ;;(a b)\n nil)" . (defun foo nil "Test function." nil))))
103 (file
91 (expand-file-name "lisp/thingatpt.el" source-directory)) 104 (expand-file-name "lisp/thingatpt.el" source-directory))
92 buf) 105 buf)
106 ;; Test for `thing-at-point'.
93 (when (file-exists-p file) 107 (when (file-exists-p file)
94 (unwind-protect 108 (unwind-protect
95 (progn 109 (progn
@@ -97,6 +111,14 @@ position to retrieve THING.")
97 (goto-char (point-max)) 111 (goto-char (point-max))
98 (forward-line -1) 112 (forward-line -1)
99 (should-not (thing-at-point 'list))) 113 (should-not (thing-at-point 'list)))
100 (kill-buffer buf))))) 114 (kill-buffer buf)))
115 ;; Tests for `list-at-point'.
116 (dolist (str-res string-result)
117 (with-temp-buffer
118 (emacs-lisp-mode)
119 (insert (car str-res))
120 (re-search-backward "\\((a\\|^a\\)")
121 (should (equal (list-at-point)
122 (cdr str-res)))))))
101 123
102;;; thingatpt.el ends here 124;;; thingatpt.el ends here