summaryrefslogtreecommitdiff
path: root/test/lisp/help-tests.el
diff options
context:
space:
mode:
authorStefan Kangas <stefan@marxist.se>2022-09-10 07:37:36 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2022-09-10 07:37:36 +0200
commit6cd9e586cc065f02d69c97b23163ec91ccc2b5dd (patch)
tree27fae333c1437be0e05f119593720be3f28f43ca /test/lisp/help-tests.el
parent54c3794899ef2d4d88812fb445b6e2acc85a2720 (diff)
downloademacs-6cd9e586cc065f02d69c97b23163ec91ccc2b5dd.tar.gz
New function substitute-quotes
* lisp/help.el (substitute-quotes): New function. (Bug#51040) * doc/lispref/help.texi (Keys in Documentation): Document substitute-quotes. * test/lisp/help-tests.el (help-tests-substitute-quotes): New test. * lisp/cedet/srecode/srt-mode.el (srecode-macro-help): * lisp/cus-theme.el (describe-theme-1): * lisp/emacs-lisp/cl-extra.el (cl--describe-class): * lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor): * lisp/emacs-lisp/package.el (describe-package-1): * lisp/help-fns.el (help-fns--parent-mode, help-fns--var-risky) (help-fns--var-file-local, help-fns--var-bufferlocal) (describe-face): * lisp/help.el (substitute-command-keys): * lisp/progmodes/octave.el (octave-help): Use the new function instead of 'substitute-command-keys'.
Diffstat (limited to 'test/lisp/help-tests.el')
-rw-r--r--test/lisp/help-tests.el52
1 files changed, 36 insertions, 16 deletions
diff --git a/test/lisp/help-tests.el b/test/lisp/help-tests.el
index 833c32ffb27..6f1dcfa5b6b 100644
--- a/test/lisp/help-tests.el
+++ b/test/lisp/help-tests.el
@@ -200,25 +200,45 @@ M-g M-c switch-to-completions
"\nUses keymap [`'‘]foobar-map['’], which is not currently defined.\n")))
(ert-deftest help-tests-substitute-command-keys/quotes ()
- (with-substitute-command-keys-test
+ (with-substitute-command-keys-test
+ (let ((text-quoting-style 'curve))
+ (test "quotes ‘like this’" "quotes ‘like this’")
+ (test "`x'" "‘x’")
+ (test "`" "‘")
+ (test "'" "’")
+ (test "\\`" "\\‘"))
+ (let ((text-quoting-style 'straight))
+ (test "quotes `like this'" "quotes 'like this'")
+ (test "`x'" "'x'")
+ (test "`" "'")
+ (test "'" "'")
+ (test "\\`" "\\'"))
+ (let ((text-quoting-style 'grave))
+ (test "quotes `like this'" "quotes `like this'")
+ (test "`x'" "`x'")
+ (test "`" "`")
+ (test "'" "'")
+ (test "\\`" "\\`"))))
+
+(ert-deftest help-tests-substitute-quotes ()
(let ((text-quoting-style 'curve))
- (test "quotes ‘like this’" "quotes ‘like this’")
- (test "`x'" "‘x’")
- (test "`" "‘")
- (test "'" "’")
- (test "\\`" "\\‘"))
+ (should (string= (substitute-quotes "quotes ‘like this’") "quotes ‘like this’"))
+ (should (string= (substitute-quotes "`x'") "‘x’"))
+ (should (string= (substitute-quotes "`") "‘"))
+ (should (string= (substitute-quotes "'") "’"))
+ (should (string= (substitute-quotes "\\`") "\\‘")))
(let ((text-quoting-style 'straight))
- (test "quotes `like this'" "quotes 'like this'")
- (test "`x'" "'x'")
- (test "`" "'")
- (test "'" "'")
- (test "\\`" "\\'"))
+ (should (string= (substitute-quotes "quotes `like this'") "quotes 'like this'"))
+ (should (string= (substitute-quotes "`x'") "'x'"))
+ (should (string= (substitute-quotes "`") "'"))
+ (should (string= (substitute-quotes "'") "'"))
+ (should (string= (substitute-quotes "\\`") "\\'")))
(let ((text-quoting-style 'grave))
- (test "quotes `like this'" "quotes `like this'")
- (test "`x'" "`x'")
- (test "`" "`")
- (test "'" "'")
- (test "\\`" "\\`"))))
+ (should (string= (substitute-quotes "quotes `like this'") "quotes `like this'"))
+ (should (string= (substitute-quotes "`x'") "`x'"))
+ (should (string= (substitute-quotes "`") "`"))
+ (should (string= (substitute-quotes "'") "'"))
+ (should (string= (substitute-quotes "\\`") "\\`"))))
(ert-deftest help-tests-substitute-command-keys/literals ()
(with-substitute-command-keys-test