]> gitweb.factorcode.org Git - factor.git/blob - basis/io/windows/nt/files/files-tests.factor
Fix permission bits
[factor.git] / basis / io / windows / nt / files / files-tests.factor
1 USING: io.files kernel tools.test io.backend
2 io.windows.nt.files splitting sequences ;
3 IN: io.windows.nt.files.tests
4
5 [ f ] [ "\\foo" absolute-path? ] unit-test
6 [ t ] [ "\\\\?\\c:\\foo" absolute-path? ] unit-test
7 [ t ] [ "\\\\?\\c:\\" absolute-path? ] unit-test
8 [ t ] [ "\\\\?\\c:" absolute-path? ] unit-test
9 [ t ] [ "c:\\foo" absolute-path? ] unit-test
10 [ t ] [ "c:" absolute-path? ] unit-test
11 [ t ] [ "c:\\" absolute-path? ] unit-test
12 [ f ] [ "/cygdrive/c/builds" absolute-path? ] unit-test
13
14 [ "c:\\foo\\" ] [ "c:\\foo\\bar" parent-directory ] unit-test
15 [ "c:\\" ] [ "c:\\foo\\" parent-directory ] unit-test
16 [ "c:\\" ] [ "c:\\foo" parent-directory ] unit-test
17 ! { "c:" "c:\\" "c:/" } [ directory ] each -- all do the same thing
18 [ "c:\\" ] [ "c:\\" parent-directory ] unit-test
19 [ "Z:\\" ] [ "Z:\\" parent-directory ] unit-test
20 [ "c:" ] [ "c:" parent-directory ] unit-test
21 [ "Z:" ] [ "Z:" parent-directory ] unit-test
22
23 [ f ] [ "" root-directory? ] unit-test
24 [ t ] [ "\\" root-directory? ] unit-test
25 [ t ] [ "\\\\" root-directory? ] unit-test
26 [ t ] [ "/" root-directory? ] unit-test
27 [ t ] [ "//" root-directory? ] unit-test
28 [ t ] [ "c:\\" trim-right-separators root-directory? ] unit-test
29 [ t ] [ "Z:\\" trim-right-separators root-directory? ] unit-test
30 [ f ] [ "c:\\foo" root-directory? ] unit-test
31 [ f ] [ "." root-directory? ] unit-test
32 [ f ] [ ".." root-directory? ] unit-test
33 [ t ] [ "\\\\?\\c:\\" root-directory? ] unit-test
34 [ t ] [ "\\\\?\\c:" root-directory? ] unit-test
35 [ f ] [ "\\\\?\\c:\\bar" root-directory? ] unit-test
36
37 [ "\\foo\\bar" ] [ "/foo/bar" normalize-path ":" split1 nip ] unit-test
38
39 [ "\\\\?\\C:\\builds\\factor\\log.txt" ] [
40     "C:\\builds\\factor\\12345\\"
41     "..\\log.txt" append-path normalize-path
42 ] unit-test
43
44 [ "\\\\?\\C:\\builds\\" ] [
45     "C:\\builds\\factor\\12345\\"
46     "..\\.." append-path normalize-path
47 ] unit-test
48
49 [ "\\\\?\\C:\\builds\\" ] [
50     "C:\\builds\\factor\\12345\\"
51     "..\\.." append-path normalize-path
52 ] unit-test
53
54 [ "c:\\blah" ] [ "c:\\foo\\bar" "\\blah" append-path ] unit-test
55 [ t ] [ "" resource-path 2 tail exists? ] unit-test