put helpers last

This commit is contained in:
sentriz
2023-10-01 03:19:07 +01:00
parent e9accfb71f
commit ae82153d79
7 changed files with 232 additions and 235 deletions

View File

@@ -11,28 +11,6 @@ import (
"go.senan.xyz/gonic/jukebox"
)
func newJukebox(tb testing.TB) *jukebox.Jukebox {
tb.Helper()
sockPath := filepath.Join(tb.TempDir(), "mpv.sock")
j := jukebox.New()
err := j.Start(
sockPath,
[]string{jukebox.MPVArg("--ao", "null")},
)
if errors.Is(err, jukebox.ErrMPVTooOld) {
tb.Skip("old mpv found, skipping")
}
if err != nil {
tb.Fatalf("start jukebox: %v", err)
}
tb.Cleanup(func() {
j.Quit()
})
return j
}
func TestPlaySkipReset(t *testing.T) {
t.Skip("bit flakey currently")
@@ -187,6 +165,28 @@ func TestVolume(t *testing.T) {
require.Equal(t, 0.0, vol)
}
func newJukebox(tb testing.TB) *jukebox.Jukebox {
tb.Helper()
sockPath := filepath.Join(tb.TempDir(), "mpv.sock")
j := jukebox.New()
err := j.Start(
sockPath,
[]string{jukebox.MPVArg("--ao", "null")},
)
if errors.Is(err, jukebox.ErrMPVTooOld) {
tb.Skip("old mpv found, skipping")
}
if err != nil {
tb.Fatalf("start jukebox: %v", err)
}
tb.Cleanup(func() {
j.Quit()
})
return j
}
func testPath(path string) string {
cwd, _ := os.Getwd()
return filepath.Join(cwd, "testdata", path)