@@ -47,13 +47,56 @@ func TestBoilerplate(t *testing.T) {
47
47
}
48
48
}
49
49
50
- const boilerplate = `// Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ac
50
+ func TestBoilerplateMultiline (t * testing.T ) {
51
+ s , buf := setupScaffoldAndWriter ()
52
+ s .Fs = afero .NewMemMapFs ()
53
+ f , err := afero .TempFile (s .Fs , "" , "" )
54
+ if err != nil {
55
+ t .Fatal (err )
56
+ }
57
+ if _ , err = f .Write ([]byte (boilerplateMulti )); err != nil {
58
+ t .Fatal (err )
59
+ }
60
+ if err = f .Close (); err != nil {
61
+ t .Fatal (err )
62
+ }
63
+ s .BoilerplatePath = f .Name ()
64
+ err = s .Execute (appConfig , & Apis {})
65
+ if err != nil {
66
+ t .Fatalf ("Failed to execute the scaffold: (%v)" , err )
67
+ }
68
+
69
+ if boilerplateMultiExp != buf .String () {
70
+ diffs := diffutil .Diff (boilerplateMultiExp , buf .String ())
71
+ t .Fatalf ("Expected vs actual differs.\n %v" , diffs )
72
+ }
73
+ }
74
+
75
+ const (
76
+ boilerplate = `// Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ac
51
77
// velit a lacus tempor accumsan sit amet eu velit. Mauris orci lectus,
52
78
// rutrum vitae porttitor in, interdum nec mauris. Praesent porttitor
53
79
// lectus a sem volutpat, ac fringilla magna fermentum. Donec a nibh
54
80
// a urna fringilla eleifend. Curabitur vitae lorem nulla. Ut at risus
55
81
// varius, blandit risus quis, porta tellus. Vivamus scelerisque turpis
56
82
// quis viverra rhoncus. Aenean non arcu velit.
57
83
`
84
+ boilerplateExp = boilerplate + "\n " + apisExp
85
+ boilerplateMulti = `/*
86
+ Copyright The Project Authors.
87
+
88
+ Licensed under the Apache License, Version 2.0 (the "License");
89
+ you may not use this file except in compliance with the License.
90
+ You may obtain a copy of the License at
58
91
59
- const boilerplateExp = boilerplate + "\n " + apisExp
92
+ http://www.apache.org/licenses/LICENSE-2.0
93
+
94
+ Unless required by applicable law or agreed to in writing, software
95
+ distributed under the License is distributed on an "AS IS" BASIS,
96
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
97
+ See the License for the specific language governing permissions and
98
+ limitations under the License.
99
+ */
100
+ `
101
+ boilerplateMultiExp = boilerplateMulti + "\n " + apisExp
102
+ )
0 commit comments