1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
(require 'ert)
(require 'wgrep-test-helper)
(require 'ag)
(ert-deftest wgrep-ag-normal ()
(ert-skip "Skipping wgrep-ag-normal")
:tags '(wgrep-subtest)
(wgrep-test-helper--default
(wgrep-test-helper-fixture "HOGE\nFOO\nBAZ\n"
(lambda (file)
(wgrep-test-helper--ag "FOO|HOGE" file)
(wgrep-change-to-wgrep-mode)
(goto-char (point-min))
(wgrep-goto-first-found)
;; search hit line (hit by -C option)
(should (re-search-forward "HOGE" nil t))
;; delete 1st line
(wgrep-mark-deletion)
(should (re-search-forward "FOO" nil t))
;; replace 2nd line
(replace-match "FOO2")
;; apply to buffer
(wgrep-finish-edit)
;; save to file
(wgrep-save-all-buffers)
;; compare file contents is valid
(should (equal "FOO2\nBAZ\n" (wgrep-test-helper--get-contents file)))))))
(ert-deftest wgrep-deadgrep-normal ()
(ert-skip "Skipping wgrep-deadgrep-normal, because there is no Deadgrep in Debian.")
:tags '(wgrep-subtest)
(wgrep-test-helper--default
(wgrep-test-helper-fixture "HOGE\nFOO\nBAZ\n"
(lambda (file)
(wgrep-test-helper--deadgrep "FOO|HOGE")
(wgrep-change-to-wgrep-mode)
(goto-char (point-min))
(wgrep-goto-first-found)
;; search hit line (hit by -C option)
(should (re-search-forward "HOGE" nil t))
;; delete 1st line
(wgrep-mark-deletion)
(should (re-search-forward "FOO" nil t))
;; replace 2nd line
(replace-match "FOO2")
;; apply to buffer
(wgrep-finish-edit)
;; save to file
(wgrep-save-all-buffers)
;; compare file contents is valid
(should (equal "FOO2\nBAZ\n" (wgrep-test-helper--get-contents file)))))))
|