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

Function TestFormatCompilerError

pkg/workflow/compiler_error_formatting_test.go:15–107  ·  view source on GitHub ↗

TestFormatCompilerError tests the formatCompilerError helper function

(t *testing.T)

Source from the content-addressed store, hash-verified

13
14// TestFormatCompilerError tests the formatCompilerError helper function
15func TestFormatCompilerError(t *testing.T) {
16 tests := []struct {
17 name string
18 filePath string
19 errType string
20 message string
21 cause error
22 wantContain []string
23 }{
24 {
25 name: "error type with simple message, no cause",
26 filePath: "/path/to/workflow.md",
27 errType: "error",
28 message: "validation failed",
29 cause: nil,
30 wantContain: []string{
31 "/path/to/workflow.md",
32 "1:1",
33 "error",
34 "validation failed",
35 },
36 },
37 {
38 name: "warning type with detailed message, no cause",
39 filePath: "/path/to/workflow.md",
40 errType: "warning",
41 message: "missing required permission",
42 cause: nil,
43 wantContain: []string{
44 "/path/to/workflow.md",
45 "1:1",
46 "warning",
47 "missing required permission",
48 },
49 },
50 {
51 name: "error with underlying cause",
52 filePath: "/path/to/workflow.md",
53 errType: "error",
54 message: "failed to parse YAML",
55 cause: errors.New("syntax error at line 42"),
56 wantContain: []string{
57 "/path/to/workflow.md",
58 "1:1",
59 "error",
60 "failed to parse YAML",
61 },
62 },
63 {
64 name: "lock file path",
65 filePath: "/path/to/workflow.lock.yml",
66 errType: "error",
67 message: "failed to write lock file",
68 cause: nil,
69 wantContain: []string{
70 "/path/to/workflow.lock.yml",
71 "1:1",
72 "error",

Callers

nothing calls this directly

Calls 3

formatCompilerErrorFunction · 0.85
RunMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected