-USING: globs io.directories io.files.temp io.files.unique
-io.pathnames literals sequences tools.test ;
+USING: globs globs.private io.directories io.files.temp
+io.files.unique io.pathnames literals sequences sorting
+tools.test ;
IN: globs.tests
{ f } [ "abd" "fdf" glob-matches? ] unit-test
{ t } [ "fo\\*" glob-pattern? ] unit-test
{ t } [ "fo{o,bro}" glob-pattern? ] unit-test
+{ "a/b/c" { } } [ "a/b/c" split-glob ] unit-test
+{ "a/b" { "c*" } } [ "a/b/c*" split-glob ] unit-test
+{ "a/b" { "c*" "" } } [ "a/b/c*/" split-glob ] unit-test
+{ "/path/to" { "a?" } } [ "/path/to/a?" split-glob ] unit-test
+
{
{ "a" }
{ "a" "a/b" "a/b/c" "a/b/c/d" "a/b/h" "a/e" "a/e/g" }
"a/e/g" make-directory
"a/e/g/e" touch-file
- "**" glob-directory
- "**/" glob-directory
- "**/*" glob-directory
- "**/**" glob-directory
- "**/b" glob-directory
- "**/e" glob-directory
- ! "**//e" glob-directory
- ! "**/**/e" glob-directory
- "**/e/**" glob-directory
- "a/**" glob-directory
+ "**" glob-directory natural-sort
+ "**/" glob-directory natural-sort
+ "**/*" glob-directory natural-sort
+ "**/**" glob-directory natural-sort
+ "**/b" glob-directory natural-sort
+ "**/e" glob-directory natural-sort
+ ! "**//e" glob-directory natural-sort
+ ! "**/**/e" glob-directory natural-sort
+ "**/e/**" glob-directory natural-sort
+ "a/**" glob-directory natural-sort
] cleanup-unique-directory
] with-temp-directory
] unit-test