(t *testing.T)
| 567 | } |
| 568 | |
| 569 | func 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 |
| 597 | Line |
| 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 | |
| 620 | func TestStringWithTypeNameToGoComment(t *testing.T) { |
| 621 | testCases := []struct { |
nothing calls this directly
no test coverage detected