aboutsummaryrefslogtreecommitdiff
path: root/test/unit-test.el
diff options
context:
space:
mode:
authorWilfred Hughes <me@wilfred.me.uk>2018-01-07 00:04:26 +0000
committerWilfred Hughes <me@wilfred.me.uk>2018-01-07 00:10:50 +0000
commit8e5390f0e8983816b938607c9b3a42fd7b868a00 (patch)
tree85b4a8a74b6fb7b83e30e8d20253f6706848c884 /test/unit-test.el
parent53dd618dc2d5fbd6b6edf72fb29210c8d129728b (diff)
Stricter regexps for highlighting `foo' in docstrings
Previously, the regexp was greedy, so we would erroneously highlight: `foo `bar' as a single symbol. Fixes #87.
Diffstat (limited to 'test/unit-test.el')
-rw-r--r--test/unit-test.el12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/unit-test.el b/test/unit-test.el
index db75500..2579316 100644
--- a/test/unit-test.el
+++ b/test/unit-test.el
@@ -27,6 +27,18 @@
(helpful--docstring #'test-foo t)
"Docstring here.")))
+(ert-deftest helpful--docstring-symbol ()
+ "Correctly handle quotes around symbols."
+ ;; We should replace quoted symbols with links, so the punctuation
+ ;; should not be in the output.
+ (let* ((formatted-docstring (helpful--format-docstring "`message'")))
+ (should
+ (equal formatted-docstring "message")))
+ ;; We should handle stray backquotes.
+ (let* ((formatted-docstring (helpful--format-docstring "`foo `message'")))
+ (should
+ (equal formatted-docstring "`foo message"))))
+
(ert-deftest helpful--docstring-unescape ()
"Discard \\=\\= in docstrings."
(let* ((docstring (helpful--docstring #'apply t))