File tree 1 file changed +10
-5
lines changed 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -503,21 +503,26 @@ func TestInterfaceAddrsWithNetsh(t *testing.T) {
503
503
}
504
504
}
505
505
506
- func getmacSpeaksEnglish (t * testing.T ) bool {
506
+ // check that getmac exists as a powershell command, and that it
507
+ // speaks English.
508
+ func checkGetmac (t * testing.T ) {
507
509
out , err := runCmd ("getmac" , "/?" )
508
510
if err != nil {
511
+ if strings .Contains (err .Error (), "term 'getmac' is not recognized as the name of a cmdlet" ) {
512
+ t .Skipf ("getmac not available" )
513
+ }
509
514
t .Fatal (err )
510
515
}
511
- return bytes .Contains (out , []byte ("network adapters on a system" ))
516
+ if ! bytes .Contains (out , []byte ("network adapters on a system" )) {
517
+ t .Skipf ("skipping test on non-English system" )
518
+ }
512
519
}
513
520
514
521
func TestInterfaceHardwareAddrWithGetmac (t * testing.T ) {
515
522
if isWindowsXP (t ) {
516
523
t .Skip ("Windows XP does not have powershell command" )
517
524
}
518
- if ! getmacSpeaksEnglish (t ) {
519
- t .Skip ("English version of getmac required for this test" )
520
- }
525
+ checkGetmac (t )
521
526
522
527
ift , err := Interfaces ()
523
528
if err != nil {
You can’t perform that action at this time.
0 commit comments