Function: projectile-related-files-fn-test-with-prefix

projectile-related-files-fn-test-with-prefix is an autoloaded and byte-compiled function defined in projectile.el.

Signature

(projectile-related-files-fn-test-with-prefix EXTENSION TEST-PREFIX)

Documentation

Generate a related-files-fn which relates tests and impl.

Use files with EXTENSION based on TEST-PREFIX.

Source Code

;; Defined in ~/.emacs.d/elpa/projectile-20260310.858/projectile.el
;;;###autoload
(defun projectile-related-files-fn-test-with-prefix(extension test-prefix)
  "Generate a related-files-fn which relates tests and impl.
Use files with EXTENSION based on TEST-PREFIX."
  (lambda (path)
    (when (equal (file-name-extension path) extension)
      (let* ((file-name (file-name-nondirectory path))
             (find-impl? (string-prefix-p test-prefix file-name))
             (file-name-to-find (if find-impl?
                                    (substring file-name (length test-prefix))
                                  (concat test-prefix file-name))))
        (list (if find-impl? :impl :test)
              (lambda (other-path)
                (and (string-suffix-p file-name-to-find other-path)
                     (equal (file-name-nondirectory other-path) file-name-to-find))))))))