mirror of
https://github.com/chatmail/core.git
synced 2026-04-20 15:06:30 +03:00
refactor: Don't use traits where it's not necessary (#6567)
Traits are bad for readability and compile times.
This commit is contained in:
@@ -282,15 +282,22 @@ async fn test_file_handling() {
|
||||
};
|
||||
}
|
||||
|
||||
assert!(delete_file(context, "$BLOBDIR/lkqwjelqkwlje")
|
||||
assert!(delete_file(context, Path::new("$BLOBDIR/lkqwjelqkwlje"))
|
||||
.await
|
||||
.is_err());
|
||||
assert!(write_file(context, "$BLOBDIR/foobar", b"content")
|
||||
.await
|
||||
.is_ok());
|
||||
assert!(
|
||||
write_file(context, Path::new("$BLOBDIR/foobar"), b"content")
|
||||
.await
|
||||
.is_ok()
|
||||
);
|
||||
assert!(file_exist!(context, "$BLOBDIR/foobar"));
|
||||
assert!(!file_exist!(context, "$BLOBDIR/foobarx"));
|
||||
assert_eq!(get_filebytes(context, "$BLOBDIR/foobar").await.unwrap(), 7);
|
||||
assert_eq!(
|
||||
get_filebytes(context, Path::new("$BLOBDIR/foobar"))
|
||||
.await
|
||||
.unwrap(),
|
||||
7
|
||||
);
|
||||
|
||||
let abs_path = context
|
||||
.get_blobdir()
|
||||
@@ -300,19 +307,23 @@ async fn test_file_handling() {
|
||||
|
||||
assert!(file_exist!(context, &abs_path));
|
||||
|
||||
assert!(delete_file(context, "$BLOBDIR/foobar").await.is_ok());
|
||||
assert!(create_folder(context, "$BLOBDIR/foobar-folder")
|
||||
assert!(delete_file(context, Path::new("$BLOBDIR/foobar"))
|
||||
.await
|
||||
.is_ok());
|
||||
assert!(create_folder(context, Path::new("$BLOBDIR/foobar-folder"))
|
||||
.await
|
||||
.is_ok());
|
||||
assert!(file_exist!(context, "$BLOBDIR/foobar-folder"));
|
||||
assert!(delete_file(context, "$BLOBDIR/foobar-folder")
|
||||
assert!(delete_file(context, Path::new("$BLOBDIR/foobar-folder"))
|
||||
.await
|
||||
.is_err());
|
||||
|
||||
let fn0 = "$BLOBDIR/data.data";
|
||||
assert!(write_file(context, &fn0, b"content").await.is_ok());
|
||||
assert!(write_file(context, Path::new(fn0), b"content")
|
||||
.await
|
||||
.is_ok());
|
||||
|
||||
assert!(delete_file(context, &fn0).await.is_ok());
|
||||
assert!(delete_file(context, Path::new(fn0)).await.is_ok());
|
||||
assert!(!file_exist!(context, &fn0));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user