]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/mime/multipart/multipart-tests.factor
factor: add newlines to .factor files
[factor.git] / basis / mime / multipart / multipart-tests.factor
index 0ebfb010b3b7c8cc031e89dd5a2679b66b97e733..d2644f2974482b55daf752988a83848fec559225 100644 (file)
@@ -1,9 +1,9 @@
 ! 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
 
@@ -13,8 +13,8 @@ CONSTANT: upload1 "------WebKitFormBoundary6odjpVPXIighAE2L\r\nContent-Dispositi
 
 : 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
 
@@ -77,3 +77,11 @@ SYMBOL: mime-test-server
     [
     ] 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
+