@@ -151,16 +151,19 @@ func TestNetrcFindMachine(t *testing.T) {
151151 t .Fatal (err )
152152 }
153153
154- m , err := n .FindMachine ("ray" )
155- if err != nil {
156- t .Fatal (err )
157- }
154+ m := n .FindMachine ("ray" )
158155 if ! eqMachine (m , expectedMachines [1 ]) {
159156 t .Errorf ("bad machine; expected %v, got %v\n " , expectedMachines [1 ], m )
160157 }
161158 if m .IsDefault () {
162159 t .Errorf ("expected def to be false" )
163160 }
161+
162+ n = & Netrc {}
163+ m = n .FindMachine ("nonexistent" )
164+ if m != nil {
165+ t .Errorf ("expected nil, got %v" , m )
166+ }
164167}
165168
166169func TestMarshalText (t * testing.T ) {
@@ -347,10 +350,7 @@ func TestUpdateLogin(t *testing.T) {
347350 }
348351
349352 for _ , test := range tests {
350- m , err := n .FindMachine (test .name )
351- if err != nil {
352- t .Fatal (err )
353- }
353+ m := n .FindMachine (test .name )
354354 if m .IsDefault () == test .exists {
355355 t .Errorf ("expected machine %s to not exist, but it did" , test .name )
356356 } else {
@@ -362,10 +362,7 @@ func TestUpdateLogin(t *testing.T) {
362362 continue
363363 }
364364 m .UpdateLogin (test .newlogin )
365- m , err := n .FindMachine (test .name )
366- if err != nil {
367- t .Fatal (err )
368- }
365+ m := n .FindMachine (test .name )
369366 if m .Login != test .newlogin {
370367 t .Errorf ("expected new login %q, got %q" , test .newlogin , m .Login )
371368 }
@@ -415,10 +412,7 @@ func TestUpdatePassword(t *testing.T) {
415412 }
416413
417414 for _ , test := range tests {
418- m , err := n .FindMachine (test .name )
419- if err != nil {
420- t .Fatal (err )
421- }
415+ m := n .FindMachine (test .name )
422416 if m .IsDefault () == test .exists {
423417 t .Errorf ("expected machine %s to not exist, but it did" , test .name )
424418 } else {
@@ -430,10 +424,7 @@ func TestUpdatePassword(t *testing.T) {
430424 continue
431425 }
432426 m .UpdatePassword (test .newpassword )
433- m , err := n .FindMachine (test .name )
434- if err != nil {
435- t .Fatal (err )
436- }
427+ m = n .FindMachine (test .name )
437428 if m .Password != test .newpassword {
438429 t .Errorf ("expected new password %q, got %q" , test .newpassword , m .Password )
439430 }
0 commit comments