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

Function TestRemoveXMLCommentsEdgeCases

pkg/workflow/xml_comments_test.go:549–657  ·  view source on GitHub ↗

TestRemoveXMLCommentsEdgeCases tests various edge cases and boundary conditions

(t *testing.T)

Source from the content-addressed store, hash-verified

547
548// TestRemoveXMLCommentsEdgeCases tests various edge cases and boundary conditions
549func TestRemoveXMLCommentsEdgeCases(t *testing.T) {
550 tests := []struct {
551 name string
552 input string
553 expected string
554 }{
555 {
556 name: "Empty string",
557 input: "",
558 expected: "",
559 },
560 {
561 name: "Only whitespace",
562 input: " \n\t\n ",
563 expected: " \n\t\n ",
564 },
565 {
566 name: "Only XML comment opening without closing",
567 input: "<!-- unclosed comment",
568 expected: "",
569 },
570 {
571 name: "Only XML comment closing without opening",
572 input: "closing without opening -->",
573 expected: "closing without opening -->",
574 },
575 {
576 name: "Comment markers in text are processed as comments",
577 input: `Text with "<!--" in quotes and "-->" also in quotes`,
578 expected: `Text with "" also in quotes`,
579 },
580 {
581 name: "XML comment spanning entire content",
582 input: `<!-- Everything is commented
583Line 2
584Line 3
585Last line -->`,
586 expected: "",
587 },
588 {
589 name: "Multiple consecutive XML comments",
590 input: `Text
591<!-- Comment 1 -->
592<!-- Comment 2 -->
593<!-- Comment 3 -->
594More text`,
595 expected: `Text
596
597
598
599More text`,
600 },
601 {
602 name: "XML comment with code block markers but incomplete blocks",
603 input: `Before
604<!--
605` + "```" + `
606This code block is never closed

Callers

nothing calls this directly

Calls 3

removeXMLCommentsFunction · 0.70
RunMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected