From 96a07c1bf2231267ba1f523f80d4b87dfa102f08 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 13 Jul 2024 22:39:37 +0900 Subject: [PATCH] audio/internal/convert: bug fix: skip some tests on browsers --- audio/internal/convert/float32_test.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/audio/internal/convert/float32_test.go b/audio/internal/convert/float32_test.go index 91c92b567..4aa5f3000 100644 --- a/audio/internal/convert/float32_test.go +++ b/audio/internal/convert/float32_test.go @@ -18,6 +18,7 @@ import ( "bytes" "crypto/rand" "io" + "runtime" "testing" "unsafe" @@ -34,7 +35,8 @@ func randInt16s(n int) []int16 { func TestFloat32(t *testing.T) { cases := []struct { - In []int16 + In []int16 + SkipOnBrowserReason string }{ { In: nil, @@ -49,10 +51,14 @@ func TestFloat32(t *testing.T) { In: randInt16s(256), }, { - In: randInt16s(65536), + In: randInt16s(65536), + SkipOnBrowserReason: "entropy is not enough on browser to generate random numbers", }, } for _, c := range cases { + if runtime.GOOS == "js" && c.SkipOnBrowserReason != "" { + t.Skip(c.SkipOnBrowserReason) + } // Note that unsafe.SliceData is available as of Go 1.20. var in, out []byte if len(c.In) > 0 {