[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/compat 821e251409 02/10: Test line-number-at-pos
From: |
ELPA Syncer |
Subject: |
[elpa] externals/compat 821e251409 02/10: Test line-number-at-pos |
Date: |
Thu, 5 Jan 2023 10:57:30 -0500 (EST) |
branch: externals/compat
commit 821e251409c03f1e43dbb3d5739aece5e23e8d2f
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Test line-number-at-pos
---
compat-26.el | 2 +-
compat-tests.el | 9 +++++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/compat-26.el b/compat-26.el
index 48261b663d..54a3254732 100644
--- a/compat-26.el
+++ b/compat-26.el
@@ -49,7 +49,7 @@ Concatenate the results by altering them (using `nconc').
SEQUENCE may be a list, a vector, a boolean vector, or a string."
(apply #'nconc (mapcar func sequence)))
-(compat-defun line-number-at-pos (&optional position absolute) ;; <UNTESTED>
+(compat-defun line-number-at-pos (&optional position absolute) ;; <OK>
"Handle optional argument ABSOLUTE:
If the buffer is narrowed, the return value by default counts the lines
diff --git a/compat-tests.el b/compat-tests.el
index ce03aa684b..1866b33be4 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -53,6 +53,15 @@
(setq list (funcall sym list "first" 1 #'string=))
(should (eq (compat-call plist-get list "first" #'string=) 1))))
+(ert-deftest line-number-at-pos ()
+ (with-temp-buffer
+ (insert "\n\n\n")
+ (narrow-to-region (1+ (point-min)) (point-max))
+ (should-equal 1 (compat-call line-number-at-pos (point-min)))
+ (should-equal 2 (compat-call line-number-at-pos (1+ (point-min))))
+ (should-equal 2 (compat-call line-number-at-pos (point-min) 'abs))
+ (should-equal 3 (compat-call line-number-at-pos (1+ (point-min)) 'abs))))
+
(defvar compat-test-map-1
(let ((map (make-sparse-keymap)))
(define-key map (kbd "C-x C-f") #'find-file)
- [elpa] externals/compat updated (c6f6d43bd7 -> a90e08cbc5), ELPA Syncer, 2023/01/05
- [elpa] externals/compat f7d4860240 06/10: Mark function as tested, ELPA Syncer, 2023/01/05
- [elpa] externals/compat 821e251409 02/10: Test line-number-at-pos,
ELPA Syncer <=
- [elpa] externals/compat 30628c9752 08/10: Update NEWS, ELPA Syncer, 2023/01/05
- [elpa] externals/compat 7d5c47576e 05/10: Fix and test add-display-text-property and get-display-property, ELPA Syncer, 2023/01/05
- [elpa] externals/compat 757ea1d68f 03/10: Fix and test replace-regexp/string-in-region, ELPA Syncer, 2023/01/05
- [elpa] externals/compat cccd61fea2 04/10: Remove ert-quiet, ELPA Syncer, 2023/01/05
- [elpa] externals/compat f06e55fbb6 01/10: Update NEWS, ELPA Syncer, 2023/01/05
- [elpa] externals/compat bc2f944886 09/10: Update NEWS, ELPA Syncer, 2023/01/05
- [elpa] externals/compat 576ede78bb 07/10: Fix add-display-text-property, ELPA Syncer, 2023/01/05
- [elpa] externals/compat a90e08cbc5 10/10: compat-macs: Fix docstrings, ELPA Syncer, 2023/01/05