config: add benchmark for replace walker
This commit is contained in:
parent
2ecf1b500f
commit
27c97b9b73
|
@ -18,6 +18,24 @@ func BenchmarkVariableDetectWalker(b *testing.B) {
|
|||
}
|
||||
}
|
||||
|
||||
func BenchmarkVariableReplaceWalker(b *testing.B) {
|
||||
w := &variableReplaceWalker{
|
||||
Values: map[string]string{
|
||||
"var.bar": "bar",
|
||||
"bar.baz.bing": "baz",
|
||||
},
|
||||
}
|
||||
|
||||
str := `foo ${var.bar} bar ${bar.baz.bing} $${escaped}`
|
||||
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
if err := reflectwalk.Walk(&str, w); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestVariableDetectWalker(t *testing.T) {
|
||||
w := new(variableDetectWalker)
|
||||
|
||||
|
|
Loading…
Reference in New Issue