(t *testing.T)
| 18 | } |
| 19 | |
| 20 | func TestFeatureSetOrder(t *testing.T) { |
| 21 | toolA := &Tool{Name: "apple", Description: "apple tool"} |
| 22 | toolB := &Tool{Name: "banana", Description: "banana tool"} |
| 23 | toolC := &Tool{Name: "cherry", Description: "cherry tool"} |
| 24 | |
| 25 | testCases := []struct { |
| 26 | tools []*Tool |
| 27 | want []*Tool |
| 28 | }{ |
| 29 | {[]*Tool{toolA, toolB, toolC}, []*Tool{toolA, toolB, toolC}}, |
| 30 | {[]*Tool{toolB, toolC, toolA}, []*Tool{toolA, toolB, toolC}}, |
| 31 | {[]*Tool{toolA, toolC}, []*Tool{toolA, toolC}}, |
| 32 | {[]*Tool{toolA, toolA, toolA}, []*Tool{toolA}}, |
| 33 | {[]*Tool{}, nil}, |
| 34 | } |
| 35 | for _, tc := range testCases { |
| 36 | fs := newFeatureSet(func(t *Tool) string { return t.Name }) |
| 37 | fs.add(tc.tools...) |
| 38 | got := slices.Collect(fs.all()) |
| 39 | if diff := cmp.Diff(got, tc.want, cmpopts.IgnoreUnexported(jsonschema.Schema{})); diff != "" { |
| 40 | t.Errorf("expected %v, got %v, (-want +got):\n%s", tc.want, got, diff) |
| 41 | } |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | func TestFeatureSetAbove(t *testing.T) { |
| 46 | toolA := &Tool{Name: "apple", Description: "apple tool"} |
nothing calls this directly
no test coverage detected
searching dependent graphs…