aboutsummaryrefslogtreecommitdiff
path: root/plugin/pkg/uniq/uniq_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/pkg/uniq/uniq_test.go')
-rw-r--r--plugin/pkg/uniq/uniq_test.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/plugin/pkg/uniq/uniq_test.go b/plugin/pkg/uniq/uniq_test.go
new file mode 100644
index 000000000..5d58c924b
--- /dev/null
+++ b/plugin/pkg/uniq/uniq_test.go
@@ -0,0 +1,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")
+ }
+}