Skip to content

Commit b214b44

Browse files
committed
update
1 parent 4c2f57a commit b214b44

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

crates/fspy/tests/rust_std.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff 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+
}

crates/fspy/tests/test_utils.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff 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,

0 commit comments

Comments
 (0)