* lisp/emacs-lisp/subr-x.el (string-limit): Fix
shorter-than-length case.
first LENGTH characters of STRING. If LENGTH is negative, return
a substring consisitng of thelast LENGTH characters of STRING."
(cond
- ((<= (length string) length) string)
+ ((<= (length string) (abs length)) string)
((>= length 0) (substring string 0 length))
(t (substring string (+ (length string) length)))))
(should (equal (string-limit "foo" 10) "foo"))
(should (equal (string-limit "foo" 2) "fo"))
(should (equal (string-limit "foo" -2) "oo"))
+ (should (equal (string-limit "abc" -10) "abc"))
(should (equal (string-limit "foo" 0) "")))
(ert-deftest subr-string-lines ()