| 
									
										
										
										
											2008-03-01 17:00:45 -05:00
										 |  |  | IN: io.files.tests | 
					
						
							| 
									
										
										
										
											2008-02-16 23:17:41 -05:00
										 |  |  | USING: tools.test io.files io threads kernel continuations io.encodings.ascii ;
 | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-03-15 07:23:10 -04:00
										 |  |  | [ ] [ "blahblah" temp-file dup exists? [ delete-directory ] [ drop ] if ] unit-test | 
					
						
							|  |  |  | [ ] [ "blahblah" temp-file make-directory ] unit-test | 
					
						
							|  |  |  | [ t ] [ "blahblah" temp-file directory? ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | [ "passwd" ] [ "/etc/passwd" file-name ] unit-test | 
					
						
							| 
									
										
										
										
											2008-02-06 20:23:39 -05:00
										 |  |  | [ "awk" ] [ "/usr/libexec/awk/" file-name ] unit-test | 
					
						
							|  |  |  | [ "awk" ] [ "/usr/libexec/awk///" file-name ] unit-test | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | [ ] [ | 
					
						
							| 
									
										
										
										
											2008-03-07 22:26:35 -05:00
										 |  |  |     { "Hello world." } | 
					
						
							|  |  |  |     "test-foo.txt" temp-file ascii set-file-lines | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ ] [ | 
					
						
							| 
									
										
										
										
											2008-02-29 02:20:44 -05:00
										 |  |  |     "test-foo.txt" temp-file ascii [ | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  |         "Hello appender." print
 | 
					
						
							| 
									
										
										
										
											2008-02-16 23:17:41 -05:00
										 |  |  |     ] with-file-appender | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ ] [ | 
					
						
							| 
									
										
										
										
											2008-02-29 02:20:44 -05:00
										 |  |  |     "test-bar.txt" temp-file ascii [ | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  |         "Hello appender." print
 | 
					
						
							| 
									
										
										
										
											2008-02-16 23:17:41 -05:00
										 |  |  |     ] with-file-appender | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ "Hello world.\nHello appender.\n" ] [ | 
					
						
							| 
									
										
										
										
											2008-02-29 02:20:44 -05:00
										 |  |  |     "test-foo.txt" temp-file ascii file-contents | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ "Hello appender.\n" ] [ | 
					
						
							| 
									
										
										
										
											2008-02-29 02:20:44 -05:00
										 |  |  |     "test-bar.txt" temp-file ascii file-contents | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-02-27 15:59:15 -05:00
										 |  |  | [ ] [ "test-foo.txt" temp-file delete-file ] unit-test | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-02-27 15:59:15 -05:00
										 |  |  | [ ] [ "test-bar.txt" temp-file delete-file ] unit-test | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-02-27 15:59:15 -05:00
										 |  |  | [ f ] [ "test-foo.txt" temp-file exists? ] unit-test | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-02-27 15:59:15 -05:00
										 |  |  | [ f ] [ "test-bar.txt" temp-file exists? ] unit-test | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-02-27 15:59:15 -05:00
										 |  |  | [ ] [ "test-blah" temp-file make-directory ] unit-test | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | [ ] [ | 
					
						
							| 
									
										
										
										
											2008-02-29 02:20:44 -05:00
										 |  |  |     "test-blah/fooz" temp-file ascii <file-writer> dispose | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ t ] [ | 
					
						
							| 
									
										
										
										
											2008-02-27 15:59:15 -05:00
										 |  |  |     "test-blah/fooz" temp-file exists? | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-02-27 15:59:15 -05:00
										 |  |  | [ ] [ "test-blah/fooz" temp-file delete-file ] unit-test | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-02-27 15:59:15 -05:00
										 |  |  | [ ] [ "test-blah" temp-file delete-directory ] unit-test | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-02-27 15:59:15 -05:00
										 |  |  | [ f ] [ "test-blah" temp-file exists? ] unit-test | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-02-29 02:20:44 -05:00
										 |  |  | [ ] [ "test-quux.txt" temp-file ascii [ [ yield "Hi" write ] "Test" spawn drop ] with-file-writer ] unit-test | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-02-27 15:59:15 -05:00
										 |  |  | [ ] [ "test-quux.txt" temp-file delete-file ] unit-test | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-02-29 02:20:44 -05:00
										 |  |  | [ ] [ "test-quux.txt" temp-file ascii [ [ yield "Hi" write ] "Test" spawn drop ] with-file-writer ] unit-test | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-02-27 15:59:15 -05:00
										 |  |  | [ ] [ "test-quux.txt" "quux-test.txt" [ temp-file ] 2apply move-file ] unit-test | 
					
						
							|  |  |  | [ t ] [ "quux-test.txt" temp-file exists? ] unit-test | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-02-27 15:59:15 -05:00
										 |  |  | [ ] [ "quux-test.txt" temp-file delete-file ] unit-test | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-02-27 15:59:15 -05:00
										 |  |  | [ ] [ "delete-tree-test/a/b/c" temp-file make-directories ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ ] [ | 
					
						
							| 
									
										
										
										
											2008-03-07 22:26:35 -05:00
										 |  |  |     { "Hi" } | 
					
						
							|  |  |  |     "delete-tree-test/a/b/c/d" temp-file ascii set-file-lines | 
					
						
							| 
									
										
										
										
											2008-02-27 15:59:15 -05:00
										 |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ ] [ | 
					
						
							|  |  |  |     "delete-tree-test" temp-file delete-tree | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ ] [ | 
					
						
							|  |  |  |     "copy-tree-test/a/b/c" temp-file make-directories | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ ] [ | 
					
						
							| 
									
										
										
										
											2008-03-07 22:26:35 -05:00
										 |  |  |     "Foobar" | 
					
						
							| 
									
										
										
										
											2008-02-27 15:59:15 -05:00
										 |  |  |     "copy-tree-test/a/b/c/d" temp-file | 
					
						
							| 
									
										
										
										
											2008-03-07 22:26:35 -05:00
										 |  |  |     ascii set-file-contents | 
					
						
							| 
									
										
										
										
											2008-02-27 15:59:15 -05:00
										 |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ ] [ | 
					
						
							|  |  |  |     "copy-tree-test" temp-file | 
					
						
							|  |  |  |     "copy-destination" temp-file copy-tree | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ "Foobar" ] [ | 
					
						
							| 
									
										
										
										
											2008-03-04 19:12:01 -05:00
										 |  |  |     "copy-destination/a/b/c/d" temp-file ascii file-contents | 
					
						
							| 
									
										
										
										
											2008-02-27 15:59:15 -05:00
										 |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ ] [ | 
					
						
							|  |  |  |     "copy-destination" temp-file delete-tree | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ ] [ | 
					
						
							|  |  |  |     "copy-tree-test" temp-file | 
					
						
							| 
									
										
										
										
											2008-03-01 16:52:34 -05:00
										 |  |  |     "copy-destination" temp-file copy-tree-into | 
					
						
							| 
									
										
										
										
											2008-02-27 15:59:15 -05:00
										 |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ "Foobar" ] [ | 
					
						
							| 
									
										
										
										
											2008-03-04 19:12:01 -05:00
										 |  |  |     "copy-destination/copy-tree-test/a/b/c/d" temp-file ascii file-contents | 
					
						
							| 
									
										
										
										
											2008-02-27 15:59:15 -05:00
										 |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ ] [ | 
					
						
							| 
									
										
										
										
											2008-03-01 16:52:34 -05:00
										 |  |  |     "copy-destination/copy-tree-test/a/b/c/d" temp-file "" temp-file copy-file-into | 
					
						
							| 
									
										
										
										
											2008-02-27 15:59:15 -05:00
										 |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ "Foobar" ] [ | 
					
						
							| 
									
										
										
										
											2008-03-04 19:12:01 -05:00
										 |  |  |     "d" temp-file ascii file-contents | 
					
						
							| 
									
										
										
										
											2008-02-27 15:59:15 -05:00
										 |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ ] [ "d" temp-file delete-file ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ ] [ "copy-destination" temp-file delete-tree ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ ] [ "copy-tree-test" temp-file delete-tree ] unit-test | 
					
						
							| 
									
										
										
										
											2008-03-01 00:17:15 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | [ t ] [ cwd "misc" resource-path [ ] with-directory cwd = ] unit-test | 
					
						
							| 
									
										
										
										
											2008-03-15 07:23:10 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | [ ] [ "append-test" temp-file dup exists? [ delete-file ] [ drop ] if ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ ] [ "append-test" ascii <file-appender> dispose ] unit-test |