From 7bbcb569d403a44de2c99d061f873e1ea5dd3c41 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Thu, 12 Mar 2009 17:01:44 -0500 Subject: [PATCH] fix find-in-directories and add unit tests --- basis/io/directories/search/search-tests.factor | 10 ++++++++++ basis/io/directories/search/search.factor | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/basis/io/directories/search/search-tests.factor b/basis/io/directories/search/search-tests.factor index ba1b9cdbe1..5281ca9c2b 100644 --- a/basis/io/directories/search/search-tests.factor +++ b/basis/io/directories/search/search-tests.factor @@ -8,3 +8,13 @@ IN: io.directories.search.tests current-temporary-directory get [ ] find-all-files ] with-unique-directory drop [ natural-sort ] bi@ = ] unit-test + +[ f ] [ + { "omg you shoudnt have a directory called this" "or this" } + t + [ "asdfasdfasdfasdfasdf" tail? ] find-in-directories +] unit-test + +[ f ] [ + { } t [ "asdfasdfasdfasdfasdf" tail? ] find-in-directories +] unit-test diff --git a/basis/io/directories/search/search.factor b/basis/io/directories/search/search.factor index ee8fd129a7..a3db10ffff 100755 --- a/basis/io/directories/search/search.factor +++ b/basis/io/directories/search/search.factor @@ -61,8 +61,8 @@ PRIVATE> ERROR: file-not-found ; : find-in-directories ( directories bfs? quot: ( obj -- ? ) -- path'/f ) - [ - '[ _ _ find-file [ file-not-found ] unless* ] attempt-all + '[ + _ [ _ _ find-file [ file-not-found ] unless* ] attempt-all ] [ drop f ] recover ;