We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b938400 commit cc6552aCopy full SHA for cc6552a
src/fs/file.rs
@@ -905,14 +905,12 @@ mod tests {
905
906
#[test]
907
fn async_file_create_error () {
908
+ let file_name = Path::new("/tmp/does_not_exist/test");
909
+ let expect = std::fs::File::create(file_name).unwrap_err();
910
+
911
crate::task::block_on(async move {
- let file_name = Path::new("/tmp/does_not_exist/test");
- match File::create(file_name).await {
- Ok(_) => (),
912
- Err(e) => {
913
- assert_eq!("No such file or directory (os error 2)", format!("{}", e));
914
- }
915
- };
+ let actual = File::create(file_name).await.unwrap_err();
+ assert_eq!(format!("{}", expect), format!("{}", actual));
916
})
917
}
918
0 commit comments