* ivy-test.el (ivy--regex-fuzzy): Update test.
Re #207
(ert-deftest ivy--regex-fuzzy ()
(should (string= (ivy--regex-fuzzy "tmux")
- "t.*m.*u.*x"))
+ "\\(t\\).*\\(m\\).*\\(u\\).*\\(x\\)"))
(should (string= (ivy--regex-fuzzy "^tmux")
- "^t.*m.*u.*x"))
+ "^\\(t\\).*\\(m\\).*\\(u\\).*\\(x\\)"))
(should (string= (ivy--regex-fuzzy "^tmux$")
- "^t.*m.*u.*x$"))
+ "^\\(t\\).*\\(m\\).*\\(u\\).*\\(x\\)$"))
(should (string= (ivy--regex-fuzzy "")
""))
(should (string= (ivy--regex-fuzzy "^")
'("the" "The")))
(should (equal (ivy--filter "The" '("foo" "the" "The"))
'("The"))))
-
"Build a regex sequence from STR.
Insert .* between each char."
(if (string-match "\\`\\(\\^?\\)\\(.*?\\)\\(\\$?\\)\\'" str)
- (concat (match-string 1 str)
- (mapconcat #'string (string-to-list (match-string 2 str)) ".*")
- (match-string 3 str))
+ (prog1
+ (concat (match-string 1 str)
+ (mapconcat
+ (lambda (x)
+ (format "\\(%c\\)" x))
+ (string-to-list (match-string 2 str)) ".*")
+ (match-string 3 str))
+ (setq ivy--subexps (length (match-string 2 str))))
str))
;;** Rest