-
Notifications
You must be signed in to change notification settings - Fork 0
/
interface_test.go
41 lines (33 loc) · 899 Bytes
/
interface_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package breaker
import "testing"
type extended interface {
Interface
// IsReleased returns true if resources associated with the breaker were released.
//
// Deprecated: the original implementation contained a bug,
// and there is no longer any need for this method. It will be removed at v2.
IsReleased() bool
}
var (
_ extended = new(breaker)
_ extended = new(signalBreaker)
_ extended = new(channelBreaker)
_ extended = new(contextBreaker)
_ extended = new(timeoutBreaker)
_ extended = stub{}
)
func TestStub_internals(t *testing.T) {
var breaker stub
if breaker.Done() != nil {
t.Error("stub's Done channel must be nil")
}
if breaker.Err() != Interrupted {
t.Error("stub must be interrupted")
}
if !breaker.IsReleased() {
t.Error("stub must be always released")
}
if breaker != breaker.trigger() {
t.Error("unexpected behavior of stub's trigger method")
}
}