(t *testing.T)
| 152 | } |
| 153 | |
| 154 | func TestIsTopLevelKey(t *testing.T) { |
| 155 | tests := []struct { |
| 156 | name string |
| 157 | line string |
| 158 | expected bool |
| 159 | }{ |
| 160 | { |
| 161 | name: "top level key", |
| 162 | line: "on: workflow_dispatch", |
| 163 | expected: true, |
| 164 | }, |
| 165 | { |
| 166 | name: "indented key", |
| 167 | line: " contents: read", |
| 168 | expected: false, |
| 169 | }, |
| 170 | { |
| 171 | name: "comment", |
| 172 | line: "# This is a comment", |
| 173 | expected: false, |
| 174 | }, |
| 175 | { |
| 176 | name: "empty line", |
| 177 | line: "", |
| 178 | expected: false, |
| 179 | }, |
| 180 | { |
| 181 | name: "no colon", |
| 182 | line: "just text", |
| 183 | expected: false, |
| 184 | }, |
| 185 | } |
| 186 | |
| 187 | for _, tt := range tests { |
| 188 | t.Run(tt.name, func(t *testing.T) { |
| 189 | result := isTopLevelKey(tt.line) |
| 190 | assert.Equal(t, tt.expected, result, "Top-level key detection should match") |
| 191 | }) |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | func TestIsNestedUnder(t *testing.T) { |
| 196 | tests := []struct { |
nothing calls this directly
no test coverage detected