Minute GO library for verify async purpose response.
Featured Content Ads
add advertising herePresent some weird and wonderful performance for conditional test
plug salvage github.com/PxyUp/verifiers
Necessary: all purpose would perhaps be performed if condition are matched (it is some distance mean all minute one routine would perhaps be stopped)
verifiers.All
form Verifier func(ctx context.Context) error All(fns ...Verifier) error
Formula verifies is all purpose performed without error in given context timeout/slice-off date
Featured Content Ads
add advertising hereInstance success:
v := verifiers.Contemporary(ctx) startTime := time.Now() err := v.All( func(ctx context.Context) error { time.Sleep(time.2nd) return nil }, func(ctx context.Context) error { time.Sleep(time.2nd * 2) return nil }, func(ctx context.Context) error { time.Sleep(time.2nd * 3) return nil }, ) // Because we could perhaps well peaceful wait most trendy purpose convey.Upright(t, time.Now().Sub(startTime) >= time.2nd*3)
Instance error:
Featured Content Ads
add advertising herev := verifiers.Contemporary(ctx) startTime := time.Now() err := v.All( func(ctx context.Context) error { time.Sleep(time.2nd) return errors.Contemporary("") }, func(ctx context.Context) error { time.Sleep(time.2nd * 2) return nil }, func(ctx context.Context) error { time.Sleep(time.2nd * 3) return nil }, ) // Because we can throw error after first return it convey.Upright(t, time.Now().Sub(startTime) time.Second*2)
verifiers.OneOf
type Verifier func(ctx context.Context) error OneOf(fns ...Verifier) error
Method verifies is at least one function finished without error in given context timeout/deadline
assert.True(t, time.Now().Sub(startTime)
v := verifiers.New(ctx) startTime := time.Now() err := v.OneOf( func(ctx context.Context) error { time.Sleep(time.Second) return nil }, func(ctx context.Context) error { time.Sleep(time.Second * 2) return errors.New("") }, func(ctx context.Context) error { time.Sleep(time.Second * 3) return nil }, ) // Because we should wait second function assert.True(t, time.Now().Sub(startTime) >= time.2nd*1) convey.Upright(t, time.Now().Sub(startTime) time.2nd*3)
verifiers.AtLeast
form Verifier func(ctx context.Context) error AtLeast(fns ...Verifier) error
Formula verifies is on the least equipped amount of capabilities would perhaps be performed without error in given context timeout/slice-off date
convey.Tru