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

Function test_write_new_file

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

Source from the content-addressed store, hash-verified

109
110 #[tokio::test]
111 async fn test_write_new_file() {
112 let temp = tempfile::tempdir().unwrap();
113 let tool = WriteTool;
114 let ctx = ToolContext::new(temp.path().to_path_buf());
115
116 let result = tool
117 .execute(
118 &serde_json::json!({"file_path": "new.txt", "content": "hello world"}),
119 &ctx,
120 )
121 .await
122 .unwrap();
123
124 assert!(result.success);
125 let content = std::fs::read_to_string(temp.path().join("new.txt")).unwrap();
126 assert_eq!(content, "hello world");
127 }
128
129 #[tokio::test]
130 async fn test_write_creates_parent_dirs() {

Callers

nothing calls this directly

Calls 2

pathMethod · 0.80
executeMethod · 0.45

Tested by

no test coverage detected