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

Function TestImportCycleError_InvalidChain

pkg/parser/import_cycle_test.go:258–288  ·  view source on GitHub ↗

TestImportCycleError_InvalidChain tests handling of invalid cycle chains

(t *testing.T)

Source from the content-addressed store, hash-verified

256
257// TestImportCycleError_InvalidChain tests handling of invalid cycle chains
258func TestImportCycleError_InvalidChain(t *testing.T) {
259 tests := []struct {
260 name string
261 chain []string
262 }{
263 {
264 name: "empty chain",
265 chain: []string{},
266 },
267 {
268 name: "single element",
269 chain: []string{"a.md"},
270 },
271 }
272
273 for _, tt := range tests {
274 t.Run(tt.name, func(t *testing.T) {
275 cycleErr := &parser.ImportCycleError{
276 Chain: tt.chain,
277 WorkflowFile: "test.md",
278 }
279
280 // Should still return an error, just not a detailed one
281 formatted := parser.FormatImportCycleError(cycleErr)
282 require.Error(t, formatted, "Should return error even for invalid chain")
283
284 errMsg := formatted.Error()
285 assert.Contains(t, errMsg, "circular import", "Error should mention circular import")
286 })
287 }
288}

Callers

nothing calls this directly

Calls 3

FormatImportCycleErrorFunction · 0.92
RunMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected