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

Function TestRemoveXMLCommentsFromLine

pkg/workflow/xml_comments_test.go:818–910  ·  view source on GitHub ↗

TestRemoveXMLCommentsFromLine tests the single-line processing function

(t *testing.T)

Source from the content-addressed store, hash-verified

816
817// TestRemoveXMLCommentsFromLine tests the single-line processing function
818func TestRemoveXMLCommentsFromLine(t *testing.T) {
819 tests := []struct {
820 name string
821 line string
822 inComment bool
823 expectedResult string
824 expectedWasIn bool
825 expectedIsIn bool
826 }{
827 {
828 name: "No comment, not in comment",
829 line: "Regular text",
830 inComment: false,
831 expectedResult: "Regular text",
832 expectedWasIn: false,
833 expectedIsIn: false,
834 },
835 {
836 name: "Complete comment on line",
837 line: "Before <!-- comment --> after",
838 inComment: false,
839 expectedResult: "Before after",
840 expectedWasIn: false,
841 expectedIsIn: false,
842 },
843 {
844 name: "Start multiline comment",
845 line: "Text before <!-- comment starts",
846 inComment: false,
847 expectedResult: "Text before ",
848 expectedWasIn: false,
849 expectedIsIn: true,
850 },
851 {
852 name: "Inside multiline comment",
853 line: "This line is entirely in comment",
854 inComment: true,
855 expectedResult: "",
856 expectedWasIn: true,
857 expectedIsIn: true,
858 },
859 {
860 name: "End multiline comment",
861 line: "comment ends --> after comment",
862 inComment: true,
863 expectedResult: " after comment",
864 expectedWasIn: true,
865 expectedIsIn: false,
866 },
867 {
868 name: "Multiple comments on same line",
869 line: "<!-- c1 --> text <!-- c2 --> more",
870 inComment: false,
871 expectedResult: " text more",
872 expectedWasIn: false,
873 expectedIsIn: false,
874 },
875 {

Callers

nothing calls this directly

Calls 3

RunMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected