MCPcopy Create free account
hub / github.com/expr-lang/expr / Never

Function Never

internal/testify/assert/assertions.go:1986–2013  ·  view source on GitHub ↗

Never asserts that the given condition doesn't satisfy in waitFor time, periodically checking the target function each tick. assert.Never(t, func() bool { return false; }, time.Second, 10*time.Millisecond)

(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{})

Source from the content-addressed store, hash-verified

1984//
1985// assert.Never(t, func() bool { return false; }, time.Second, 10*time.Millisecond)
1986func Never(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool {
1987 if h, ok := t.(tHelper); ok {
1988 h.Helper()
1989 }
1990
1991 ch := make(chan bool, 1)
1992
1993 timer := time.NewTimer(waitFor)
1994 defer timer.Stop()
1995
1996 ticker := time.NewTicker(tick)
1997 defer ticker.Stop()
1998
1999 for tick := ticker.C; ; {
2000 select {
2001 case <-timer.C:
2002 return true
2003 case <-tick:
2004 tick = nil
2005 go func() { ch <- condition() }()
2006 case v := <-ch:
2007 if v {
2008 return Fail(t, "Condition satisfied", msgAndArgs...)
2009 }
2010 tick = ticker.C
2011 }
2012 }
2013}
2014
2015// ErrorIs asserts that at least one of the errors in err's chain matches target.
2016// This is a wrapper for errors.Is.

Callers 5

NeverFunction · 0.92
NeverfFunction · 0.70
TestNeverFalseFunction · 0.70
TestNeverTrueFunction · 0.70
NeverMethod · 0.70

Calls 2

FailFunction · 0.70
HelperMethod · 0.45

Tested by 2

TestNeverFalseFunction · 0.56
TestNeverTrueFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…