| 
									
										
										
										
											2016-04-04 13:32:42 -04:00
										 |  |  | USING: destructors io io.directories io.directories.hierarchy | 
					
						
							|  |  |  | io.encodings.ascii io.encodings.utf8 io.files io.files.info | 
					
						
							|  |  |  | io.launcher io.pathnames kernel sequences tools.test ;
 | 
					
						
							| 
									
										
										
										
											2008-12-14 21:03:00 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-03 12:39:59 -04:00
										 |  |  | { { "kernel" } } [ | 
					
						
							| 
									
										
										
										
											2008-12-14 21:03:00 -05:00
										 |  |  |     "core" resource-path [ | 
					
						
							|  |  |  |         "." directory-files [ "kernel" = ] filter
 | 
					
						
							|  |  |  |     ] with-directory | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-03 12:39:59 -04:00
										 |  |  | { { "kernel" } } [ | 
					
						
							| 
									
										
										
										
											2008-12-14 21:03:00 -05:00
										 |  |  |     "resource:core" [ | 
					
						
							|  |  |  |         "." directory-files [ "kernel" = ] filter
 | 
					
						
							|  |  |  |     ] with-directory | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-03 12:39:59 -04:00
										 |  |  | { { "kernel" } } [ | 
					
						
							| 
									
										
										
										
											2008-12-14 21:03:00 -05:00
										 |  |  |     "resource:core" [ | 
					
						
							|  |  |  |         [ "kernel" = ] filter
 | 
					
						
							|  |  |  |     ] with-directory-files | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-04 13:32:42 -04:00
										 |  |  | [ | 
					
						
							|  |  |  |     { t t f } [ | 
					
						
							|  |  |  |         "blahblah" make-directory | 
					
						
							|  |  |  |         "blahblah" exists? | 
					
						
							|  |  |  |         "blahblah" file-info directory? | 
					
						
							|  |  |  |         "blahblah" delete-directory | 
					
						
							|  |  |  |         "blahblah" exists? | 
					
						
							|  |  |  |     ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     { "file1 contents" } [ | 
					
						
							| 
									
										
										
										
											2008-12-14 21:03:00 -05:00
										 |  |  |         "file1 contents" "file1" utf8 set-file-contents | 
					
						
							|  |  |  |         "file1" "file2" copy-file | 
					
						
							|  |  |  |         "file2" utf8 file-contents | 
					
						
							| 
									
										
										
										
											2016-03-17 20:11:59 -04:00
										 |  |  |         "file1" delete-file | 
					
						
							|  |  |  |         "file2" delete-file | 
					
						
							| 
									
										
										
										
											2016-04-04 13:32:42 -04:00
										 |  |  |     ] unit-test | 
					
						
							| 
									
										
										
										
											2008-12-14 21:03:00 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-04 13:32:42 -04:00
										 |  |  |     { "file3 contents" } [ | 
					
						
							| 
									
										
										
										
											2008-12-14 21:03:00 -05:00
										 |  |  |         "file3 contents" "file3" utf8 set-file-contents | 
					
						
							|  |  |  |         "file3" "file4" move-file | 
					
						
							|  |  |  |         "file4" utf8 file-contents | 
					
						
							| 
									
										
										
										
											2016-03-17 20:11:59 -04:00
										 |  |  |         "file4" delete-file | 
					
						
							| 
									
										
										
										
											2016-04-04 13:32:42 -04:00
										 |  |  |     ] unit-test | 
					
						
							| 
									
										
										
										
											2008-12-14 21:03:00 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-04 13:32:42 -04:00
										 |  |  |     { } [ | 
					
						
							| 
									
										
										
										
											2008-12-14 21:03:00 -05:00
										 |  |  |         "file5" touch-file | 
					
						
							|  |  |  |         "file5" delete-file | 
					
						
							| 
									
										
										
										
											2016-04-04 13:32:42 -04:00
										 |  |  |     ] unit-test | 
					
						
							| 
									
										
										
										
											2008-12-14 21:03:00 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-04 13:32:42 -04:00
										 |  |  |     { } [ | 
					
						
							| 
									
										
										
										
											2008-12-14 21:03:00 -05:00
										 |  |  |         "file6" touch-file | 
					
						
							|  |  |  |         "file6" link-info drop
 | 
					
						
							| 
									
										
										
										
											2016-04-04 13:32:42 -04:00
										 |  |  |     ] unit-test | 
					
						
							| 
									
										
										
										
											2008-12-14 21:03:00 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-04 13:32:42 -04:00
										 |  |  |     { } [ | 
					
						
							|  |  |  |         { "Hello world." } | 
					
						
							|  |  |  |         "test-foo.txt" ascii set-file-lines | 
					
						
							|  |  |  |     ] unit-test | 
					
						
							| 
									
										
										
										
											2016-03-31 03:23:13 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-04 13:32:42 -04:00
										 |  |  |     { } [ | 
					
						
							|  |  |  |         "test-foo.txt" ascii [ | 
					
						
							|  |  |  |             "Hello appender." print
 | 
					
						
							|  |  |  |         ] with-file-appender | 
					
						
							|  |  |  |     ] unit-test | 
					
						
							| 
									
										
										
										
											2008-12-14 21:03:00 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-04 13:32:42 -04:00
										 |  |  |     { } [ | 
					
						
							|  |  |  |         "test-bar.txt" ascii [ | 
					
						
							|  |  |  |             "Hello appender." print
 | 
					
						
							|  |  |  |         ] with-file-appender | 
					
						
							|  |  |  |     ] unit-test | 
					
						
							| 
									
										
										
										
											2008-12-14 21:03:00 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-04 13:32:42 -04:00
										 |  |  |     { "Hello world.\nHello appender.\n" } [ | 
					
						
							|  |  |  |         "test-foo.txt" ascii file-contents | 
					
						
							|  |  |  |     ] unit-test | 
					
						
							| 
									
										
										
										
											2008-12-14 21:03:00 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-04 13:32:42 -04:00
										 |  |  |     { "Hello appender.\n" } [ | 
					
						
							|  |  |  |         "test-bar.txt" ascii file-contents | 
					
						
							|  |  |  |     ] unit-test | 
					
						
							| 
									
										
										
										
											2008-12-14 21:03:00 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-04 13:32:42 -04:00
										 |  |  |     { } [ "test-foo.txt" delete-file ] unit-test | 
					
						
							|  |  |  |     { } [ "test-bar.txt" delete-file ] unit-test | 
					
						
							| 
									
										
										
										
											2008-12-14 21:03:00 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-04 13:32:42 -04:00
										 |  |  |     { f } [ "test-foo.txt" exists? ] unit-test | 
					
						
							|  |  |  |     { f } [ "test-bar.txt" exists? ] unit-test | 
					
						
							| 
									
										
										
										
											2008-12-14 21:03:00 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-04 13:32:42 -04:00
										 |  |  |     { } [ "test-blah" make-directory ] unit-test | 
					
						
							| 
									
										
										
										
											2008-12-14 21:03:00 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-04 13:32:42 -04:00
										 |  |  |     { } [ | 
					
						
							|  |  |  |         "test-blah/fooz" ascii <file-writer> dispose | 
					
						
							|  |  |  |     ] unit-test | 
					
						
							| 
									
										
										
										
											2008-12-14 21:03:00 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-04 13:32:42 -04:00
										 |  |  |     { t } [ | 
					
						
							|  |  |  |         "test-blah/fooz" exists? | 
					
						
							|  |  |  |     ] unit-test | 
					
						
							| 
									
										
										
										
											2008-12-14 21:03:00 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-04 13:32:42 -04:00
										 |  |  |     { } [ "test-blah/fooz" delete-file ] unit-test | 
					
						
							|  |  |  |     { } [ "test-blah" delete-directory ] unit-test | 
					
						
							| 
									
										
										
										
											2008-12-14 21:03:00 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-04 13:32:42 -04:00
										 |  |  |     { f } [ "test-blah" exists? ] unit-test | 
					
						
							| 
									
										
										
										
											2008-12-14 21:03:00 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-04 13:32:42 -04:00
										 |  |  |     { } [ "delete-tree-test/a/b/c" make-directories ] unit-test | 
					
						
							| 
									
										
										
										
											2008-12-14 21:03:00 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-04 13:32:42 -04:00
										 |  |  |     { } [ | 
					
						
							|  |  |  |         { "Hi" } "delete-tree-test/a/b/c/d" ascii set-file-lines | 
					
						
							|  |  |  |     ] unit-test | 
					
						
							| 
									
										
										
										
											2008-12-14 21:03:00 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-04 13:32:42 -04:00
										 |  |  |     { } [ "delete-tree-test" delete-tree ] unit-test | 
					
						
							| 
									
										
										
										
											2008-12-14 21:03:00 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-04 13:32:42 -04:00
										 |  |  |     { } [ | 
					
						
							|  |  |  |         "copy-tree-test/a/b/c" make-directories | 
					
						
							|  |  |  |     ] unit-test | 
					
						
							| 
									
										
										
										
											2008-12-14 21:03:00 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-04 13:32:42 -04:00
										 |  |  |     { } [ | 
					
						
							|  |  |  |         "Foobar" | 
					
						
							|  |  |  |         "copy-tree-test/a/b/c/d" | 
					
						
							|  |  |  |         ascii set-file-contents | 
					
						
							|  |  |  |     ] unit-test | 
					
						
							| 
									
										
										
										
											2008-12-14 21:03:00 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-04 13:32:42 -04:00
										 |  |  |     { } [ | 
					
						
							|  |  |  |         "copy-tree-test" "copy-destination" copy-tree | 
					
						
							|  |  |  |     ] unit-test | 
					
						
							| 
									
										
										
										
											2008-12-14 21:03:00 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-04 13:32:42 -04:00
										 |  |  |     { "Foobar" } [ | 
					
						
							|  |  |  |         "copy-destination/a/b/c/d" ascii file-contents | 
					
						
							|  |  |  |     ] unit-test | 
					
						
							| 
									
										
										
										
											2008-12-14 21:03:00 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-04 13:32:42 -04:00
										 |  |  |     { } [ | 
					
						
							|  |  |  |         "copy-destination" delete-tree | 
					
						
							|  |  |  |     ] unit-test | 
					
						
							| 
									
										
										
										
											2008-12-14 21:03:00 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-04 13:32:42 -04:00
										 |  |  |     { } [ | 
					
						
							|  |  |  |         "copy-tree-test" "copy-destination" copy-tree-into | 
					
						
							|  |  |  |     ] unit-test | 
					
						
							| 
									
										
										
										
											2011-11-12 21:27:33 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-04 13:32:42 -04:00
										 |  |  |     { "Foobar" } [ | 
					
						
							|  |  |  |         "copy-destination/copy-tree-test/a/b/c/d" ascii file-contents | 
					
						
							|  |  |  |     ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-14 19:25:53 -04:00
										 |  |  |     ! copy-file | 
					
						
							|  |  |  |     { } [ | 
					
						
							|  |  |  |         "resource:LICENSE.txt" "test" copy-file | 
					
						
							|  |  |  |     ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ! copy-file-into | 
					
						
							| 
									
										
										
										
											2016-04-04 13:32:42 -04:00
										 |  |  |     { } [ | 
					
						
							|  |  |  |         "copy-destination/copy-tree-test/a/b/c/d" "." copy-file-into | 
					
						
							|  |  |  |     ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     { "Foobar" } [ | 
					
						
							|  |  |  |         "d" ascii file-contents | 
					
						
							|  |  |  |     ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     { } [ "d" delete-file ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     { } [ "copy-destination" delete-tree ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     { } [ "copy-tree-test" delete-tree ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ! Issue #890 | 
					
						
							|  |  |  |     { } [ | 
					
						
							|  |  |  |         "foo" [ make-directories ] keep
 | 
					
						
							|  |  |  |         [ "touch bar" try-output-process ] with-directory | 
					
						
							|  |  |  |     ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-14 18:33:44 -04:00
										 |  |  |     { t } [ | 
					
						
							|  |  |  |         "one/two/three" make-parent-directories parent-directory exists? | 
					
						
							|  |  |  |     ] unit-test | 
					
						
							| 
									
										
										
										
											2014-11-18 17:11:13 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-14 18:33:44 -04:00
										 |  |  | ] with-test-directory |