TestRemoveXMLCommentsCodeBlocksInComments tests the specific bug fix: code blocks within XML comments should be removed, not preserved
(t *testing.T)
| 406 | // TestRemoveXMLCommentsCodeBlocksInComments tests the specific bug fix: |
| 407 | // code blocks within XML comments should be removed, not preserved |
| 408 | func TestRemoveXMLCommentsCodeBlocksInComments(t *testing.T) { |
| 409 | tests := []struct { |
| 410 | name string |
| 411 | input string |
| 412 | expected string |
| 413 | }{ |
| 414 | { |
| 415 | name: "Code block with backticks inside XML comment should be removed", |
| 416 | input: `Before comment |
| 417 | <!-- |
| 418 | Documentation about usage: |
| 419 | |
| 420 | ` + "```yaml" + ` |
| 421 | --- |
| 422 | key: value |
| 423 | --- |
| 424 | ` + "```" + ` |
| 425 | |
| 426 | More documentation |
| 427 | --> |
| 428 | After comment`, |
| 429 | expected: `Before comment |
| 430 | |
| 431 | After comment`, |
| 432 | }, |
| 433 | { |
| 434 | name: "Code block with tildes inside XML comment should be removed", |
| 435 | input: `Content |
| 436 | <!-- |
| 437 | Example: |
| 438 | ~~~bash |
| 439 | command --flag |
| 440 | ~~~ |
| 441 | --> |
| 442 | More content`, |
| 443 | expected: `Content |
| 444 | |
| 445 | More content`, |
| 446 | }, |
| 447 | { |
| 448 | name: "Multiple code blocks inside XML comment should be removed", |
| 449 | input: `Text |
| 450 | <!-- |
| 451 | First example: |
| 452 | ` + "```python" + ` |
| 453 | print("hello") |
| 454 | ` + "```" + ` |
| 455 | |
| 456 | Second example: |
| 457 | ` + "```javascript" + ` |
| 458 | console.log("world"); |
| 459 | ` + "```" + ` |
| 460 | --> |
| 461 | End`, |
| 462 | expected: `Text |
| 463 | |
| 464 | End`, |
| 465 | }, |
nothing calls this directly
no test coverage detected