use serde_json::json;
use crate::tool::Tool;
use crate::tool::tetherscript::TetherScriptPluginTool;
#[tokio::test]
async fn rejects_project_file_escape() {
let dir = tempfile::tempdir().unwrap();
let root = dir.path().join("workspace");
tokio::fs::create_dir_all(&root).await.unwrap();
let outside = dir.path().join("outside.tether");
tokio::fs::write(&outside, r#"fn validate() { return Ok("bad") }"#)
.await
.unwrap();
let tool = TetherScriptPluginTool::with_root(root);
let result = tool
.execute(json!({
"path": "../outside.tether",
"hook": "validate"
}))
.await
.unwrap();
assert!(!result.success);
assert!(result.output.contains("escapes workspace root"));
}