Skip to content

Commit bcfc734

Browse files
committed
update tests
1 parent 7d068ac commit bcfc734

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

bloom_test.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,6 @@ func TestBloomFilter_Add(t *testing.T) {
7474
})
7575

7676
t.Run("add should panic when number of entries exceed the capacity", func(t *testing.T) {
77-
defer func() {
78-
if r := recover(); r == nil {
79-
fmt.Println("recovered from panic")
80-
return
81-
}
82-
}()
83-
8477
count := 1000
8578
opts := &BloomOptions{
8679
Err_rate: 0.01,
@@ -98,8 +91,10 @@ func TestBloomFilter_Add(t *testing.T) {
9891
binary.LittleEndian.PutUint32(by[:], uint32(i))
9992
bf.Add(by[:])
10093
}
101-
bf.Add([]byte("test"))
102-
t.Errorf("Expected function to panic when number of entries exceed the capacity")
94+
err := bf.Add([]byte("test"))
95+
if err == nil {
96+
t.Errorf("Expected error, got nil")
97+
}
10398
})
10499

105100
t.Run("get should panic when there is no persistent store", func(t *testing.T) {

0 commit comments

Comments
 (0)