some clippy lints
This commit is contained in:
parent
01b198953f
commit
8b6d9be92e
|
@ -6,7 +6,7 @@ path = "src/main.rs"
|
|||
name = "tiempo"
|
||||
repository = "https://gitlab.com/categulario/tiempo-rs"
|
||||
authors = ["Abraham Toriz <categulario@gmail.com>"]
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
description = "A command line time tracker"
|
||||
license = "GPL-3.0"
|
||||
documentation = "https://gitlab.com/categulario/tiempo-rs"
|
||||
|
|
|
@ -29,8 +29,8 @@ impl<'a> TryFrom<&'a ArgMatches<'a>> for Args {
|
|||
|
||||
fn try_from(matches: &'a ArgMatches) -> Result<Self> {
|
||||
Ok(Args {
|
||||
start: matches.value_of("start").map(|s| parse_time(s)).transpose()?,
|
||||
end: matches.value_of("end").map(|s| parse_time(s)).transpose()?,
|
||||
start: matches.value_of("start").map(parse_time).transpose()?,
|
||||
end: matches.value_of("end").map(parse_time).transpose()?,
|
||||
grep: matches.value_of("grep").map(parse_regex).transpose()?,
|
||||
fake: matches.is_present("fake"),
|
||||
sheet: matches.value_of("sheet").map(|s| s.to_owned()),
|
||||
|
|
|
@ -104,8 +104,8 @@ impl<'a> TryFrom<&'a ArgMatches<'a>> for Args {
|
|||
fn try_from(matches: &'a ArgMatches) -> Result<Args> {
|
||||
Ok(Args {
|
||||
ids: matches.is_present("ids"),
|
||||
start: matches.value_of("start").map(|s| parse_time(s)).transpose()?,
|
||||
end: matches.value_of("end").map(|s| parse_time(s)).transpose()?,
|
||||
start: matches.value_of("start").map(parse_time).transpose()?,
|
||||
end: matches.value_of("end").map(parse_time).transpose()?,
|
||||
format: matches.value_of("format").map(|v| v.parse()).transpose()?,
|
||||
grep: matches.value_of("grep").map(parse_regex).transpose()?,
|
||||
sheet: matches.value_of("sheet").map(|s| s.parse()).transpose()?,
|
||||
|
@ -185,8 +185,8 @@ mod tests {
|
|||
let mut streams = Streams::fake(b"");
|
||||
let facts = Facts::new();
|
||||
|
||||
streams.db.entry_insert(Utc.ymd(2021, 6, 30).and_hms(10, 0, 0), None, Some("hola".into()), "default".into()).unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 6, 30).and_hms(10, 10, 0), None, Some("hola".into()), "default".into()).unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 6, 30).and_hms(10, 0, 0), None, Some("hola".into()), "default").unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 6, 30).and_hms(10, 10, 0), None, Some("hola".into()), "default").unwrap();
|
||||
|
||||
DisplayCommand::handle(args, &mut streams, &facts).unwrap();
|
||||
|
||||
|
@ -205,8 +205,8 @@ mod tests {
|
|||
let mut streams = Streams::fake(b"");
|
||||
let facts = Facts::new();
|
||||
|
||||
streams.db.entry_insert(Utc.ymd(2021, 6, 30).and_hms(10, 0, 0), None, Some("hola".into()), "default".into()).unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 6, 30).and_hms(10, 10, 0), None, Some("adios".into()), "default".into()).unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 6, 30).and_hms(10, 0, 0), None, Some("hola".into()), "default").unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 6, 30).and_hms(10, 10, 0), None, Some("adios".into()), "default").unwrap();
|
||||
|
||||
entries_for_display(None, None, None, &mut streams, Formatter::Csv, true, Some("io".parse().unwrap()), &facts).unwrap();
|
||||
|
||||
|
@ -230,9 +230,9 @@ mod tests {
|
|||
let facts = Facts::new();
|
||||
std::env::set_var("TZ", "CST+6");
|
||||
|
||||
streams.db.entry_insert(Utc.ymd(2021, 6, 30).and_hms(10, 0, 0), Some(Utc.ymd(2021, 6, 30).and_hms(11, 0, 0)), None, "sheet1".into()).unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 6, 30).and_hms(11, 0, 0), Some(Utc.ymd(2021, 6, 30).and_hms(12, 0, 0)), None, "sheet2".into()).unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 6, 30).and_hms(12, 0, 0), Some(Utc.ymd(2021, 6, 30).and_hms(13, 0, 0)), None, "sheet1".into()).unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 6, 30).and_hms(10, 0, 0), Some(Utc.ymd(2021, 6, 30).and_hms(11, 0, 0)), None, "sheet1").unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 6, 30).and_hms(11, 0, 0), Some(Utc.ymd(2021, 6, 30).and_hms(12, 0, 0)), None, "sheet2").unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 6, 30).and_hms(12, 0, 0), Some(Utc.ymd(2021, 6, 30).and_hms(13, 0, 0)), None, "sheet1").unwrap();
|
||||
|
||||
DisplayCommand::handle(args, &mut streams, &facts).unwrap();
|
||||
|
||||
|
@ -265,9 +265,9 @@ Timesheet: sheet2
|
|||
let facts = Facts::new();
|
||||
std::env::set_var("TZ", "CST+6");
|
||||
|
||||
streams.db.entry_insert(Utc.ymd(2021, 6, 30).and_hms(10, 0, 0), Some(Utc.ymd(2021, 6, 30).and_hms(11, 0, 0)), None, "sheet1".into()).unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 6, 30).and_hms(11, 0, 0), Some(Utc.ymd(2021, 6, 30).and_hms(12, 0, 0)), None, "_sheet2".into()).unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 6, 30).and_hms(12, 0, 0), Some(Utc.ymd(2021, 6, 30).and_hms(13, 0, 0)), None, "sheet1".into()).unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 6, 30).and_hms(10, 0, 0), Some(Utc.ymd(2021, 6, 30).and_hms(11, 0, 0)), None, "sheet1").unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 6, 30).and_hms(11, 0, 0), Some(Utc.ymd(2021, 6, 30).and_hms(12, 0, 0)), None, "_sheet2").unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 6, 30).and_hms(12, 0, 0), Some(Utc.ymd(2021, 6, 30).and_hms(13, 0, 0)), None, "sheet1").unwrap();
|
||||
|
||||
DisplayCommand::handle(args, &mut streams, &facts).unwrap();
|
||||
|
||||
|
@ -333,8 +333,8 @@ Timesheet: sheet1
|
|||
..Default::default()
|
||||
});
|
||||
|
||||
streams.db.entry_insert(Utc.ymd(2021, 6, 30).and_hms(10, 0, 0), None, Some("hola".into()), "default".into()).unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 6, 30).and_hms(10, 10, 0), None, Some("hola".into()), "default".into()).unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 6, 30).and_hms(10, 0, 0), None, Some("hola".into()), "default").unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 6, 30).and_hms(10, 10, 0), None, Some("hola".into()), "default").unwrap();
|
||||
|
||||
DisplayCommand::handle(args, &mut streams, &facts).unwrap();
|
||||
|
||||
|
|
|
@ -38,8 +38,8 @@ impl<'a> TryFrom<&'a ArgMatches<'a>> for Args {
|
|||
fn try_from(matches: &'a ArgMatches) -> Result<Self> {
|
||||
Ok(Args {
|
||||
id: matches.value_of("id").map(|i| i.parse().unwrap()),
|
||||
start: matches.value_of("start").map(|s| parse_time(s)).transpose()?,
|
||||
end: matches.value_of("end").map(|s| parse_time(s)).transpose()?,
|
||||
start: matches.value_of("start").map(parse_time).transpose()?,
|
||||
end: matches.value_of("end").map(parse_time).transpose()?,
|
||||
append: matches.is_present("append"),
|
||||
r#move: matches.value_of("move").map(|s| s.into()),
|
||||
note: matches.value_of("note").map(|s| s.into()),
|
||||
|
@ -348,7 +348,7 @@ mod tests {
|
|||
SqliteDatabase::from_path(&database_file).unwrap()
|
||||
);
|
||||
let now = Utc.ymd(2021, 8, 3).and_hms(20, 29, 0);
|
||||
let new_end = Utc.ymd(2021, 06, 29).and_hms(14, 26, 52);
|
||||
let new_end = Utc.ymd(2021, 6, 29).and_hms(14, 26, 52);
|
||||
let args = Args {
|
||||
end: Some(new_end),
|
||||
..Default::default()
|
||||
|
|
|
@ -23,7 +23,7 @@ impl<'a> TryFrom<&'a ArgMatches<'a>> for Args {
|
|||
|
||||
fn try_from(matches: &'a ArgMatches) -> Result<Self> {
|
||||
Ok(Args {
|
||||
at: matches.value_of("at").map(|s| parse_time(s)).transpose()?,
|
||||
at: matches.value_of("at").map(parse_time).transpose()?,
|
||||
note: matches.value_of("note").map(|s| s.into()),
|
||||
})
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ mod tests {
|
|||
let mut streams = Streams::fake(b"");
|
||||
let facts = Facts::new();
|
||||
|
||||
streams.db.entry_insert(facts.now, None, None, "default".into()).unwrap();
|
||||
streams.db.entry_insert(facts.now, None, None, "default").unwrap();
|
||||
|
||||
assert_eq!(streams.db.entries_full(None, None).unwrap().len(), 1);
|
||||
|
||||
|
|
|
@ -172,11 +172,11 @@ mod tests {
|
|||
streams.db.set_current_sheet("sheet2").unwrap();
|
||||
streams.db.set_last_sheet("sheet4").unwrap();
|
||||
|
||||
streams.db.entry_insert(Utc.ymd(2021, 1, 1).and_hms(0, 0, 0), Some(Utc.ymd(2021, 1, 1).and_hms(1, 0, 0)), None, "_archived".into()).unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 1, 1).and_hms(0, 0, 0), Some(Utc.ymd(2021, 1, 1).and_hms(10,13, 55)), None, "sheet1".into()).unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 1, 1).and_hms(0, 0, 0), Some(Utc.ymd(2021, 1, 1).and_hms(7, 39, 18)), None, "sheet3".into()).unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 1, 1).and_hms(12, 0, 0), Some(Utc.ymd(2021, 1, 1).and_hms(13, 52, 45)), None, "sheet3".into()).unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 1, 1).and_hms(12, 0, 0), None, None, "sheet4".into()).unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 1, 1).and_hms(0, 0, 0), Some(Utc.ymd(2021, 1, 1).and_hms(1, 0, 0)), None, "_archived").unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 1, 1).and_hms(0, 0, 0), Some(Utc.ymd(2021, 1, 1).and_hms(10,13, 55)), None, "sheet1").unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 1, 1).and_hms(0, 0, 0), Some(Utc.ymd(2021, 1, 1).and_hms(7, 39, 18)), None, "sheet3").unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 1, 1).and_hms(12, 0, 0), Some(Utc.ymd(2021, 1, 1).and_hms(13, 52, 45)), None, "sheet3").unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 1, 1).and_hms(12, 0, 0), None, None, "sheet4").unwrap();
|
||||
|
||||
let now = Utc.ymd(2021, 1, 1).and_hms(13, 52, 45);
|
||||
let facts = Facts::new().with_now(now);
|
||||
|
|
|
@ -162,8 +162,8 @@ mod tests {
|
|||
..Default::default()
|
||||
}).with_now(now);
|
||||
|
||||
streams.db.entry_insert(Utc.ymd(2021, 6, 30).and_hms(10, 0, 0), None, Some("hola".into()), "default".into()).unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 6, 30).and_hms(10, 10, 0), None, Some("hola".into()), "default".into()).unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 6, 30).and_hms(10, 0, 0), None, Some("hola".into()), "default").unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 6, 30).and_hms(10, 10, 0), None, Some("hola".into()), "default").unwrap();
|
||||
|
||||
MonthCommand::handle(args, &mut streams, &facts).unwrap();
|
||||
|
||||
|
|
|
@ -104,11 +104,11 @@ mod tests {
|
|||
streams.db.set_current_sheet("sheet2").unwrap();
|
||||
streams.db.set_last_sheet("sheet4").unwrap();
|
||||
|
||||
streams.db.entry_insert(Utc.ymd(2021, 1, 1).and_hms(0, 0, 0), Some(Utc.ymd(2021, 1, 1).and_hms(1, 0, 0)), None, "_archived".into()).unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 1, 1).and_hms(0, 0, 0), Some(Utc.ymd(2021, 1, 1).and_hms(10,13, 55)), None, "sheet1".into()).unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 1, 1).and_hms(0, 0, 0), Some(Utc.ymd(2021, 1, 1).and_hms(7, 39, 18)), None, "sheet3".into()).unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 1, 1).and_hms(12, 0, 0), Some(Utc.ymd(2021, 1, 1).and_hms(13, 52, 45)), None, "sheet3".into()).unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 1, 1).and_hms(12, 0, 0), None, Some("some".into()), "sheet4".into()).unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 1, 1).and_hms(0, 0, 0), Some(Utc.ymd(2021, 1, 1).and_hms(1, 0, 0)), None, "_archived").unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 1, 1).and_hms(0, 0, 0), Some(Utc.ymd(2021, 1, 1).and_hms(10,13, 55)), None, "sheet1").unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 1, 1).and_hms(0, 0, 0), Some(Utc.ymd(2021, 1, 1).and_hms(7, 39, 18)), None, "sheet3").unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 1, 1).and_hms(12, 0, 0), Some(Utc.ymd(2021, 1, 1).and_hms(13, 52, 45)), None, "sheet3").unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 1, 1).and_hms(12, 0, 0), None, Some("some".into()), "sheet4").unwrap();
|
||||
|
||||
NowCommand::handle(Default::default(), &mut streams, &facts).unwrap();
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ impl<'a> TryFrom<&'a ArgMatches<'a>> for Args {
|
|||
|
||||
fn try_from(matches: &'a ArgMatches) -> Result<Args> {
|
||||
Ok(Args {
|
||||
at: matches.value_of("at").map(|s| parse_time(s)).transpose()?,
|
||||
at: matches.value_of("at").map(parse_time).transpose()?,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ impl<'a> TryFrom<&'a ArgMatches<'a>> for Args {
|
|||
|
||||
fn try_from(matches: &'a ArgMatches) -> Result<Self> {
|
||||
Ok(Args {
|
||||
at: matches.value_of("at").map(|s| parse_time(s)).transpose()?,
|
||||
at: matches.value_of("at").map(parse_time).transpose()?,
|
||||
id: matches.value_of("id").map(|i| i.parse().unwrap()),
|
||||
})
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ impl<'a> TryFrom<&'a ArgMatches<'a>> for Args {
|
|||
fn try_from(matches: &'a ArgMatches) -> Result<Args> {
|
||||
Ok(Args {
|
||||
ids: matches.is_present("ids"),
|
||||
end: matches.value_of("end").map(|s| parse_time(s)).transpose()?,
|
||||
end: matches.value_of("end").map(parse_time).transpose()?,
|
||||
format: matches.value_of("format").map(|v| v.parse()).transpose()?,
|
||||
grep: matches.value_of("grep").map(parse_regex).transpose()?,
|
||||
sheet: matches.value_of("sheet").map(|s| s.parse()).transpose()?,
|
||||
|
@ -83,8 +83,8 @@ mod tests {
|
|||
..Default::default()
|
||||
}).with_now(Utc.ymd(2021, 6, 30).and_hms(11, 0, 0));
|
||||
|
||||
streams.db.entry_insert(Utc.ymd(2021, 6, 30).and_hms(10, 0, 0), None, Some("hola".into()), "default".into()).unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 6, 30).and_hms(10, 10, 0), None, Some("hola".into()), "default".into()).unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 6, 30).and_hms(10, 0, 0), None, Some("hola".into()), "default").unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 6, 30).and_hms(10, 10, 0), None, Some("hola".into()), "default").unwrap();
|
||||
|
||||
TodayCommand::handle(args, &mut streams, &facts).unwrap();
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ impl<'a> TryFrom<&'a ArgMatches<'a>> for Args {
|
|||
fn try_from(matches: &'a ArgMatches) -> Result<Args> {
|
||||
Ok(Args {
|
||||
ids: matches.is_present("ids"),
|
||||
end: matches.value_of("end").map(|s| parse_time(s)).transpose()?,
|
||||
end: matches.value_of("end").map(parse_time).transpose()?,
|
||||
format: matches.value_of("format").map(|v| v.parse()).transpose()?,
|
||||
grep: matches.value_of("grep").map(parse_regex).transpose()?,
|
||||
sheet: matches.value_of("sheet").map(|s| s.parse()).transpose()?,
|
||||
|
@ -143,8 +143,8 @@ mod tests {
|
|||
..Default::default()
|
||||
}).with_now(now);
|
||||
|
||||
streams.db.entry_insert(Utc.ymd(2021, 6, 30).and_hms(10, 0, 0), None, Some("hola".into()), "default".into()).unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 6, 30).and_hms(10, 10, 0), None, Some("hola".into()), "default".into()).unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 6, 30).and_hms(10, 0, 0), None, Some("hola".into()), "default").unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 6, 30).and_hms(10, 10, 0), None, Some("hola".into()), "default").unwrap();
|
||||
|
||||
WeekCommand::handle(args, &mut streams, &facts).unwrap();
|
||||
|
||||
|
|
|
@ -85,9 +85,9 @@ mod tests {
|
|||
let today = Local::now().date();
|
||||
let facts = Facts::new();
|
||||
|
||||
streams.db.entry_insert(two_days_ago.and_hms(1, 2, 3).with_timezone(&Utc), None, None, "default".into()).unwrap();
|
||||
streams.db.entry_insert(yesterday.and_hms(1, 2, 3).with_timezone(&Utc), None, Some("This!".into()), "default".into()).unwrap();
|
||||
streams.db.entry_insert(today.and_hms(1, 2, 3).with_timezone(&Utc), None, None, "default".into()).unwrap();
|
||||
streams.db.entry_insert(two_days_ago.and_hms(1, 2, 3).with_timezone(&Utc), None, None, "default").unwrap();
|
||||
streams.db.entry_insert(yesterday.and_hms(1, 2, 3).with_timezone(&Utc), None, Some("This!".into()), "default").unwrap();
|
||||
streams.db.entry_insert(today.and_hms(1, 2, 3).with_timezone(&Utc), None, None, "default").unwrap();
|
||||
|
||||
YesterdayCommand::handle(args, &mut streams, &facts).unwrap();
|
||||
|
||||
|
@ -113,8 +113,8 @@ mod tests {
|
|||
..Default::default()
|
||||
}).with_now(now);
|
||||
|
||||
streams.db.entry_insert(Utc.ymd(2021, 6, 30).and_hms(10, 0, 0), None, Some("hola".into()), "default".into()).unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 6, 30).and_hms(10, 10, 0), None, Some("hola".into()), "default".into()).unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 6, 30).and_hms(10, 0, 0), None, Some("hola".into()), "default").unwrap();
|
||||
streams.db.entry_insert(Utc.ymd(2021, 6, 30).and_hms(10, 10, 0), None, Some("hola".into()), "default").unwrap();
|
||||
|
||||
YesterdayCommand::handle(args, &mut streams, &facts).unwrap();
|
||||
|
||||
|
|
|
@ -331,12 +331,12 @@ mod tests {
|
|||
let mut db = SqliteDatabase::from_memory().unwrap();
|
||||
db.init().unwrap();
|
||||
|
||||
db.entry_insert(Utc.ymd(2021, 7, 7).and_hms(1, 0, 0), None, None, "XXX".into()).unwrap();
|
||||
db.entry_insert(Utc.ymd(2021, 7, 7).and_hms(1, 0, 0), None, None, "OOO".into()).unwrap();
|
||||
db.entry_insert(Utc.ymd(2021, 7, 7).and_hms(2, 0, 0), None, None, "XXX".into()).unwrap();
|
||||
db.entry_insert(Utc.ymd(2021, 7, 7).and_hms(2, 0, 0), None, None, "OOO".into()).unwrap();
|
||||
db.entry_insert(Utc.ymd(2021, 7, 7).and_hms(3, 0, 0), None, None, "XXX".into()).unwrap();
|
||||
db.entry_insert(Utc.ymd(2021, 7, 7).and_hms(3, 0, 0), None, None, "OOO".into()).unwrap();
|
||||
db.entry_insert(Utc.ymd(2021, 7, 7).and_hms(1, 0, 0), None, None, "XXX").unwrap();
|
||||
db.entry_insert(Utc.ymd(2021, 7, 7).and_hms(1, 0, 0), None, None, "OOO").unwrap();
|
||||
db.entry_insert(Utc.ymd(2021, 7, 7).and_hms(2, 0, 0), None, None, "XXX").unwrap();
|
||||
db.entry_insert(Utc.ymd(2021, 7, 7).and_hms(2, 0, 0), None, None, "OOO").unwrap();
|
||||
db.entry_insert(Utc.ymd(2021, 7, 7).and_hms(3, 0, 0), None, None, "XXX").unwrap();
|
||||
db.entry_insert(Utc.ymd(2021, 7, 7).and_hms(3, 0, 0), None, None, "OOO").unwrap();
|
||||
|
||||
let start = Utc.ymd(2021, 7, 7).and_hms(1, 30, 0);
|
||||
let end = Utc.ymd(2021, 7, 7).and_hms(2, 30, 0);
|
||||
|
@ -383,12 +383,12 @@ mod tests {
|
|||
let mut db = SqliteDatabase::from_memory().unwrap();
|
||||
db.init().unwrap();
|
||||
|
||||
db.entry_insert(Utc.ymd(2021, 7, 7).and_hms(1, 0, 0), None, None, "XXX".into()).unwrap();
|
||||
db.entry_insert(Utc.ymd(2021, 7, 7).and_hms(1, 0, 0), None, None, "_OO".into()).unwrap();
|
||||
db.entry_insert(Utc.ymd(2021, 7, 7).and_hms(2, 0, 0), None, None, "XXX".into()).unwrap();
|
||||
db.entry_insert(Utc.ymd(2021, 7, 7).and_hms(2, 0, 0), None, None, "_OO".into()).unwrap();
|
||||
db.entry_insert(Utc.ymd(2021, 7, 7).and_hms(3, 0, 0), None, None, "XXX".into()).unwrap();
|
||||
db.entry_insert(Utc.ymd(2021, 7, 7).and_hms(3, 0, 0), None, None, "_OO".into()).unwrap();
|
||||
db.entry_insert(Utc.ymd(2021, 7, 7).and_hms(1, 0, 0), None, None, "XXX").unwrap();
|
||||
db.entry_insert(Utc.ymd(2021, 7, 7).and_hms(1, 0, 0), None, None, "_OO").unwrap();
|
||||
db.entry_insert(Utc.ymd(2021, 7, 7).and_hms(2, 0, 0), None, None, "XXX").unwrap();
|
||||
db.entry_insert(Utc.ymd(2021, 7, 7).and_hms(2, 0, 0), None, None, "_OO").unwrap();
|
||||
db.entry_insert(Utc.ymd(2021, 7, 7).and_hms(3, 0, 0), None, None, "XXX").unwrap();
|
||||
db.entry_insert(Utc.ymd(2021, 7, 7).and_hms(3, 0, 0), None, None, "_OO").unwrap();
|
||||
|
||||
let start = Utc.ymd(2021, 7, 7).and_hms(1, 30, 0);
|
||||
let end = Utc.ymd(2021, 7, 7).and_hms(2, 30, 0);
|
||||
|
@ -435,12 +435,12 @@ mod tests {
|
|||
let mut db = SqliteDatabase::from_memory().unwrap();
|
||||
db.init().unwrap();
|
||||
|
||||
db.entry_insert(Utc.ymd(2021, 7, 7).and_hms(1, 0, 0), None, None, "XXX".into()).unwrap();
|
||||
db.entry_insert(Utc.ymd(2021, 7, 7).and_hms(1, 0, 0), None, None, "_OO".into()).unwrap();
|
||||
db.entry_insert(Utc.ymd(2021, 7, 7).and_hms(2, 0, 0), None, None, "XXX".into()).unwrap();
|
||||
db.entry_insert(Utc.ymd(2021, 7, 7).and_hms(2, 0, 0), None, None, "_OO".into()).unwrap();
|
||||
db.entry_insert(Utc.ymd(2021, 7, 7).and_hms(3, 0, 0), None, None, "XXX".into()).unwrap();
|
||||
db.entry_insert(Utc.ymd(2021, 7, 7).and_hms(3, 0, 0), None, None, "_OO".into()).unwrap();
|
||||
db.entry_insert(Utc.ymd(2021, 7, 7).and_hms(1, 0, 0), None, None, "XXX").unwrap();
|
||||
db.entry_insert(Utc.ymd(2021, 7, 7).and_hms(1, 0, 0), None, None, "_OO").unwrap();
|
||||
db.entry_insert(Utc.ymd(2021, 7, 7).and_hms(2, 0, 0), None, None, "XXX").unwrap();
|
||||
db.entry_insert(Utc.ymd(2021, 7, 7).and_hms(2, 0, 0), None, None, "_OO").unwrap();
|
||||
db.entry_insert(Utc.ymd(2021, 7, 7).and_hms(3, 0, 0), None, None, "XXX").unwrap();
|
||||
db.entry_insert(Utc.ymd(2021, 7, 7).and_hms(3, 0, 0), None, None, "_OO").unwrap();
|
||||
|
||||
let start = Utc.ymd(2021, 7, 7).and_hms(1, 30, 0);
|
||||
let end = Utc.ymd(2021, 7, 7).and_hms(2, 30, 0);
|
||||
|
|
|
@ -135,7 +135,7 @@ mod tests {
|
|||
|
||||
use super::*;
|
||||
|
||||
const LONG_NOTE: &'static str = "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.";
|
||||
const LONG_NOTE: &str = "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.";
|
||||
|
||||
#[test]
|
||||
fn test_text_output() {
|
||||
|
|
|
@ -196,7 +196,7 @@ mod tests {
|
|||
|
||||
use super::*;
|
||||
|
||||
const LONG_NOTE: &'static str = "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.";
|
||||
const LONG_NOTE: &str = "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.";
|
||||
|
||||
#[test]
|
||||
fn test_constrained_lines_long_text() {
|
||||
|
|
|
@ -236,15 +236,15 @@ mod tests {
|
|||
// mixed
|
||||
time_diff(parse_time("an hour 10 minutes ago").unwrap(), Local::now() - Duration::minutes(70));
|
||||
time_diff(parse_time("2 hours five minutes ago").unwrap(), Local::now() - Duration::minutes(125));
|
||||
time_diff(parse_time("an hour 12 minutes ago").unwrap(), Local::now() - Duration::minutes(1 * 60 + 12));
|
||||
time_diff(parse_time("an hour 12 minutes ago").unwrap(), Local::now() - Duration::minutes(60 + 12));
|
||||
|
||||
// abbreviated
|
||||
time_diff(parse_time("2hrs ago").unwrap(), Local::now() - Duration::hours(2));
|
||||
time_diff(parse_time("10min ago").unwrap(), Local::now() - Duration::minutes(10));
|
||||
time_diff(parse_time("1hr ago").unwrap(), Local::now() - Duration::hours(1));
|
||||
time_diff(parse_time("1h ago").unwrap(), Local::now() - Duration::hours(1));
|
||||
time_diff(parse_time("1h 5m ago").unwrap(), Local::now() - Duration::minutes(1 * 60 + 5));
|
||||
time_diff(parse_time("1h5m ago").unwrap(), Local::now() - Duration::minutes(1 * 60 + 5));
|
||||
time_diff(parse_time("1h 5m ago").unwrap(), Local::now() - Duration::minutes(60 + 5));
|
||||
time_diff(parse_time("1h5m ago").unwrap(), Local::now() - Duration::minutes(60 + 5));
|
||||
time_diff(parse_time("a m ago").unwrap(), Local::now() - Duration::minutes(1));
|
||||
time_diff(parse_time("an hr ago").unwrap(), Local::now() - Duration::hours(1));
|
||||
time_diff(parse_time("a min ago").unwrap(), Local::now() - Duration::minutes(1));
|
||||
|
|
Loading…
Reference in New Issue