(module byteslike mzscheme (require "../byteslike.ss" (planet "test.ss" ("schematics" "schemeunit.plt" 1))) (provide byteslike-test) (define byteslike-test (make-test-suite "byteslike.ss" (make-test-case "byteslike?" (assert-true (byteslike? "")) (assert-true (byteslike? #"a")) (assert-false (byteslike? 5)) (assert-false (byteslike? 'hello)) (assert-false (byteslike? (bytes->path #"a")))) (make-test-case "byteslike->string" (assert-equal? (byteslike->string "hello") "hello") (assert-equal? (byteslike->string #"hello") "hello") (assert-exn exn:fail:contract? (lambda () (byteslike->string 'a)))) (make-test-case "byteslike->bytes" (assert-equal? (byteslike->bytes "hello") #"hello") (assert-equal? (byteslike->bytes #"hello") #"hello") (assert-exn exn:fail:contract? (lambda () (byteslike->bytes 'hello)))) (make-test-case "byteslike-append" (assert-equal? (byteslike-append "a" #"b" #"c") #"abc") (assert-equal? (byteslike-append) #"")))) )