WIP replace chat messages test
This commit is contained in:
@@ -0,0 +1,19 @@
|
|||||||
|
;;; mostalive/convert-chats-to-org.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
(defun format-chat-messages ()
|
||||||
|
"Format chat messages by adding '|' separator and user names."
|
||||||
|
(interactive)
|
||||||
|
(save-excursion
|
||||||
|
(goto-char (point-min))
|
||||||
|
(while (re-search-forward "^\\([[:alnum:]]+\\)\n +\\([[:print:]\n ]+?\\)\n\n" nil t)
|
||||||
|
(replace-match "| \\1 | \\2 |\n"))))
|
||||||
|
|
||||||
|
(ert-deftest test-format-chat-messages-adds-separators ()
|
||||||
|
(should
|
||||||
|
(string=
|
||||||
|
(with-temp-buffer
|
||||||
|
(org-mode)
|
||||||
|
(insert "marcevers\n 17 hours ago\n sentence 1\n")
|
||||||
|
(goto-char (point-min))
|
||||||
|
(format-chat-messages(buffer-string))
|
||||||
|
"|marcevers | sentence1\n")))
|
||||||
Reference in New Issue
Block a user