Function: go-test--get-current-data

go-test--get-current-data is a natively compiled function defined in gotest.el.

Signature

(go-test--get-current-data PREFIX)

Documentation

Return the current data: test, example or benchmark.

PREFIX defines token to place cursor.

Source Code

;; Defined in /nix/store/y8iliarhkh17m4iiwcy1hbi78r7b5489-emacs-packages-deps/share/emacs/site-lisp/elpa/gotest-20230221.945/gotest.el
(defun go-test--get-current-data (prefix)
  "Return the current data: test, example or benchmark.
`PREFIX' defines token to place cursor."
  (let ((start (point))
        name)
    (save-excursion
      (end-of-line)
      (unless (and
               (search-backward-regexp
                (s-concat "^[[:space:]]*func[[:space:]]*" prefix) nil t)
               (save-excursion (go-end-of-defun) (< start (point))))
        (error "Unable to find data"))
      (save-excursion
        (search-forward prefix)
        (setq name (thing-at-point 'symbol t))))
    name))