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

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

[elpa] master 0a4ad42 047/399: ivy-test.el (counsel--grep-regex): Add te


From: Oleh Krehel
Subject: [elpa] master 0a4ad42 047/399: ivy-test.el (counsel--grep-regex): Add test for negative lookahead
Date: Sat, 20 Jul 2019 14:56:46 -0400 (EDT)

branch: master
commit 0a4ad4219b59e2b63dc914bf1dc23a81d2635b18
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    ivy-test.el (counsel--grep-regex): Add test for negative lookahead
    
    Re #1935
---
 ivy-test.el | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/ivy-test.el b/ivy-test.el
index 12c1077..2098194 100644
--- a/ivy-test.el
+++ b/ivy-test.el
@@ -344,7 +344,10 @@ will bring the behavior in line with the newer Emacsen."
                  "bar.*baz"))
   (should (equal (counsel--elisp-to-pcre
                   '(("foo\\|bar" . t) ("blah\\|bloop") ("blick" . t) 
("\\(baz\\)\\|quux" . t)))
-                 "(?:foo|bar).*blick.*(?:(baz)|quux)")))
+                 "(?:foo|bar).*blick.*(?:(baz)|quux)"))
+  (should (equal (counsel--elisp-to-pcre
+                  '(("ivy" . t) ("-")) t)
+                 "(?=.*ivy)(?!.*-)")))
 
 (defmacro ivy--string-buffer (text &rest body)
   "Test helper that wraps TEXT in a temp buffer while running BODY."
@@ -979,6 +982,15 @@ a buffer visiting a file."
         (should (equal out expected))
         (should (equal match-data-orig (match-data)))))))
 
+(ert-deftest counsel--grep-regex ()
+  ;; negative lookahead: lines with "ivy", without "-"
+  (should
+   (string=
+    (let ((counsel--regex-look-around t)
+          (ivy--regex-function 'ivy--regex-plus))
+      (counsel--grep-regex "ivy ! -"))
+    "(?=.*ivy)(?!.*-)")))
+
 (provide 'ivy-test)
 
 ;;; ivy-test.el ends here



reply via email to

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