diff options
| author | Simen Heggestøyl | 2019-06-22 12:49:04 +0200 |
|---|---|---|
| committer | Simen Heggestøyl | 2019-06-23 07:27:19 +0200 |
| commit | abf7d0d802728e0ae8e064683eb5fb411bad911e (patch) | |
| tree | dff14f64a25a3f5245a6a06e6cf173f855e53679 /test | |
| parent | b9d0337c84a6be7f26fd7134615048293320e234 (diff) | |
| download | emacs-abf7d0d802728e0ae8e064683eb5fb411bad911e.tar.gz emacs-abf7d0d802728e0ae8e064683eb5fb411bad911e.zip | |
Split up and add tests for two page.el functions
* lisp/textmodes/page.el (page--count-lines-page): New function
extracted from `count-lines-page'.
(count-lines-page): Extract main logic into `page--count-lines-page'.
(page--what-page); New function extracted from `what-page'.
(what-page): Extract main logic into `page--what-page'.
* test/lisp/textmodes/page-tests.el (page-tests-count-lines-page)
(page-tests-what-page): New tests for `page--count-lines-page' and
`page--what-page'. (Bug#36009)
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/textmodes/page-tests.el | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/test/lisp/textmodes/page-tests.el b/test/lisp/textmodes/page-tests.el index 0834d654338..517f1d5a9e5 100644 --- a/test/lisp/textmodes/page-tests.el +++ b/test/lisp/textmodes/page-tests.el | |||
| @@ -82,5 +82,22 @@ | |||
| 82 | (narrow-to-page -1) | 82 | (narrow-to-page -1) |
| 83 | (should (equal (buffer-string) "bar\n")))) | 83 | (should (equal (buffer-string) "bar\n")))) |
| 84 | 84 | ||
| 85 | (provide 'page-tests) | 85 | (ert-deftest page-tests-count-lines-page () |
| 86 | (with-temp-buffer | ||
| 87 | (insert "foo\n\nbar\n\nbaz") | ||
| 88 | (goto-char (point-min)) | ||
| 89 | (should (equal (page--count-lines-page) '(1 0 1))) | ||
| 90 | (goto-char (point-max)) | ||
| 91 | (should (equal (page--count-lines-page) '(2 2 0))))) | ||
| 92 | |||
| 93 | (ert-deftest page-tests-what-page () | ||
| 94 | (with-temp-buffer | ||
| 95 | (insert "foo\n\nbar\n\nbaz") | ||
| 96 | (goto-char (point-min)) | ||
| 97 | (should (equal (page--what-page) '(1 1))) | ||
| 98 | (forward-page) | ||
| 99 | (should (equal (page--what-page) '(2 2))) | ||
| 100 | (forward-page) | ||
| 101 | (should (equal (page--what-page) '(3 4))))) | ||
| 102 | |||
| 86 | ;;; page-tests.el ends here | 103 | ;;; page-tests.el ends here |