diff options
author | Simen Heggestøyl <simenheg@gmail.com> | 2019-06-22 12:49:04 +0200 |
---|---|---|
committer | Simen Heggestøyl <simenheg@gmail.com> | 2019-06-23 07:27:19 +0200 |
commit | abf7d0d802728e0ae8e064683eb5fb411bad911e (patch) | |
tree | dff14f64a25a3f5245a6a06e6cf173f855e53679 /test | |
parent | b9d0337c84a6be7f26fd7134615048293320e234 (diff) | |
download | emacs-abf7d0d802728e0ae8e064683eb5fb411bad911e.tar.gz |
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 @@ (narrow-to-page -1) (should (equal (buffer-string) "bar\n")))) -(provide 'page-tests) +(ert-deftest page-tests-count-lines-page () + (with-temp-buffer + (insert "foo\n\nbar\n\nbaz") + (goto-char (point-min)) + (should (equal (page--count-lines-page) '(1 0 1))) + (goto-char (point-max)) + (should (equal (page--count-lines-page) '(2 2 0))))) + +(ert-deftest page-tests-what-page () + (with-temp-buffer + (insert "foo\n\nbar\n\nbaz") + (goto-char (point-min)) + (should (equal (page--what-page) '(1 1))) + (forward-page) + (should (equal (page--what-page) '(2 2))) + (forward-page) + (should (equal (page--what-page) '(3 4))))) + ;;; page-tests.el ends here |