1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

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)
This commit is contained in:
Simen Heggestøyl 2019-06-22 12:49:04 +02:00
parent b9d0337c84
commit abf7d0d802
2 changed files with 53 additions and 27 deletions

View file

@ -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