style: apply rustfmt to async fs updates
This commit is contained in:
parent
b9af601943
commit
275d3e7791
11 changed files with 44 additions and 17 deletions
|
|
@ -481,7 +481,9 @@ mod tests {
|
||||||
config_path: tmp.path().join("config.toml"),
|
config_path: tmp.path().join("config.toml"),
|
||||||
..Config::default()
|
..Config::default()
|
||||||
};
|
};
|
||||||
tokio::fs::create_dir_all(&config.workspace_dir).await.unwrap();
|
tokio::fs::create_dir_all(&config.workspace_dir)
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
config
|
config
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,9 @@ mod tests {
|
||||||
{
|
{
|
||||||
let source_dir = tmp.path().join("source_skill");
|
let source_dir = tmp.path().join("source_skill");
|
||||||
tokio::fs::create_dir_all(&source_dir).await.unwrap();
|
tokio::fs::create_dir_all(&source_dir).await.unwrap();
|
||||||
tokio::fs::write(source_dir.join("SKILL.md"), "# Test Skill\nContent").await.unwrap();
|
tokio::fs::write(source_dir.join("SKILL.md"), "# Test Skill\nContent")
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
let dest_link = skills_path.join("linked_skill");
|
let dest_link = skills_path.join("linked_skill");
|
||||||
|
|
||||||
|
|
@ -94,7 +96,9 @@ mod tests {
|
||||||
// Test case: Symlink outside workspace should be allowed (user responsibility)
|
// Test case: Symlink outside workspace should be allowed (user responsibility)
|
||||||
let outside_dir = tmp.path().join("outside_skill");
|
let outside_dir = tmp.path().join("outside_skill");
|
||||||
tokio::fs::create_dir_all(&outside_dir).await.unwrap();
|
tokio::fs::create_dir_all(&outside_dir).await.unwrap();
|
||||||
tokio::fs::write(outside_dir.join("SKILL.md"), "# Outside Skill\nContent").await.unwrap();
|
tokio::fs::write(outside_dir.join("SKILL.md"), "# Outside Skill\nContent")
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
let dest_link = skills_path.join("outside_skill");
|
let dest_link = skills_path.join("outside_skill");
|
||||||
let result = std::os::unix::fs::symlink(&outside_dir, &dest_link);
|
let result = std::os::unix::fs::symlink(&outside_dir, &dest_link);
|
||||||
|
|
|
||||||
|
|
@ -1225,9 +1225,9 @@ mod native_backend {
|
||||||
});
|
});
|
||||||
|
|
||||||
if let Some(path_str) = path {
|
if let Some(path_str) = path {
|
||||||
tokio::fs::write(&path_str, &png).await.with_context(|| {
|
tokio::fs::write(&path_str, &png)
|
||||||
format!("Failed to write screenshot to {path_str}")
|
.await
|
||||||
})?;
|
.with_context(|| format!("Failed to write screenshot to {path_str}"))?;
|
||||||
payload["path"] = Value::String(path_str);
|
payload["path"] = Value::String(path_str);
|
||||||
} else {
|
} else {
|
||||||
payload["png_base64"] =
|
payload["png_base64"] =
|
||||||
|
|
|
||||||
|
|
@ -223,7 +223,9 @@ mod tests {
|
||||||
config_path: tmp.path().join("config.toml"),
|
config_path: tmp.path().join("config.toml"),
|
||||||
..Config::default()
|
..Config::default()
|
||||||
};
|
};
|
||||||
tokio::fs::create_dir_all(&config.workspace_dir).await.unwrap();
|
tokio::fs::create_dir_all(&config.workspace_dir)
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
Arc::new(config)
|
Arc::new(config)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -262,7 +264,9 @@ mod tests {
|
||||||
};
|
};
|
||||||
config.autonomy.allowed_commands = vec!["echo".into()];
|
config.autonomy.allowed_commands = vec!["echo".into()];
|
||||||
config.autonomy.level = AutonomyLevel::Supervised;
|
config.autonomy.level = AutonomyLevel::Supervised;
|
||||||
tokio::fs::create_dir_all(&config.workspace_dir).await.unwrap();
|
tokio::fs::create_dir_all(&config.workspace_dir)
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
let cfg = Arc::new(config);
|
let cfg = Arc::new(config);
|
||||||
let tool = CronAddTool::new(cfg.clone(), test_security(&cfg));
|
let tool = CronAddTool::new(cfg.clone(), test_security(&cfg));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,9 @@ mod tests {
|
||||||
config_path: tmp.path().join("config.toml"),
|
config_path: tmp.path().join("config.toml"),
|
||||||
..Config::default()
|
..Config::default()
|
||||||
};
|
};
|
||||||
tokio::fs::create_dir_all(&config.workspace_dir).await.unwrap();
|
tokio::fs::create_dir_all(&config.workspace_dir)
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
Arc::new(config)
|
Arc::new(config)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,9 @@ mod tests {
|
||||||
config_path: tmp.path().join("config.toml"),
|
config_path: tmp.path().join("config.toml"),
|
||||||
..Config::default()
|
..Config::default()
|
||||||
};
|
};
|
||||||
tokio::fs::create_dir_all(&config.workspace_dir).await.unwrap();
|
tokio::fs::create_dir_all(&config.workspace_dir)
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
Arc::new(config)
|
Arc::new(config)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,9 @@ mod tests {
|
||||||
config_path: tmp.path().join("config.toml"),
|
config_path: tmp.path().join("config.toml"),
|
||||||
..Config::default()
|
..Config::default()
|
||||||
};
|
};
|
||||||
tokio::fs::create_dir_all(&config.workspace_dir).await.unwrap();
|
tokio::fs::create_dir_all(&config.workspace_dir)
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
Arc::new(config)
|
Arc::new(config)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,9 @@ mod tests {
|
||||||
config_path: tmp.path().join("config.toml"),
|
config_path: tmp.path().join("config.toml"),
|
||||||
..Config::default()
|
..Config::default()
|
||||||
};
|
};
|
||||||
tokio::fs::create_dir_all(&config.workspace_dir).await.unwrap();
|
tokio::fs::create_dir_all(&config.workspace_dir)
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
Arc::new(config)
|
Arc::new(config)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,9 @@ mod tests {
|
||||||
config_path: tmp.path().join("config.toml"),
|
config_path: tmp.path().join("config.toml"),
|
||||||
..Config::default()
|
..Config::default()
|
||||||
};
|
};
|
||||||
tokio::fs::create_dir_all(&config.workspace_dir).await.unwrap();
|
tokio::fs::create_dir_all(&config.workspace_dir)
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
Arc::new(config)
|
Arc::new(config)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -156,7 +158,9 @@ mod tests {
|
||||||
..Config::default()
|
..Config::default()
|
||||||
};
|
};
|
||||||
config.autonomy.allowed_commands = vec!["echo".into()];
|
config.autonomy.allowed_commands = vec!["echo".into()];
|
||||||
tokio::fs::create_dir_all(&config.workspace_dir).await.unwrap();
|
tokio::fs::create_dir_all(&config.workspace_dir)
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
let cfg = Arc::new(config);
|
let cfg = Arc::new(config);
|
||||||
let job = cron::add_job(&cfg, "*/5 * * * *", "echo ok").unwrap();
|
let job = cron::add_job(&cfg, "*/5 * * * *", "echo ok").unwrap();
|
||||||
let tool = CronUpdateTool::new(cfg.clone(), test_security(&cfg));
|
let tool = CronUpdateTool::new(cfg.clone(), test_security(&cfg));
|
||||||
|
|
|
||||||
|
|
@ -375,7 +375,9 @@ mod tests {
|
||||||
config_path: tmp.path().join("config.toml"),
|
config_path: tmp.path().join("config.toml"),
|
||||||
..Config::default()
|
..Config::default()
|
||||||
};
|
};
|
||||||
tokio::fs::create_dir_all(&config.workspace_dir).await.unwrap();
|
tokio::fs::create_dir_all(&config.workspace_dir)
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
let security = Arc::new(SecurityPolicy::from_config(
|
let security = Arc::new(SecurityPolicy::from_config(
|
||||||
&config.autonomy,
|
&config.autonomy,
|
||||||
&config.workspace_dir,
|
&config.workspace_dir,
|
||||||
|
|
@ -489,7 +491,9 @@ mod tests {
|
||||||
},
|
},
|
||||||
..Config::default()
|
..Config::default()
|
||||||
};
|
};
|
||||||
tokio::fs::create_dir_all(&config.workspace_dir).await.unwrap();
|
tokio::fs::create_dir_all(&config.workspace_dir)
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
let security = Arc::new(SecurityPolicy::from_config(
|
let security = Arc::new(SecurityPolicy::from_config(
|
||||||
&config.autonomy,
|
&config.autonomy,
|
||||||
&config.workspace_dir,
|
&config.workspace_dir,
|
||||||
|
|
|
||||||
|
|
@ -363,7 +363,8 @@ mod tests {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert!(allowed.success);
|
assert!(allowed.success);
|
||||||
|
|
||||||
let _ = tokio::fs::remove_file(std::env::temp_dir().join("zeroclaw_shell_approval_test")).await;
|
let _ =
|
||||||
|
tokio::fs::remove_file(std::env::temp_dir().join("zeroclaw_shell_approval_test")).await;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── §5.2 Shell timeout enforcement tests ─────────────────
|
// ── §5.2 Shell timeout enforcement tests ─────────────────
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue