Function: projectile--test-name-for-impl-name

projectile--test-name-for-impl-name is a byte-compiled function defined in projectile.el.

Signature

(projectile--test-name-for-impl-name IMPL-FILE-PATH)

Documentation

Determine the name of the test file for IMPL-FILE-PATH.

IMPL-FILE-PATH may be an absolute path, relative path or a file name.

Source Code

;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(defun projectile--test-name-for-impl-name (impl-file-path)
  "Determine the name of the test file for IMPL-FILE-PATH.

IMPL-FILE-PATH may be an absolute path, relative path or a file name."
  (let* ((project-type (projectile-project-type))
         (impl-file-name (file-name-sans-extension (file-name-nondirectory impl-file-path)))
         (impl-file-ext (file-name-extension impl-file-path))
         (test-prefix (funcall projectile-test-prefix-function project-type))
         (test-suffix (funcall projectile-test-suffix-function project-type))
         ;; A test usually carries the implementation's extension; a type
         ;; that says otherwise (Elixir's scripts) is taken at its word.
         (test-file-ext (or (projectile-test-extension project-type)
                            impl-file-ext)))
    (cond
     (test-prefix (concat test-prefix impl-file-name "." test-file-ext))
     (test-suffix (concat impl-file-name test-suffix "." test-file-ext))
     (t (user-error "Cannot determine a test file name, one of \"test-suffix\" or \"test-prefix\" must be set for project type `%s'" project-type)))))