diff --git a/proptest-regressions/message.txt b/proptest-regressions/message.txt new file mode 100644 index 0000000..87b8d47 --- /dev/null +++ b/proptest-regressions/message.txt @@ -0,0 +1,7 @@ +# Seeds for failure cases proptest has generated in the past. It is +# automatically read and these particular cases re-run before any +# novel cases are generated. +# +# It is recommended to check this file in to source control so that +# everyone who runs the test benefits from these saved cases. +cc 19cc356a7360943bfb23bdff0f579425f8957a37395bc952950f8f2250d047a3 # shrinks to line = "0 :\t" diff --git a/src/message.rs b/src/message.rs index 5cdb3b1..bc0d002 100644 --- a/src/message.rs +++ b/src/message.rs @@ -48,7 +48,7 @@ impl Message { /// Parse one wire line. Returns `None` for an empty/garbage line. pub fn parse(line: &str) -> Option { - let mut rest = line.trim_start(); + let mut rest = line.trim_start_matches(' '); // IRCv3 message tags — keep the client-only (`+`) tags for relay, drop the rest. let mut ctags = String::new(); @@ -71,18 +71,18 @@ pub fn parse(line: &str) -> Option { .find_map(|t| t.strip_prefix("batch=")) .map(|v| v.to_string()); concat = tags.split(';').any(|t| t == "draft/multiline-concat"); - rest = r.trim_start(); + rest = r.trim_start_matches(' '); } let mut source = None; if let Some(after_colon) = rest.strip_prefix(':') { let (src, r) = after_colon.split_once(' ')?; source = Some(src.to_string()); - rest = r.trim_start(); + rest = r.trim_start_matches(' '); } let (cmd, mut rest) = match rest.split_once(' ') { - Some((c, r)) => (c, r.trim_start()), + Some((c, r)) => (c, r.trim_start_matches(' ')), None => (rest, ""), }; if cmd.is_empty() { @@ -98,7 +98,7 @@ pub fn parse(line: &str) -> Option { match rest.split_once(' ') { Some((p, r)) => { params.push(p.to_string()); - rest = r.trim_start(); + rest = r.trim_start_matches(' '); } None => { params.push(rest.to_string());