Test nil values

This commit is contained in:
andig 2020-04-15 13:10:39 +02:00
parent cffc275ca8
commit edf780328a

View file

@ -41,6 +41,15 @@ func TestLimiter(t *testing.T) {
if o := <-out; o.Key != p.Key || o.Val != p.Val {
t.Errorf("unexpected param %v", o)
}
// allow nils
clck.Add(2 * l.interval)
p.Val = nil
in <- p
if o := <-out; o.Key != p.Key || o.Val != p.Val {
t.Errorf("unexpected param %v", o)
}
}
func TestDeduplicator(t *testing.T) {
@ -65,6 +74,14 @@ func TestDeduplicator(t *testing.T) {
t.Errorf("unexpected param %v", o)
}
// allow nils
p = core.Param{Key: "k", Val: nil}
in <- p
if o := <-out; o.Key != p.Key || o.Val != p.Val {
t.Errorf("unexpected param %v", o)
}
p = core.Param{Key: "filtered", Val: 3}
in <- p
@ -96,4 +113,12 @@ func TestDeduplicator(t *testing.T) {
if o := <-out; o.Key != p.Key || o.Val != p.Val {
t.Errorf("unexpected param %v", o)
}
// allow nils
p = core.Param{Key: "filtered", Val: nil}
in <- p
if o := <-out; o.Key != p.Key || o.Val != p.Val {
t.Errorf("unexpected param %v", o)
}
}