adequate tabulate tests
This commit is contained in:
parent
4116e77a68
commit
c83552af61
|
@ -109,8 +109,8 @@ mod tests {
|
|||
#[test]
|
||||
fn test_text_output() {
|
||||
let mut tabs = Tabulate::with_columns(vec![
|
||||
Col::min_width("Fri Oct 03, 2008".len()).and_alignment(Left),
|
||||
Col::min_width("12:00:00 - 14:00:00".len()).and_alignment(Left),
|
||||
Col::min_width("Fri Oct 03, 2008 ".len()).and_alignment(Left),
|
||||
Col::min_width("12:00:00 - 14:00:00 ".len()).and_alignment(Left),
|
||||
Col::min_width("Duration".len()).and_alignment(Right),
|
||||
Col::min_width("Notes".len()).and_alignment(Left),
|
||||
]);
|
||||
|
@ -201,51 +201,51 @@ Total 52:00:00
|
|||
#[test]
|
||||
fn test_text_output_long_note_default_with() {
|
||||
let mut tabs = Tabulate::with_columns(vec![
|
||||
Col::min_width("Fri Oct 03, 2008".len()).and_alignment(Left),
|
||||
Col::min_width("12:00:00 - 14:00:00".len()).and_alignment(Left),
|
||||
Col::min_width("Fri Oct 03, 2008 ".len()).and_alignment(Left),
|
||||
Col::min_width("12:00:00 - 14:00:00 ".len()).and_alignment(Left),
|
||||
Col::min_width("Duration".len()).and_alignment(Right),
|
||||
Col::min_width("Notes".len()).and_alignment(Left),
|
||||
]);
|
||||
|
||||
tabs.feed(vec!["Day".into(), "Start End".into(), "Duration".into(), "Notes".into()]);
|
||||
tabs.feed(vec!["Sun Oct 05, 2008".into(), "16:00:00 - 18:00:00".into(), LONG_NOTE.into()]);
|
||||
tabs.feed(vec!["Sun Oct 05, 2008".into(), "16:00:00 - 18:00:00".into(), "2:00:00".into(), LONG_NOTE.into()]);
|
||||
tabs.feed(vec!["".into(), "".into(), "2:00:00".into(), "".into()]);
|
||||
tabs.separator('-');
|
||||
tabs.feed(vec!["Total".into(), "".into(), "2:00:00".into(), "".into()]);
|
||||
tabs.feed(vec!["Total".into(), "".into(), "2:00:00".into(), "".into()]);
|
||||
|
||||
assert_eq!(PrettyString(&tabs.print()), PrettyString("\
|
||||
Day Start End Duration Notes
|
||||
Sun Oct 05, 2008 16:00:00 - 18:00:00 2:00:00 chatting with bob about upcoming task,
|
||||
district sharing of images, how the user
|
||||
settings currently works etc. Discussing the
|
||||
fingerprinting / cache busting issue with
|
||||
CKEDITOR, suggesting perhaps looking into
|
||||
forking the rubygem and seeing if we can work
|
||||
in our own changes, however hard that might
|
||||
be.
|
||||
2:00:00
|
||||
-----------------------------------------------------------------------------------------------
|
||||
Total 2:00:00
|
||||
Day Start End Duration Notes
|
||||
Sun Oct 05, 2008 16:00:00 - 18:00:00 2:00:00 chatting with bob about upcoming task,
|
||||
district sharing of images, how the user
|
||||
settings currently works etc. Discussing the
|
||||
fingerprinting / cache busting issue with
|
||||
CKEDITOR, suggesting perhaps looking into
|
||||
forking the rubygem and seeing if we can work
|
||||
in our own changes, however hard that might
|
||||
be.
|
||||
2:00:00
|
||||
-----------------------------------------------------------------------------------------------
|
||||
Total 2:00:00
|
||||
"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_text_output_long_note_with_ids() {
|
||||
let mut tabs = Tabulate::with_columns(vec![
|
||||
Col::min_width("Fri Oct 03, 2008".len()).and_alignment(Left),
|
||||
Col::min_width("12:00:00 - 14:00:00".len()).and_alignment(Left),
|
||||
Col::min_width(2).and_alignment(Right),
|
||||
Col::min_width("Fri Oct 03, 2008 ".len()).and_alignment(Left),
|
||||
Col::min_width("12:00:00 - 14:00:00 ".len()).and_alignment(Left),
|
||||
Col::min_width("Duration".len()).and_alignment(Right),
|
||||
Col::min_width("Notes".len()).and_alignment(Left),
|
||||
]);
|
||||
|
||||
tabs.feed(vec!["ID".into(), "Day".into(), "Start End".into(), "Duration".into(), "Notes".into()]);
|
||||
tabs.feed(vec!["60000".into(), "Sun Oct 05, 2008".into(), "16:00:00 - 18:00:00".into(), "2:00:00".into(), LONG_NOTE.into()]);
|
||||
tabs.feed(vec!["".into(), "".into(), "2:00:00".into(), "".into()]);
|
||||
tabs.feed(vec!["".into(), "".into(), "".into(), "2:00:00".into(), "".into()]);
|
||||
tabs.separator('-');
|
||||
tabs.feed(vec!["".into(), "Total".into(), "".into(), "".into(), "2:00:00".into()]);
|
||||
tabs.feed(vec!["".into(), "Total".into(), "".into(), "2:00:00".into()]);
|
||||
|
||||
assert_eq!(PrettyString(&tabs.print()), PrettyString("\
|
||||
ID Day Start End Duration Notes
|
||||
assert_eq!(PrettyString(&tabs.print()), PrettyString(" ID Day Start End Duration Notes
|
||||
60000 Sun Oct 05, 2008 16:00:00 - 18:00:00 2:00:00 chatting with bob about upcoming task,
|
||||
district sharing of images, how the user
|
||||
settings currently works etc. Discussing the
|
||||
|
@ -263,8 +263,8 @@ Total 52:00:00
|
|||
#[test]
|
||||
fn test_text_output_note_with_line_breaks() {
|
||||
let mut tabs = Tabulate::with_columns(vec![
|
||||
Col::min_width("Fri Oct 03, 2008".len()).and_alignment(Left),
|
||||
Col::min_width("12:00:00 - 14:00:00".len()).and_alignment(Left),
|
||||
Col::min_width("Fri Oct 03, 2008 ".len()).and_alignment(Left),
|
||||
Col::min_width("12:00:00 - 14:00:00 ".len()).and_alignment(Left),
|
||||
Col::min_width("Duration".len()).and_alignment(Right),
|
||||
Col::min_width("Notes".len()).and_alignment(Left),
|
||||
]);
|
||||
|
@ -276,12 +276,12 @@ Total 52:00:00
|
|||
tabs.feed(vec!["Total".into(), "".into(), "2:00:00".into(), "".into()]);
|
||||
|
||||
assert_eq!(PrettyString(&tabs.print()), PrettyString("\
|
||||
Day Start End Duration Notes
|
||||
Sun Oct 05, 2008 16:00:00 - 18:00:00 2:00:00 first line
|
||||
and a second line
|
||||
2:00:00
|
||||
-------------------------------------------------------------------
|
||||
Total 2:00:00
|
||||
Day Start End Duration Notes
|
||||
Sun Oct 05, 2008 16:00:00 - 18:00:00 2:00:00 first line
|
||||
and a second line
|
||||
2:00:00
|
||||
-------------------------------------------------------------------
|
||||
Total 2:00:00
|
||||
"));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue