mirror of
https://github.com/bettercap/bettercap
synced 2025-07-16 10:03:39 -07:00
add test for Each function
This commit is contained in:
parent
21c0fc43ca
commit
db7c2d0a74
1 changed files with 18 additions and 0 deletions
|
@ -67,3 +67,21 @@ func TestMetaGetOr(t *testing.T) {
|
|||
t.Fatalf("expected '%v', got '%v'", exp, got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMetaEach(t *testing.T) {
|
||||
example := buildExampleMeta()
|
||||
example.m["picat"] = true
|
||||
example.m["evilsocket"] = true
|
||||
|
||||
count := 0
|
||||
exampleCB := func(name string, value interface{}) {
|
||||
count++
|
||||
}
|
||||
example.Each(exampleCB)
|
||||
|
||||
exp := 2
|
||||
got := count
|
||||
if exp != got {
|
||||
t.Fatalf("expected '%v', got '%v'", exp, got)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue