summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2020-12-21 22:05:37 +0100
committerLars Ingebrigtsen <larsi@gnus.org>2020-12-21 22:05:37 +0100
commitf329a3180ead740bb85e1edfc48ae360a56f7ffd (patch)
treee5710512f8c9dbed77cbda51753c479865b77f8d /test
parente967ba301857edd15778a018ae716e4e98fa2fa9 (diff)
downloademacs-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.el5
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