(t *testing.T)
| 267 | } |
| 268 | |
| 269 | func TestAnnotationsNilSafety(t *testing.T) { |
| 270 | // 测试 nil annotations 的安全性 |
| 271 | var ann *ToolAnnotations = nil |
| 272 | |
| 273 | // GetAnnotations 应该对 nil 工具返回默认注解 |
| 274 | defaultAnn := GetAnnotations(&mockToolWithoutAnnotations{name: "test"}) |
| 275 | if defaultAnn == nil { |
| 276 | t.Error("GetAnnotations should never return nil") |
| 277 | } |
| 278 | |
| 279 | // 测试 nil annotations 的方法(应该 panic 或返回默认值) |
| 280 | // 这里我们验证非 nil 注解的行为 |
| 281 | ann = &ToolAnnotations{} |
| 282 | if ann.IsSafeForAutoApproval() { |
| 283 | // 默认空注解不应该被认为是安全的(ReadOnly = false) |
| 284 | t.Error("Empty annotations should not be safe for auto approval") |
| 285 | } |
| 286 | } |
nothing calls this directly
no test coverage detected