Function: go-test--get-current-file-data
go-test--get-current-file-data is a natively compiled function defined
in gotest.el.
Signature
(go-test--get-current-file-data PREFIX)
Documentation
Generate regexp to match test, benchmark or example the current buffer.
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-file-data (prefix)
"Generate regexp to match test, benchmark or example the current buffer.
`PREFIX' defines token to place cursor."
(let ((buffer (go-test--get-current-buffer)))
(when buffer
(with-current-buffer buffer
(save-excursion
(goto-char (point-min))
(when (string-match "\.go$" buffer-file-name)
(let ((regex
(s-concat "^[[:space:]]*func[[:space:]]*\\(" prefix "[^(]+\\)"))
result)
(while
(re-search-forward regex nil t)
(let ((data (buffer-substring-no-properties
(match-beginning 1) (match-end 1))))
(setq result (append result (list data)))))
(mapconcat 'identity result "|"))))))))