File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -391,7 +391,7 @@ func (e *Env) HasLibrary(libName string) bool {
391
391
392
392
// Libraries returns a list of SingletonLibrary that have been configured in the environment.
393
393
func (e * Env ) Libraries () []string {
394
- libraries := make ([]string , len (e .libraries ))
394
+ libraries := make ([]string , 0 , len (e .libraries ))
395
395
for libName := range e .libraries {
396
396
libraries = append (libraries , libName )
397
397
}
Original file line number Diff line number Diff line change @@ -257,9 +257,13 @@ func TestLibraries(t *testing.T) {
257
257
t .Errorf ("Expected HasLibrary() to return true for '%s'" , expected )
258
258
}
259
259
libMap := map [string ]struct {}{}
260
- for _ , lib := range e .Libraries () {
260
+ libraries := e .Libraries ()
261
+ for _ , lib := range libraries {
261
262
libMap [lib ] = struct {}{}
262
263
}
264
+ if len (libraries ) != 2 {
265
+ t .Errorf ("Expected HasLibrary() to contain exactly 2 libraries but got: %v" , libraries )
266
+ }
263
267
264
268
if _ , ok := libMap [expected ]; ! ok {
265
269
t .Errorf ("Expected Libraries() to include '%s'" , expected )
You can’t perform that action at this time.
0 commit comments