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 @@ -390,7 +390,7 @@ func (e *Env) HasLibrary(libName string) bool {
390390
391391// Libraries returns a list of SingletonLibrary that have been configured in the environment.
392392func (e * Env ) Libraries () []string {
393- libraries := make ([]string , len (e .libraries ))
393+ libraries := make ([]string , 0 , len (e .libraries ))
394394 for libName := range e .libraries {
395395 libraries = append (libraries , libName )
396396 }
Original file line number Diff line number Diff line change @@ -238,9 +238,13 @@ func TestLibraries(t *testing.T) {
238238 t .Errorf ("Expected HasLibrary() to return true for '%s'" , expected )
239239 }
240240 libMap := map [string ]struct {}{}
241- for _ , lib := range e .Libraries () {
241+ libraries := e .Libraries ()
242+ for _ , lib := range libraries {
242243 libMap [lib ] = struct {}{}
243244 }
245+ if len (libraries ) != 2 {
246+ t .Errorf ("Expected HasLibrary() to contain exactly 2 libraries but got: %v" , libraries )
247+ }
244248
245249 if _ , ok := libMap [expected ]; ! ok {
246250 t .Errorf ("Expected Libraries() to include '%s'" , expected )
You can’t perform that action at this time.
0 commit comments