summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp/subr-x-tests.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2022-07-23 08:55:20 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2022-07-23 08:58:53 +0200
commit51f5c4b773e11dd50f9fc6887362324b6d4dc755 (patch)
tree6ab881dc983d3dab010fd91d7069bbf36b6f9a03 /test/lisp/emacs-lisp/subr-x-tests.el
parent33602132acdf0ff9148aaeea32423c683529f039 (diff)
downloademacs-51f5c4b773e11dd50f9fc6887362324b6d4dc755.tar.gz
emacs-51f5c4b773e11dd50f9fc6887362324b6d4dc755.tar.bz2
emacs-51f5c4b773e11dd50f9fc6887362324b6d4dc755.zip
Fix off-by-one error in string-truncate-left
* lisp/emacs-lisp/subr-x.el (string-truncate-left): Fix off-by-one error (bug#56685).
Diffstat (limited to 'test/lisp/emacs-lisp/subr-x-tests.el')
-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 99c0e822155..7a3efe9db62 100644
--- a/test/lisp/emacs-lisp/subr-x-tests.el
+++ b/test/lisp/emacs-lisp/subr-x-tests.el
@@ -766,5 +766,10 @@
(should (equal (sort (hash-table-keys h) #'string<) '(a b c)))
(should (equal (sort (hash-table-values h) #'<) '(1 2 3)))))
+(ert-deftest test-string-truncate-left ()
+ (should (equal (string-truncate-left "band" 3) "...d"))
+ (should (equal (string-truncate-left "band" 2) "...d"))
+ (should (equal (string-truncate-left "longstring" 8) "...tring")))
+
(provide 'subr-x-tests)
;;; subr-x-tests.el ends here