aboutsummaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
authorLars Ingebrigtsen2021-02-07 16:02:56 +0100
committerLars Ingebrigtsen2021-02-07 16:03:02 +0100
commit094a109b8eefbabbc99dba925ebec9887c101a91 (patch)
treede1959ee43a6a1b8bda4de6b4ec781a8eccdd0a3 /test/src
parent4e8d36fdaadade020f0bcadc70d617d8b07b739c (diff)
downloademacs-094a109b8eefbabbc99dba925ebec9887c101a91.tar.gz
emacs-094a109b8eefbabbc99dba925ebec9887c101a91.zip
Add a new function 'line-number-at-position'
* doc/lispref/positions.texi (Text Lines): Document it. * lisp/simple.el (count-lines): Use it. (line-number-at-pos): Ditto. * src/fns.c (Fline_number_at_position): New function (bug#22763).
Diffstat (limited to 'test/src')
-rw-r--r--test/src/fns-tests.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el
index e0aed2a71b6..3a43142106b 100644
--- a/test/src/fns-tests.el
+++ b/test/src/fns-tests.el
@@ -1098,3 +1098,11 @@
1098 (goto-char (point-max)) 1098 (goto-char (point-max))
1099 (insert "fóo") 1099 (insert "fóo")
1100 (should (approx-equal (buffer-line-statistics) '(1002 50 49.9))))) 1100 (should (approx-equal (buffer-line-statistics) '(1002 50 49.9)))))
1101
1102(ert-deftest test-line-number-at-position ()
1103 (with-temp-buffer
1104 (insert (make-string 10 ?\n))
1105 (should (= (line-number-at-position (point)) 11))
1106 (should-error (line-number-at-position nil))
1107 (should-error (line-number-at-position -1))
1108 (should-error (line-number-at-position 100))))