Function: bazel-test-at-point
bazel-test-at-point is an interactive and natively compiled function
defined in bazel.el.
Signature
(bazel-test-at-point)
Documentation
Run the test case at point.
Key Bindings
This command is not in any keymaps.
Source Code
;; Defined in /nix/store/ws8pkszjvcad1rgzqw6wja7qxacylfhn-emacs-packages-deps/share/emacs/site-lisp/elpa/bazel-20261002.1510/bazel.el
(defun bazel-test-at-point ()
"Run the test case at point."
(declare (ftype (function () null))
(interactive-only t))
(interactive)
(let* ((source-file (or buffer-file-name
(user-error "Buffer doesn’t visit a file")))
(root (or (bazel--repository-root source-file)
(user-error "File is not in a Bazel repository")))
(directory (or (bazel--package-directory source-file root)
(user-error "File is not in a Bazel package")))
(package (or (bazel--package-name directory root)
(user-error "File is not in a Bazel package")))
(build-file (or (bazel--locate-build-file directory)
(user-error "No BUILD file found")))
(relative-file (file-relative-name source-file directory))
(case-fold-file (file-name-case-insensitive-p source-file))
(target (or (bazel--consuming-target build-file relative-file
case-fold-file :only-tests)
(user-error "No rule target for file %s found"
relative-file)))
(name
(or (run-hook-with-args-until-success 'bazel-test-at-point-functions)
(user-error "Point is not on a test case"))))
(bazel--compile "test" (concat "--test_filter=" name) "--"
(bazel--canonical nil package target)))
nil)