Skip to content
Snippets Groups Projects
Commit bb1fe9cc authored by marijnh's avatar marijnh
Browse files

add failing test when an almost-boundary marker is encountered

Ignore-this: a2e9a3db24f62886a0410cb6a77e50b9

darcs-hash:3d0b1d18b470e1f25e3cc86a9b816eea312aab55
parent 510bfa3c
No related branches found
No related tags found
No related merge requests found
abc
--123456
--12345678
abc
--123456
--12345678--
......@@ -150,6 +150,30 @@ hello, world!" (get-output-stream-string hello-world))))))
(is (string= "text/plain" (content-type (second parts)))))
(is (= 2 (length parts))))))
(defun test-read-until-boundary (file)
(let ((more-data nil))
(values
(with-output-to-string (out)
(with-input-from-file (mime (data-file file) :element-type '(unsigned-byte 8))
(setf more-data
(rfc2388::read-until-next-boundary mime (rfc2388::ascii-string-to-boundary-array "12345678")
(lambda (byte) (write-char (code-char byte) out))))))
more-data)))
(test read-until-next-boundary
(multiple-value-bind (content more-data) (test-read-until-boundary "mime10")
(if (and (string= content (format nil "abc~A~A--123456" #\return #\newline))
more-data)
(pass)
(fail))))
(test read-until-next-boundary2
(multiple-value-bind (content more-data) (test-read-until-boundary "mime11")
(if (and (string= content (format nil "abc~A~A--123456" #\return #\newline))
(not more-data))
(pass)
(fail))))
(test read-mime-multipart
(with-input-from-file (mime (data-file "mime6") :element-type '(unsigned-byte 8))
(read-mime mime "AaB03x" #'simple-test-callback)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment