test data and content length
This commit is contained in:
parent
887af8e41a
commit
bb8f7bd016
12
parse.nim
12
parse.nim
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue