1 USING: io.files kernel tools.test io.backend
2 io.windows.nt.files splitting sequences ;
3 IN: io.windows.nt.files.tests
5 [ f ] [ "\\foo" absolute-path? ] unit-test
6 [ t ] [ "\\\\?\\c:\\foo" absolute-path? ] unit-test
7 [ t ] [ "c:\\foo" absolute-path? ] unit-test
8 [ t ] [ "c:" absolute-path? ] unit-test
10 [ "c:\\foo\\" ] [ "c:\\foo\\bar" parent-directory ] unit-test
11 [ "c:\\" ] [ "c:\\foo\\" parent-directory ] unit-test
12 [ "c:\\" ] [ "c:\\foo" parent-directory ] unit-test
13 ! { "c:" "c:\\" "c:/" } [ directory ] each -- all do the same thing
14 [ "c:\\" ] [ "c:\\" parent-directory ] unit-test
15 [ "Z:\\" ] [ "Z:\\" parent-directory ] unit-test
16 [ "c:" ] [ "c:" parent-directory ] unit-test
17 [ "Z:" ] [ "Z:" parent-directory ] unit-test
19 [ f ] [ "" root-directory? ] unit-test
20 [ t ] [ "\\" root-directory? ] unit-test
21 [ t ] [ "\\\\" root-directory? ] unit-test
22 [ t ] [ "/" root-directory? ] unit-test
23 [ t ] [ "//" root-directory? ] unit-test
24 [ t ] [ "c:\\" right-trim-separators root-directory? ] unit-test
25 [ t ] [ "Z:\\" right-trim-separators root-directory? ] unit-test
26 [ f ] [ "c:\\foo" root-directory? ] unit-test
27 [ f ] [ "." root-directory? ] unit-test
28 [ f ] [ ".." root-directory? ] unit-test
30 [ "\\foo\\bar" ] [ "/foo/bar" normalize-path ":" split1 nip ] unit-test
32 [ "\\\\?\\C:\\builds\\factor\\log.txt" ] [
33 "C:\\builds\\factor\\12345\\"
34 "..\\log.txt" append-path normalize-path
37 [ "\\\\?\\C:\\builds\\" ] [
38 "C:\\builds\\factor\\12345\\"
39 "..\\.." append-path normalize-path
42 [ "\\\\?\\C:\\builds\\" ] [
43 "C:\\builds\\factor\\12345\\"
44 "..\\.." append-path normalize-path
47 [ "c:\\blah" ] [ "c:\\foo\\bar" "\\blah" append-path ] unit-test
48 [ t ] [ "" resource-path 2 tail exists? ] unit-test