test data and content length

This commit is contained in:
lurchi 2018-08-17 00:24:22 +02:00
parent 887af8e41a
commit bb8f7bd016
No known key found for this signature in database
GPG Key ID: 8241BE099775A097
1 changed files with 10 additions and 2 deletions

View File

@ -293,10 +293,18 @@ suite "parser tests":
check(packet.entityHeader[0] == Modifier(op: ':', name: "_hello", value: "world"))
check(packet.entityHeader[1] == Modifier(op: ':', name: "_hallo", value: "welt"))
test "method":
let input = ":_target\talice\n\n_hello_world\n|\n"
test "method/data":
let input = ":_target\talice\n\n_hello_world\nHello Alice!\n|\n"
while packet.state != ParseState.Complete:
discard parse(input, packet)
check(packet.methodName == "_hello_world")
check(packet.data == "Hello Alice!")
test "content length":
let input = ":_target\talice\n25\n_hello_world\nHello Alice!\n|\n"
while packet.state != ParseState.Complete:
discard parse(input, packet)
check(packet.contentLength == 25)
check(packet.data == "Hello Alice!")
echo "parser tests completed"