fix parseMethod
This commit is contained in:
parent
2735d8e089
commit
887af8e41a
|
@ -50,7 +50,7 @@ proc parseKeyword(input: string,
|
|||
packet: var PsycPacket): tuple[complete: bool, value: string] =
|
||||
assert(packet.cursor < input.len())
|
||||
proc validate(c: char): bool = c == '_' or c.isAlphaNumeric()
|
||||
result = input.getUntil([' ', '\t'], packet, validate)
|
||||
result = input.getUntil([' ', '\t', '\n'], packet, validate)
|
||||
if result.complete:
|
||||
packet.cursor.inc()
|
||||
if result.value.isNil() or result.value.len() == 0 or result.value[0] != '_':
|
||||
|
@ -293,4 +293,10 @@ 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"
|
||||
while packet.state != ParseState.Complete:
|
||||
discard parse(input, packet)
|
||||
check(packet.methodName == "_hello_world")
|
||||
|
||||
echo "parser tests completed"
|
||||
|
|
Loading…
Reference in New Issue