(load-relative "../netstring") (import netstring) (use test) (test "12:hello, world," (string->netstring "hello, world")) (test "0:," (string->netstring "")) (test "hello, world" (netstring->string "12:hello, world,")) (test "" (netstring->string "0:,")) (test "3:foo," (with-output-to-string (lambda () (netstring-write "foo")))) (test "foo" (with-input-from-string "3:foo," netstring-read)) (test-error (netstring->string "foo")) (test-error (netstring->string "3 foo,")) (test-error (netstring->string "4:foo,")) (test-error (netstring->string "3:foo"))