action: run tests on more platforms

This commit is contained in:
wwqgtxx
2025-04-15 21:59:35 +08:00
parent 8fa4e8122c
commit 984535f006
2 changed files with 118 additions and 3 deletions

View File

@@ -22,9 +22,10 @@ func sleepAndSend[T any](ctx context.Context, delay int, input T) func() (T, err
}
func TestPicker_Basic(t *testing.T) {
t.Parallel()
picker, ctx := WithContext[int](context.Background())
picker.Go(sleepAndSend(ctx, 30, 2))
picker.Go(sleepAndSend(ctx, 20, 1))
picker.Go(sleepAndSend(ctx, 200, 2))
picker.Go(sleepAndSend(ctx, 100, 1))
number := picker.Wait()
assert.NotNil(t, number)
@@ -32,8 +33,9 @@ func TestPicker_Basic(t *testing.T) {
}
func TestPicker_Timeout(t *testing.T) {
t.Parallel()
picker, ctx := WithTimeout[int](context.Background(), time.Millisecond*5)
picker.Go(sleepAndSend(ctx, 20, 1))
picker.Go(sleepAndSend(ctx, 100, 1))
number := picker.Wait()
assert.Equal(t, number, lo.Empty[int]())