[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/urgrep 814ad5c60d 038/115: Update tests to work on MS W
From: |
ELPA Syncer |
Subject: |
[elpa] externals/urgrep 814ad5c60d 038/115: Update tests to work on MS Windows |
Date: |
Wed, 10 May 2023 03:00:41 -0400 (EDT) |
branch: externals/urgrep
commit 814ad5c60dd6e72c897248a4c9a227c6edd45857
Author: Jim Porter <jporterbugs@gmail.com>
Commit: Jim Porter <jporterbugs@gmail.com>
Update tests to work on MS Windows
---
urgrep-tests.el | 404 +++++++++++++++++++++++++++++++++-----------------------
1 file changed, 240 insertions(+), 164 deletions(-)
diff --git a/urgrep-tests.el b/urgrep-tests.el
index 97c570ca5d..6b3f711a77 100644
--- a/urgrep-tests.el
+++ b/urgrep-tests.el
@@ -43,192 +43,264 @@
(should (equal (urgrep--wildcards-to-regexp '("*.[ab]cpp" "*.[ab]c") 'pcre)
"^[^\\000]*\\.([ab]cpp|[ab]c)$")))
+(defun urgrep-test--check-command (command expected-arguments)
+ (should (string= command (mapconcat #'urgrep--maybe-shell-quote-argument
+ expected-arguments " "))))
+
(ert-deftest urgrep-tests-command-ripgrep ()
(let ((tool (assoc "ripgrep" urgrep-tools))
- (common-args (concat "rg --color always --colors path\\:fg\\:magenta "
- "--colors match\\:fg\\:red "
- "--colors match\\:style\\:bold ")))
+ (common-args '("rg" "--color" "always" "--colors" "path:fg:magenta"
+ "--colors" "match:fg:red" "--colors"
+ "match:style:bold")))
;; String/case
- (should (equal (urgrep-command "foo" :tool tool)
- (concat common-args "--heading -i -F -- foo")))
- (should (equal (urgrep-command "Foo" :tool tool)
- (concat common-args "--heading -F -- Foo")))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool)
+ (append common-args '("--heading" "-i" "-F" "--" "foo")))
+ (urgrep-test--check-command
+ (urgrep-command "Foo" :tool tool)
+ (append common-args '("--heading" "-F" "--" "Foo")))
(let ((case-fold-search nil))
- (should (equal (urgrep-command "foo" :tool tool)
- (concat common-args "--heading -F -- foo"))))
- (should (equal (urgrep-command "foo" :tool tool :case-fold t)
- (concat common-args "--heading -i -F -- foo")))
- (should (equal (urgrep-command "foo" :tool tool :case-fold nil)
- (concat common-args "--heading -F -- foo")))
- (should (equal (urgrep-command "foo" :tool tool :case-fold 'smart)
- (concat common-args "--heading -i -F -- foo")))
- (should (equal (urgrep-command "Foo" :tool tool :case-fold 'smart)
- (concat common-args "--heading -F -- Foo")))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool)
+ (append common-args '("--heading" "-F" "--" "foo"))))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool :case-fold t)
+ (append common-args '("--heading" "-i" "-F" "--" "foo")))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool :case-fold nil)
+ (append common-args '("--heading" "-F" "--" "foo")))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool :case-fold 'smart)
+ (append common-args '("--heading" "-i" "-F" "--" "foo")))
+ (urgrep-test--check-command
+ (urgrep-command "Foo" :tool tool :case-fold 'smart)
+ (append common-args '("--heading" "-F" "--" "Foo")))
;; Group
- (should (equal (urgrep-command "foo" :tool tool :group nil)
- (concat common-args "--no-heading -i -F -- foo")))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool :group nil)
+ (append common-args '("--no-heading" "-i" "-F" "--" "foo")))
;; Regexp
- (should (equal (urgrep-command "(foo)" :tool tool :regexp 'bre)
- (concat common-args "--heading -i -- \\\\\\(foo\\\\\\)")))
- (should (equal (urgrep-command "(foo)" :tool tool :regexp 'ere)
- (concat common-args "--heading -i -- \\(foo\\)")))
- (should (equal (urgrep-command "(foo)" :tool tool :regexp 'pcre)
- (concat common-args "--heading -i -- \\(foo\\)")))
+ (urgrep-test--check-command
+ (urgrep-command "(foo)" :tool tool :regexp t)
+ (append common-args '("--heading" "-i" "--" "\\(foo\\)")))
+ (urgrep-test--check-command
+ (urgrep-command "(foo)" :tool tool :regexp 'bre)
+ (append common-args '("--heading" "-i" "--" "\\(foo\\)")))
+ (urgrep-test--check-command
+ (urgrep-command "(foo)" :tool tool :regexp 'ere)
+ (append common-args '("--heading" "-i" "--" "(foo)")))
+ (urgrep-test--check-command
+ (urgrep-command "(foo)" :tool tool :regexp 'pcre)
+ (append common-args '("--heading" "-i" "--" "(foo)")))
;; Context
- (should (equal (urgrep-command "foo" :tool tool :context 3)
- (concat common-args "--heading -C3 -i -F -- foo")))
- (should (equal (urgrep-command "foo" :tool tool :context '(3 . 3))
- (concat common-args "--heading -C3 -i -F -- foo")))
- (should (equal (urgrep-command "foo" :tool tool :context '(2 . 4))
- (concat common-args "--heading -B2 -A4 -i -F -- foo")))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool :context 3)
+ (append common-args '("--heading" "-C3" "-i" "-F" "--" "foo")))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool :context '(3 . 3))
+ (append common-args '("--heading" "-C3" "-i" "-F" "--" "foo")))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool :context '(2 . 4))
+ (append common-args '("--heading" "-B2" "-A4" "-i" "-F" "--" "foo")))
;; File wildcard
- (should (equal (urgrep-command "foo" :tool tool :files "*.el")
- (concat common-args "-g \\*.el --heading -i -F -- foo")))
- (should (equal (urgrep-command "foo" :tool tool :files '("*.c" "*.h"))
- (concat common-args "-g \\*.c -g \\*.h --heading -i -F -- "
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool :files "*.el")
+ (append common-args '("-g" "*.el" "--heading" "-i" "-F" "--" "foo")))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool :files '("*.c" "*.h"))
+ (append common-args '("-g" "*.c" "-g" "*.h" "--heading" "-i" "-F" "--"
"foo")))))
(ert-deftest urgrep-tests-command-ag ()
(let ((tool (assoc "ag" urgrep-tools))
- (common-args "ag --color-path 35 --color-match 1\\;31 "))
+ (common-args '("ag" "--color-path" "35" "--color-match" "1;31")))
;; String/case
- (should (equal (urgrep-command "foo" :tool tool)
- (concat common-args "--group -i -Q -- foo")))
- (should (equal (urgrep-command "Foo" :tool tool)
- (concat common-args "--group -s -Q -- Foo")))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool)
+ (append common-args '("--group" "-i" "-Q" "--" "foo")))
+ (urgrep-test--check-command
+ (urgrep-command "Foo" :tool tool)
+ (append common-args '("--group" "-s" "-Q" "--" "Foo")))
(let ((case-fold-search nil))
- (should (equal (urgrep-command "foo" :tool tool)
- (concat common-args "--group -s -Q -- foo"))))
- (should (equal (urgrep-command "foo" :tool tool :case-fold t)
- (concat common-args "--group -i -Q -- foo")))
- (should (equal (urgrep-command "foo" :tool tool :case-fold nil)
- (concat common-args "--group -s -Q -- foo")))
- (should (equal (urgrep-command "foo" :tool tool :case-fold 'smart)
- (concat common-args "--group -i -Q -- foo")))
- (should (equal (urgrep-command "Foo" :tool tool :case-fold 'smart)
- (concat common-args "--group -s -Q -- Foo")))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool)
+ (append common-args '("--group" "-s" "-Q" "--" "foo"))))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool :case-fold t)
+ (append common-args '("--group" "-i" "-Q" "--" "foo")))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool :case-fold nil)
+ (append common-args '("--group" "-s" "-Q" "--" "foo")))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool :case-fold 'smart)
+ (append common-args '("--group" "-i" "-Q" "--" "foo")))
+ (urgrep-test--check-command
+ (urgrep-command "Foo" :tool tool :case-fold 'smart)
+ (append common-args '("--group" "-s" "-Q" "--" "Foo")))
;; Group
- (should (equal (urgrep-command "foo" :tool tool :group nil)
- (concat common-args "--nogroup -i -Q -- foo")))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool :group nil)
+ (append common-args '("--nogroup" "-i" "-Q" "--" "foo")))
;; Regexp
- (should (equal (urgrep-command "(foo)" :tool tool :regexp t)
- (concat common-args "--group -i -- \\\\\\(foo\\\\\\)")))
- (should (equal (urgrep-command "(foo)" :tool tool :regexp 'bre)
- (concat common-args "--group -i -- \\\\\\(foo\\\\\\)")))
- (should (equal (urgrep-command "(foo)" :tool tool :regexp 'ere)
- (concat common-args "--group -i -- \\(foo\\)")))
- (should (equal (urgrep-command "(foo)" :tool tool :regexp 'pcre)
- (concat common-args "--group -i -- \\(foo\\)")))
+ (urgrep-test--check-command
+ (urgrep-command "(foo)" :tool tool :regexp t)
+ (append common-args '("--group" "-i" "--" "\\(foo\\)")))
+ (urgrep-test--check-command
+ (urgrep-command "(foo)" :tool tool :regexp 'bre)
+ (append common-args '("--group" "-i" "--" "\\(foo\\)")))
+ (urgrep-test--check-command
+ (urgrep-command "(foo)" :tool tool :regexp 'ere)
+ (append common-args '("--group" "-i" "--" "(foo)")))
+ (urgrep-test--check-command
+ (urgrep-command "(foo)" :tool tool :regexp 'pcre)
+ (append common-args '("--group" "-i" "--" "(foo)")))
;; Context
- (should (equal (urgrep-command "foo" :tool tool :context 3)
- (concat common-args "--group -C3 -i -Q -- foo")))
- (should (equal (urgrep-command "foo" :tool tool :context '(3 . 3))
- (concat common-args "--group -C3 -i -Q -- foo")))
- (should (equal (urgrep-command "foo" :tool tool :context '(2 . 4))
- (concat common-args "--group -B2 -A4 -i -Q -- foo")))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool :context 3)
+ (append common-args '("--group" "-C3" "-i" "-Q" "--" "foo")))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool :context '(3 . 3))
+ (append common-args '("--group" "-C3" "-i" "-Q" "--" "foo")))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool :context '(2 . 4))
+ (append common-args '("--group" "-B2" "-A4" "-i" "-Q" "--" "foo")))
;; File wildcard
- (should (equal (urgrep-command "foo" :tool tool :files "*.el")
- (concat common-args "-G \\^\\[\\^\\\\000\\]\\*\\\\.el\\$ "
- "--group -i -Q -- foo")))
- (should (equal (urgrep-command "foo" :tool tool :files '("*.c" "*.h"))
- (concat common-args
- "-G \\^\\[\\^\\\\000\\]\\*\\\\.\\(c\\|h\\)\\$ "
- "--group -i -Q -- foo")))))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool :files "*.el")
+ (append common-args '("-G" "^[^\\000]*\\.el$" "--group" "-i" "-Q" "--"
+ "foo")))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool :files '("*.c" "*.h"))
+ (append common-args '("-G" "^[^\\000]*\\.(c|h)$" "--group" "-i" "-Q" "--"
+ "foo")))))
(ert-deftest urgrep-tests-command-ack ()
(let ((tool (assoc "ack" urgrep-tools))
- (common-args "ack --color-filename magenta --color-match bold\\ red "))
+ (common-args '("ack" "--color-filename" "magenta" "--color-match"
+ "bold red")))
;; String/case
- (should (equal (urgrep-command "foo" :tool tool)
- (concat common-args "--group -i -Q -- foo")))
- (should (equal (urgrep-command "Foo" :tool tool)
- (concat common-args "--group -Q -- Foo")))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool)
+ (append common-args '("--group" "-i" "-Q" "--" "foo")))
+ (urgrep-test--check-command
+ (urgrep-command "Foo" :tool tool)
+ (append common-args '("--group" "-Q" "--" "Foo")))
(let ((case-fold-search nil))
- (should (equal (urgrep-command "foo" :tool tool)
- (concat common-args "--group -Q -- foo"))))
- (should (equal (urgrep-command "foo" :tool tool :case-fold t)
- (concat common-args "--group -i -Q -- foo")))
- (should (equal (urgrep-command "foo" :tool tool :case-fold nil)
- (concat common-args "--group -Q -- foo")))
- (should (equal (urgrep-command "foo" :tool tool :case-fold 'smart)
- (concat common-args "--group -i -Q -- foo")))
- (should (equal (urgrep-command "Foo" :tool tool :case-fold 'smart)
- (concat common-args "--group -Q -- Foo")))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool)
+ (append common-args '("--group" "-Q" "--" "foo"))))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool :case-fold t)
+ (append common-args '("--group" "-i" "-Q" "--" "foo")))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool :case-fold nil)
+ (append common-args '("--group" "-Q" "--" "foo")))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool :case-fold 'smart)
+ (append common-args '("--group" "-i" "-Q" "--" "foo")))
+ (urgrep-test--check-command
+ (urgrep-command "Foo" :tool tool :case-fold 'smart)
+ (append common-args '("--group" "-Q" "--" "Foo")))
;; Group
- (should (equal (urgrep-command "foo" :tool tool :group nil)
- (concat common-args "--nogroup -i -Q -- foo")))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool :group nil)
+ (append common-args '("--nogroup" "-i" "-Q" "--" "foo")))
;; Regexp
- (should (equal (urgrep-command "(foo)" :tool tool :regexp t)
- (concat common-args "--group -i -- \\\\\\(foo\\\\\\)")))
- (should (equal (urgrep-command "(foo)" :tool tool :regexp 'bre)
- (concat common-args "--group -i -- \\\\\\(foo\\\\\\)")))
- (should (equal (urgrep-command "(foo)" :tool tool :regexp 'ere)
- (concat common-args "--group -i -- \\(foo\\)")))
- (should (equal (urgrep-command "(foo)" :tool tool :regexp 'pcre)
- (concat common-args "--group -i -- \\(foo\\)")))
+ (urgrep-test--check-command
+ (urgrep-command "(foo)" :tool tool :regexp t)
+ (append common-args '("--group" "-i" "--" "\\(foo\\)")))
+ (urgrep-test--check-command
+ (urgrep-command "(foo)" :tool tool :regexp 'bre)
+ (append common-args '("--group" "-i" "--" "\\(foo\\)")))
+ (urgrep-test--check-command
+ (urgrep-command "(foo)" :tool tool :regexp 'ere)
+ (append common-args '("--group" "-i" "--" "(foo)")))
+ (urgrep-test--check-command
+ (urgrep-command "(foo)" :tool tool :regexp 'pcre)
+ (append common-args '("--group" "-i" "--" "(foo)")))
;; Context
- (should (equal (urgrep-command "foo" :tool tool :context 3)
- (concat common-args "--group -C3 -i -Q -- foo")))
- (should (equal (urgrep-command "foo" :tool tool :context '(3 . 3))
- (concat common-args "--group -C3 -i -Q -- foo")))
- (should (equal (urgrep-command "foo" :tool tool :context '(2 . 4))
- (concat common-args "--group -B2 -A4 -i -Q -- foo")))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool :context 3)
+ (append common-args '("--group" "-C3" "-i" "-Q" "--" "foo")))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool :context '(3 . 3))
+ (append common-args '("--group" "-C3" "-i" "-Q" "--" "foo")))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool :context '(2 . 4))
+ (append common-args '("--group" "-B2" "-A4" "-i" "-Q" "--" "foo")))
;; File wildcard
- (should (equal (urgrep-command "foo" :tool tool :files "*.el")
- (concat common-args "-G \\^\\[\\^\\\\000\\]\\*\\\\.el\\$ "
- "--group -i -Q -- foo")))
- (should (equal (urgrep-command "foo" :tool tool :files '("*.c" "*.h"))
- (concat common-args
- "-G \\^\\[\\^\\\\000\\]\\*\\\\.\\(c\\|h\\)\\$ "
- "--group -i -Q -- foo")))))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool :files "*.el")
+ (append common-args '("-G" "^[^\\000]*\\.el$" "--group" "-i" "-Q" "--"
+ "foo")))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool :files '("*.c" "*.h"))
+ (append common-args '("-G" "^[^\\000]*\\.(c|h)$" "--group" "-i" "-Q" "--"
+ "foo")))))
(ert-deftest urgrep-tests-command-git-grep ()
(let ((tool (assoc "git-grep" urgrep-tools))
- (common-args (concat "git --no-pager -c color.grep.filename\\=magenta "
- "-c color.grep.match\\=bold\\ red grep --color -n
"
- "--recurse-submodules "))
- (group-args "--heading --break "))
+ (common-args '("git" "--no-pager" "-c" "color.grep.filename=magenta"
+ "-c" "color.grep.match=bold red" "grep" "--color" "-n"
+ "--recurse-submodules"))
+ (group-args '("--heading" "--break")))
;; String/case
- (should (equal (urgrep-command "foo" :tool tool)
- (concat common-args group-args "-i -F -e foo --")))
- (should (equal (urgrep-command "Foo" :tool tool)
- (concat common-args group-args "-F -e Foo --")))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool)
+ (append common-args group-args '("-i" "-F" "-e" "foo" "--")))
+ (urgrep-test--check-command
+ (urgrep-command "Foo" :tool tool)
+ (append common-args group-args '("-F" "-e" "Foo" "--")))
(let ((case-fold-search nil))
- (should (equal (urgrep-command "foo" :tool tool)
- (concat common-args group-args "-F -e foo --"))))
- (should (equal (urgrep-command "foo" :tool tool :case-fold t)
- (concat common-args group-args "-i -F -e foo --")))
- (should (equal (urgrep-command "foo" :tool tool :case-fold nil)
- (concat common-args group-args "-F -e foo --")))
- (should (equal (urgrep-command "foo" :tool tool :case-fold 'smart)
- (concat common-args group-args "-i -F -e foo --")))
- (should (equal (urgrep-command "Foo" :tool tool :case-fold 'smart)
- (concat common-args group-args "-F -e Foo --")))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool)
+ (append common-args group-args '("-F" "-e" "foo" "--"))))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool :case-fold t)
+ (append common-args group-args '("-i" "-F" "-e" "foo" "--")))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool :case-fold nil)
+ (append common-args group-args '("-F" "-e" "foo" "--")))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool :case-fold 'smart)
+ (append common-args group-args '("-i" "-F" "-e" "foo" "--")))
+ (urgrep-test--check-command
+ (urgrep-command "Foo" :tool tool :case-fold 'smart)
+ (append common-args group-args '("-F" "-e" "Foo" "--")))
;; Group
- (should (equal (urgrep-command "foo" :tool tool :group nil)
- (concat common-args "-i -F -e foo --")))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool :group nil)
+ (append common-args '("-i" "-F" "-e" "foo" "--")))
;; Regexp
- (should (equal (urgrep-command "(foo)" :tool tool :regexp t)
- (concat common-args group-args "-i -G -e \\(foo\\) --")))
- (should (equal (urgrep-command "(foo)" :tool tool :regexp 'bre)
- (concat common-args group-args "-i -G -e \\(foo\\) --")))
- (should (equal (urgrep-command "(foo)" :tool tool :regexp 'ere)
- (concat common-args group-args "-i -E -e \\(foo\\) --")))
- (should (equal (urgrep-command "(foo)" :tool tool :regexp 'pcre)
- (concat common-args group-args "-i -P -e \\(foo\\) --")))
+ (urgrep-test--check-command
+ (urgrep-command "(foo)" :tool tool :regexp t)
+ (append common-args group-args '("-i" "-G" "-e" "(foo)" "--")))
+ (urgrep-test--check-command
+ (urgrep-command "(foo)" :tool tool :regexp 'bre)
+ (append common-args group-args '("-i" "-G" "-e" "(foo)" "--")))
+ (urgrep-test--check-command
+ (urgrep-command "(foo)" :tool tool :regexp 'ere)
+ (append common-args group-args '("-i" "-E" "-e" "(foo)" "--")))
+ (urgrep-test--check-command
+ (urgrep-command "(foo)" :tool tool :regexp 'pcre)
+ (append common-args group-args '("-i" "-P" "-e" "(foo)" "--")))
;; Context
- (should (equal (urgrep-command "foo" :tool tool :context 3)
- (concat common-args group-args "-C3 -i -F -e foo --")))
- (should (equal (urgrep-command "foo" :tool tool :context '(3 . 3))
- (concat common-args group-args "-C3 -i -F -e foo --")))
- (should (equal (urgrep-command "foo" :tool tool :context '(2 . 4))
- (concat common-args group-args "-B2 -A4 -i -F -e foo --")))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool :context 3)
+ (append common-args group-args '("-C3" "-i" "-F" "-e" "foo" "--")))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool :context '(3 . 3))
+ (append common-args group-args '("-C3" "-i" "-F" "-e" "foo" "--")))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool :context '(2 . 4))
+ (append common-args group-args '("-B2" "-A4" "-i" "-F" "-e" "foo" "--")))
;; File wildcard
- (should (equal (urgrep-command "foo" :tool tool :files "*.el")
- (concat common-args group-args "-i -F -e foo -- \\*.el")))
- (should (equal (urgrep-command "foo" :tool tool :files '("*.c" "*.h"))
- (concat common-args group-args "-i -F -e foo -- \\*.c "
- "\\*.h")))))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool :files "*.el")
+ (append common-args group-args '("-i" "-F" "-e" "foo" "--" "*.el")))
+ (urgrep-test--check-command
+ (urgrep-command "foo" :tool tool :files '("*.c" "*.h"))
+ (append common-args group-args '("-i" "-F" "-e" "foo" "--" "*.c"
"*.h")))))
(ert-deftest urgrep-tests-command-grep ()
(let ((tool (assoc "grep" urgrep-tools)))
@@ -252,14 +324,15 @@
(should (string-match "^find \\. .*grep -F .*-i .*foo"
(urgrep-command "foo" :tool tool :group nil)))
;; Regexp
- (should (string-match "^find \\. .*grep -G .*-i .*\\\\(foo\\\\)"
- (urgrep-command "(foo)" :tool tool :regexp t)))
- (should (string-match "^find \\. .*grep -G .*-i .*\\\\(foo\\\\)"
- (urgrep-command "(foo)" :tool tool :regexp 'bre)))
- (should (string-match "^find \\. .*grep -E .*-i .*\\\\(foo\\\\)"
- (urgrep-command "(foo)" :tool tool :regexp 'ere)))
- (should (string-match "^find \\. .*grep -P .*-i .*\\\\(foo\\\\)"
- (urgrep-command "(foo)" :tool tool :regexp 'pcre)))
+ (let ((query (shell-quote-argument "(foo)")))
+ (should (string-match (concat "^find \\. .*grep -G .*-i .*" query)
+ (urgrep-command "(foo)" :tool tool :regexp t)))
+ (should (string-match (concat "^find \\. .*grep -G .*-i .*" query)
+ (urgrep-command "(foo)" :tool tool :regexp 'bre)))
+ (should (string-match (concat "^find \\. .*grep -E .*-i .*" query)
+ (urgrep-command "(foo)" :tool tool :regexp 'ere)))
+ (should (string-match (concat "^find \\. .*grep -P .*-i .*" query)
+ (urgrep-command "(foo)" :tool tool :regexp
'pcre))))
;; Context
(should (string-match "^find \\. .*grep -F -C3 .*-i .*foo"
(urgrep-command "foo" :tool tool :context 3)))
@@ -268,12 +341,15 @@
(should (string-match "^find \\. .*grep -F -B2 -A4 .*-i .*foo"
(urgrep-command "foo" :tool tool :context '(2 . 4))))
;; File wildcard
- (should (string-match "^find \\. .*-name \\\\\\*\\.el .*grep -F .*-i .*foo"
- (urgrep-command "foo" :tool tool :files "*.el")))
- (should (string-match (concat "^find \\. .*-name \\\\\\*\\.c -o "
- "-name \\\\\\*\\.h .*grep -F .*-i .*foo")
- (urgrep-command "foo" :tool tool
- :files '("*.c" "*.h"))))))
+ (let ((escape (lambda (i) (regexp-quote (shell-quote-argument i)))))
+ (should (string-match
+ (concat "^find \\. .*-name " (funcall escape "*.el")
+ " .*grep -F .*-i .*foo")
+ (urgrep-command "foo" :tool tool :files "*.el")))
+ (should (string-match
+ (concat "^find \\. .*-name " (funcall escape "*.c") " -o -name "
+ (funcall escape "*.h") " .*grep -F .*-i .*foo")
+ (urgrep-command "foo" :tool tool :files '("*.c" "*.h")))))))
(ert-deftest urgrep-tests-get-tool-default ()
(cl-letf (((symbol-function #'executable-find) #'always))
- [elpa] externals/urgrep 0687d9e867 073/115: Update copyright, (continued)
- [elpa] externals/urgrep 0687d9e867 073/115: Update copyright, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep ce07e97d37 088/115: Allow ANSI escapes for matches to end just after a newline, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep dbb2c2caeb 095/115: Wrap some docstring lines with "\", ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep 9949a5b296 094/115: Use connection-local variables for caching the tool to use for each host, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep 569c52f504 083/115: Allow overriding EMACS during tests, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep d479dc5ad6 104/115: Remove unnecessary/wrong Git grep color settings, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep d0012b9fcb 112/115: Tweak tests so they only work around Emacs bug#58265 on older versions, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep 392e4bcb98 008/115: Don't inherit from compilation-minor-mode to avoid its menu, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep c7a3cc5b30 015/115: Be less aggressive with shell-quoting on MS Windows, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep bfab29d1d7 014/115: Add support for searches starting with "-", ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep 814ad5c60d 038/115: Update tests to work on MS Windows,
ELPA Syncer <=
- [elpa] externals/urgrep 86c36492b9 064/115: Include a description of how to enable wgrep support in the README, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep 7453367e6d 065/115: Avoid false-positives when looking for context lines in results, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep 593d209a31 067/115: Search in untracked files with git grep, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep 1c08b41324 078/115: s/TRAMP/Tramp/g, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep 6df13a8dee 071/115: Add support for urgrep command in Eshell, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep 11e1f7474e 079/115: Add CI configuration, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep a7d87da8b5 096/115: Slight improvements to docstrings for defcustoms, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep 1172efb5a2 107/115: Don't allow using an unknown tool in `urgrep-command`, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep 7823d384e6 115/115: Add .elpaignore, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep e5d485de84 034/115: Improve behavior of `urgrep' to allow passing options and add `urgrep-run-command', ELPA Syncer, 2023/05/10