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

Function TestRemoveXMLCommentsCodeBlocksInComments

pkg/workflow/xml_comments_test.go:408–546  ·  view source on GitHub ↗

TestRemoveXMLCommentsCodeBlocksInComments tests the specific bug fix: code blocks within XML comments should be removed, not preserved

(t *testing.T)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

removeXMLCommentsFunction · 0.70
RunMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected