summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp/checkdoc-tests.el
diff options
context:
space:
mode:
authorStefan Kangas <stefan@marxist.se>2021-09-13 06:03:44 +0200
committerStefan Kangas <stefan@marxist.se>2021-09-13 06:44:52 +0200
commit2110973351f01fb5cdf90b705acb58354b608050 (patch)
treeee22904f63e925a95177e5ce4d11e94671642aad /test/lisp/emacs-lisp/checkdoc-tests.el
parentbd601099b9332ef6bae697b23b63ee648d56b667 (diff)
downloademacs-2110973351f01fb5cdf90b705acb58354b608050.tar.gz
emacs-2110973351f01fb5cdf90b705acb58354b608050.tar.bz2
emacs-2110973351f01fb5cdf90b705acb58354b608050.zip
Improve checkdoc abbreviation handling
* lisp/emacs-lisp/checkdoc.el (checkdoc-in-abbreviation-p): New helper function. (checkdoc-sentencespace-region-engine): Fix handling abbreviations after escaped parenthesis. * test/lisp/emacs-lisp/checkdoc-tests.el (checkdoc-tests-in-abbrevation-p) (checkdoc-tests-in-abbrevation-p/with-parens) (checkdoc-tests-in-abbrevation-p/with-escaped-parens): New tests.
Diffstat (limited to 'test/lisp/emacs-lisp/checkdoc-tests.el')
-rw-r--r--test/lisp/emacs-lisp/checkdoc-tests.el24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/checkdoc-tests.el b/test/lisp/emacs-lisp/checkdoc-tests.el
index 2a1d8b27636..a4b252031fe 100644
--- a/test/lisp/emacs-lisp/checkdoc-tests.el
+++ b/test/lisp/emacs-lisp/checkdoc-tests.el
@@ -122,4 +122,28 @@ See the comments in Bug#24998."
(should (looking-at-p "\"baz\")"))
(should-not (checkdoc-next-docstring))))
+(ert-deftest checkdoc-tests-in-abbrevation-p ()
+ (with-temp-buffer
+ (emacs-lisp-mode)
+ (insert "foo bar e.g. baz")
+ (goto-char (point-min))
+ (re-search-forward "e.g")
+ (should (checkdoc-in-abbreviation-p (point)))))
+
+(ert-deftest checkdoc-tests-in-abbrevation-p/with-parens ()
+ (with-temp-buffer
+ (emacs-lisp-mode)
+ (insert "foo bar (e.g. baz)")
+ (goto-char (point-min))
+ (re-search-forward "e.g")
+ (should (checkdoc-in-abbreviation-p (point)))))
+
+(ert-deftest checkdoc-tests-in-abbrevation-p/with-escaped-parens ()
+ (with-temp-buffer
+ (emacs-lisp-mode)
+ (insert "foo\n\\(e.g. baz)")
+ (goto-char (point-min))
+ (re-search-forward "e.g")
+ (should (checkdoc-in-abbreviation-p (point)))))
+
;;; checkdoc-tests.el ends here