github.com/tetratelabs/wazero@v1.7.3-0.20240513003603-48f702e154b5/imports/wasi_snapshot_preview1/sched_test.go (about) 1 package wasi_snapshot_preview1_test 2 3 import ( 4 "testing" 5 6 "github.com/tetratelabs/wazero" 7 "github.com/tetratelabs/wazero/internal/testing/require" 8 "github.com/tetratelabs/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 }