mirror of
https://github.com/diamondburned/arikawa.git
synced 2024-11-30 10:43:30 +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"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
_ "embed"
|
||||||
|
|
||||||
"github.com/diamondburned/arikawa/v3/internal/testenv"
|
"github.com/diamondburned/arikawa/v3/internal/testenv"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
//go:embed integration_exclude.txt
|
||||||
|
var integrationExclude string
|
||||||
|
|
||||||
func TestExamples(t *testing.T) {
|
func TestExamples(t *testing.T) {
|
||||||
// Assert that the tests only run when the environment variables are set.
|
// Assert that the tests only run when the environment variables are set.
|
||||||
testenv.Must(t)
|
testenv.Must(t)
|
||||||
|
@ -22,6 +28,11 @@ func TestExamples(t *testing.T) {
|
||||||
t.Skip("skipping test; go compiler not found")
|
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(".")
|
examplePackages, err := os.ReadDir(".")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
@ -66,6 +77,10 @@ func TestExamples(t *testing.T) {
|
||||||
t.Fatal("cannot go build:", err)
|
t.Fatal("cannot go build:", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if excluded[pkg.Name()] {
|
||||||
|
t.Skip("skipping excluded example", pkg.Name())
|
||||||
|
}
|
||||||
|
|
||||||
timer := time.NewTimer(exampleRunDuration)
|
timer := time.NewTimer(exampleRunDuration)
|
||||||
t.Cleanup(func() { timer.Stop() })
|
t.Cleanup(func() { timer.Stop() })
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue