proxy-pool/internal/adapters/providerapi/template_complexity_test.go
youfak 4de3ffb85f
Some checks are pending
ci / test (ubuntu-latest) (push) Waiting to run
ci / test (windows-latest) (push) Waiting to run
ci / race (push) Waiting to run
feat: add ephemeral proxy activity pool
2026-07-29 12:51:18 +08:00

24 lines
533 B
Go

package providerapi
import (
"errors"
"testing"
"proxy-pool/internal/config"
)
func TestTemplateParserRejectsNestedRanges(t *testing.T) {
t.Parallel()
_, err := NewTemplateParser("provider-a", config.Upstream{
Provider: config.Provider{Protocols: []string{"http"}},
API: config.ProviderAPI{
Template: `{{range .}}{{range .}}{{end}}{{end}}`,
},
Pool: config.Pool{MaxSize: 10},
}, nil)
if !errors.Is(err, ErrTemplateTooComplex) {
t.Fatalf("NewTemplateParser() error = %v, want ErrTemplateTooComplex", err)
}
}