aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/logbag.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/logbag.rs b/src/logbag.rs
index b08098a..6575ecd 100644
--- a/src/logbag.rs
+++ b/src/logbag.rs
@@ -105,6 +105,7 @@ impl FromStr for LogBag {
lines.map(ToString::to_string).collect::<Vec<_>>(),
)
})
+ .filter(|(cat, lines)| !cat.is_empty() && !lines.is_empty())
.collect();
Ok(LogBag { data })
}
@@ -147,6 +148,11 @@ mod test {
}
#[test]
+ fn parse_empty() {
+ assert_eq!(LogBag::parse_plain(""), Some(LogBag::new()));
+ }
+
+ #[test]
fn parse_single() {
let mut logbag = LogBag::new();
logbag.insert("cat 1", "line 1".to_string());