diff options
| author | Greg Pfeil <greg@technomadic.org> | 2022-11-05 01:24:56 -0600 |
|---|---|---|
| committer | Bozhidar Batsov <bozhidar@batsov.dev> | 2022-11-05 17:41:13 +0100 |
| commit | 3231795e924557111fb2867c707c81114a155653 (patch) | |
| tree | 5758358e9dfb95e8c4b5ba5b915a768f8fb83adc /test | |
| parent | 004e202a6af3f452e1ef6539420dc0775f603290 (diff) | |
Update projectile-root-bottom-up tests
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.
Diffstat (limited to 'test')
| -rw-r--r-- | test/projectile-test.el | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/test/projectile-test.el b/test/projectile-test.el index 55d5774..de89580 100644 --- a/test/projectile-test.el +++ b/test/projectile-test.el @@ -63,7 +63,10 @@ You'd normally combine this with `projectile-test-with-sandbox'." ,@(mapcar (lambda (file) (if (string-suffix-p "/" file) `(make-directory ,file t) - `(with-temp-file ,file))) + `(let ((dir (file-name-directory ,file))) + (when dir + (make-directory dir t)) + (with-temp-file ,file)))) files) ,@body)) @@ -615,26 +618,35 @@ Just delegates OPERATION and ARGS for all operations except for`shell-command`'. (it "identifies the root directory of a project by bottom-up search" (projectile-test-with-sandbox (projectile-test-with-files - ("projectA/.svn/" + ("projectA/.git/" + "projectA/.projectile" + "projectA/.svn/" "projectA/src/.svn/" - "projectA/src/html/.svn/" - "projectA/.git/" - "projectA/src/html/" - "projectA/src/framework/lib/" "projectA/src/framework/framework.conf" - "projectA/src/html/index.html" - "projectA/.projectile") + "projectA/src/framework/lib/" + "projectA/src/html/" + "projectA/src/html/.svn/" + "projectA/src/html/index.html") (expect (projectile-root-bottom-up "projectA/src/framework/lib" '(".git" ".svn")) :to-equal + (expand-file-name "projectA/src/")) + (expect (projectile-root-bottom-up "projectA/src/framework/lib" '(".git")) + :to-equal (expand-file-name "projectA/")) (expect (projectile-root-bottom-up "projectA/src/html" '(".git" ".svn")) :to-equal - (expand-file-name "projectA/")) + (expand-file-name "projectA/src/html/")) (expect (projectile-root-bottom-up "projectA/src/html" '(".svn" ".git")) :to-equal (expand-file-name "projectA/src/html/")) (expect (projectile-root-bottom-up "projectA/src/html" '(".projectile" "index.html")) :to-equal + (expand-file-name "projectA/src/html/")) + (expect (projectile-root-bottom-up "projectA/src/html" '("index.html" ".projectile")) + :to-equal + (expand-file-name "projectA/src/html/")) + (expect (projectile-root-bottom-up "projectA/src/html" '(".projectile")) + :to-equal (expand-file-name "projectA/")))))) (describe "projectile-project-root" |
