TestIsMatchingCodeBlockMarker tests the matching of closing markers
(t *testing.T)
| 784 | |
| 785 | // TestIsMatchingCodeBlockMarker tests the matching of closing markers |
| 786 | func TestIsMatchingCodeBlockMarker(t *testing.T) { |
| 787 | tests := []struct { |
| 788 | name string |
| 789 | closing string |
| 790 | opening string |
| 791 | shouldMatch bool |
| 792 | }{ |
| 793 | {"Same backticks", "```", "```", true}, |
| 794 | {"More closing backticks", "````", "```", true}, |
| 795 | {"Fewer closing backticks", "```", "````", false}, |
| 796 | {"Same tildes", "~~~", "~~~", true}, |
| 797 | {"More closing tildes", "~~~~~", "~~~", true}, |
| 798 | {"Fewer closing tildes", "~~~", "~~~~~", false}, |
| 799 | {"Backticks vs tildes", "```", "~~~", false}, |
| 800 | {"Tildes vs backticks", "~~~", "```", false}, |
| 801 | {"Empty opening", "```", "", false}, |
| 802 | {"Empty closing", "", "```", false}, |
| 803 | {"Both empty", "", "", false}, |
| 804 | } |
| 805 | |
| 806 | for _, tt := range tests { |
| 807 | t.Run(tt.name, func(t *testing.T) { |
| 808 | result := isMatchingCodeBlockMarker(tt.closing, tt.opening) |
| 809 | if result != tt.shouldMatch { |
| 810 | t.Errorf("isMatchingCodeBlockMarker(%q, %q) = %v, want %v", |
| 811 | tt.closing, tt.opening, result, tt.shouldMatch) |
| 812 | } |
| 813 | }) |
| 814 | } |
| 815 | } |
| 816 | |
| 817 | // TestRemoveXMLCommentsFromLine tests the single-line processing function |
| 818 | func TestRemoveXMLCommentsFromLine(t *testing.T) { |
nothing calls this directly
no test coverage detected