MCPcopy Create free account
hub / github.com/github/gh-aw / TestIsMatchingCodeBlockMarker

Function TestIsMatchingCodeBlockMarker

pkg/workflow/xml_comments_test.go:786–815  ·  view source on GitHub ↗

TestIsMatchingCodeBlockMarker tests the matching of closing markers

(t *testing.T)

Source from the content-addressed store, hash-verified

784
785// TestIsMatchingCodeBlockMarker tests the matching of closing markers
786func 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
818func TestRemoveXMLCommentsFromLine(t *testing.T) {

Callers

nothing calls this directly

Calls 3

RunMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected