mirror of
https://github.com/pgsty/minio.git
synced 2026-11-07 08:12:03 +03:00
lambda/event: fix TargetIDSet.IsEmpty and add regression test
Signed-off-by: AleksaMCode <aleksamcode@gmail.com>
This commit is contained in:
@@ -24,7 +24,7 @@ type TargetIDSet map[TargetID]struct{}
|
|||||||
|
|
||||||
// IsEmpty returns true if the set is empty.
|
// IsEmpty returns true if the set is empty.
|
||||||
func (set TargetIDSet) IsEmpty() bool {
|
func (set TargetIDSet) IsEmpty() bool {
|
||||||
return len(set) != 0
|
return len(set) == 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clone - returns copy of this set.
|
// Clone - returns copy of this set.
|
||||||
|
|||||||
@@ -22,6 +22,22 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func TestTargetIDSetIsEmpty(t *testing.T) {
|
||||||
|
testCases := []struct {
|
||||||
|
set TargetIDSet
|
||||||
|
expected bool
|
||||||
|
}{
|
||||||
|
{NewTargetIDSet(), true},
|
||||||
|
{NewTargetIDSet(TargetID{"1", "webhook"}), false},
|
||||||
|
}
|
||||||
|
|
||||||
|
for i, testCase := range testCases {
|
||||||
|
if got := testCase.set.IsEmpty(); got != testCase.expected {
|
||||||
|
t.Fatalf("test %v: expected: %v, got: %v", i+1, testCase.expected, got)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestTargetIDSetClone(t *testing.T) {
|
func TestTargetIDSetClone(t *testing.T) {
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
set TargetIDSet
|
set TargetIDSet
|
||||||
|
|||||||
Reference in New Issue
Block a user