aboutsummaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
authorEli Zaretskii2021-02-06 11:54:08 +0200
committerEli Zaretskii2021-02-06 11:54:08 +0200
commitb84b8dff709fd80ee124565222f333f53351ab4a (patch)
tree19eb4e29ca739b28e0e12e1e5c4b9a3cf8cd26c8 /test/src
parent431b098a206d27a2dff6a88312c28c36926f90e9 (diff)
downloademacs-b84b8dff709fd80ee124565222f333f53351ab4a.tar.gz
emacs-b84b8dff709fd80ee124565222f333f53351ab4a.zip
Fix copying text properties in 'format'
* src/editfns.c (styled_format): Fix accounting for text properties that come from the format string. (Bug#46317) * test/src/editfns-tests.el (format-properties): Add new tests for bug#46317.
Diffstat (limited to 'test/src')
-rw-r--r--test/src/editfns-tests.el22
1 files changed, 21 insertions, 1 deletions
diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el
index 64f9137865b..dcec971c12e 100644
--- a/test/src/editfns-tests.el
+++ b/test/src/editfns-tests.el
@@ -106,7 +106,27 @@
106 #("foobar" 3 6 (face error)))) 106 #("foobar" 3 6 (face error))))
107 (should (ert-equal-including-properties 107 (should (ert-equal-including-properties
108 (format (concat "%s " (propertize "%s" 'face 'error)) "foo" "bar") 108 (format (concat "%s " (propertize "%s" 'face 'error)) "foo" "bar")
109 #("foo bar" 4 7 (face error))))) 109 #("foo bar" 4 7 (face error))))
110 ;; Bug #46317
111 (let ((s (propertize "X" 'prop "val")))
112 (should (ert-equal-including-properties
113 (format (concat "%3s/" s) 12)
114 #(" 12/X" 4 5 (prop "val"))))
115 (should (ert-equal-including-properties
116 (format (concat "%3S/" s) 12)
117 #(" 12/X" 4 5 (prop "val"))))
118 (should (ert-equal-including-properties
119 (format (concat "%3d/" s) 12)
120 #(" 12/X" 4 5 (prop "val"))))
121 (should (ert-equal-including-properties
122 (format (concat "%-3s/" s) 12)
123 #("12 /X" 4 5 (prop "val"))))
124 (should (ert-equal-including-properties
125 (format (concat "%-3S/" s) 12)
126 #("12 /X" 4 5 (prop "val"))))
127 (should (ert-equal-including-properties
128 (format (concat "%-3d/" s) 12)
129 #("12 /X" 4 5 (prop "val"))))))
110 130
111;; Tests for bug#5131. 131;; Tests for bug#5131.
112(defun transpose-test-reverse-word (start end) 132(defun transpose-test-reverse-word (start end)