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

Function TestReadFileResource

mcp/resource_test.go:97–114  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

95}
96
97func TestReadFileResource(t *testing.T) {
98 if runtime.GOOS == "windows" {
99 t.Skip("TODO: fix for Windows")
100 }
101 abs, err := filepath.Abs("testdata")
102 if err != nil {
103 t.Fatal(err)
104 }
105 dirFilepath := filepath.Join(abs, "files")
106 got, err := readFileResource("file:///info.txt", dirFilepath, nil)
107 if err != nil {
108 t.Fatal(err)
109 }
110 want := "Contents\n"
111 if g := string(got); g != want {
112 t.Errorf("got %q, want %q", g, want)
113 }
114}
115
116func TestTemplateMatch(t *testing.T) {
117 uri := "file:///path/to/file"

Callers

nothing calls this directly

Calls 1

readFileResourceFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…