MCPcopy Create free account
hub / github.com/modelcontextprotocol/go-sdk / TestFeatureSetAbove

Function TestFeatureSetAbove

mcp/features_test.go:45–67  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

43}
44
45func 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}

Callers

nothing calls this directly

Calls 3

newFeatureSetFunction · 0.85
addMethod · 0.80
aboveMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…