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 7700595 commit 6259028Copy full SHA for 6259028
library/std/src/fs/tests.rs
@@ -1551,3 +1551,19 @@ fn hiberfil_sys() {
1551
fs::metadata(hiberfil).unwrap();
1552
assert_eq!(true, hiberfil.exists());
1553
}
1554
+
1555
+/// Test that two different ways of obtaining the FileType give the same result.
1556
+/// Cf. https://github.com/rust-lang/rust/issues/104900
1557
+#[test]
1558
+fn test_eq_direntry_metadata() {
1559
+ let tmpdir = tmpdir();
1560
+ let file_path = tmpdir.join("file");
1561
+ File::create(file_path).unwrap();
1562
+ for e in fs::read_dir(tmpdir.path()).unwrap() {
1563
+ let e = e.unwrap();
1564
+ let p = e.path();
1565
+ let ft1 = e.file_type().unwrap();
1566
+ let ft2 = p.metadata().unwrap().file_type();
1567
+ assert_eq!(ft1, ft2);
1568
+ }
1569
+}
0 commit comments