diff --git a/lib/configparser/src/config.rs b/lib/configparser/src/config.rs index 296b3c1d67..324ffb91b2 100644 --- a/lib/configparser/src/config.rs +++ b/lib/configparser/src/config.rs @@ -265,7 +265,7 @@ impl ConfigSet { while pos < buf.len() { match buf[pos] { - b'\n' | b'\r' => pos += 1, + b'\n' | b'\r' | b' ' | b'\t' => pos += 1, b'[' => { let section_start = pos + 1; match memchr(b']', &buf.as_ref()[section_start..]) { @@ -653,6 +653,18 @@ mod tests { assert_eq!(sources[1].location().unwrap(), (PathBuf::new(), 52..53)); } + #[test] + fn test_parse_spaces() { + let mut cfg = ConfigSet::new(); + cfg.parse( + "[a]\n\ + \t#\n\ + x=1", + &"".into(), + ); + assert_eq!(cfg.get("a", "x"), Some("1".into())); + } + #[test] fn test_parse_errors() { let mut cfg = ConfigSet::new();