1
0
Fork 0
mirror of git://git.psyc.eu/libpsyc synced 2024-08-15 03:19:02 +00:00

add test: multiple packets in one buffer

This commit is contained in:
lurchi 2017-01-03 17:18:07 +01:00
parent 5d7bdfd7be
commit 99b86d3faa

View file

@ -86,3 +86,32 @@ fn test_insufficient() {
assert_eq!(parser.parse(&test_data1).unwrap(), expected[3]);
assert_eq!(parser.parse(&test_data1).unwrap(), expected[4]);
}
#[test]
fn test_multiple() {
let test_data = b":_target\tpsyc://ve.symlynx.com/@blog\n\n?\n|\n:_target\tpsyc://ve.symlynx.com/@blog\n\n_test_method\n|\n";
let expected = vec![PsycParserResult::RoutingModifier {
operator: ':',
name: b"_target",
value: b"psyc://ve.symlynx.com/@blog"
},
PsycParserResult::StateSync,
PsycParserResult::Complete,
PsycParserResult::RoutingModifier {
operator: ':',
name: b"_target",
value: b"psyc://ve.symlynx.com/@blog"
},
PsycParserResult::Body {
method: b"_test_method",
data: b""
},
PsycParserResult::Complete];
let mut parser = PsycParser::new();
for e in expected {
assert_eq!(parser.parse(test_data).unwrap(), e);
}
}