Skip to content

Commit d4a5910

Browse files
committed
refactor(test): improve error check
1 parent 3e612da commit d4a5910

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

glow_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ package main
22

33
import (
44
"bytes"
5-
"strings"
5+
"errors"
6+
"net"
67
"testing"
78
)
89

@@ -19,7 +20,8 @@ func TestGlowSources(t *testing.T) {
1920
t.Run(v, func(t *testing.T) {
2021
// Start by checking for network issues.
2122
_, nerr := readmeURL(v)
22-
if nerr != nil && strings.Contains(nerr.Error(), "no such host") {
23+
var dnsErr *net.DNSError
24+
if nerr != nil && errors.As(nerr, &dnsErr) {
2325
t.Logf("Error during execution (args: %s):\n%v", v, nerr)
2426
t.Skip("Test uses network. Are you connected to the Internet?")
2527
}

0 commit comments

Comments
 (0)