2016-04-05 17:49:27 -04:00
|
|
|
USING: combinators io.directories io.directories.hierarchy
|
2016-04-04 13:32:42 -04:00
|
|
|
io.directories.search io.files.unique io.pathnames kernel
|
2016-03-19 12:50:01 -04:00
|
|
|
sequences sorting strings tools.test ;
|
2008-12-14 21:03:00 -05:00
|
|
|
|
2015-07-03 12:39:59 -04:00
|
|
|
{ t } [
|
2008-12-14 21:03:00 -05:00
|
|
|
[
|
2016-04-04 13:32:42 -04:00
|
|
|
10 [ "io.paths.test" "gogogo" unique-file ] replicate
|
|
|
|
"." [ ] find-all-files [ natural-sort ] same?
|
|
|
|
] with-test-directory
|
2008-12-14 21:03:00 -05:00
|
|
|
] unit-test
|
2009-03-12 18:01:44 -04:00
|
|
|
|
2015-07-03 12:39:59 -04:00
|
|
|
{ f } [
|
2009-03-12 18:01:44 -04:00
|
|
|
{ "omg you shoudnt have a directory called this" "or this" }
|
|
|
|
t
|
|
|
|
[ "asdfasdfasdfasdfasdf" tail? ] find-in-directories
|
|
|
|
] unit-test
|
|
|
|
|
2015-07-03 12:39:59 -04:00
|
|
|
{ f } [
|
2009-03-12 18:01:44 -04:00
|
|
|
{ } t [ "asdfasdfasdfasdfasdf" tail? ] find-in-directories
|
|
|
|
] unit-test
|
2009-04-24 16:22:12 -04:00
|
|
|
|
2015-07-03 12:39:59 -04:00
|
|
|
{ t } [
|
2009-04-24 16:22:12 -04:00
|
|
|
[
|
2016-04-04 13:32:42 -04:00
|
|
|
"the-head" "" unique-file drop
|
|
|
|
"." t [ file-name "the-head" head? ] find-file string?
|
|
|
|
] with-test-directory
|
2009-04-24 16:22:12 -04:00
|
|
|
] unit-test
|
|
|
|
|
2015-07-03 12:39:59 -04:00
|
|
|
{ t } [
|
2016-03-18 13:57:54 -04:00
|
|
|
[
|
2016-04-04 13:32:42 -04:00
|
|
|
{ "foo" "bar" } {
|
|
|
|
[ [ make-directory ] each ]
|
2016-03-18 13:57:54 -04:00
|
|
|
[ [ "abcd" append-path touch-file ] each ]
|
|
|
|
[ [ file-name "abcd" = ] find-all-in-directories length 2 = ]
|
2016-04-04 13:32:42 -04:00
|
|
|
[ [ delete-tree ] each ]
|
|
|
|
} cleave
|
|
|
|
] with-test-directory
|
2009-04-24 16:22:12 -04:00
|
|
|
] unit-test
|
2015-05-09 00:02:29 -04:00
|
|
|
|
|
|
|
{ t } [
|
|
|
|
"resource:core/math/integers/integers.factor"
|
|
|
|
[ "math.factor" tail? ] find-up-to-root >boolean
|
|
|
|
] unit-test
|
|
|
|
|
|
|
|
{ f } [
|
|
|
|
"resource:core/math/integers/integers.factor"
|
|
|
|
[ drop f ] find-up-to-root
|
|
|
|
] unit-test
|