diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2020-12-21 20:01:28 +0100 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2020-12-21 20:01:28 +0100 |
commit | b3dec3176673fa99e57e3916b36ea4367d47c0fa (patch) | |
tree | e9a6a6b6926a9abd4c93138ed6e7acb84438a318 /test/lisp/emacs-lisp | |
parent | 87e422f1044068a4d27e5e4bfdbc664d9e4bbc43 (diff) | |
download | emacs-b3dec3176673fa99e57e3916b36ea4367d47c0fa.tar.gz emacs-b3dec3176673fa99e57e3916b36ea4367d47c0fa.tar.bz2 emacs-b3dec3176673fa99e57e3916b36ea4367d47c0fa.zip |
Add `string-pad'
* doc/lispref/strings.texi (Creating Strings): Document it.
* lisp/emacs-lisp/shortdoc.el (string): Add example.
* lisp/emacs-lisp/subr-x.el (string-pad): New function.
Diffstat (limited to 'test/lisp/emacs-lisp')
-rw-r--r-- | test/lisp/emacs-lisp/subr-x-tests.el | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/subr-x-tests.el b/test/lisp/emacs-lisp/subr-x-tests.el index 949bbb163eb..94ff459869c 100644 --- a/test/lisp/emacs-lisp/subr-x-tests.el +++ b/test/lisp/emacs-lisp/subr-x-tests.el @@ -608,5 +608,11 @@ (should (equal (slice-string "-foo-bar-" "-") '("-foo" "-bar" "-"))) (should (equal (slice-string "ooo" "lala") '("ooo")))) +(ert-deftest subr-string-pad () + (should (equal (string-pad "foo" 5) "foo ")) + (should (equal (string-pad "foo" 5 ?-) "foo--")) + (should (equal (string-pad "foo" -5 ?-) "--foo")) + (should (equal (string-pad "foo" 2 ?-) "foo"))) + (provide 'subr-x-tests) ;;; subr-x-tests.el ends here |