File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -1154,6 +1154,20 @@ mod tests {
11541154 assert ! ( names. contains( &&"upper.txt" . to_string( ) ) ) ;
11551155 }
11561156
1157+ /// Regression: read_dir on a file must return Err, not Ok(vec![])
1158+ #[ tokio:: test]
1159+ async fn test_read_dir_on_file_returns_error ( ) {
1160+ let lower = Arc :: new ( InMemoryFs :: new ( ) ) ;
1161+ lower
1162+ . write_file ( Path :: new ( "/tmp/file.txt" ) , b"data" )
1163+ . await
1164+ . unwrap ( ) ;
1165+
1166+ let overlay = OverlayFs :: new ( lower) ;
1167+ let result = overlay. read_dir ( Path :: new ( "/tmp/file.txt" ) ) . await ;
1168+ assert ! ( result. is_err( ) , "read_dir on a file should return Err" ) ;
1169+ }
1170+
11571171 // Issue #418: usage should deduct whited-out files
11581172 #[ tokio:: test]
11591173 async fn test_usage_deducts_whiteouts ( ) {
You can’t perform that action at this time.
0 commit comments