aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorEli Zaretskii2025-06-21 11:08:05 +0300
committerEli Zaretskii2025-06-21 11:08:05 +0300
commit4607d3e426115ded71f0d8c19e7187ed45c19734 (patch)
tree0c5db58576e0a2aa44c367af54685e027811b260 /test
parent8201e7e7a765e2c74076cdddb4fdbe854e672438 (diff)
downloademacs-4607d3e426115ded71f0d8c19e7187ed45c19734.tar.gz
emacs-4607d3e426115ded71f0d8c19e7187ed45c19734.zip
Fix 'split-string' when TRIM is used
* lisp/subr.el (split-string): Support the case where STRING begins with a match for SEPARATORS, and a match for SEPARATORS also matches TRIM. Doc fix. (Bug#78690) * test/lisp/subr-tests.el (subr-test-split-string): New test.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/subr-tests.el11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el
index 024cbe85bba..f598ee57f8d 100644
--- a/test/lisp/subr-tests.el
+++ b/test/lisp/subr-tests.el
@@ -1505,5 +1505,16 @@ final or penultimate step during initialization."))
1505 (should (hash-table-contains-p 'cookie h)) 1505 (should (hash-table-contains-p 'cookie h))
1506 (should (hash-table-contains-p 'milk h)))) 1506 (should (hash-table-contains-p 'milk h))))
1507 1507
1508(ert-deftest subr-test-split-string ()
1509 (let ((text "-*- lexical-binding: t; -*-")
1510 (seps "-\\*-")
1511 (trim "[ \t\n\r-]+"))
1512 (should (equal (split-string text seps nil trim)
1513 '("" "lexical-binding: t;" "")))
1514 (should (equal (split-string text seps t trim)
1515 '("lexical-binding: t;")))
1516 (should (equal (split-string text "[ \t\n\r-]*-\\*-[ \t\n\r-]*")
1517 '("" "lexical-binding: t;" "")))))
1518
1508(provide 'subr-tests) 1519(provide 'subr-tests)
1509;;; subr-tests.el ends here 1520;;; subr-tests.el ends here