(t *testing.T)
| 234 | } |
| 235 | |
| 236 | func TestHasExitedBlock(t *testing.T) { |
| 237 | tests := []struct { |
| 238 | name string |
| 239 | line string |
| 240 | blockIndent string |
| 241 | expected bool |
| 242 | }{ |
| 243 | { |
| 244 | name: "exited with top-level key", |
| 245 | line: "permissions:", |
| 246 | blockIndent: " ", |
| 247 | expected: true, |
| 248 | }, |
| 249 | { |
| 250 | name: "still in block - more indentation", |
| 251 | line: " nested: value", |
| 252 | blockIndent: " ", |
| 253 | expected: false, |
| 254 | }, |
| 255 | { |
| 256 | name: "exited with comment at same level", |
| 257 | line: " # Comment", |
| 258 | blockIndent: " ", |
| 259 | expected: true, |
| 260 | }, |
| 261 | { |
| 262 | name: "still in block - nested comment", |
| 263 | line: " # Nested comment", |
| 264 | blockIndent: " ", |
| 265 | expected: false, |
| 266 | }, |
| 267 | { |
| 268 | name: "empty line", |
| 269 | line: "", |
| 270 | blockIndent: " ", |
| 271 | expected: false, |
| 272 | }, |
| 273 | } |
| 274 | |
| 275 | for _, tt := range tests { |
| 276 | t.Run(tt.name, func(t *testing.T) { |
| 277 | result := hasExitedBlock(tt.line, tt.blockIndent) |
| 278 | assert.Equal(t, tt.expected, result, "Block exit detection should match") |
| 279 | }) |
| 280 | } |
| 281 | } |
| 282 | |
| 283 | func TestFindAndReplaceInLine(t *testing.T) { |
| 284 | tests := []struct { |
nothing calls this directly
no test coverage detected