(t *testing.T)
| 251 | } |
| 252 | |
| 253 | func TestGetToolRiskLevel(t *testing.T) { |
| 254 | highRiskTool := &mockToolWithAnnotations{name: "high", annotations: AnnotationsDestructiveWrite} |
| 255 | lowRiskTool := &mockToolWithAnnotations{name: "low", annotations: AnnotationsSafeReadOnly} |
| 256 | noAnnotationTool := &mockToolWithoutAnnotations{name: "none"} |
| 257 | |
| 258 | if GetToolRiskLevel(highRiskTool) != RiskLevelHigh { |
| 259 | t.Errorf("High risk tool level = %d, want %d", GetToolRiskLevel(highRiskTool), RiskLevelHigh) |
| 260 | } |
| 261 | if GetToolRiskLevel(lowRiskTool) != RiskLevelSafe { |
| 262 | t.Errorf("Low risk tool level = %d, want %d", GetToolRiskLevel(lowRiskTool), RiskLevelSafe) |
| 263 | } |
| 264 | if GetToolRiskLevel(noAnnotationTool) != RiskLevelMedium { |
| 265 | t.Errorf("No annotation tool level = %d, want %d", GetToolRiskLevel(noAnnotationTool), RiskLevelMedium) |
| 266 | } |
| 267 | } |
| 268 | |
| 269 | func TestAnnotationsNilSafety(t *testing.T) { |
| 270 | // 测试 nil annotations 的安全性 |
nothing calls this directly
no test coverage detected