From 75bb888a36b5fdc005a0661c964779d6e0277298 Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Sun, 18 Aug 2024 23:46:55 -0700 Subject: [PATCH 1/1] read_rows() lies --- src/lib.rs | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 820f43e..0e2007d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,37 @@ +#[cfg(test)] +use std::iter::Iterator; + +#[derive(Debug, PartialEq, Eq)] +struct RowInput { + label: String, + entries: Vec, +} + +#[cfg(test)] +fn read_rows(_input: &impl std::io::Read) -> impl Iterator { + vec![RowInput { + label: String::from("foo"), + entries: vec![], + }] + .into_iter() +} + pub fn tablify(_input: &impl std::io::Read) -> String { String::from("Hello, world!") } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_read_rows() { + assert_eq!( + read_rows(&&b"foo"[..]).collect::>(), + vec![RowInput { + label: String::from("foo"), + entries: vec![] + }] + ); + } +} -- 2.44.1