We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 900e1c3 commit 33783d0Copy full SHA for 33783d0
src/utils.rs
@@ -163,11 +163,18 @@ mod tests {
163
164
#[test]
165
fn invalid_file() {
166
+ use chrono::{DateTime, Local};
167
+ use std::time::SystemTime;
168
+
169
let invalid_file = "target/utils/invalid-file";
170
- let m_time = get_modification_time(invalid_file);
171
+ // store current time before calling `get_modification_time`
172
+ // Because the file is invalid, it will return SystemTime::now()
173
+ // which will be greater than previously saved time
174
+ let current_time: DateTime<Local> = SystemTime::now().into();
175
+ let m_time: DateTime<Local> = get_modification_time(invalid_file).parse().unwrap();
176
- assert!(!m_time.is_empty());
177
+ assert!(m_time > current_time);
178
}
179
180
0 commit comments