]> git.eshelyaron.com Git - emacs.git/commitdiff
Prefer pos-bol and pos-eol in tests
authorStefan Kangas <stefankangas@gmail.com>
Sun, 21 Aug 2022 15:33:55 +0000 (17:33 +0200)
committerStefan Kangas <stefankangas@gmail.com>
Sun, 21 Aug 2022 15:45:04 +0000 (17:45 +0200)
* test/lisp/calendar/todo-mode-tests.el
(todo-test-toggle-item-header02, todo-test-edit-item-date-month)
(todo-test-multiline-item-indentation-1)
(todo-test-multiline-item-indentation-2)
(todo-test-multiline-item-indentation-3):
* test/lisp/cedet/semantic-utest-ia.el (semantic-ia-utest-buffer)
(semantic-sr-utest-buffer-refs):
* test/lisp/cedet/semantic-utest.el (semantic-utest-kill-indicator)
(semantic-utest-unkill-indicator):
* test/lisp/dired-tests.el (dired-test-bug27968):
* test/lisp/emacs-lisp/backtrace-tests.el
(backtrace-tests--verify-single-and-multi-line):
* test/lisp/emacs-lisp/find-func-tests.el
(find-func-tests--find-library-verbose):
* test/lisp/erc/erc-tests.el (erc-ring-previous-command)
(erc-log-irc-protocol):
* test/lisp/gnus/message-tests.el (message-mode-propertize):
* test/lisp/info-xref-tests.el (info-xref-test-emacs-manuals):
* test/lisp/mail/footnote-tests.el (footnote-tests-same-place):
* test/lisp/progmodes/elisp-mode-tests.el
(elisp-shorthand-completion-at-point):
* test/lisp/progmodes/f90-tests.el (f90-test-bug38415):
* test/lisp/progmodes/python-tests.el
(python-indent-electric-comma-inside-multiline-string)
(python-indent-electric-comma-after-multiline-string)
(python-indent-electric-colon-1, python-indent-electric-colon-2)
(python-indent-electric-colon-3, python-indent-electric-colon-4)
(python-mark-defun-2, python-mark-defun-3, python-mark-defun-4)
(python-mark-defun-5, python-nav-end-of-defun-2)
(python-nav-end-of-statement-1, python-nav-end-of-block-1)
(python-indent-dedent-line-backspace-2)
(python-indent-dedent-line-backspace-3)
(python-eldoc--get-symbol-at-point-1)
(python-info-beginning-of-statement-p-1)
(python-info-beginning-of-statement-p-2):
* test/lisp/replace-tests.el (replace-occur-revert-bug32543)
(replace-occur-revert-bug32987):
* test/lisp/simple-tests.el (simple-delete-indentation-boundaries)
(simple-delete-indentation-region)
(line-number-at-pos-in-narrow-buffer)
(line-number-at-pos-keeps-restriction):
* test/lisp/textmodes/css-mode-tests.el (css-mode-test-selectors)
(scss-mode-test-selectors):
* test/lisp/textmodes/fill-tests.el (fill-test-unbreakable-paragraph)
(fill-test-breakable-paragraph):
* test/lisp/time-stamp-tests.el (time-stamp-custom-pattern):
* test/src/lread-tests.el (lread-tests--last-message):
* test/src/process-tests.el (set-process-filter-t):
* test/src/undo-tests.el (undo-test-skip-invalidated-markers): Prefer
pos-bol and pos-eol.

21 files changed:
test/lisp/calendar/todo-mode-tests.el
test/lisp/cedet/semantic-utest-ia.el
test/lisp/cedet/semantic-utest.el
test/lisp/dired-tests.el
test/lisp/emacs-lisp/backtrace-tests.el
test/lisp/emacs-lisp/find-func-tests.el
test/lisp/erc/erc-tests.el
test/lisp/gnus/message-tests.el
test/lisp/info-xref-tests.el
test/lisp/mail/footnote-tests.el
test/lisp/progmodes/elisp-mode-tests.el
test/lisp/progmodes/f90-tests.el
test/lisp/progmodes/python-tests.el
test/lisp/replace-tests.el
test/lisp/simple-tests.el
test/lisp/textmodes/css-mode-tests.el
test/lisp/textmodes/fill-tests.el
test/lisp/time-stamp-tests.el
test/src/lread-tests.el
test/src/process-tests.el
test/src/undo-tests.el

index 0102b62c10f12ad7366ebf08ccb353213c4db27c..95855d1e639da64038499df35450d3d575862d8f 100644 (file)
@@ -459,7 +459,7 @@ the top done item should be the first done item."
                                  todo-date-pattern
                                 "\\( " diary-time-regexp "\\)?"
                                 (regexp-quote todo-nondiary-end) "?")
-                        (line-end-position) t)
+                         (pos-eol) t)
                         (forward-char)
                         (point)))
           (start1 (save-excursion (funcall find-start)))
@@ -854,7 +854,7 @@ item's date should be adjusted accordingly."
    (let ((current-prefix-arg t)         ; For todo-edit-item--header.
          (get-date (lambda ()
                      (save-excursion
-                       (todo-date-string-matcher (line-end-position))
+                       (todo-date-string-matcher (pos-eol))
                        (buffer-substring-no-properties (match-beginning 1)
                                                        (match-end 0))))))
      (should (equal (funcall get-date) "Jan 1, 2020"))
@@ -903,7 +903,7 @@ tab character."
      (todo-test--insert-item item 1)
      (re-search-forward (concat todo-date-string-start todo-date-pattern
                                (regexp-quote todo-nondiary-end) " ")
-                       (line-end-position) t)
+                       (pos-eol) t)
      (should (looking-at (regexp-quote (concat item0 "\n\t" item1)))))))
 
 (ert-deftest todo-test-multiline-item-indentation-2 () ; bug#43068
@@ -917,7 +917,7 @@ begin with a tab character."
      (todo-edit-item--text 'multiline)
      (insert (concat "\n" item1))
      (todo-edit-quit)
-     (goto-char (line-beginning-position))
+     (goto-char (pos-bol))
      (should (looking-at (regexp-quote (concat item0 "\n\t" item1)))))))
 
 (ert-deftest todo-test-multiline-item-indentation-3 ()
@@ -930,7 +930,7 @@ since all non-initial item lines must begin with whitespace."
           (item1 "Second line."))
      (todo-edit-file)
      (should (looking-at (regexp-quote item0)))
-     (goto-char (line-end-position))
+     (goto-char (pos-eol))
      (insert (concat "\n" item1))
      (should-error (todo-edit-quit) :type 'user-error))))
 
index caf20fa8e07614712e5282e6da80c6348cba6cc5..fa3b3185ed56e4c413ef0fe873280cd5d55cdaec 100644 (file)
 
        (goto-char a)
 
-       (let ((bss (buffer-substring-no-properties (point) (point-at-eol))))
+        (let ((bss (buffer-substring-no-properties (point) (pos-eol))))
          (condition-case nil
              (setq desired (read bss))
            (error (setq desired (format "  FAILED TO PARSE: %S"
                        )
                       fail)))
 
-      (setq p nil a nil)
-      (setq idx (1+ idx)))
+        (setq p nil a nil)
+        (setq idx (1+ idx)))
       )
 
     (when fail
               (when (re-search-forward regex-p nil t)
                 (setq tag (semantic-current-tag))
                 (goto-char (match-end 0))
-                (setq desired (read (buffer-substring (point) (point-at-eol))))
+                 (setq desired (read (buffer-substring (point) (pos-eol))))
                 ))
             tag)
 
@@ -451,7 +451,7 @@ tag that contains point, and return that."
               (when (re-search-forward regex-p nil t)
                 (goto-char (match-end 0))
                 (skip-syntax-backward "w")
-                (setq desired (read (buffer-substring (point) (point-at-eol))))
+                 (setq desired (read (buffer-substring (point) (pos-eol))))
                 (setq start (match-beginning 0))
                 (goto-char start)
                 (setq actual (semantic-symref-test-count-hits-in-tag))
@@ -463,7 +463,7 @@ tag that contains point, and return that."
                         (list
                         (format
                          "Symref id %d: No results." idx))
-                         fail))
+                        fail))
 
            )
 
index 78bbbbf45923896b17e86a5291946037b2d62427..24a467474b90c48568b77bd08ec5d25a3c85b44b 100644 (file)
@@ -736,8 +736,8 @@ JAVE this thing would need to be recursive to handle java and csharp"
   (beginning-of-line)
   (setq semantic-utest-last-kill-pos (point))
   (setq semantic-utest-last-kill-text
-       (buffer-substring (point) (point-at-eol)))
-  (delete-region (point) (point-at-eol))
+        (buffer-substring (point) (pos-eol)))
+  (delete-region (point) (pos-eol))
   (insert insertme)
   (sit-for 0)
 )
@@ -745,7 +745,7 @@ JAVE this thing would need to be recursive to handle java and csharp"
 (defun semantic-utest-unkill-indicator ()
   "Unkill the last indicator."
   (goto-char semantic-utest-last-kill-pos)
-  (delete-region (point) (point-at-eol))
+  (delete-region (point) (pos-eol))
   (insert semantic-utest-last-kill-text)
   (sit-for 0)
   )
index 0e893259077f59fce62a34ce6bf1d79f0c4356bd..9cf01519052d276f58c15341fad2ebd4860a3379 100644 (file)
                             (save-excursion
                               (goto-char 1)
                               (forward-line 1)
-                              (- (point-at-eol) (point)))))
+                              (- (pos-eol) (point)))))
            orig-len len diff pos line-nb)
       (make-directory subdir 'parents)
       (with-current-buffer (dired-noselect subdir)
           (forward-line 1)
           (let ((inhibit-read-only t)
                 (new-header "  test-bug27968"))
-            (delete-region (point) (point-at-eol))
+            (delete-region (point) (pos-eol))
             (when (= orig-len (length new-header))
               ;; Wow lucky guy! I must buy lottery today.
               (setq new-header (concat new-header " :-)")))
index b08695a22bb1640859665ab4326a55fade0b8cbb..b42de06776bc0471e4086332fef073295f77b7ba 100644 (file)
@@ -274,16 +274,16 @@ line contains the strings \"lambda\" and \"number\"."
   ;; Verify the form now spans multiple lines.
   (let ((pos (point)))
     (search-forward "number")
-    (should-not (= pos (point-at-bol))))
+    (should-not (= pos (pos-bol))))
   ;; Collapse the form.
   (backtrace-single-line)
   ;; Verify that the form is now back on one line,
   ;; and that point is at the same place.
   (should (string= (backtrace-tests--get-substring
                     (- (point) 6) (point)) "number"))
-  (should-not (= (point) (point-at-bol)))
+  (should-not (= (point) (pos-bol)))
   (should (string= (backtrace-tests--get-substring
-                    (point-at-bol) (1+ (point-at-eol)))
+                    (pos-bol) (1+ (pos-eol)))
                    line)))
 
 (ert-deftest backtrace-tests--print-circle ()
index 420c61acb55b2c62719c7d904ae2c9849cd428d6..d18a9dc1a94230c314608790f5363942f1331e4a 100644 (file)
@@ -109,9 +109,7 @@ expected function symbol and function library, respectively."
       (skip-chars-backward "\n")
       (should (string-match-p
                ".join-line. is an alias for .delete-indentation."
-               (buffer-substring
-                (line-beginning-position)
-                (point)))))))
+               (buffer-substring (pos-bol) (point)))))))
 
 ;; Avoid a byte-compilation warning that may confuse people reading
 ;; the result of the following test.
index 0f222edacfae7415b940ef10a4cfeccf31e2afbf..55efe2fd2d9c4a51076bf1da6d58cc569d467335 100644 (file)
         (erc-send-current-line)
         (should (ring-p erc-input-ring))
         (should (zerop (ring-member erc-input-ring "/one"))) ; equal
-        (should (save-excursion (forward-line -1) (goto-char (point-at-bol))
+        (should (save-excursion (forward-line -1) (goto-char (pos-bol))
                                 (looking-at-p "[*]+ echo: one")))
         (should-not erc-input-ring-index)
         (erc-bol)
     (goto-char (point-min))
     (search-forward "Version")
     (search-forward "\r\n\r\n")
-    (search-forward "myproxy.localhost:6667 >> PASS" (line-end-position))
+    (search-forward "myproxy.localhost:6667 >> PASS" (pos-eol))
     (forward-line)
-    (search-forward "irc.gnu.org << :irc.gnu.org 001" (line-end-position))
+    (search-forward "irc.gnu.org << :irc.gnu.org 001" (pos-eol))
     (forward-line)
-    (search-forward "irc.gnu.org << :irc.gnu.org 002" (line-end-position))
+    (search-forward "irc.gnu.org << :irc.gnu.org 002" (pos-eol))
     (forward-line)
-    (search-forward "FooNet << :irc.gnu.org 422" (line-end-position))
+    (search-forward "FooNet << :irc.gnu.org 422" (pos-eol))
     (forward-line)
-    (search-forward "BarNet << :irc.gnu.org 221" (line-end-position)))
+    (search-forward "BarNet << :irc.gnu.org 221" (pos-eol)))
   (when noninteractive
     (kill-buffer "*erc-protocol*")
     (should-not erc-debug-irc-protocol)))
index 8f3c1250a9efb9e0da1c9caf3c99185114c0b7c7..a724428ecb431be16cb6c6c7d60728d378e4a965 100644 (file)
           (setq-local parse-sexp-lookup-properties t)
           (backward-sexp)
           (should (string= "here's an opener "
-                           (buffer-substring-no-properties
-                            (line-beginning-position)
-                            (point))))
+                           (buffer-substring-no-properties (pos-bol) (point))))
           (forward-sexp)
           (should (string= "and here's a closer )"
-                           (buffer-substring-no-properties
-                            (line-beginning-position)
-                            (point)))))
+                           (buffer-substring-no-properties (pos-bol) (point)))))
       (set-buffer-modified-p nil))))
 
 
index acfd6e82f16299ca68c42f2787935f0fe6773b1b..117170ba338ebc99ca96367cab6bef2dfaa140af 100644 (file)
@@ -161,8 +161,7 @@ text.
       (should (search-backward "done" nil t))
       (should (string-match-p
                " [0-9]\\{3,\\} good, 0 bad"
-               (buffer-substring-no-properties (line-beginning-position)
-                                               (line-end-position)))))))
+               (buffer-substring-no-properties (pos-bol) (pos-eol)))))))
 
 
 ;;; info-xref-tests.el ends here
index e33b59bc41676349f9d29b9b9c4965714ca66f93..f3a35e3dfc668c01e7356a4709d273b7d9498e14 100644 (file)
@@ -40,7 +40,7 @@
     (footnote-back-to-message)
     (should (equal (buffer-substring (point-min) (point))
                    "hello[1]"))
-    (should (equal (buffer-substring (point-min) (line-end-position))
+    (should (equal (buffer-substring (point-min) (pos-eol))
                    "hello[1][2] world"))))
 
 (provide 'footnote-tests)
index 8e4dfa8bb83009a1166223a6b15783d05610fa52..8074d8d70668180295f9ee01b62f7369b0d007f1 100644 (file)
@@ -1084,7 +1084,7 @@ evaluation of BODY."
       (insert "f-test-compl")
       (completion-at-point)
       (goto-char (point-min))
-      (should (search-forward "f-test-complete-me" (line-end-position) t))
+      (should (search-forward "f-test-complete-me" (pos-eol) t))
       (goto-char (point-min))
       (should (string= (symbol-name (read (current-buffer)))
                        "elisp--foo-test-complete-me"))
index 3fe5eecd1b220612f0549fe0932dda4e9946ee69..b857a25bf2a4659309ecf210bccb81d740bd915b 100644 (file)
@@ -285,14 +285,14 @@ real :: x
 end")
     (f90-indent-line)
     (should (equal " function foo"
-                   (buffer-substring (point) (line-end-position))))
+                   (buffer-substring (point) (pos-eol))))
     (goto-char (point-max))
     (insert "\nmodule subroutine bar(x)
 real :: x
 end")
     (f90-indent-line)
     (should (equal " subroutine bar"
-                   (buffer-substring (point) (line-end-position))))))
+                   (buffer-substring (point) (pos-eol))))))
 
 
 ;;; f90-tests.el ends here
index a11716a7b53215c16aa50a916d60fb3bdadec7e5..12ac871fdf8ef67aa33a2e51a8ea84f820a72243 100644 (file)
@@ -1639,7 +1639,7 @@ a = (
 "
    (python-tests-look-at "- bar")
    (should (eq (car (python-indent-context)) :inside-string))
-   (goto-char (line-end-position))
+   (goto-char (pos-eol))
    (python-tests-self-insert ",")
    (should (= (current-indentation) 0))))
 
@@ -1654,7 +1654,7 @@ a = (
 "
    (python-tests-look-at "- bar'''")
    (should (eq (car (python-indent-context)) :inside-string))
-   (goto-char (line-end-position))
+   (goto-char (pos-eol))
    (python-tests-self-insert ",")
    (should (= (current-indentation) 0))))
 
@@ -1668,7 +1668,7 @@ def a():
 def b()
 "
    (python-tests-look-at "def b()")
-   (goto-char (line-end-position))
+   (goto-char (pos-eol))
    (python-tests-self-insert ":")
    (should (= (current-indentation) 0))))
 
@@ -1682,7 +1682,7 @@ if do:
 outside
 "
    (python-tests-look-at "else")
-   (goto-char (line-end-position))
+   (goto-char (pos-eol))
    (python-tests-self-insert ":")
    (should (= (current-indentation) 0))
    (python-tests-look-at "outside")
@@ -1699,7 +1699,7 @@ if do:
           that)
 "
    (python-tests-look-at "that)")
-   (goto-char (line-end-position))
+   (goto-char (pos-eol))
    (python-tests-self-insert ":")
    (python-tests-look-at "elif" -1)
    (should (= (current-indentation) 0))
@@ -1724,7 +1724,7 @@ def f():
 else
 "
    (python-tests-look-at "else")
-   (goto-char (line-end-position))
+   (goto-char (pos-eol))
    (python-tests-self-insert ":")
    (python-tests-look-at "else" -1)
    (should (= (current-indentation) 4))))
@@ -1984,7 +1984,7 @@ class C:
          (expected-mark-beginning-position
           (progn
             (python-tests-look-at "def __init__(self):")
-            (1- (line-beginning-position))))
+            (1- (pos-bol))))
          (expected-mark-end-position-1
           (save-excursion
             (python-tests-look-at "self.b = 'b'")
@@ -2041,7 +2041,7 @@ class C:
           (progn
             (python-tests-look-at "def fun(self):")
             (python-tests-look-at "(self):")
-            (1- (line-beginning-position))))
+            (1- (pos-bol))))
          (expected-mark-end-position
           (save-excursion
             (python-tests-look-at "return self.b")
@@ -2066,7 +2066,7 @@ def foo(x):
    (let ((expected-mark-beginning-position
           (progn
             (python-tests-look-at "def foo(x):")
-            (1- (line-beginning-position))))
+            (1- (pos-bol))))
          (expected-mark-end-position (point-max)))
      (python-tests-look-at "return bar")
      (python-mark-defun 1)
@@ -2086,7 +2086,7 @@ def \\
          (expected-mark-beginning-position
           (progn
             (python-tests-look-at "def ")
-            (1- (line-beginning-position))))
+            (1- (pos-bol))))
          (expected-mark-end-position
           (save-excursion
             (python-tests-look-at "return x")
@@ -2438,21 +2438,21 @@ def decoratorFunctionWithArguments(arg1, arg2, arg3):
                 (point))
               (save-excursion
                 (python-tests-look-at "return wwrap")
-                (line-beginning-position))))
+                (pos-bol))))
    (should (= (save-excursion
                 (python-tests-look-at "def wrapped_f(*args):")
                 (python-nav-end-of-defun)
                 (point))
               (save-excursion
                 (python-tests-look-at "return wrapped_f")
-                (line-beginning-position))))
+                (pos-bol))))
    (should (= (save-excursion
                 (python-tests-look-at "f(*args)")
                 (python-nav-end-of-defun)
                 (point))
               (save-excursion
                 (python-tests-look-at "return wrapped_f")
-                (line-beginning-position))))))
+                (pos-bol))))))
 
 (ert-deftest python-nav-end-of-defun-3 ()
   (python-tests-with-temp-buffer
@@ -2765,14 +2765,14 @@ string
                 (point))
               (save-excursion
                 (python-tests-look-at "789")
-                (line-end-position))))
+                (pos-eol))))
    (python-tests-look-at "v2 =")
    (should (= (save-excursion
                 (python-nav-end-of-statement)
                 (point))
               (save-excursion
                 (python-tests-look-at "value4)")
-                (line-end-position))))
+                (pos-eol))))
    (python-tests-look-at "v3 =")
    (should (= (save-excursion
                 (python-nav-end-of-statement)
@@ -2780,7 +2780,7 @@ string
               (save-excursion
                 (python-tests-look-at
                  "'continue previous line')")
-                (line-end-position))))
+                (pos-eol))))
    (python-tests-look-at "v4 =")
    (should (= (save-excursion
                 (python-nav-end-of-statement)
@@ -3004,21 +3004,21 @@ def decoratorFunctionWithArguments(arg1, arg2, arg3):
                 (point))
               (save-excursion
                 (python-tests-look-at "return wrapped_f")
-                (line-end-position))))
+                (pos-eol))))
    (end-of-line)
    (should (= (save-excursion
                 (python-nav-end-of-block)
                 (point))
               (save-excursion
                 (python-tests-look-at "return wrapped_f")
-                (line-end-position))))
+                (pos-eol))))
    (python-tests-look-at "f(*args)")
    (should (= (save-excursion
                 (python-nav-end-of-block)
                 (point))
               (save-excursion
                 (python-tests-look-at "print 'After f(*args)'")
-                (line-end-position))))))
+                (pos-eol))))))
 
 (ert-deftest python-nav-end-of-block-2 ()
   "Ensure that `python-nav-end-of-block' does not enter an infinite loop."
@@ -3308,11 +3308,11 @@ if x:
 \tabcdefg
 "
      (python-tests-look-at "abcdefg")
-     (goto-char (line-end-position))
+     (goto-char (pos-eol))
      (call-interactively #'python-indent-dedent-line-backspace)
      (should
       (string= (buffer-substring-no-properties
-                (line-beginning-position) (line-end-position))
+                (pos-bol) (pos-eol))
                "\tabcdef")))))
 
 (ert-deftest python-indent-dedent-line-backspace-3 ()
@@ -3325,27 +3325,27 @@ if x:
 \t abcdefg
 "
      (python-tests-look-at "abcdefg")
-     (goto-char (line-end-position))
+     (goto-char (pos-eol))
      (call-interactively #'python-indent-dedent-line-backspace)
      (should
       (string= (buffer-substring-no-properties
-                (line-beginning-position) (line-end-position))
+                (pos-bol) (pos-eol))
                "\t abcdef"))
      (back-to-indentation)
      (call-interactively #'python-indent-dedent-line-backspace)
      (should
       (string= (buffer-substring-no-properties
-                (line-beginning-position) (line-end-position))
+                (pos-bol) (pos-eol))
                "\tabcdef"))
      (call-interactively #'python-indent-dedent-line-backspace)
      (should
       (string= (buffer-substring-no-properties
-                (line-beginning-position) (line-end-position))
+                (pos-bol) (pos-eol))
                "    abcdef"))
      (call-interactively #'python-indent-dedent-line-backspace)
      (should
       (string= (buffer-substring-no-properties
-                (line-beginning-position) (line-end-position))
+                (pos-bol) (pos-eol))
                "abcdef")))))
 
 (ert-deftest python-bob-infloop-avoid ()
@@ -4358,11 +4358,11 @@ map(codecs.open('somefile'
 "
    (python-tests-look-at "ap(xx")
    (should (string= (python-eldoc--get-symbol-at-point) "map"))
-   (goto-char (line-end-position))
+   (goto-char (pos-eol))
    (should (string= (python-eldoc--get-symbol-at-point) "map"))
    (python-tests-look-at "('somefile'")
    (should (string= (python-eldoc--get-symbol-at-point) "map"))
-   (goto-char (line-end-position))
+   (goto-char (pos-eol))
    (should (string= (python-eldoc--get-symbol-at-point) "codecs.open"))))
 
 (ert-deftest python-eldoc--get-symbol-at-point-2 ()
@@ -4875,7 +4875,7 @@ def long_function_name(
    (should (not (python-info-beginning-of-statement-p)))
    (python-tests-look-at "print (var_one)")
    (should (python-info-beginning-of-statement-p))
-   (goto-char (line-beginning-position))
+   (goto-char (pos-bol))
    (should (not (python-info-beginning-of-statement-p)))))
 
 (ert-deftest python-info-beginning-of-statement-p-2 ()
@@ -4895,7 +4895,7 @@ if width == 0 and height == 0 and \\
    (should (not (python-info-beginning-of-statement-p)))
    (python-tests-look-at "raise ValueError(")
    (should (python-info-beginning-of-statement-p))
-   (goto-char (line-beginning-position))
+   (goto-char (pos-bol))
    (should (not (python-info-beginning-of-statement-p)))))
 
 (ert-deftest python-info-end-of-statement-p-1 ()
index ef1e5c3eafcb5a7fd41162236183a5aa0c895135..23ec24840fbc1aa9c228057acfd7347a219f9190 100644 (file)
@@ -378,7 +378,7 @@ Each element has the format:
               (goto-char (point-min))
               (should (string-match "\\`2 matches for \"and\" in buffer: "
                                     (buffer-substring-no-properties
-                                     (point) (line-end-position)))))))
+                                     (point) (pos-eol)))))))
       (and (buffer-name temp-buffer)
            (kill-buffer temp-buffer)))))
 
@@ -401,7 +401,7 @@ Each element has the format:
               (goto-char (point-min))
               (should (string-match "\\`2 matches for \"and\" in buffer: "
                                     (buffer-substring-no-properties
-                                     (point) (line-end-position)))))))
+                                     (point) (pos-eol)))))))
       (and (buffer-name temp-buffer)
            (kill-buffer temp-buffer)))))
 
index b4576889dcda9d576214f0d21e29c96d6064b543..97f425f6f480781d3ffff59c21f55e5c7a925378 100644 (file)
@@ -321,7 +321,7 @@ See bug#35036."
     ;; Stay at BOB.
     (forward-line -1)
     (save-restriction
-      (narrow-to-region (point) (line-end-position))
+      (narrow-to-region (point) (pos-eol))
       (should-not (delete-indentation))
       (should (equal (simple-test--buffer-substrings)
                      '("" . " second ")))
@@ -344,27 +344,23 @@ See bug#35036."
     (should (equal (simple-test--buffer-substrings)
                    '(" first " . "")))
     ;; Single line.
-    (should-not (delete-indentation
-                 nil (line-beginning-position) (1- (point))))
+    (should-not (delete-indentation nil (pos-bol) (1- (point))))
     (should (equal (simple-test--buffer-substrings)
                    '("" . " first ")))
-    (should-not (delete-indentation nil (1+ (point)) (line-end-position)))
+    (should-not (delete-indentation nil (1+ (point)) (pos-eol)))
     (should (equal (simple-test--buffer-substrings)
                    '(" " . "first ")))
-    (should-not (delete-indentation
-                 nil (line-beginning-position) (line-end-position)))
+    (should-not (delete-indentation nil (pos-bol) (pos-eol)))
     (should (equal (simple-test--buffer-substrings)
                    '("" . " first ")))
     ;; Multiple lines.
     (goto-char (point-max))
     (insert "\n second \n third \n fourth ")
     (goto-char (point-min))
-    (should-not (delete-indentation
-                 nil (line-end-position) (line-beginning-position 2)))
+    (should-not (delete-indentation nil (pos-eol) (pos-bol 2)))
     (should (equal (simple-test--buffer-substrings)
                    '(" first" . " second \n third \n fourth ")))
-    (should-not (delete-indentation
-                 nil (point) (1+ (line-beginning-position 2))))
+    (should-not (delete-indentation nil (point) (1+ (pos-bol 2))))
     (should (equal (simple-test--buffer-substrings)
                    '(" first second" . " third \n fourth ")))
     ;; Prefix argument overrides region.
@@ -808,7 +804,7 @@ See Bug#21722."
       (insert "a\nb\nc\nd\n")
       (goto-char (point-min))
       (forward-line (1- target-line))
-      (narrow-to-region (line-beginning-position) (line-end-position))
+      (narrow-to-region (pos-bol) (pos-eol))
       (should (equal (line-number-at-pos) 1))
       (should (equal (line-number-at-pos nil t) target-line)))))
 
@@ -817,7 +813,7 @@ See Bug#21722."
     (insert "a\nb\nc\nd\n")
     (goto-char (point-min))
     (forward-line 2)
-    (narrow-to-region (line-beginning-position) (line-end-position))
+    (narrow-to-region (pos-bol) (pos-eol))
     (should (equal (line-number-at-pos) 1))
     (line-number-at-pos nil t)
     (should (equal (line-number-at-pos) 1))))
index a746edf89445008f76c78f0e779b8a935f0518d1..1d2d556992b8fdf9b41c247da4974cd93d9c5a12 100644 (file)
                       'css-selector)
             (should-not (format "Didn't recognize %s as a selector"
                                 (buffer-substring-no-properties
-                                 (point) (line-end-position)))))))
+                                 (point) (pos-eol)))))))
       ;; Test many selectors.
       (dolist (selector selectors)
         (with-temp-buffer
                       'css-selector)
             (should-not (format "Didn't recognize %s as a selector"
                                 (buffer-substring-no-properties
-                                 (point) (line-end-position)))))))
+                                 (point) (pos-eol)))))))
       ;; Test wrong separators.
       (dolist (selector selectors)
         (with-temp-buffer
                     'css-selector)
             (should-not (format "Recognized %s as a selector"
                                 (buffer-substring-no-properties
-                                 (point) (line-end-position))))))))))
+                                 (point) (pos-eol))))))))))
 
 (ert-deftest scss-mode-test-selectors ()
   (let ((selectors
                       'css-selector)
             (should-not (format "Didn't recognize %s as a selector"
                                 (buffer-substring-no-properties
-                                 (point) (line-end-position))))))))))
+                                 (point) (pos-eol))))))))))
 
 
 (provide 'css-mode-tests)
index b730de5a69076d91f94bed09338b2e8c945b93bd..f2a0daf81222a361e7210e1361d113e6bea22fe1 100644 (file)
@@ -53,8 +53,8 @@
       (goto-char (point-min))
       (search-forward "b")
       (let* ((pos (point))
-             (beg (line-beginning-position))
-             (end (line-end-position))
+             (beg (pos-bol))
+             (end (pos-eol))
              (fill-prefix (make-string (- pos beg) ?\s))
              ;; `fill-column' is too small to accommodate the current line
              (fill-column (- end beg 10)))
@@ -68,8 +68,8 @@
       (goto-char (point-min))
       (search-forward "b")
       (let* ((pos (point))
-             (beg (line-beginning-position))
-             (end (line-end-position))
+             (beg (pos-bol))
+             (end (pos-eol))
              (fill-prefix (make-string (- pos beg) ?\s))
              ;; `fill-column' is too small to accommodate the current line
              (fill-column (- end beg 10)))
index 8361d58b558fe3a830626556adc2965cac87dcf8..55e37b71d804e780fe4a7116e8614c4b796a9553 100644 (file)
                                     (string-to-number line-limit1))))
                 (goto-char (point-min))
                 (if (> limit-number 0)
-                    (should (= search-limit (line-beginning-position
-                                             (1+ limit-number))))
+                    (should (= search-limit (pos-bol (1+ limit-number))))
                   (should (= search-limit (point-max))))
                 (goto-char (point-max))
                 (if (< limit-number 0)
-                    (should (= start (line-beginning-position
-                                      (1+ limit-number))))
+                    (should (= start (pos-bol (1+ limit-number))))
                   (should (= start (point-min)))))
               (if (equal start1 "")
                   (should (equal ts-start time-stamp-start))
index 2f25de4cc39b1e2ed838f87221b36eff1e806ceb..57143dd81e5c98477ab8e7bdd9e494cacac547a1 100644 (file)
     (save-excursion
       (goto-char (point-max))
       (skip-chars-backward "\n")
-      (buffer-substring (line-beginning-position) (point)))))
+      (buffer-substring (pos-bol) (point)))))
 
 (ert-deftest lread-tests--unescaped-char-literals ()
   "Check that loading warns about unescaped character
index db8a5044783790aeb3e9bb8a0058e8a7c3475a64..6e1e148332c0bd3466fc27796c2a2a3cfc03b1a9 100644 (file)
@@ -160,8 +160,7 @@ process to complete."
                         (setq count (1+ count))))))))
       (set-process-query-on-exit-flag proc nil)
       (send-string proc "one\n")
-      (while (not (equal (buffer-substring
-                          (line-beginning-position) (point-max))
+      (while (not (equal (buffer-substring (pos-bol) (point-max))
                          "1> "))
         (accept-process-output proc))   ; Read "one".
       (should (equal (buffer-string) "0> one\n1> "))
@@ -171,8 +170,7 @@ process to complete."
        (accept-process-output proc 1))  ; Can't read "two" yet.
       (should (equal (buffer-string) "0> one\n1> "))
       (set-process-filter proc nil)     ; Resume reading from proc.
-      (while (not (equal (buffer-substring
-                          (line-beginning-position) (point-max))
+      (while (not (equal (buffer-substring (pos-bol) (point-max))
                          "2> "))
         (accept-process-output proc))   ; Read "Two".
       (should (equal (buffer-string) "0> one\n1> two\n2> "))))))
index c84ed74f0b1ec2197fd96ac83528a8064b3554da..cb0822fb1b968263600e9dff55a41977867bd098 100644 (file)
@@ -460,11 +460,10 @@ Demonstrates bug 25599."
                  (delete-overlay ov))))))
       (save-excursion
         (goto-char (point-min))
-        (let ((ov (make-overlay (line-beginning-position 2)
-                                (line-end-position 2))))
+        (let ((ov (make-overlay (pos-bol 2) (pos-eol 2))))
           (overlay-put ov 'insert-in-front-hooks
                        (list overlay-modified)))))
-    (kill-region (point-min) (line-beginning-position 2))
+    (kill-region (point-min) (pos-bol 2))
     (undo-boundary)
     (undo)))