mirror of
https://github.com/eosswedenorg/thalos
synced 2026-06-27 10:53:42 +02:00
transport/channel_test.go: Add test for Channel.Is()
This commit is contained in:
parent
70bc689736
commit
08c84d81ca
1 changed files with 27 additions and 0 deletions
|
|
@ -25,6 +25,33 @@ func TestChannel_Append(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestChannel_Is(t *testing.T) {
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
a Channel
|
||||||
|
b Channel
|
||||||
|
want bool
|
||||||
|
}{
|
||||||
|
{"Empty valid", Channel{}, Channel{}, true},
|
||||||
|
{"Valid #1", Channel{"one"}, Channel{"one"}, true},
|
||||||
|
{"Valid #2", Channel{"one", "two"}, Channel{"one", "two"}, true},
|
||||||
|
{"Invalid #1", Channel{"one"}, Channel{"one", "two"}, false},
|
||||||
|
{"Invalid #2", Channel{"one", "three"}, Channel{"one", "two"}, false},
|
||||||
|
{"Invalid #3", Channel{"two", "one"}, Channel{"one", "two"}, false},
|
||||||
|
}
|
||||||
|
for _, tt := range tests {
|
||||||
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
if got := tt.a.Is(tt.b); got != tt.want {
|
||||||
|
t.Errorf("a.Is(b) = %v, want %v", got, tt.want)
|
||||||
|
}
|
||||||
|
|
||||||
|
if got := tt.b.Is(tt.a); got != tt.want {
|
||||||
|
t.Errorf("b.Is(a) = %v, want %v", got, tt.want)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestChannel_String(t *testing.T) {
|
func TestChannel_String(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue