1 USING: calendar ftp.server io.encodings.ascii io.files
2 io.files.unique namespaces threads tools.test kernel
3 io.servers ftp.client accessors urls
4 io.pathnames io.directories sequences fry io.backend
6 FROM: ftp.client => ftp-get ;
9 CONSTANT: test-file-contents "Files are so boring anymore."
11 : create-test-file ( -- path )
13 "ftp.server" "test" make-unique-file
14 [ ascii set-file-contents ] [ normalize-path ] bi ;
16 : test-ftp-server ( quot -- )
18 current-temporary-directory get
20 "ftp://localhost" >url insecure-addr set-url-addr
22 create-test-file >>path
24 ] with-threaded-server
25 ] cleanup-unique-directory ; inline
31 [ ftp-get ] [ path>> file-name ascii file-contents ] bi
32 ] cleanup-unique-working-directory
33 ] test-ftp-server test-file-contents =
41 [ ftp-get ] [ path>> file-name ascii file-contents ] bi
42 ] cleanup-unique-working-directory
43 ] test-ftp-server test-file-contents =