MCPcopy Create free account
hub / github.com/AI45Lab/Code / test_write_overwrite

Function test_write_overwrite

core/src/tools/builtin/write.rs:149–167  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

147
148 #[tokio::test]
149 async fn test_write_overwrite() {
150 let temp = tempfile::tempdir().unwrap();
151 std::fs::write(temp.path().join("existing.txt"), "old").unwrap();
152
153 let tool = WriteTool;
154 let ctx = ToolContext::new(temp.path().to_path_buf());
155
156 let result = tool
157 .execute(
158 &serde_json::json!({"file_path": "existing.txt", "content": "new"}),
159 &ctx,
160 )
161 .await
162 .unwrap();
163
164 assert!(result.success);
165 let content = std::fs::read_to_string(temp.path().join("existing.txt")).unwrap();
166 assert_eq!(content, "new");
167 }
168
169 #[tokio::test]
170 async fn test_write_missing_params() {

Callers

nothing calls this directly

Calls 3

writeFunction · 0.85
pathMethod · 0.80
executeMethod · 0.45

Tested by

no test coverage detected