match hours ago with line

This commit is contained in:
Willem van den Ende
2023-04-13 08:20:09 +02:00
parent 3506f61f7f
commit 49dd5dfc48
+5 -4
View File
@@ -5,15 +5,15 @@
(interactive)
(save-excursion
(goto-char (point-min))
(while (re-search-forward (rx (one-or-more (category digit))) nil t)
(replace-match "dada"))))
(while (re-search-forward "[0-9]+ hours ago" nil t)
(replace-match ""))))
(ert-deftest test-chat-remove-hours-ago ()
(should (string=
(with-temp-buffer
(insert "17")
(insert "17 hours ago")
(goto-char (point-min))
(chat-remove-hours-ago)
(buffer-string))
@@ -21,7 +21,8 @@
(ert-deftest test-replace-hours-ago-regexp-in-string ()
(should (string=
(replace-regexp-in-string "[0-9]+ hours ago" "" "11 hours ago")
(replace-regexp-in-string "[0-9]+ hours ago" "" "space 11 hours ago")
"")))
(ert 'test-replace-regexp-in-string )
;;(ert 'test-chat-remove-hours-ago )