(t *testing.T)
| 43 | } |
| 44 | |
| 45 | func TestFeatureSetAbove(t *testing.T) { |
| 46 | toolA := &Tool{Name: "apple", Description: "apple tool"} |
| 47 | toolB := &Tool{Name: "banana", Description: "banana tool"} |
| 48 | toolC := &Tool{Name: "cherry", Description: "cherry tool"} |
| 49 | |
| 50 | testCases := []struct { |
| 51 | tools []*Tool |
| 52 | above string |
| 53 | want []*Tool |
| 54 | }{ |
| 55 | {[]*Tool{toolA, toolB, toolC}, "apple", []*Tool{toolB, toolC}}, |
| 56 | {[]*Tool{toolA, toolB, toolC}, "banana", []*Tool{toolC}}, |
| 57 | {[]*Tool{toolA, toolB, toolC}, "cherry", nil}, |
| 58 | } |
| 59 | for _, tc := range testCases { |
| 60 | fs := newFeatureSet(func(t *Tool) string { return t.Name }) |
| 61 | fs.add(tc.tools...) |
| 62 | got := slices.Collect(fs.above(tc.above)) |
| 63 | if diff := cmp.Diff(got, tc.want, cmpopts.IgnoreUnexported(jsonschema.Schema{})); diff != "" { |
| 64 | t.Errorf("expected %v, got %v, (-want +got):\n%s", tc.want, got, diff) |
| 65 | } |
| 66 | } |
| 67 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…