     (setq-local tags-file-name tags-file)
     (insert "\nerlang_test:fun")
     (erlang-complete-tag)
-    (should (looking-back "erlang_test:function"))
+    (should (looking-back "erlang_test:function" (point-at-bol)))
     (insert "\nfun")
     (erlang-complete-tag)
-    (should (looking-back "function"))
+    (should (looking-back "function" (point-at-bol)))
     (insert "\nerlang_")
     (erlang-complete-tag)
-    (should (looking-back "erlang_test:"))))
+    (should (looking-back "erlang_test:" (point-at-bol)))))
 
 
 (ert-deftest erlang-test-compile-options ()

;;; Commentary:

;; This library require GNU Emacs 25 or later.

;;; Code:


          (erlang-test-create-erlang-file erlang-file)
          (erlang-test-compile-tags erlang-file tags-file)
          (setq erlang-buffer (find-file-noselect erlang-file))
          (if (< emacs-major-version 26)
              (progn
                (with-current-buffer erlang-buffer
                  (setq-local tags-file-name tags-file))
                ;; Setting global tags-file-name is a workaround for
                ;; GNU Emacs bug#23164.
                (setq tags-file-name tags-file))
            (visit-tags-table tags-file t))
          (erlang-test-complete-at-point tags-file)
          (erlang-test-completion-table)
          (erlang-test-xref-find-definitions erlang-file erlang-buffer))
