mirror of
https://github.com/coredns/coredns.git
synced 2025-10-28 08:44:17 -04:00
18 lines
319 B
Go
18 lines
319 B
Go
|
|
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")
|
||
|
|
}
|
||
|
|
}
|