MCPcopy Index your code
hub / github.com/oapi-codegen/oapi-codegen / TestStringToGoComment

Function TestStringToGoComment

pkg/codegen/utils_test.go:569–618  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

567}
568
569func TestStringToGoComment(t *testing.T) {
570 testCases := []struct {
571 input string
572 expected string
573 message string
574 }{
575 {
576 input: "",
577 expected: "",
578 message: "blank string should be ignored due to human unreadable",
579 },
580 {
581 input: " ",
582 expected: "",
583 message: "whitespace should be ignored due to human unreadable",
584 },
585 {
586 input: "Single Line",
587 expected: "// Single Line",
588 message: "single line comment",
589 },
590 {
591 input: " Single Line",
592 expected: "// Single Line",
593 message: "single line comment preserving whitespace",
594 },
595 {
596 input: `Multi
597Line
598 With
599 Spaces
600 And
601 Tabs
602`,
603 expected: `// Multi
604// Line
605// With
606// Spaces
607// And
608// Tabs`,
609 message: "multi line preserving whitespaces using tabs or spaces",
610 },
611 }
612 for _, testCase := range testCases {
613 t.Run(testCase.message, func(t *testing.T) {
614 result := StringToGoComment(testCase.input)
615 assert.EqualValues(t, testCase.expected, result, testCase.message)
616 })
617 }
618}
619
620func TestStringWithTypeNameToGoComment(t *testing.T) {
621 testCases := []struct {

Callers

nothing calls this directly

Calls 2

StringToGoCommentFunction · 0.85
RunMethod · 0.80

Tested by

no test coverage detected