forked from Elara6331/pcre
		
	Add Varnish test case
This commit is contained in:
		@@ -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)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user