regexp in string replaced
This commit is contained in:
@@ -5,19 +5,18 @@
|
|||||||
(interactive)
|
(interactive)
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(while (re-search-forward "hours ago" nil t)
|
(while (re-search-forward (rx (one-or-more (category digit))) nil t)
|
||||||
(replace-match ""))))
|
(replace-match ""))))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(ert-deftest test-chat-remove-hours-ago ()
|
(ert-deftest test-chat-remove-hours-ago ()
|
||||||
(should (string=
|
(should (string=
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
(insert "marcevers\n17 hours ago\n sentence 1\n")
|
(insert "17")
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(chat-remove-hours-ago)
|
(chat-remove-hours-ago)
|
||||||
(buffer-string))
|
(buffer-string))
|
||||||
"marcevers\n17 \n sentence 1\n"
|
"")))
|
||||||
)))
|
|
||||||
|
|
||||||
(ert 'test-chat-remove-hours-ago )
|
(ert 'test-chat-remove-hours-ago )
|
||||||
|
|||||||
Reference in New Issue
Block a user