(t *testing.T)
| 132 | } |
| 133 | |
| 134 | func TestAdditionalClaudeToolsForSafeOutputs(t *testing.T) { |
| 135 | compiler := NewCompiler() |
| 136 | engine := NewClaudeEngine() |
| 137 | |
| 138 | tests := []struct { |
| 139 | name string |
| 140 | tools map[string]any |
| 141 | safeOutputs *SafeOutputsConfig |
| 142 | expectEditingTools bool |
| 143 | }{ |
| 144 | { |
| 145 | name: "no safe outputs - no editing tools", |
| 146 | tools: map[string]any{}, |
| 147 | safeOutputs: nil, |
| 148 | expectEditingTools: false, |
| 149 | }, |
| 150 | { |
| 151 | name: "create-pull-request enabled - should add editing tools", |
| 152 | tools: map[string]any{}, |
| 153 | safeOutputs: &SafeOutputsConfig{ |
| 154 | CreatePullRequests: &CreatePullRequestsConfig{}, |
| 155 | }, |
| 156 | expectEditingTools: true, |
| 157 | }, |
| 158 | { |
| 159 | name: "push-to-pull-request-branch enabled - should add editing tools", |
| 160 | tools: map[string]any{}, |
| 161 | safeOutputs: &SafeOutputsConfig{ |
| 162 | PushToPullRequestBranch: &PushToPullRequestBranchConfig{}, |
| 163 | }, |
| 164 | expectEditingTools: true, |
| 165 | }, |
| 166 | { |
| 167 | name: "only create-issue enabled - no editing tools", |
| 168 | tools: map[string]any{}, |
| 169 | safeOutputs: &SafeOutputsConfig{ |
| 170 | CreateIssues: &CreateIssuesConfig{}, |
| 171 | }, |
| 172 | expectEditingTools: false, |
| 173 | }, |
| 174 | { |
| 175 | name: "existing editing tools should be preserved", |
| 176 | tools: map[string]any{ |
| 177 | "edit": nil, |
| 178 | }, |
| 179 | safeOutputs: &SafeOutputsConfig{ |
| 180 | CreatePullRequests: &CreatePullRequestsConfig{}, |
| 181 | }, |
| 182 | expectEditingTools: true, |
| 183 | }, |
| 184 | } |
| 185 | |
| 186 | expectedEditingTools := []string{"Edit", "MultiEdit", "NotebookEdit"} |
| 187 | expectedWriteTool := "Write" |
| 188 | |
| 189 | for _, tt := range tests { |
| 190 | t.Run(tt.name, func(t *testing.T) { |
| 191 | // Create a copy of input tools to avoid modifying test data |
nothing calls this directly
no test coverage detected