mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2026-02-26 16:57:08 +00:00
action: run tests on more platforms
This commit is contained in:
@@ -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]())
|
||||
|
||||
Reference in New Issue
Block a user