Function: projectile-test-at-point-rust-name

projectile-test-at-point-rust-name is a byte-compiled function defined in projectile.el.

Signature

(projectile-test-at-point-rust-name NODE)

Documentation

Return the test name for the Rust function_item NODE.

Return nil unless the function carries a #[test]\= (or
#[tokio::test]\=, and friends) attribute, since an ordinary function
isn't something cargo test\= would run.

Source Code

;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(defun projectile-test-at-point-rust-name (node)
  "Return the test name for the Rust `function_item' NODE.
Return nil unless the function carries a `#[test]\\=' (or
`#[tokio::test]\\=', and friends) attribute, since an ordinary function
isn\\='t something `cargo test\\=' would run."
  (when-let* ((name-node (treesit-node-child-by-field-name node "name"))
              (name (treesit-node-text name-node t)))
    ;; Attributes are siblings preceding the function item.
    (let ((sibling (treesit-node-prev-sibling node))
          (test nil))
      (while (and sibling
                  (equal (treesit-node-type sibling) "attribute_item"))
        (when (projectile--test-at-point-annotated-p
               (treesit-node-text sibling t) '("test"))
          (setq test t))
        (setq sibling (treesit-node-prev-sibling sibling)))
      (when test name))))