diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2019-07-13 03:50:43 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2019-07-13 03:50:50 +0200 |
commit | 936d074d7c58bd4504b89a0b739b370312ae141a (patch) | |
tree | 254c2d3e4e2ae15aff37479bc7451e6fb9a54282 /test/lisp | |
parent | 74579d3d2bb82f300a6f2d81b7b559f0a24061db (diff) | |
download | emacs-936d074d7c58bd4504b89a0b739b370312ae141a.tar.gz emacs-936d074d7c58bd4504b89a0b739b370312ae141a.tar.bz2 emacs-936d074d7c58bd4504b89a0b739b370312ae141a.zip |
Document format-spec and expand the modifiers it supports
* doc/lispref/text.texi (Interpolated Strings): New section.
* lisp/format-spec.el (format-spec--parse-modifiers)
(format-spec--pad): New functions.
(format-spec): Support more format modifiers (bug#32931).
Diffstat (limited to 'test/lisp')
-rw-r--r-- | test/lisp/format-spec-tests.el | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/lisp/format-spec-tests.el b/test/lisp/format-spec-tests.el index 6fbfaaad83a..a386e9da8ff 100644 --- a/test/lisp/format-spec-tests.el +++ b/test/lisp/format-spec-tests.el @@ -37,4 +37,22 @@ (should (equal (format-spec "foo %b %z %% zot" '((?b . "bar")) t) "foo bar %z %% zot"))) +(ert-deftest test-format-modifiers () + (should (equal (format-spec "foo %10b zot" '((?b . "bar"))) + "foo bar zot")) + (should (equal (format-spec "foo % 10b zot" '((?b . "bar"))) + "foo bar zot")) + (should (equal (format-spec "foo %-010b zot" '((?b . "bar"))) + "foo bar0000000 zot")) + (should (equal (format-spec "foo %0-10b zot" '((?b . "bar"))) + "foo bar0000000 zot")) + (should (equal (format-spec "foo %^10b zot" '((?b . "bar"))) + "foo BAR zot")) + (should (equal (format-spec "foo %_10b zot" '((?b . "BAR"))) + "foo bar zot")) + (should (equal (format-spec "foo %<4b zot" '((?b . "longbar"))) + "foo gbar zot")) + (should (equal (format-spec "foo %>4b zot" '((?b . "longbar"))) + "foo long zot"))) + ;;; format-spec-tests.el ends here |