io.directories.search: fix linux tests.

Linux doesn't return alphabetic ordering like Windows and macOS, so
we just assert the paths are iterated in the correct order by depth.
char-rename
John Benediktsson 2017-03-05 15:56:28 -08:00
parent 8b455d2306
commit 495d27a502
1 changed files with 48 additions and 35 deletions

View File

@ -1,6 +1,7 @@
USING: combinators fry io.directories io.directories.hierarchy USING: combinators fry io.directories io.directories.hierarchy
io.directories.search io.files.unique io.pathnames kernel io.directories.search io.files.unique io.pathnames kernel
namespaces sequences sorting splitting strings tools.test ; namespaces sequences sorting splitting strings system
tools.test ;
{ t } [ { t } [
[ [
@ -46,42 +47,49 @@ namespaces sequences sorting splitting strings tools.test ;
[ drop f ] find-up-to-root [ drop f ] find-up-to-root
] unit-test ] unit-test
{ os linux? [
V{ {
"/a" V{ 1 2 3 2 3 1 2 3 2 3 1 2 3 2 3 }
"/a/a" V{ 1 1 1 2 2 2 2 2 2 3 3 3 3 3 3 }
"/a/a/a"
"/a/b"
"/a/b/a"
"/b"
"/b/a"
"/b/a/a"
"/b/b"
"/b/b/a"
"/c"
"/c/a"
"/c/a/a"
"/c/b"
"/c/b/a"
} }
V{ ] [
"/a" {
"/b" V{
"/c" "/a"
"/a/a" "/a/a"
"/a/b" "/a/a/a"
"/b/a" "/a/b"
"/b/b" "/a/b/a"
"/c/a" "/b"
"/c/b" "/b/a"
"/a/a/a" "/b/a/a"
"/a/b/a" "/b/b"
"/b/a/a" "/b/b/a"
"/b/b/a" "/c"
"/c/a/a" "/c/a"
"/c/b/a" "/c/a/a"
"/c/b"
"/c/b/a"
}
V{
"/a"
"/b"
"/c"
"/a/a"
"/a/b"
"/b/a"
"/b/b"
"/c/a"
"/c/b"
"/a/a/a"
"/a/b/a"
"/b/a/a"
"/b/b/a"
"/c/a/a"
"/c/b/a"
}
} }
} [ ] if [
[ [
"a" make-directory "a" make-directory
"a/a" make-directory "a/a" make-directory
@ -108,5 +116,10 @@ namespaces sequences sorting splitting strings tools.test ;
"." recursive-directory-files "." recursive-directory-files
current-directory get '[ _ ?head drop ] map current-directory get '[ _ ?head drop ] map
] with-variable ] with-variable
! Linux doesn't return alphabetic ordering
os linux? [
[ [ path-components length ] map ] bi@
] when
] with-test-directory ] with-test-directory
] unit-test ] unit-test