1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
pub use buffers::{Buffer, MessageBuffer, TagBuffer};
pub use command::Command;
pub use message::{
MESSAGE_LENGTH,
Message,
PARAMS_LENGTH,
Tag,
tag_escape,
tags,
};
mod buffers;
mod command;
mod message;
pub mod mode;
pub mod rpl;
pub fn assert_msg(msg: &Message<'_>, prefix: Option<&str>, command: Result<Command, &str>,
params: &[&str])
{
assert_eq!(msg.prefix, prefix, "prefix of {:?}", msg);
assert_eq!(msg.command, command, "command of {:?}", msg);
assert_eq!(msg.num_params, params.len(), "number of parameters of {:?}", msg);
for (i, (actual, expected)) in msg.params.iter().zip(params.iter()).enumerate() {
if expected.is_empty() {
continue;
}
assert_eq!(actual, expected, "parameter #{} of {:?}", i, msg);
}
}