fzy

terminal fuzzy finder picker

git clone https://9o.is/git/fzy.git

commit cf431f66952621d7aa03e8149f74917bee2b0fb0
parent 5d8840288f99e76a9e144e530ce4c8adfede7bf0
Author: John Hawthorn <john.hawthorn@gmail.com>
Date:   Sat, 26 Jul 2014 19:22:19 -0700

Update tests

Diffstat:
Mtest.rb | 5+++--
Mtestscore.c | 8+++++---
2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/test.rb b/test.rb @@ -4,11 +4,12 @@ require "minitest/autorun" describe "score" do def score(candidate, query) # FIXME: should escape this properly - `./testscore '#{query}' '#{candidate}'`.to_f + ret = `./testscore '#{query}' '#{candidate}'` + ret.to_f unless ret.empty? end def assert_unmatched(candidate, query) - assert_equal -1, score(candidate, query) + assert_equal nil, score(candidate, query) end def assert_matched(candidate, query) diff --git a/testscore.c b/testscore.c @@ -1,7 +1,7 @@ #include <stdlib.h> #include <stdio.h> -/* from match.c */ +#include "fzy.h" double match(const char *needle, const char *haystack); void usage(const char *argv0){ @@ -13,8 +13,10 @@ int main(int argc, char *argv[]){ usage(argv[0]); } - double result = match(argv[1], argv[2]); - printf("%f\n", result); + if(has_match(argv[1], argv[2])){ + double result = match(argv[1], argv[2]); + printf("%f\n", result); + } return 0; }