]> code.delx.au - gnu-emacs/blobdiff - test/src/editfns-tests.el
Minor tweaks of copying text properties when padding strings
[gnu-emacs] / test / src / editfns-tests.el
index c515927cff1b25f161989c30f2cb682420cf9520..507ceef2f7d13d19d644f2a73e65fbd0bb712e88 100644 (file)
   ;; Bug #23859
   (should (ert-equal-including-properties
            (format "%4s" (propertize "hi" 'face 'bold))
-           #("  hi" 0 4 (face bold)))))
+           #("  hi" 2 4 (face bold))))
+
+  ;; Bug #23897
+  (should (ert-equal-including-properties
+           (format "%s" (concat (propertize "01234" 'face 'bold) "56789"))
+           #("0123456789" 0 5 (face bold))))
+  (should (ert-equal-including-properties
+           (format "%s" (concat (propertize "01" 'face 'bold)
+                                (propertize "23" 'face 'underline)
+                                "45"))
+           #("012345" 0 2 (face bold) 2 4 (face underline))))
+  ;; The last property range is extended to include padding on the
+  ;; right, but the first range is not extended to the left to include
+  ;; padding on the left!
+  (should (ert-equal-including-properties
+           (format "%12s" (concat (propertize "01234" 'face 'bold) "56789"))
+           #("  0123456789" 2 7 (face bold))))
+  (should (ert-equal-including-properties
+           (format "%-12s" (concat (propertize "01234" 'face 'bold) "56789"))
+           #("0123456789  " 0 5 (face bold))))
+  (should (ert-equal-including-properties
+           (format "%10s" (concat (propertize "01" 'face 'bold)
+                                  (propertize "23" 'face 'underline)
+                                  "45"))
+           #("    012345" 4 6 (face bold) 6 8 (face underline))))
+  (should (ert-equal-including-properties
+           (format "%-10s" (concat (propertize "01" 'face 'bold)
+                                   (propertize "23" 'face 'underline)
+                                   "45"))
+           #("012345    " 0 2 (face bold) 2 4 (face underline))))
+  (should (ert-equal-including-properties
+           (format "%-10s" (concat (propertize "01" 'face 'bold)
+                                   (propertize "23" 'face 'underline)
+                                   (propertize "45" 'face 'italic)))
+           #("012345    " 0 2 (face bold) 2 4 (face underline) 4 10 (face italic)))))