diff options
author | Stefan Kangas <stefan@marxist.se> | 2021-09-13 06:03:44 +0200 |
---|---|---|
committer | Stefan Kangas <stefan@marxist.se> | 2021-09-13 06:44:52 +0200 |
commit | 2110973351f01fb5cdf90b705acb58354b608050 (patch) | |
tree | ee22904f63e925a95177e5ce4d11e94671642aad /test/lisp/emacs-lisp/checkdoc-tests.el | |
parent | bd601099b9332ef6bae697b23b63ee648d56b667 (diff) | |
download | emacs-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.el | 24 |
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 |