From bb8f7bd0169924e4bcd309f81160442e20e3ff25 Mon Sep 17 00:00:00 2001 From: lurchi Date: Fri, 17 Aug 2018 00:24:22 +0200 Subject: [PATCH] test data and content length --- parse.nim | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/parse.nim b/parse.nim index 93577cb..3db93d8 100644 --- a/parse.nim +++ b/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"