diff --git a/pcre_test.go b/pcre_test.go index f8a9b1c..4617413 100644 --- a/pcre_test.go +++ b/pcre_test.go @@ -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) + } +}