]> git.scottworley.com Git - tablify/blob - src/lib.rs
read_rows() lies
[tablify] / src / lib.rs
1 #[cfg(test)]
2 use std::iter::Iterator;
3
4 #[derive(Debug, PartialEq, Eq)]
5 struct RowInput {
6 label: String,
7 entries: Vec<String>,
8 }
9
10 #[cfg(test)]
11 fn read_rows(_input: &impl std::io::Read) -> impl Iterator<Item = RowInput> {
12 vec![RowInput {
13 label: String::from("foo"),
14 entries: vec![],
15 }]
16 .into_iter()
17 }
18
19 pub fn tablify(_input: &impl std::io::Read) -> String {
20 String::from("Hello, world!")
21 }
22
23 #[cfg(test)]
24 mod tests {
25 use super::*;
26
27 #[test]
28 fn test_read_rows() {
29 assert_eq!(
30 read_rows(&&b"foo"[..]).collect::<Vec<_>>(),
31 vec![RowInput {
32 label: String::from("foo"),
33 entries: vec![]
34 }]
35 );
36 }
37 }