Compare commits

..

1 Commits

Author SHA1 Message Date
Davide Polonio 84e5c0c341 feat: improve formatting output
* duration is now in human readable format
* list of artists is now capped at 140 chars max
2021-11-13 17:20:17 +01:00
1 changed files with 0 additions and 15 deletions

View File

@ -2,10 +2,6 @@ use std::ops::Add;
use std::time::Duration;
pub(crate) fn truncate_with_dots(to_truncate: String, new_size: usize) -> String {
if to_truncate.len() < new_size {
return to_truncate;
}
let mut new_string = to_truncate.clone();
let dots = "...";
if new_size as isize - 3 > 0 {
@ -62,17 +58,6 @@ mod test {
)
}
#[test]
fn should_not_truncate_if_string_is_not_long_enough() {
let example_string = "short string";
let expected_string = "short string";
assert_eq!(
expected_string,
truncate_with_dots(example_string.to_string(), 1000)
);
}
#[test]
fn should_print_correct_duration_into_human_readable_format() {
let duration: Duration = Duration::new(124, 0);