2010-09-19 15:02:32 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								! Copyright (C) 2010 Doug Coleman.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								! See http://factorcode.org/license.txt for BSD license.
							 | 
						
					
						
							
								
									
										
										
										
											2008-12-16 02:12:36 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								USING: io.files io.pathnames kernel tools.test io.backend
							 | 
						
					
						
							
								
									
										
										
										
											2010-09-19 15:02:32 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								io.files.windows splitting sequences io.pathnames.private ;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								IN: io.files.windows.tests
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-27 10:00:59 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2008-04-01 20:00:20 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ f ] [ "\\foo" absolute-path? ] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ t ] [ "\\\\?\\c:\\foo" absolute-path? ] unit-test
							 | 
						
					
						
							
								
									
										
										
										
											2008-09-18 18:45:15 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ t ] [ "\\\\?\\c:\\" absolute-path? ] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ t ] [ "\\\\?\\c:" absolute-path? ] unit-test
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-27 17:22:24 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ t ] [ "c:\\foo" absolute-path? ] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ t ] [ "c:" absolute-path? ] unit-test
							 | 
						
					
						
							
								
									
										
										
										
											2008-09-18 18:45:15 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ t ] [ "c:\\" absolute-path? ] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ f ] [ "/cygdrive/c/builds" absolute-path? ] unit-test
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-27 17:22:24 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ "c:\\foo\\" ] [ "c:\\foo\\bar" parent-directory ] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ "c:\\" ] [ "c:\\foo\\" parent-directory ] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ "c:\\" ] [ "c:\\foo" parent-directory ] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								! { "c:" "c:\\" "c:/" } [ directory ] each -- all do the same thing
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ "c:\\" ] [ "c:\\" parent-directory ] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ "Z:\\" ] [ "Z:\\" parent-directory ] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ "c:" ] [ "c:" parent-directory ] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ "Z:" ] [ "Z:" parent-directory ] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-27 10:00:59 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ f ] [ "" root-directory? ] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ t ] [ "\\" root-directory? ] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ t ] [ "\\\\" root-directory? ] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ t ] [ "/" root-directory? ] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ t ] [ "//" root-directory? ] unit-test
							 | 
						
					
						
							
								
									
										
										
										
											2009-01-29 23:19:07 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ t ] [ "c:\\" trim-tail-separators root-directory? ] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ t ] [ "Z:\\" trim-tail-separators root-directory? ] unit-test
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-27 17:22:24 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ f ] [ "c:\\foo" root-directory? ] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ f ] [ "." root-directory? ] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ f ] [ ".." root-directory? ] unit-test
							 | 
						
					
						
							
								
									
										
										
										
											2008-09-18 18:45:15 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ t ] [ "\\\\?\\c:\\" root-directory? ] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ t ] [ "\\\\?\\c:" root-directory? ] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ f ] [ "\\\\?\\c:\\bar" root-directory? ] unit-test
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-27 17:22:24 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2011-08-28 15:55:09 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								[ "\\\\a\\b\\c\\foo.xls" ] [ "//a/b/c/foo.xls" normalize-path ] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ "\\\\a\\b\\c\\foo.xls" ] [ "\\\\a\\b\\c\\foo.xls" normalize-path ] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2008-04-01 20:51:49 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ "\\foo\\bar" ] [ "/foo/bar" normalize-path ":" split1 nip ] unit-test
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-27 17:22:24 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ "\\\\?\\C:\\builds\\factor\\log.txt" ] [
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    "C:\\builds\\factor\\12345\\"
							 | 
						
					
						
							
								
									
										
										
										
											2008-04-01 20:51:49 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    "..\\log.txt" append-path normalize-path
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-27 17:22:24 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ "\\\\?\\C:\\builds\\" ] [
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    "C:\\builds\\factor\\12345\\"
							 | 
						
					
						
							
								
									
										
										
										
											2008-04-01 20:51:49 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    "..\\.." append-path normalize-path
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-27 17:22:24 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								] unit-test
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-27 10:01:48 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-27 17:22:24 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ "\\\\?\\C:\\builds\\" ] [
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    "C:\\builds\\factor\\12345\\"
							 | 
						
					
						
							
								
									
										
										
										
											2008-04-01 20:51:49 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    "..\\.." append-path normalize-path
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-27 17:22:24 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								] unit-test
							 | 
						
					
						
							
								
									
										
										
										
											2008-04-01 20:00:20 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ "c:\\blah" ] [ "c:\\foo\\bar" "\\blah" append-path ] unit-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								[ t ] [ "" resource-path 2 tail exists? ] unit-test
							 |