Skip to content

Commit

Permalink
refactor(test): improve error check
Browse files Browse the repository at this point in the history
  • Loading branch information
bashbunni committed Dec 4, 2024
1 parent 3e612da commit d4a5910
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions glow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ package main

import (
"bytes"
"strings"
"errors"
"net"
"testing"
)

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

0 comments on commit d4a5910

Please sign in to comment.