+ vec![(2, String::from("baz")), (1, String::from("bar"))]
+ );
+ assert_eq!(
+ column_counts(
+ &read_rows(&b"foo\n bar: 1\n bar: 2\n baz\n bar\nquux\n baz"[..])
+ .collect::<Result<Vec<_>, _>>()
+ .unwrap()
+ ),
+ vec![(2, String::from("baz")), (1, String::from("bar"))]
+ );
+ }
+
+ #[test]
+ fn test_render_cell() {
+ assert_eq!(
+ render_cell(
+ "foo",
+ &RowInput {
+ label: String::from("nope"),
+ entries: vec![]
+ }
+ ),
+ String::from("<td class=\"\" onmouseover=\"h2('nope','foo')\" onmouseout=\"ch2('nope','foo')\"></td>")
+ );
+ assert_eq!(
+ render_cell(
+ "foo",
+ &RowInput {
+ label: String::from("nope"),
+ entries: vec![Entry::from("bar")]
+ }
+ ),
+ String::from("<td class=\"\" onmouseover=\"h2('nope','foo')\" onmouseout=\"ch2('nope','foo')\"></td>")
+ );
+ assert_eq!(
+ render_cell(
+ "foo",
+ &RowInput {
+ label: String::from("nope"),
+ entries: vec![Entry::from("foo")]
+ }
+ ),
+ String::from("<td class=\"yes\" onmouseover=\"h2('nope','foo')\" onmouseout=\"ch2('nope','foo')\"></td>")
+ );
+ assert_eq!(
+ render_cell(
+ "foo",
+ &RowInput {
+ label: String::from("nope"),
+ entries: vec![Entry::from("foo"), Entry::from("foo")]
+ }
+ ),
+ String::from("<td class=\"yes\" onmouseover=\"h2('nope','foo')\" onmouseout=\"ch2('nope','foo')\">2</td>")
+ );
+ assert_eq!(
+ render_cell(
+ "foo",
+ &RowInput {
+ label: String::from("nope"),
+ entries: vec![Entry::from("foo: 5"), Entry::from("foo: 10")]
+ }
+ ),
+ String::from("<td class=\"yes\" onmouseover=\"h2('nope','foo')\" onmouseout=\"ch2('nope','foo')\">5 10</td>")
+ );
+ assert_eq!(
+ render_cell(
+ "foo",
+ &RowInput {
+ label: String::from("nope"),
+ entries: vec![Entry::from("foo: 5"), Entry::from("foo")]
+ }
+ ),
+ String::from("<td class=\"yes\" onmouseover=\"h2('nope','foo')\" onmouseout=\"ch2('nope','foo')\">5 ✓</td>")