summaryrefslogtreecommitdiff
path: root/test/lisp
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2019-07-13 03:50:43 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2019-07-13 03:50:50 +0200
commit936d074d7c58bd4504b89a0b739b370312ae141a (patch)
tree254c2d3e4e2ae15aff37479bc7451e6fb9a54282 /test/lisp
parent74579d3d2bb82f300a6f2d81b7b559f0a24061db (diff)
downloademacs-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.el18
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