MCPcopy Create free account
hub / github.com/campoy/embedmd / TestProcess

Function TestProcess

embedmd/embedmd_test.go:155–278  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

153}
154
155func TestProcess(t *testing.T) {
156 tc := []struct {
157 name string
158 in string
159 dir string
160 files map[string][]byte
161 urls map[string][]byte
162 out string
163 err string
164 diff bool
165 }{
166 {
167 name: "missing file",
168 in: "# This is some markdown\n" +
169 "[embedmd]:# (code.go)\n" +
170 "Yay!\n",
171 err: "2: could not read code.go: file does not exist",
172 },
173 {
174 name: "generating code for first time",
175 in: "# This is some markdown\n" +
176 "[embedmd]:# (code.go)\n" +
177 "Yay!\n",
178 files: map[string][]byte{"code.go": []byte(content)},
179 out: "# This is some markdown\n" +
180 "[embedmd]:# (code.go)\n" +
181 "```go\n" +
182 string(content) +
183 "```\n" +
184 "Yay!\n",
185 },
186 {
187 name: "generating code for first time with base dir",
188 dir: "sample",
189 in: "# This is some markdown\n" +
190 "[embedmd]:# (code.go)\n" +
191 "Yay!\n",
192 files: map[string][]byte{"sample/code.go": []byte(content)},
193 out: "# This is some markdown\n" +
194 "[embedmd]:# (code.go)\n" +
195 "```go\n" +
196 string(content) +
197 "```\n" +
198 "Yay!\n",
199 },
200 {
201 name: "replacing existing code",
202 in: "# This is some markdown\n" +
203 "[embedmd]:# (code.go)\n" +
204 "```go\n" +
205 string(content) +
206 "```\n" +
207 "Yay!\n",
208 files: map[string][]byte{"code.go": []byte(content)},
209 out: "# This is some markdown\n" +
210 "[embedmd]:# (code.go)\n" +
211 "```go\n" +
212 string(content) +

Callers

nothing calls this directly

Calls 4

WithFetcherFunction · 0.85
WithBaseDirFunction · 0.85
ProcessFunction · 0.85
eqErrFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…