SectionsCode generates and formats the code for the given sections.
(t *testing.T, sections []*SectionTemplate)
| 34 | |
| 35 | // SectionsCode generates and formats the code for the given sections. |
| 36 | func SectionsCode(t *testing.T, sections []*SectionTemplate) string { |
| 37 | codes := make([]string, len(sections)) |
| 38 | for i, section := range sections { |
| 39 | codes[i] = sectionCodeWithPrefix(t, section, "package foo\n") |
| 40 | } |
| 41 | return strings.Join(codes, "\n") |
| 42 | } |
| 43 | |
| 44 | // SectionCodeFromImportsAndMethods generates and formats the code for given import and method definition sections. |
| 45 | func SectionCodeFromImportsAndMethods(t *testing.T, importSection, methodSection *SectionTemplate) string { |