aboutsummaryrefslogtreecommitdiff
path: root/plugin/pkg/uniq/uniq_test.go
blob: 5d58c924bcb160882e1d0af3b1aca4473a82cd6a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package uniq

import "testing"

func TestForEach(t *testing.T) {
	u, i := New(), 0
	u.Set("test", func() error { i++; return nil })

	u.ForEach()
	if i != 1 {
		t.Errorf("Failed to executed f for %s", "test")
	}
	u.ForEach()
	if i != 1 {
		t.Errorf("Executed f twice instead of once")
	}
}