github.com/bananabytelabs/wazero@v0.0.0-20240105073314-54b22a776da8/imports/wasi_snapshot_preview1/sched_test.go (about) 1 package wasi_snapshot_preview1_test 2 3 import ( 4 "testing" 5 6 "github.com/bananabytelabs/wazero" 7 "github.com/bananabytelabs/wazero/internal/testing/require" 8 "github.com/bananabytelabs/wazero/internal/wasip1" 9 ) 10 11 func Test_schedYield(t *testing.T) { 12 var yielded bool 13 mod, r, log := requireProxyModule(t, wazero.NewModuleConfig(). 14 WithOsyield(func() { 15 yielded = true 16 })) 17 defer r.Close(testCtx) 18 requireErrnoResult(t, wasip1.ErrnoSuccess, mod, wasip1.SchedYieldName) 19 require.Equal(t, ` 20 ==> wasi_snapshot_preview1.sched_yield() 21 <== errno=ESUCCESS 22 `, "\n"+log.String()) 23 require.True(t, yielded) 24 }