aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorWilfred Hughes <me@wilfred.me.uk>2017-12-30 01:23:06 +0000
committerWilfred Hughes <me@wilfred.me.uk>2017-12-30 01:23:06 +0000
commit59fb24dc969658f37e9464fc87200ed06a8b1ecc (patch)
treed28f180645575767a4c81a30bf8b59c3a5d15bd8 /test
parented23fa740151cd15c27ad56d8cef5fc84b63d003 (diff)
Handle command key substitution correctly
Emacs allows you to write \[foo] to show the keybinding for command foo. It provides \= as a way of escaping. Ensure we substitute \= properly in docstrings, using a similar logic to substitute-command-keys. We still provide additional buttons, so \[foo] will be converted to a button pointing to foo in Helpful buffers. Fixes #80.
Diffstat (limited to 'test')
-rw-r--r--test/unit-test.el7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/unit-test.el b/test/unit-test.el
index d0e3893..51029da 100644
--- a/test/unit-test.el
+++ b/test/unit-test.el
@@ -27,6 +27,13 @@
(helpful--docstring #'test-foo t)
"Docstring here.")))
+(ert-deftest helpful--docstring-unescape ()
+ "Discard \\=\\= in docstrings."
+ (let* ((docstring (helpful--docstring #'apply t))
+ (formatted-docstring (helpful--format-docstring docstring)))
+ (should
+ (not (s-contains-p "\\=" formatted-docstring)))))
+
(ert-deftest helpful--docstring-advice ()
"Get the docstring on advised functions."
(should