Skip to content

Commit

Permalink
chore: add failing race test for default logger
Browse files Browse the repository at this point in the history
  • Loading branch information
op authored and aymanbagabas committed May 7, 2024
1 parent 287c9d0 commit 06722a6
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions pkg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,35 @@ package log
import (
"bytes"
"fmt"
"io"
"os"
"os/exec"
"path/filepath"
"runtime"
"strconv"
"testing"
"time"

"github.com/muesli/termenv"
"github.com/stretchr/testify/assert"
)

func TestDefaultRace(t *testing.T) {
l := Default()
t.Cleanup(func() {
SetDefault(l)
})

for i := 0; i < 2; i++ {
t.Run(strconv.Itoa(i), func(t *testing.T) {
t.Parallel()

SetDefault(New(io.Discard))
Default().Info("foo")
})
}
}

func TestGlobal(t *testing.T) {
var buf bytes.Buffer
SetOutput(&buf)
Expand Down

0 comments on commit 06722a6

Please sign in to comment.