emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 7e73580 171/399: ivy-test.el (counsel-find-file-with-dolla


From: Oleh Krehel
Subject: [elpa] master 7e73580 171/399: ivy-test.el (counsel-find-file-with-dollars): Add test
Date: Sat, 20 Jul 2019 14:57:17 -0400 (EDT)

branch: master
commit 7e735808e966d70340b5a2cef0430f913151d9b6
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    ivy-test.el (counsel-find-file-with-dollars): Add test
    
    Re #2012
---
 ivy-test.el | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/ivy-test.el b/ivy-test.el
index fa03907..20daa9d 100644
--- a/ivy-test.el
+++ b/ivy-test.el
@@ -48,13 +48,17 @@
 
 (global-set-key (kbd "C-c e") 'ivy-eval)
 
-(defun ivy-with (expr keys)
+(cl-defun ivy-with (expr keys &key dir)
   "Evaluate EXPR followed by KEYS."
   (let ((ivy-expr expr)
         (inhibit-message t))
-    (execute-kbd-macro
-     (vconcat (kbd "C-c e")
-              (kbd keys)))
+    (save-window-excursion
+      ;; `execute-kbd-macro' doesn't pick up `default-directory'
+      (when dir
+        (dired (expand-file-name dir (counsel-locate-git-root))))
+      (execute-kbd-macro
+       (vconcat (kbd "C-c e")
+                (kbd keys))))
     ivy-result))
 
 (defun command-execute-setting-this-command (cmd &rest args)
@@ -1071,6 +1075,16 @@ a buffer visiting a file."
                                "C-p C-m")
                      ""))))
 
+(unless (file-exists-p "test")
+  (shell-command "git clone -b test --single-branch 
https://github.com/abo-abo/swiper/ test"))
+
+(ert-deftest counsel-find-file-with-dollars ()
+  (should (string=
+           (file-relative-name
+            (ivy-with '(counsel-find-file) "fo C-m"
+                      :dir "test/find-file/files-with-dollar/"))
+           "test/find-file/files-with-dollar/foo$")))
+
 (provide 'ivy-test)
 
 ;;; ivy-test.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]