TestPrintCompilationSummary tests the printCompilationSummary function
(t *testing.T)
| 85 | |
| 86 | // TestPrintCompilationSummary tests the printCompilationSummary function |
| 87 | func TestPrintCompilationSummary(t *testing.T) { |
| 88 | tests := []struct { |
| 89 | name string |
| 90 | stats *CompilationStats |
| 91 | }{ |
| 92 | { |
| 93 | name: "no workflows", |
| 94 | stats: &CompilationStats{ |
| 95 | Total: 0, |
| 96 | Errors: 0, |
| 97 | Warnings: 0, |
| 98 | }, |
| 99 | }, |
| 100 | { |
| 101 | name: "successful compilation", |
| 102 | stats: &CompilationStats{ |
| 103 | Total: 5, |
| 104 | Errors: 0, |
| 105 | Warnings: 0, |
| 106 | }, |
| 107 | }, |
| 108 | { |
| 109 | name: "with warnings", |
| 110 | stats: &CompilationStats{ |
| 111 | Total: 5, |
| 112 | Errors: 0, |
| 113 | Warnings: 3, |
| 114 | }, |
| 115 | }, |
| 116 | { |
| 117 | name: "with errors", |
| 118 | stats: &CompilationStats{ |
| 119 | Total: 5, |
| 120 | Errors: 2, |
| 121 | Warnings: 1, |
| 122 | FailedWorkflows: []string{"workflow1.md", "workflow2.md"}, |
| 123 | }, |
| 124 | }, |
| 125 | { |
| 126 | name: "with detailed failure information", |
| 127 | stats: &CompilationStats{ |
| 128 | Total: 5, |
| 129 | Errors: 3, |
| 130 | Warnings: 1, |
| 131 | FailureDetails: []WorkflowFailure{ |
| 132 | {Path: ".github/workflows/test1.md", ErrorCount: 1}, |
| 133 | {Path: ".github/workflows/test2.md", ErrorCount: 2}, |
| 134 | {Path: ".github/workflows/test3.md", ErrorCount: 1}, |
| 135 | }, |
| 136 | }, |
| 137 | }, |
| 138 | { |
| 139 | name: "with multiple errors per workflow", |
| 140 | stats: &CompilationStats{ |
| 141 | Total: 3, |
| 142 | Errors: 5, |
| 143 | Warnings: 0, |
| 144 | FailureDetails: []WorkflowFailure{ |
nothing calls this directly
no test coverage detected