TestIsValidCodeBlockMarker tests the validation of code block markers
(t *testing.T)
| 753 | |
| 754 | // TestIsValidCodeBlockMarker tests the validation of code block markers |
| 755 | func TestIsValidCodeBlockMarker(t *testing.T) { |
| 756 | tests := []struct { |
| 757 | name string |
| 758 | input string |
| 759 | expected bool |
| 760 | }{ |
| 761 | {"Three backticks", "```", true}, |
| 762 | {"Four backticks", "````", true}, |
| 763 | {"Three tildes", "~~~", true}, |
| 764 | {"Five tildes", "~~~~~", true}, |
| 765 | {"Backticks with language", "```python", true}, |
| 766 | {"Tildes with language", "~~~bash", true}, |
| 767 | {"Two backticks", "``", false}, |
| 768 | {"One backtick", "`", false}, |
| 769 | {"Two tildes", "~~", false}, |
| 770 | {"Regular text", "text", false}, |
| 771 | {"Empty string", "", false}, |
| 772 | {"Mixed markers", "``~", false}, |
| 773 | } |
| 774 | |
| 775 | for _, tt := range tests { |
| 776 | t.Run(tt.name, func(t *testing.T) { |
| 777 | result := isValidCodeBlockMarker(tt.input) |
| 778 | if result != tt.expected { |
| 779 | t.Errorf("isValidCodeBlockMarker(%q) = %v, want %v", tt.input, result, tt.expected) |
| 780 | } |
| 781 | }) |
| 782 | } |
| 783 | } |
| 784 | |
| 785 | // TestIsMatchingCodeBlockMarker tests the matching of closing markers |
| 786 | func TestIsMatchingCodeBlockMarker(t *testing.T) { |
nothing calls this directly
no test coverage detected