24 lines
533 B
Go
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)
|
|
}
|
|
}
|