()
| 923 | |
| 924 | #[tokio::test] |
| 925 | async fn test_search_files_match() { |
| 926 | let sandbox_path = with_sandbox("search_files"); |
| 927 | |
| 928 | tokio::fs::write(sandbox_path.join("test.rs"), "fn hello() {}") |
| 929 | .await |
| 930 | .expect("create test.rs"); |
| 931 | tokio::fs::write(sandbox_path.join("ignore.txt"), "no match here") |
| 932 | .await |
| 933 | .expect("create ignore.txt"); |
| 934 | |
| 935 | let executor = ToolExecutor::new(sandbox_path); |
| 936 | |
| 937 | let call = ToolCall { |
| 938 | tool: ToolName::SearchFiles, |
| 939 | input: serde_json::json!({ |
| 940 | "pattern": "fn hello", |
| 941 | "path": "." |
| 942 | }), |
| 943 | }; |
| 944 | let result = executor.execute(call).await; |
| 945 | assert!(!result.is_error, "search should succeed: {}", result.output); |
| 946 | assert!(result.output.contains("test.rs")); |
| 947 | assert!(result.output.contains("fn hello() {}")); |
| 948 | assert!(!result.output.contains("ignore.txt")); |
| 949 | |
| 950 | cleanup("search_files"); |
| 951 | } |
| 952 | |
| 953 | #[tokio::test] |
| 954 | async fn test_search_files_invalid_regex() { |
nothing calls this directly
no test coverage detected