! Copyright (C) 2009 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors assocs continuations fry http.server io
-io.encodings.ascii io.files io.files.unique
+io.encodings.ascii io.files io.files.temp io.files.unique
io.servers io.streams.duplex io.streams.string
-kernel math.ranges mime.multipart multiline namespaces random
+kernel ranges mime.multipart multiline namespaces random
sequences sorting strings threads tools.test ;
IN: mime.multipart.tests
: mime-test-stream ( -- stream )
upload1
- "mime" "test" make-unique-file ascii
- [ set-file-contents ] [ <file-reader> ] 2bi ;
+ [ "mime" "test" unique-file ] with-temp-directory
+ ascii [ set-file-contents ] [ <file-reader> ] 2bi ;
{ } [ mime-test-stream [ ] with-input-stream ] unit-test
[
] with-test-server
] unit-test
+
+[
+ "--\r\n\r\n" <string-reader> [
+ "\r\n\r\n" <multipart>
+ "\r\n\r\n" parse-multipart
+ ] with-input-stream
+] [ mime-decoding-ran-out-of-bytes? ] must-fail-with
+