File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -391,7 +391,7 @@ func (e *Env) HasLibrary(libName string) bool {
391391
392392// Libraries returns a list of SingletonLibrary that have been configured in the environment.
393393func (e * Env ) Libraries () []string {
394- libraries := make ([]string , len (e .libraries ))
394+ libraries := make ([]string , 0 , len (e .libraries ))
395395 for libName := range e .libraries {
396396 libraries = append (libraries , libName )
397397 }
Original file line number Diff line number Diff line change @@ -257,9 +257,13 @@ func TestLibraries(t *testing.T) {
257257 t .Errorf ("Expected HasLibrary() to return true for '%s'" , expected )
258258 }
259259 libMap := map [string ]struct {}{}
260- for _ , lib := range e .Libraries () {
260+ libraries := e .Libraries ()
261+ for _ , lib := range libraries {
261262 libMap [lib ] = struct {}{}
262263 }
264+ if len (libraries ) != 2 {
265+ t .Errorf ("Expected HasLibrary() to contain exactly 2 libraries but got: %v" , libraries )
266+ }
263267
264268 if _ , ok := libMap [expected ]; ! ok {
265269 t .Errorf ("Expected Libraries() to include '%s'" , expected )
You can’t perform that action at this time.
0 commit comments