emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 0465bf5: Add more tests for Bug#24627


From: Tino Calancha
Subject: [Emacs-diffs] master 0465bf5: Add more tests for Bug#24627
Date: Thu, 27 Oct 2016 09:13:26 +0000 (UTC)

branch: master
commit 0465bf511521ea780a61f1a0eb67731280e689a5
Author: Tino Calancha <address@hidden>
Commit: Tino Calancha <address@hidden>

    Add more tests for Bug#24627
    
    * test/lisp/thingatpt-tests.el (thing-at-point-bug24627):
    Add tests for 'list-at-point'.
---
 test/lisp/thingatpt-tests.el |   26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/test/lisp/thingatpt-tests.el b/test/lisp/thingatpt-tests.el
index 2b8e067..71d2c88 100644
--- a/test/lisp/thingatpt-tests.el
+++ b/test/lisp/thingatpt-tests.el
@@ -84,12 +84,26 @@ position to retrieve THING.")
       (goto-char (nth 1 test))
       (should (equal (thing-at-point (nth 2 test)) (nth 3 test))))))
 
+;; These tests reflect the actual behaviour of
+;; `thing-at-point-bounds-of-list-at-point'.
 (ert-deftest thing-at-point-bug24627 ()
   "Test for http://debbugs.gnu.org/24627 ."
   :expected-result :failed
-  (let ((file
+  (let ((string-result '(("(a \"b\" c)" . (a "b" c))
+                         (";(a \"b\" c)")
+                         ("(a \"b\" c\n)" . (a "b" c))
+                         ("\"(a b c)\"")
+                         ("(a ;(b c d)\ne)" . (a e))
+                         ("(foo\n(a ;(b c d)\ne) bar)" . (a e))
+                         ("(foo\na ;(b c d)\ne bar)" . (foo a e bar))
+                         ("(foo\n(a \"(b c d)\"\ne) bar)" . (a "(b c d)" e))
+                         ("(b\n(a ;(foo c d)\ne) bar)" . (a e))
+                         ("(princ \"(a b c)\")" . (princ "(a b c)"))
+                         ("(defun foo ()\n  \"Test function.\"\n  ;;(a b)\n  
nil)" . (defun foo nil "Test function." nil))))
+        (file
          (expand-file-name "lisp/thingatpt.el" source-directory))
         buf)
+    ;; Test for `thing-at-point'.
     (when (file-exists-p file)
       (unwind-protect
           (progn
@@ -97,6 +111,14 @@ position to retrieve THING.")
             (goto-char (point-max))
             (forward-line -1)
             (should-not (thing-at-point 'list)))
-        (kill-buffer buf)))))
+        (kill-buffer buf)))
+    ;; Tests for `list-at-point'.
+    (dolist (str-res string-result)
+      (with-temp-buffer
+        (emacs-lisp-mode)
+        (insert (car str-res))
+        (re-search-backward "\\((a\\|^a\\)")
+        (should (equal (list-at-point)
+                       (cdr str-res)))))))
 
 ;;; thingatpt.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]