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

import "testing"

func TestForEachTodo(t *testing.T) {
	a, i := newAddress(), 0
	a.setAddress("test", func() error { i++; return nil })

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