aboutsummaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
authorPaul Eggert2019-01-27 15:49:53 -0800
committerPaul Eggert2019-01-27 15:52:06 -0800
commitcc1c46e4122a08657a7c75495115d1c60efb1b31 (patch)
tree263f419e5f70ab9dceaa15093339623bf3513e64 /test/src
parent6c2ee11d8f27cc39f852b69a49056ba76ac6bee9 (diff)
downloademacs-cc1c46e4122a08657a7c75495115d1c60efb1b31.tar.gz
emacs-cc1c46e4122a08657a7c75495115d1c60efb1b31.zip
forward-line now works with bignums
* src/cmds.c (Fforward_line): Support bignum arg. (scan_newline): Return void since no caller was using the return value. * src/search.c (find_newline, scan_newline_from_point) (find_newline1): Return the number of newlines counted, not the count shortage, so that the return value always fits in ptrdiff_t even if the original count was a bignum. All callers changed. * test/src/cmds-tests.el (forward-line-with-bignum): New test.
Diffstat (limited to 'test/src')
-rw-r--r--test/src/cmds-tests.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/src/cmds-tests.el b/test/src/cmds-tests.el
index 05c62858773..bab8b5f26ec 100644
--- a/test/src/cmds-tests.el
+++ b/test/src/cmds-tests.el
@@ -30,5 +30,13 @@
30 (let ((last-command-event ?a)) 30 (let ((last-command-event ?a))
31 (should-error (self-insert-command -1)))) 31 (should-error (self-insert-command -1))))
32 32
33(ert-deftest forward-line-with-bignum ()
34 (with-temp-buffer
35 (insert "x\n")
36 (let ((shortage (forward-line (1- most-negative-fixnum))))
37 (should (= shortage most-negative-fixnum)))
38 (let ((shortage (forward-line (+ 2 most-positive-fixnum))))
39 (should (= shortage (1+ most-positive-fixnum))))))
40
33(provide 'cmds-tests) 41(provide 'cmds-tests)
34;;; cmds-tests.el ends here 42;;; cmds-tests.el ends here