diff options
| author | Lars Ingebrigtsen | 2022-04-30 12:46:40 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2022-04-30 12:57:20 +0200 |
| commit | aab5d7b3f3bb6fb82924aaabdfdd6e2a79ad3141 (patch) | |
| tree | 2bf60263ec953c17dee664ea762d70b8c827effb /test | |
| parent | 57447f5ce0a723f698d1515485860ca17ce93960 (diff) | |
| download | emacs-aab5d7b3f3bb6fb82924aaabdfdd6e2a79ad3141.tar.gz emacs-aab5d7b3f3bb6fb82924aaabdfdd6e2a79ad3141.zip | |
Add a KEEP-NEWLINES argument to string-lines
* doc/lispref/strings.texi (Creating Strings): Document it.
* lisp/subr.el (string-lines): Add a KEEP-NEWLINES argument.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/subr-tests.el | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index e027c68d0b2..c431930c272 100644 --- a/test/lisp/subr-tests.el +++ b/test/lisp/subr-tests.el | |||
| @@ -1028,5 +1028,27 @@ final or penultimate step during initialization.")) | |||
| 1028 | (should (readablep "foo")) | 1028 | (should (readablep "foo")) |
| 1029 | (should-not (readablep (list (make-marker))))) | 1029 | (should-not (readablep (list (make-marker))))) |
| 1030 | 1030 | ||
| 1031 | (ert-deftest test-string-lines () | ||
| 1032 | (should (equal (string-lines "foo") '("foo"))) | ||
| 1033 | (should (equal (string-lines "foo\n") '("foo" ""))) | ||
| 1034 | (should (equal (string-lines "foo\nbar") '("foo" "bar"))) | ||
| 1035 | |||
| 1036 | (should (equal (string-lines "foo" t) '("foo"))) | ||
| 1037 | (should (equal (string-lines "foo\n" t) '("foo"))) | ||
| 1038 | (should (equal (string-lines "foo\nbar" t) '("foo" "bar"))) | ||
| 1039 | (should (equal (string-lines "foo\n\n\nbar" t) '("foo" "bar"))) | ||
| 1040 | |||
| 1041 | (should (equal (string-lines "foo" nil t) '("foo"))) | ||
| 1042 | (should (equal (string-lines "foo\n" nil t) '("foo\n"))) | ||
| 1043 | (should (equal (string-lines "foo\nbar" nil t) '("foo\n" "bar"))) | ||
| 1044 | (should (equal (string-lines "foo\n\n\nbar" nil t) | ||
| 1045 | '("foo\n" "\n" "\n" "bar"))) | ||
| 1046 | |||
| 1047 | (should (equal (string-lines "foo" t t) '("foo"))) | ||
| 1048 | (should (equal (string-lines "foo\n" t t) '("foo\n"))) | ||
| 1049 | (should (equal (string-lines "foo\nbar" t t) '("foo\n" "bar"))) | ||
| 1050 | (should (equal (string-lines "foo\n\n\nbar" t t) | ||
| 1051 | '("foo\n" "bar")))) | ||
| 1052 | |||
| 1031 | (provide 'subr-tests) | 1053 | (provide 'subr-tests) |
| 1032 | ;;; subr-tests.el ends here | 1054 | ;;; subr-tests.el ends here |