aboutsummaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2026-02-14Replace cl-lib sequence functions with seq.el equivalentsBozhidar Batsov
Migrate cl-remove-if-not → seq-filter, cl-remove-if → seq-remove, cl-some → seq-some, cl-every → seq-every-p, cl-find-if → seq-find, cl-mapcan → mapcan, cl-union → seq-union, cl-sort → seq-sort, cl-case → pcase, and delete projectile-difference in favor of seq-difference. Manual replacements for cl-notany, cl-typep, cl-incf, cl-remove, and cl-subst. cl-lib is still required for cl-defun, cl-defmethod, cl-loop, cl-letf, and cl-flet*.
2026-02-14Fix projectile-root-top-down to search top-down, not bottom-up (#1729)Bozhidar Batsov
projectile-root-top-down used projectile-locate-dominating-file which stops at the first (bottommost) match going up the directory tree. This made it behave identically to projectile-root-bottom-up. Add projectile-locate-dominating-file-top-down which walks the entire directory hierarchy and returns the topmost match. For example, with nested Makefiles at both project/ and project/subdir/, searching from project/subdir/ now correctly returns project/ instead of project/subdir/.
2026-02-14Include intermediate directories in projectile-find-dir (#1596)Bozhidar Batsov
projectile-project-dirs previously only returned directories that directly contain files, missing intermediate directories that contain only subdirectories (e.g. src/ when it only has src/ComponentA/). Fix by walking each file path's ancestor directories up to the project root, so all intermediate directories are included.
2026-02-13Minor cleanup of the #1897 fixBozhidar Batsov
- Use cl-remove-if instead of seq-remove for consistency with the rest of the codebase. - Remove unnecessary project/.git/ from test fixture (git init creates it). - Remove unnecessary projectile-indexing-method binding in test.
2026-02-13Filter deleted-but-unstaged files from git ls-files output (#1897)Bozhidar Batsov
When fd is unavailable or disabled, `git ls-files -zco --exclude-standard` returns files still tracked in the index even if deleted from disk. This causes projectile-dir-files-alien to list ghost files. Fix by running `git ls-files -zd` and removing those entries from the result.
2026-02-13Skip unreadable directories in projectile-index-directory (#1873)Bozhidar Batsov
Wrap the directory-files call in ignore-errors so that unreadable directories (e.g. .Spotlight-V100 on macOS) are silently skipped instead of aborting the entire native indexing operation.
2026-02-13Strip "./" prefix from fd output in projectile-files-via-ext-commandBozhidar Batsov
Newer fd versions (8.3.0+) prepend "./" to output. The --strip-cwd-prefix flag was already added to projectile-generic-command and projectile-git-fd-args, but this flag doesn't exist in older fd versions, causing errors. Add post-processing in projectile-files-via-ext-command to strip the "./" prefix from results as a defensive fallback, matching the existing pattern in projectile-files-from-cmd. Fixes #1749
2026-02-13Prevent directories from matching file-type project root markersBozhidar Batsov
On case-insensitive filesystems (macOS default), a ~/workspace directory matches the "WORKSPACE" Bazel marker because file-exists-p returns t for both files and directories. This causes the home directory to be falsely detected as a Bazel project root, leading to severe performance issues. Add a (not (file-directory-p ...)) guard in projectile-root-top-down so that only regular files can satisfy file-type marker checks. Fixes #1961
2026-01-09Add projectile-cache-file to projectile-globally-ignored-files default (#1966)take
- Include projectile-cache-file in projectile-globally-ignored-files default - Add :safe predicate to allow dir-locals configuration - Add tests for default values and :safe predicate validation - Update related file and test matching functions to use let* variants - Improve variable binding consistency and future compatibility
2026-01-09Bump the copyright yearsBozhidar Batsov
2026-01-07[Fix #1962] Fix finding other file when candidate is a root fileTroy Figiel
2025-02-03Make the cache transient by defaultBozhidar Batsov
2025-01-31Speed-up load time by moving known projects initializationBozhidar Batsov
It's now done outside of `projectile-mode`'s init, which should make Projectile load faster. * As a side effect the known projects will be initialized properly even if you're not using `projectile-mode`. * The projects are read from disk the first time you invoke `projectile-switch-project` or a similar command. * We no longer do auto-cleanup of known projects when projectile-mode starts. I'll think about how to handle this in an efficient manner.
2025-01-30Fix broken tests, take 2Bozhidar Batsov
2025-01-30Fix a couple of broken testsBozhidar Batsov
2025-01-11Bump the copyright yearsBozhidar Batsov
2024-11-02Add Zig project discovery (#1918)stephan-cr
2024-11-01Fix dotnet sln project typeDamien Cassou
The presence of an "src/" directory doesn't say anything about the type of the project. This commit fixes the dotnet sln project type to rely on the presence of an .sln file instead of the "src/" directory.
2024-10-22Revert "Add #'projectile-track-known-projects-find-file-hook to ↵Mark Stuart
'buffer-list-update-hook" This reverts commit 3c92d28c056c3553f83a513a35502b4547d29319.
2024-08-24Add #'projectile-track-known-projects-find-file-hook to 'buffer-list-update-hookJules Tamagnan
2024-08-14Fix tests to not modify top level .dir-locals.el fileJules Tamagnan
2024-02-11Bump the copyright yearsBozhidar Batsov
2024-01-23Add new custom variable 'projectile-cmd-hist-ignoredups'Laurence Warne
Add new custom variable 'projectile-cmd-hist-ignoredups', which can be used to tweak how duplicates are dealt with in projectile's command history. The custom variable is identical in behaviour to 'eshell-hist-ignoredups'. Specifically, the existing default behavior is maintained with the value of t, which means consecutive duplicates are ignored. A value of 'erase means only the last duplicate is kept, whilst a value of nil means all duplicates are kept.
2023-03-16Detect Julia projects (#1833)Eric Berquist
2023-02-28Bump the copyright yearsBozhidar Batsov
2023-01-13Make the tests work reliably with native compilation enabledBozhidar Batsov
I am the maintainer of projectile for debian. (Aymeric Agon-Rambosson) As part of the building process of our packages, we run the tests provided by the upstream maintainers in a clean and empty environment (no writable $HOME, no internet access, etc...). For this reason, we sometimes uncover bugs that would remain masked on the machines of the upstream maintainers, and of the users. The test "projectile-parse-dirconfig-file" can break in a very specific setting : Since version 28.1, emacs has been shipped with native-compilation, that is the possibility to compile elisp to native instructions using libgccjit. Since elisp allows the advising of functions implemented in C ("primitives"), it is necessary to compile trampolines to replace those functions if we want to advise them, in order to allow an arbitrary user-defined function to be run instead. The test library you use, buttercup, and more specifically its function spy-on, advises functions routinely. In the test we're interested in, buttercup (spy-on) changes the definition of a few primitives in the offending test (projectile-parse-dirconfig-file), namely file-exists-p, file-truename and insert-file-contents. The first one is advised so as to always return t, regardless of whether the file is really present or not. The first two are advised without error. The last one, however, can fail because, being a primitive, a trampoline needs to be compiled. We have the following backtrace in our build environment : comp-subr-trampoline-install(insert-file-contents) comp-trampoline-search(insert-file-contents) native-elisp-load("/tmp/buttercupKuLmvD/28.2-4001e2a9/subr--trampoline-696... error: (native-lisp-load-failed "file does not exists" "/tmp/buttercupKuLmvD/28.2-4001e2a9/subr--trampoline-696e736572742d66696c652d636f6e74656e7473_insert_file_contents_0.eln") What happens here is the following : if we are in a situation where the trampoline corresponding to the function insert-file-contents is not already present in some eln-cache directory on the machine, then the function comp-trampoline-search should return nil, which would trigger the compilation of said trampoline. However, since comp-trampoline-search relies on file-exists-p, and this last one has been advised so as to always answer yes, comp-trampoline-search tries to load a file that does not exists, hence our error. You or your users probably never reach that state, probably because you can always count on the trampoline being present beforehand. But if it is not there, you should be able to reproduce. We always reach that state because we run the tests in a clean environment, where the trampoline is never present. This error can be expected whenever a primitive is advised (in our case insert-file-contents) while file-exists-p is already advised so as to always return t, and the trampoline corresponding to the primitive does not already exists on the file system. There are two possible solutions : the first one is to try and ensure the trampoline is present by the time of the advice, for instance by compiling it unconditionally before the test. This is not entirely reliable, as some environments could inhibit the saving of this trampoline to the file system (this is what we do, for instance). The second one is to exclude the function insert-file-contents (and indeed, any primitive you would want to advise while file-exists-p is advised as to always return t) from trampoline optimisation completely. The variable native-comp-never-optimize-functions can be used to do just that. This patch tweaks it accordingly.
2022-11-18Allow multiple project-files per type and wildcards in project-filestoshokan
2022-11-05Update projectile-root-bottom-up testsGreg Pfeil
They should return the bottommost directory that contains a matching file, not the bottommost directory for the first file matched. Incidentally, reordered the files created for the test, so it’s easier to follow the hierarchy. This also necessitated changing `projectile-test-with-files` so that attempting to create a file before creating the directory that contains it didn’t fail.
2022-10-31Allow passing a directory argument deep down the stack (#1806)fanshi1028
This address potential issues with project root discovery - e.g. before this change projectile-project-type could return the wrong project type when called with a dir argument, as this was not propagated properly.
2022-10-30Add helpers for dir-local-variables for 3rd party use (#1737)813gan
Functions `projectile-add-dir-local-variable` and `projectile-delete-dir-local-variable` wraps their built-in counterparts. They always use `.dir-locals.el` from root of projectile project.
2022-10-28Revert "[Fix #1804] Make it possible to ignore special project buffers"Bozhidar Batsov
This reverts commit f5a2a3ab268b905c796de255e04790e6e69a61ab. This out we already had this functionality under the name `projectile-globally-ignored-buffers`.
2022-10-27[Fix #1804] Make it possible to ignore special project buffersMiles Liu
2022-10-04Make all project type attributes locally overridableLaurence Warne
Add local overrides for the project type attributes test-prefix, test-suffix, related-files-fn, src-dir and test-dir. Add tests for this new behaviour.
2022-07-19Bump the copyright yearsBozhidar Batsov
2022-06-26[Fix #1755] Cache failure to find project root (#1779)Edmund Jorgensen
When `projectile-project-root` was unable to find a project root for a directory, it would not cache the negative result, so future invocations would repeat the (often expensive) search for a project root every time. With this change, `projectile-project-root` caches failure to find a project root, when that failure is expected to be permanent, and consults that cache for speed on subsequent invocations. "Expected to be permanent" means that either we're trying to find the project root of a local directory, or we're successfully connected to a remote directory via TRAMP. If the directory isn't local, but we can't connect to it, we consider that a transient failure and don't cache it. Under the hood, this change uses the same `projectile-project-root-cache` that's used to cache successful attempts to find a project root, but with a new key `projectilerootless-{dir}`. This should allow cache invalidation to work as expected.
2022-06-13Fix several typos and spelling errorsJon Dufresne
Discovered using codespell: https://github.com/codespell-project/codespell
2022-05-22Don't add duplicate commands to command historylWarne
2022-04-19[Fix #1765] Re-add defaults for src-dir and test-dirlWarne
Use "src/" and "test/" as defaults for the src-dir and test-dir attributes of a project type when toggling between implementation and test files. Improve error messages for implementation and test file toggling
2022-02-11Allow changing of project type precendencelWarne
Allow changing of project type precendence in projectile-update-project-type.
2022-02-11Allow nil values in update-project-typelWarne
2021-12-20Fix testslWarne
2021-09-30[Fix #1709] Fix `projectile-project-buffer-p` contain current buffer (#1713)Kijima Daigo
If `projectile-project-buffer-p` is executed in a non-current project, `default-directory` return current directory. Since `projectile-project-buffers` contains current buffer, kill current buffer.
2021-09-05[Fix #1703] Improve projectile-generic-command default (#1706)Victor Makarov
* Use fd/fdfind when available * Strip leading ./ from paths produced by find
2021-08-11Update my e-mailBozhidar Batsov
2021-06-29Add opt params to projectile-run-(async)-shell-cmd (#1675)Laura Viglioni
2021-06-23Add tests for src-dir as a function logiclWarne
Add tests for projectile--test-name-for-impl-name, projectile--impl-file-from-src-dir-fn and add test for projectile--find-matching-file to check precedence logic is as expected.
2021-06-20Add tests for added and modified functions.lWarne
Adds tests for projectile-find-implementation-or-test, projectile--test-file-override, projectile--complementary-file and projectile--impl-to-test-dir.
2021-05-24Add new command `projectile-reset-known-projects`ClarityStorm
2021-05-03Add tests for added functions.lWarne
Add tests for projectile-update-project-types which verify that it updates existing projects. Add tests for projectile--combine-lists which test its overriding logic and that it ignores nil values in secondary plists.
2021-01-25Add some comments to the test suiteBozhidar Batsov