aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorStefan Kangas2021-11-22 08:08:11 +0100
committerStefan Kangas2021-11-22 12:04:19 +0100
commite91f71676c19127dd90efabfc0da36483aa53a82 (patch)
tree832dfd92cf35d5f695d9ecb2c47500fa4d9757b0 /test
parent61c254cafc9caa3b52553fa0e7cca8a5086c5cea (diff)
downloademacs-e91f71676c19127dd90efabfc0da36483aa53a82.tar.gz
emacs-e91f71676c19127dd90efabfc0da36483aa53a82.zip
Avoid false positives about wide docstrings for key sequences
* lisp/emacs-lisp/bytecomp.el (byte-compile--wide-docstring-p): Ignore literal key sequence substitutions. * test/lisp/emacs-lisp/bytecomp-resources/warn-wide-docstring-ignore-substitutions.el: New file. * test/lisp/emacs-lisp/bytecomp-tests.el ("warn-wide-docstring-ignore-substitutions.el"): New test.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/emacs-lisp/bytecomp-resources/warn-wide-docstring-ignore-substitutions.el17
-rw-r--r--test/lisp/emacs-lisp/bytecomp-tests.el4
2 files changed, 21 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/bytecomp-resources/warn-wide-docstring-ignore-substitutions.el b/test/lisp/emacs-lisp/bytecomp-resources/warn-wide-docstring-ignore-substitutions.el
new file mode 100644
index 00000000000..37cfe463bfe
--- /dev/null
+++ b/test/lisp/emacs-lisp/bytecomp-resources/warn-wide-docstring-ignore-substitutions.el
@@ -0,0 +1,17 @@
1;;; -*- lexical-binding: t -*-
2(defalias 'foo #'ignore
3 "None of this should be considered too wide.
4
5; this should be treated as 60 characters - no warning
6\\[quit-window]\\[quit-window]\\[quit-window]\\[quit-window]\\[quit-window]\\[quit-window]\\[quit-window]\\[quit-window]\\[quit-window]\\[quit-window]\\[quit-window]\\[quit-window]\\[quit-window]\\[quit-window]\\[quit-window]\\[quit-window]\\[quit-window]\\[quit-window]
7
8; 64 * 'x' does not warn
9\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'\\`x'
10
11; keymaps are just ignored
12\\<foo-bar-map>\\<foo-bar-map>\\<foo-bar-map>\\<foo-bar-map>\\<foo-bar-map>\\<foo-bar-map>\\<foo-bar-map>\\<foo-bar-map>\\<foo-bar-map>\\<foo-bar-map>\\<foo-bar-map>\\<foo-bar-map>\\<foo-bar-map>\\<foo-bar-map>\\<foo-bar-map>\\<foo-bar-map>\\<foo-bar-map>\\<foo-bar-map>\\<foo-bar-map>\\<foo-bar-map>\\<foo-bar-map>\\<foo-bar-map>\\<foo-bar-map>\\<foo-bar-map>\\<foo-bar-map>\\<foo-bar-map>\\<foo-bar-map>\\<foo-bar-map>\\<foo-bar-map>
13
14\\{foo-bar-map}\\{foo-bar-map}\\{foo-bar-map}\\{foo-bar-map}\\{foo-bar-map}\\{foo-bar-map}\\{foo-bar-map}\\{foo-bar-map}\\{foo-bar-map}\\{foo-bar-map}\\{foo-bar-map}\\{foo-bar-map}\\{foo-bar-map}\\{foo-bar-map}\\{foo-bar-map}\\{foo-bar-map}\\{foo-bar-map}\\{foo-bar-map}\\{foo-bar-map}\\{foo-bar-map}\\{foo-bar-map}\\{foo-bar-map}\\{foo-bar-map}\\{foo-bar-map}\\{foo-bar-map}\\{foo-bar-map}\\{foo-bar-map}\\{foo-bar-map}\\{foo-bar-map}\\{foo-bar-map}\\{foo-bar-map}\\{foo-bar-map}\\{foo-bar-map}\\{foo-bar-map}\\{foo-bar-map}\\{foo-bar-map}
15
16bar baz foo bar baz foo bar baz foo bar baz foo bar baz foo bar
17")
diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el
index dbc0aa3db42..816f14a18d5 100644
--- a/test/lisp/emacs-lisp/bytecomp-tests.el
+++ b/test/lisp/emacs-lisp/bytecomp-tests.el
@@ -956,6 +956,10 @@ byte-compiled. Run with dynamic binding."
956 "defvar .foo-bar. docstring wider than .* characters" 'reverse) 956 "defvar .foo-bar. docstring wider than .* characters" 'reverse)
957 957
958(bytecomp--define-warning-file-test 958(bytecomp--define-warning-file-test
959 "warn-wide-docstring-ignore-substitutions.el"
960 "defvar .foo-bar. docstring wider than .* characters" 'reverse)
961
962(bytecomp--define-warning-file-test
959 "warn-wide-docstring-ignore.el" 963 "warn-wide-docstring-ignore.el"
960 "defvar .foo-bar. docstring wider than .* characters" 'reverse) 964 "defvar .foo-bar. docstring wider than .* characters" 'reverse)
961 965