(module io-test mzscheme (require (planet "test.ss" ("schematics" "schemeunit.plt" 2))) (require "io.ss") (provide io-tests) (define io-tests (test-suite "All tests for io" (test-case "read-http-line" (check bytes=? (read-http-line (open-input-bytes #"hello\r\n")) #"hello") (check bytes=? (read-http-line (open-input-bytes #"hel\rlo\r\n")) #"hel\rlo")) (test-case "read-n-bytes" (check bytes=? (read-n-bytes (open-input-bytes #"123456") 3) #"123")) (test-case "write-http-line" (let ([op (open-output-bytes)]) (write-http-line op #"foobar") (check bytes=? (get-output-bytes op) #"foobar\r\n"))) )) )