A note to my future self

It’s important to capture the current behaviour, even if it ends up being totally wrong.
This commit is contained in:
Benjamin Sago 2017-09-28 18:59:51 +01:00
parent 108dc80944
commit 476299e21f

View File

@ -74,6 +74,8 @@ where I: Iterator<Item=&'a str>
let iter = iter.filter(|el| !el.is_empty());
let iter = iter.filter(|el| !el.starts_with("#"));
// TODO: Figure out if this should trim whitespace or not
// Errors are currently being ignored... not a good look
IgnorePatterns::parse_from_iter(iter).0
}
@ -114,6 +116,13 @@ mod test {
assert_eq!(patterns, file_lines_to_patterns(stuff.into_iter()));
}
#[test]
fn parse_some_whitespacey_lines() {
let stuff = vec![ " *.mp3", " ", " a ", "README.md " ];
let reals = vec![ " *.mp3", " ", " a ", "README.md " ];
let (patterns, _) = IgnorePatterns::parse_from_iter(reals.into_iter());
assert_eq!(patterns, file_lines_to_patterns(stuff.into_iter()));
}