Skip to content
This repository was archived by the owner on Apr 5, 2024. It is now read-only.

Commit 9cc54b3

Browse files
open-schnickGitea
authored andcommitted
Added unhappy case tests
1 parent 0565522 commit 9cc54b3

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

server/src/backend/storage_backend.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,6 @@ mod tests {
318318
#[test]
319319
fn path_contains_rclone_modification_date_works() {
320320
let path = PathBuf::from_str("/20221003093709 /Home/School").unwrap();
321-
322321
let option = path_contains_rclone_modification_date(&path);
323322

324323
match option {
@@ -332,4 +331,25 @@ mod tests {
332331
None => panic!("Expected some value here."),
333332
}
334333
}
334+
335+
#[test]
336+
fn path_contains_rclone_modification_date_fails_without_whitespace() {
337+
let path = PathBuf::from_str("/20221003093709/Home/School").unwrap();
338+
let option = path_contains_rclone_modification_date(&path);
339+
assert!(option.is_none())
340+
}
341+
342+
#[test]
343+
fn path_contains_rclone_modification_date_fails_with_wrong_timestamp_format() {
344+
let path = PathBuf::from_str("/202210030937 /Home/School").unwrap();
345+
let option = path_contains_rclone_modification_date(&path);
346+
assert!(option.is_none())
347+
}
348+
349+
#[test]
350+
fn path_contains_rclone_modification_date_fails_with_wrong_timestamp() {
351+
let path = PathBuf::from_str("/20221003093790 /Home/School").unwrap();
352+
let option = path_contains_rclone_modification_date(&path);
353+
assert!(option.is_none())
354+
}
335355
}

0 commit comments

Comments
 (0)