diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2020-12-21 22:05:37 +0100 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2020-12-21 22:05:37 +0100 |
commit | f329a3180ead740bb85e1edfc48ae360a56f7ffd (patch) | |
tree | e5710512f8c9dbed77cbda51753c479865b77f8d /test | |
parent | e967ba301857edd15778a018ae716e4e98fa2fa9 (diff) | |
download | emacs-f329a3180ead740bb85e1edfc48ae360a56f7ffd.tar.gz |
Add string-chop-newline
* doc/lispref/strings.texi (Creating Strings): Document it.
* lisp/emacs-lisp/subr-x.el (string-chop-newline): Add new function.
Diffstat (limited to 'test')
-rw-r--r-- | test/lisp/emacs-lisp/subr-x-tests.el | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/subr-x-tests.el b/test/lisp/emacs-lisp/subr-x-tests.el index c655fcf6ead..ab5a5bfa641 100644 --- a/test/lisp/emacs-lisp/subr-x-tests.el +++ b/test/lisp/emacs-lisp/subr-x-tests.el @@ -615,5 +615,10 @@ (should (equal (string-pad "foo" -5 ?-) "--foo")) (should (equal (string-pad "foo" 2 ?-) "foo"))) +(ert-deftest subr-string-chop-newline () + (should (equal (string-chop-newline "foo\n") "foo")) + (should (equal (string-chop-newline "foo\nbar\n") "foo\nbar")) + (should (equal (string-chop-newline "foo\nbar") "foo\nbar"))) + (provide 'subr-x-tests) ;;; subr-x-tests.el ends here |