forked from Elara6331/pcre
Add Varnish test case
This commit is contained in:
parent
18912728e9
commit
e90cc6feac
@ -4,6 +4,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"testing"
|
"testing"
|
||||||
|
"reflect"
|
||||||
|
|
||||||
"go.elara.ws/pcre"
|
"go.elara.ws/pcre"
|
||||||
)
|
)
|
||||||
@ -289,3 +290,11 @@ func TestCallout(t *testing.T) {
|
|||||||
t.Error("expected regular expression to match the string")
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user