| 26 | } |
| 27 | |
| 28 | func TestToolAnnotations_Clone(t *testing.T) { |
| 29 | original := &ToolAnnotations{ |
| 30 | ReadOnly: true, |
| 31 | Destructive: false, |
| 32 | RiskLevel: 2, |
| 33 | Category: "test", |
| 34 | } |
| 35 | |
| 36 | cloned := original.Clone() |
| 37 | |
| 38 | if cloned.ReadOnly != original.ReadOnly { |
| 39 | t.Error("ReadOnly not cloned correctly") |
| 40 | } |
| 41 | if cloned.Destructive != original.Destructive { |
| 42 | t.Error("Destructive not cloned correctly") |
| 43 | } |
| 44 | if cloned.RiskLevel != original.RiskLevel { |
| 45 | t.Error("RiskLevel not cloned correctly") |
| 46 | } |
| 47 | if cloned.Category != original.Category { |
| 48 | t.Error("Category not cloned correctly") |
| 49 | } |
| 50 | |
| 51 | // 修改克隆不应影响原始 |
| 52 | cloned.RiskLevel = 5 |
| 53 | if original.RiskLevel == 5 { |
| 54 | t.Error("Modifying clone should not affect original") |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | func TestToolAnnotations_IsSafeForAutoApproval(t *testing.T) { |
| 59 | tests := []struct { |