Add Varnish test case
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Elara 2023-07-27 09:41:27 -07:00
parent 18912728e9
commit e90cc6feac

View File

@ -4,6 +4,7 @@ import (
"strings"
"sync"
"testing"
"reflect"
"go.elara.ws/pcre"
)
@ -289,3 +290,11 @@ func TestCallout(t *testing.T) {
t.Error("expected regular expression to match the string")
}
}
func TestVarnish(t *testing.T) {
regex := pcre.MustCompile(`varnish(?: \(Varnish\/([\d.]{1,250})\))?`)
matches := regex.FindStringSubmatch("1.1 varnish")
if !reflect.DeepEqual(matches, []string{"varnish", ""}) {
t.Errorf(`Expected ["varnish" ""], got %q`, matches)
}
}