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