mirror of
https://github.com/diamondburned/arikawa.git
synced 2024-11-01 04:24:19 +00:00
*: Ignore examples/voice in integration test
This commit is contained in:
parent
5ebd28bab6
commit
ad26a72256
1
0-examples/integration_exclude.txt
Normal file
1
0-examples/integration_exclude.txt
Normal file
|
@ -0,0 +1 @@
|
|||
voice
|
|
@ -6,12 +6,18 @@ import (
|
|||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
_ "embed"
|
||||
|
||||
"github.com/diamondburned/arikawa/v3/internal/testenv"
|
||||
)
|
||||
|
||||
//go:embed integration_exclude.txt
|
||||
var integrationExclude string
|
||||
|
||||
func TestExamples(t *testing.T) {
|
||||
// Assert that the tests only run when the environment variables are set.
|
||||
testenv.Must(t)
|
||||
|
@ -22,6 +28,11 @@ func TestExamples(t *testing.T) {
|
|||
t.Skip("skipping test; go compiler not found")
|
||||
}
|
||||
|
||||
excluded := make(map[string]bool)
|
||||
for _, line := range strings.Split(string(integrationExclude), "\n") {
|
||||
excluded[strings.TrimSpace(line)] = true
|
||||
}
|
||||
|
||||
examplePackages, err := os.ReadDir(".")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
@ -66,6 +77,10 @@ func TestExamples(t *testing.T) {
|
|||
t.Fatal("cannot go build:", err)
|
||||
}
|
||||
|
||||
if excluded[pkg.Name()] {
|
||||
t.Skip("skipping excluded example", pkg.Name())
|
||||
}
|
||||
|
||||
timer := time.NewTimer(exampleRunDuration)
|
||||
t.Cleanup(func() { timer.Stop() })
|
||||
|
||||
|
|
Loading…
Reference in a new issue