]> gitweb.factorcode.org Git - factor.git/commitdiff
globs: more tests.
authorJohn Benediktsson <mrjbq7@gmail.com>
Mon, 28 Mar 2016 03:50:13 +0000 (20:50 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Mon, 28 Mar 2016 03:50:13 +0000 (20:50 -0700)
basis/globs/globs-tests.factor

index a8b81f6d8ec6c2f5a4a674217f4504c5f0cdda4c..cb450022968b1f52fb9c192fb0abdf350920e57a 100755 (executable)
@@ -1,5 +1,6 @@
-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
@@ -33,6 +34,11 @@ IN: globs.tests
 { 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" }
@@ -70,16 +76,16 @@ IN: globs.tests
             "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