diff options
| author | Arthur Carcano <arthur.carcano@ocamlpro.com> | 2022-11-30 23:31:42 +0100 |
|---|---|---|
| committer | Arthur Carcano <arthur.carcano@ocamlpro.com> | 2022-11-30 23:45:01 +0100 |
| commit | 62590288621fe9c1fd9b379ed613538f7225f3eb (patch) | |
| tree | c70bc1c91d2b94f3a478840aede012b58ebf032f | |
| parent | 77005950f09d2f9ba54962bf5adc3f2bc3a7213f (diff) | |
| download | rust-62590288621fe9c1fd9b379ed613538f7225f3eb.tar.gz rust-62590288621fe9c1fd9b379ed613538f7225f3eb.zip | |
Add test for regression for FileType equality
Cf: https://github.com/rust-lang/rust/issues/104900
| -rw-r--r-- | library/std/src/fs/tests.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/library/std/src/fs/tests.rs b/library/std/src/fs/tests.rs index b8959316de1..4748ac9d97e 100644 --- a/library/std/src/fs/tests.rs +++ b/library/std/src/fs/tests.rs @@ -1551,3 +1551,19 @@ fn hiberfil_sys() { fs::metadata(hiberfil).unwrap(); assert_eq!(true, hiberfil.exists()); } + +/// Test that two different ways of obtaining the FileType give the same result. +/// Cf. https://github.com/rust-lang/rust/issues/104900 +#[test] +fn test_eq_direntry_metadata() { + let tmpdir = tmpdir(); + let file_path = tmpdir.join("file"); + File::create(file_path).unwrap(); + for e in fs::read_dir(tmpdir.path()).unwrap() { + let e = e.unwrap(); + let p = e.path(); + let ft1 = e.file_type().unwrap(); + let ft2 = p.metadata().unwrap().file_type(); + assert_eq!(ft1, ft2); + } +} |
