diff options
| author | Jackson Ray Hamilton <jackson@jacksonrayhamilton.com> | 2019-01-12 13:41:30 -0800 |
|---|---|---|
| committer | Bozhidar Batsov <bozhidar.batsov@gmail.com> | 2019-01-16 18:40:16 +0200 |
| commit | f1ebb24556d651110da7b200fe9feaa0d9ca5e1e (patch) | |
| tree | 776630e781cb7bc52869411be62c3739c314650a /test | |
| parent | a16545058591bcc863d5a1c451f4c88ffa42e16a (diff) | |
Add tests for rgrep excludes
Diffstat (limited to 'test')
| -rw-r--r-- | test/projectile-test.el | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/test/projectile-test.el b/test/projectile-test.el index 0904ef8..2d92670 100644 --- a/test/projectile-test.el +++ b/test/projectile-test.el @@ -623,6 +623,60 @@ test temp directory" (expect (projectile-project-root) :to-equal correct-project-root)))))) (describe "projectile-grep" + (describe "rgrep" + (before-each + (spy-on 'compilation-start)) + (it "excludes global ignores" + (projectile-test-with-sandbox + (projectile-test-with-files + ("project/" + "project/.projectile") + (cd "project") + (with-current-buffer (find-file-noselect ".projectile" t) + (let ((grep-find-template "<X>") + (grep-find-ignored-directories '("IG_DIR")) + (grep-find-ignored-files '("IG_FILE")) + (projectile-globally-ignored-files '("GLOB_IG_FILE")) + (projectile-globally-ignored-file-suffixes '("IG_SUF")) + (projectile-globally-ignored-directories '("GLOB_IG_DIR"))) + (projectile-grep "hi"))) + (expect 'compilation-start :to-have-been-called-with + (concat "-type d \\( -path \\*/IG_DIR \\) -prune -o " + "\\! -type d \\( -name IG_FILE -o -name \\*IG_SUF \\) -prune -o " + "\\( -path ./GLOB_IG_DIR -o -path ./GLOB_IG_FILE \\) -prune -o ") + 'grep-mode)))) + (it "excludes project ignores" + (projectile-test-with-sandbox + (projectile-test-with-files + ("project/bar/" + "project/baz/") + (cd "project") + (with-temp-file ".projectile" (insert (concat "-/*.txt\n" + "-/bar/*.txt\n" + "-/baz\n" + "-*.txt\n" + "-*.text\n" + "!/abc.txt\n" + "!/bar/abc.txt\n" + "!def.txt\n"))) + (with-temp-file "foo.txt") + (with-temp-file "abc.txt") + (with-temp-file "bar/foo.txt") + (with-temp-file "bar/abc.txt") + (with-current-buffer (find-file-noselect ".projectile" t) + (let ((grep-find-template "<X>") + grep-find-ignored-directories grep-find-ignored-files + projectile-globally-ignored-files + projectile-globally-ignored-file-suffixes + projectile-globally-ignored-directories) + (projectile-grep "hi"))) + (expect 'compilation-start :to-have-been-called-with + (concat "\\( -path ./baz -o -path ./foo.txt -o -path ./bar/foo.txt \\) -prune -o " + "\\( " + "\\( -path \\*.txt -o -path \\*.text \\) " + "-a \\! \\( -path ./abc.txt -o -path ./bar/abc.txt -o -path \\*/def.txt \\) " + "\\) -prune -o ") + 'grep-mode))))) (it "grep a git project using default files" (require 'vc-git) (projectile-test-with-sandbox |
