MCPcopy Create free account
hub / github.com/github/gh-aw / TestFindIncludesInContent

Function TestFindIncludesInContent

pkg/cli/commands_utils_test.go:196–308  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

194}
195
196func TestFindIncludesInContent(t *testing.T) {
197 tests := []struct {
198 name string
199 content string
200 expected []string
201 }{
202 {
203 name: "no includes",
204 content: "This is regular content without includes.",
205 expected: []string{},
206 },
207 {
208 name: "single include",
209 content: `This is content with include:
210@include shared/tools.md
211More content here.`,
212 expected: []string{"shared/tools.md"},
213 },
214 {
215 name: "multiple includes",
216 content: `Content with multiple includes:
217@include shared/tools.md
218Some content between.
219@include shared/config.md
220More content.
221@include another/file.md`,
222 expected: []string{"shared/tools.md", "shared/config.md", "another/file.md"},
223 },
224 {
225 name: "includes with different whitespace",
226 content: `Content:
227@include shared/tools.md
228@include shared/config.md
229@include shared/tabs.md`,
230 expected: []string{"shared/tools.md", "shared/config.md", "shared/tabs.md"},
231 },
232 {
233 name: "includes with section references",
234 content: `Content:
235@include shared/tools.md#Tools
236@include shared/config.md#Configuration`,
237 expected: []string{"shared/tools.md", "shared/config.md"},
238 },
239 {
240 name: "empty content",
241 content: "",
242 expected: []string{},
243 },
244 // @import (deprecated synonym for @include)
245 {
246 name: "@import basic",
247 content: "@import shared/tools.md",
248 expected: []string{"shared/tools.md"},
249 },
250 {
251 name: "@import optional marker",
252 content: "@import? shared/tools.md",
253 expected: []string{"shared/tools.md"},

Callers

nothing calls this directly

Calls 3

findIncludesInContentFunction · 0.85
RunMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected