Skip to content

Commit

Permalink
test: skip networked tests if no connection
Browse files Browse the repository at this point in the history
  • Loading branch information
bashbunni committed Dec 3, 2024
1 parent ae57cce commit 3e612da
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions glow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"bytes"
"strings"
"testing"
)

Expand All @@ -16,6 +17,13 @@ func TestGlowSources(t *testing.T) {

for _, v := range tt {
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") {
t.Logf("Error during execution (args: %s):\n%v", v, nerr)
t.Skip("Test uses network. Are you connected to the Internet?")
}

buf := &bytes.Buffer{}
err := executeArg(rootCmd, v, buf)
if err != nil {
Expand Down

0 comments on commit 3e612da

Please sign in to comment.