File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ async fn readdir() -> anyhow::Result<()> {
4747}
4848
4949#[ test( tokio:: test) ]
50- async fn subprocess ( ) -> anyhow:: Result < ( ) > {
50+ async fn read_in_subprocess ( ) -> anyhow:: Result < ( ) > {
5151 let accesses = track_child ! ( ( ) , |( ) : ( ) | {
5252 let mut command = if cfg!( windows) {
5353 let mut command = std:: process:: Command :: new( "cmd" ) ;
@@ -72,3 +72,18 @@ async fn subprocess() -> anyhow::Result<()> {
7272
7373 Ok ( ( ) )
7474}
75+
76+ #[ test( tokio:: test) ]
77+ async fn read_program ( ) -> anyhow:: Result < ( ) > {
78+ let accesses = track_child ! ( ( ) , |( ) : ( ) | {
79+ let _ = std:: process:: Command :: new( "./not_exist.exe" ) . spawn( ) ;
80+ } )
81+ . await ?;
82+ assert_contains (
83+ & accesses,
84+ current_dir ( ) . unwrap ( ) . join ( "not_exist.exe" ) . as_path ( ) ,
85+ AccessMode :: READ ,
86+ ) ;
87+
88+ Ok ( ( ) )
89+ }
Original file line number Diff line number Diff line change @@ -26,6 +26,11 @@ pub fn assert_contains(
2626 }
2727 }
2828
29+ if actual_mode. contains ( AccessMode :: READ_DIR ) {
30+ // READ_DIR already implies READ.
31+ actual_mode. remove ( AccessMode :: READ ) ;
32+ }
33+
2934 assert_eq ! (
3035 expected_mode,
3136 actual_mode,
You can’t perform that action at this time.
0 commit comments