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

Function TestRemoveXMLCommentsComplexNesting

pkg/workflow/xml_comments_test.go:913–976  ·  view source on GitHub ↗

TestRemoveXMLCommentsComplexNesting tests complex nesting scenarios

(t *testing.T)

Source from the content-addressed store, hash-verified

911
912// TestRemoveXMLCommentsComplexNesting tests complex nesting scenarios
913func TestRemoveXMLCommentsComplexNesting(t *testing.T) {
914 tests := []struct {
915 name string
916 input string
917 expected string
918 }{
919 {
920 name: "Code block, then comment, then code block",
921 input: "```\ncode1\n```\n<!-- comment -->\n```\ncode2\n```",
922 expected: "```\ncode1\n```\n\n```\ncode2\n```",
923 },
924 {
925 name: "Comment, then code block, then comment",
926 input: "<!-- c1 -->\n```\ncode\n```\n<!-- c2 -->",
927 expected: "\n```\ncode\n```\n",
928 },
929 {
930 name: "Interleaved comments and code blocks",
931 input: `Text
932<!-- Start comment
933Comment line 1
934Comment line 2
935End comment -->
936` + "```" + `
937Code block
938` + "```" + `
939<!-- Another comment -->
940Final text`,
941 expected: `Text
942
943` + "```" + `
944Code block
945` + "```" + `
946
947Final text`,
948 },
949 {
950 name: "Code block with comment-like content (not actual comments)",
951 input: `Text
952` + "```html" + `
953<div>
954<!-- This looks like a comment but it's HTML in code -->
955</div>
956` + "```" + `
957End`,
958 expected: `Text
959` + "```html" + `
960<div>
961<!-- This looks like a comment but it's HTML in code -->
962</div>
963` + "```" + `
964End`,
965 },
966 }
967
968 for _, tt := range tests {
969 t.Run(tt.name, func(t *testing.T) {
970 result := removeXMLComments(tt.input)

Callers

nothing calls this directly

Calls 3

removeXMLCommentsFunction · 0.70
RunMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected