MCPcopy Create free account
hub / github.com/enowdev/enowX-Coder / test_write_file_creates_parent_dirs

Function test_write_file_creates_parent_dirs

src-tauri/src/tools/executor.rs:804–832  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

802
803 #[tokio::test]
804 async fn test_write_file_creates_parent_dirs() {
805 let sandbox_path = with_sandbox("rw_mkdirs");
806
807 let executor = ToolExecutor::new(sandbox_path);
808
809 let call = ToolCall {
810 tool: ToolName::WriteFile,
811 input: serde_json::json!({
812 "path": "deeply/nested/dir/file.txt",
813 "content": "nested data"
814 }),
815 };
816 let result = executor.execute(call).await;
817 assert!(
818 !result.is_error,
819 "write with nested dirs should succeed: {}",
820 result.output
821 );
822
823 // Verify file exists by reading it back
824 let call = ToolCall {
825 tool: ToolName::ReadFile,
826 input: serde_json::json!({ "path": "deeply/nested/dir/file.txt" }),
827 };
828 let result = executor.execute(call).await;
829 assert_eq!(result.output, "nested data");
830
831 cleanup("rw_mkdirs");
832 }
833
834 #[tokio::test]
835 async fn test_read_missing_field() {

Callers

nothing calls this directly

Calls 3

with_sandboxFunction · 0.85
cleanupFunction · 0.85
executeMethod · 0.80

Tested by

no test coverage detected