regexp in string replaced
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(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 ""))))
|
||||
|
||||
|
||||
@@ -13,11 +13,10 @@
|
||||
(ert-deftest test-chat-remove-hours-ago ()
|
||||
(should (string=
|
||||
(with-temp-buffer
|
||||
(insert "marcevers\n17 hours ago\n sentence 1\n")
|
||||
(insert "17")
|
||||
(goto-char (point-min))
|
||||
(chat-remove-hours-ago)
|
||||
(buffer-string))
|
||||
"marcevers\n17 \n sentence 1\n"
|
||||
)))
|
||||
"")))
|
||||
|
||||
(ert 'test-chat-remove-hours-ago )
|
||||
|
||||
Reference in New Issue
Block a user