Skip to content

Commit

Permalink
fixed ffip regression bug v4.9.1
Browse files Browse the repository at this point in the history
- more test cases for `M-x ffip'
  • Loading branch information
Chen Bin committed May 16, 2016
1 parent ef34ed0 commit 32e291c
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.org
@@ -1,4 +1,4 @@
* find-file-in-project (v4.9)
* find-file-in-project (v4.9.1)
Find files in a project quickly, on *any operating system*.

This program provides a couple methods for quickly finding any file in a given project. It depends on [[http://www.gnu.org/software/findutils/][GNU Find]].
Expand Down
5 changes: 3 additions & 2 deletions find-file-in-project.el
Expand Up @@ -3,7 +3,7 @@
;; Copyright (C) 2006-2009, 2011-2012, 2015
;; Phil Hagelberg, Doug Alcorn, and Will Farrington
;;
;; Version: 4.9
;; Version: 4.9.1
;; Author: Phil Hagelberg, Doug Alcorn, and Will Farrington
;; Maintainer: Chen Bin <chenbin.sh@gmail.com>
;; URL: https://github.com/technomancy/find-file-in-project
Expand Down Expand Up @@ -422,7 +422,8 @@ directory they are found in so that they are unique."
root)

;; extract line num if exists
(when (string-match "^\\(.*\\):\\([0-9]+\\):?$" keyword)
(when (and keyword
(string-match "^\\(.*\\):\\([0-9]+\\):?$" keyword))
(setq lnum (string-to-number (match-string 2 keyword)))
(setq keyword (match-string 1 keyword)))

Expand Down
2 changes: 1 addition & 1 deletion pkg.sh
@@ -1,6 +1,6 @@
#!/bin/bash
name=find-file-in-project
version=4.9
version=4.9.1
pkg=$name-$version
mkdir $pkg
cp *.el $pkg
Expand Down
14 changes: 13 additions & 1 deletion tests/general.el
Expand Up @@ -28,4 +28,16 @@
(setq ffip-project-root default-directory)
(setq files (mapcar 'car (ffip-project-search "ivy" nil)))
;; (message "files=%s" files)
(should (string-match-p "ivy.el" (car files)))))
(should (string-match-p "ivy.el" (car files)))))


(ert-deftest ffip-test-ffip ()
(let (files)
(setq ffip-project-root default-directory)
(setq files (mapcar 'car (ffip-project-search nil nil)))
(should (> (length files) 1))
(should (not (active-minibuffer-window)))
(setq ivy-read-called nil)
;; ffip will call ivy by default
(ffip-find-files nil nil)
(should ivy-read-called)))
3 changes: 3 additions & 0 deletions tests/ivy.el
Expand Up @@ -2,10 +2,13 @@
(require 'cl-lib)
(require 'ert)

(defvar ivy-read-called nil)

(cl-defun ivy-read (prompt collection
&key predicate require-match initial-input
history preselect keymap update-fn sort
action unwind re-builder matcher dynamic-collection caller)
(setq ivy-read-called t)
(message "ivy-read mockup is called"))

(provide 'ivy)

0 comments on commit 32e291c

Please sign in to comment.