Commit 2f698cdf authored by Geoff Simmons's avatar Geoff Simmons

cover set objects in tests adapted from Varnish regression tests

parent e91c13e4
......@@ -12,12 +12,19 @@ varnish v1 -vcl+backend {
sub vcl_init {
new longregex = re2.regex("^(abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij)");
new longset = re2.set();
longset.add("^(abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij)");
longset.compile();
}
sub vcl_recv {
if (longregex.match(req.http.host)) {
return(synth(500, "not ok"));
}
if (longset.match(req.http.host)) {
return(synth(500, "not ok"));
}
if (re2.match("^(abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij)",
req.http.host)) {
return(synth(500, "not ok"));
......
......@@ -13,6 +13,14 @@ varnish v1 -vcl+backend {
sub vcl_init {
new end = re2.regex("$");
new empty = re2.regex("");
new endset = re2.set();
endset.add("$");
endset.compile();
new emptyset = re2.set();
emptyset.add("");
emptyset.compile();
}
sub vcl_backend_response {
......@@ -22,6 +30,12 @@ varnish v1 -vcl+backend {
if (empty.match(beresp.http.foo)) {
set beresp.http.bar = "YYY";
}
if (endset.match(beresp.http.bar)) {
set beresp.http.foos = "XXX";
}
if (emptyset.match(beresp.http.foo)) {
set beresp.http.bars = "YYY";
}
if (re2.match("$", beresp.http.bar)) {
set beresp.http.foof = "XXX";
}
......@@ -37,6 +51,8 @@ client c1 {
expect resp.status == 200
expect resp.http.foo == "XXX"
expect resp.http.bar == "YYY"
expect resp.http.foos == "XXX"
expect resp.http.bars == "YYY"
expect resp.http.foof == "XXX"
expect resp.http.barf == "YYY"
} -run
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment