X-Git-Url: http://git.scottworley.com/tablify/blobdiff_plain/06a6a5cad195d0b7504c4e7b4caf085487f53578..14a039db4c850c41ca1cd72c692afe59d6d1347b:/src/lib.rs?ds=sidebyside diff --git a/src/lib.rs b/src/lib.rs index 73e517b..744dc66 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -138,7 +138,7 @@ impl>> Iterator for Reader InputLine::Blank if self.row.is_some() => { return Ok(std::mem::take(&mut self.row).map(Rowlike::Row)).transpose() } - InputLine::Blank => {} + InputLine::Blank => return Some(Ok(Rowlike::Spacer)), InputLine::Entry(col, instance) => match &mut self.row { None => { return Some(Err(std::io::Error::other(format!( @@ -410,6 +410,22 @@ mod tests { }) ] ); + assert_eq!( + read_rows(&b"foo\n\n\nbar\n"[..]) + .flatten() + .collect::>(), + vec![ + Rowlike::Row(Row { + label: "foo".to_owned(), + entries: HashMap::new(), + }), + Rowlike::Spacer, + Rowlike::Row(Row { + label: "bar".to_owned(), + entries: HashMap::new(), + }) + ] + ); assert_eq!( read_rows(&b"foo\n \nbar\n"[..]) .flatten()