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

Function test_read_write_file_roundtrip

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

Source from the content-addressed store, hash-verified

769
770 #[tokio::test]
771 async fn test_read_write_file_roundtrip() {
772 let sandbox_path = with_sandbox("rw_roundtrip");
773
774 tokio::fs::write(sandbox_path.join("hello.txt"), "initial")
775 .await
776 .expect("create file");
777
778 let executor = ToolExecutor::new(sandbox_path);
779
780 // Write
781 let call = ToolCall {
782 tool: ToolName::WriteFile,
783 input: serde_json::json!({
784 "path": "hello.txt",
785 "content": "updated content here"
786 }),
787 };
788 let result = executor.execute(call).await;
789 assert!(!result.is_error, "write should succeed: {}", result.output);
790
791 // Read back
792 let call = ToolCall {
793 tool: ToolName::ReadFile,
794 input: serde_json::json!({ "path": "hello.txt" }),
795 };
796 let result = executor.execute(call).await;
797 assert!(!result.is_error, "read should succeed: {}", result.output);
798 assert_eq!(result.output, "updated content here");
799
800 cleanup("rw_roundtrip");
801 }
802
803 #[tokio::test]
804 async fn test_write_file_creates_parent_dirs() {

Callers

nothing calls this directly

Calls 3

with_sandboxFunction · 0.85
cleanupFunction · 0.85
executeMethod · 0.80

Tested by

no test coverage detected