()
| 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() { |
nothing calls this directly
no test coverage detected