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

Function TestFormatImportError

pkg/parser/import_error_test.go:13–123  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func TestFormatImportError(t *testing.T) {
14 tests := []struct {
15 name string
16 err *parser.ImportError
17 yamlContent string
18 wantContain []string
19 }{
20 {
21 name: "file not found error",
22 err: &parser.ImportError{
23 ImportPath: "missing.md",
24 FilePath: "test.md",
25 Line: 3,
26 Column: 3,
27 Cause: errors.New("file not found: /path/to/missing.md"),
28 },
29 yamlContent: `---
30on: push
31imports:
32 - missing.md
33---`,
34 wantContain: []string{
35 "test.md:3:3:",
36 "error:",
37 "import file not found",
38 "imports:",
39 "hint:",
40 "missing.md",
41 },
42 },
43 {
44 name: "download failed error",
45 err: &parser.ImportError{
46 ImportPath: "owner/repo/file.md@main",
47 FilePath: "workflow.md",
48 Line: 4,
49 Column: 5,
50 Cause: errors.New("failed to download include from owner/repo/file.md@main: network error"),
51 },
52 yamlContent: `---
53on: issues
54imports:
55 - owner/repo/file.md@main
56---`,
57 wantContain: []string{
58 "workflow.md:4:5:",
59 "error:",
60 "failed to download import file",
61 "owner/repo/file.md@main",
62 "hint:",
63 },
64 },
65 {
66 name: "ref resolution error",
67 err: &parser.ImportError{
68 ImportPath: "owner/repo/file.md@v0.0.0-bad",
69 FilePath: "test.md",
70 Line: 3,

Callers

nothing calls this directly

Calls 4

FormatImportErrorFunction · 0.92
RunMethod · 0.45
ErrorMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected