Commit aa2004cd authored by Geoff Simmons's avatar Geoff Simmons

fix test r00913.vtc -- only in match() will we treat strings to be

match as "" when NULL, to correspond with the Varnish native regexen
parent 387b6fd7
# looks like -*- vcl -*-
varnishtest "test null match (varnish r00913.vtc)"
varnishtest "test null and empty match"
server s1 {
rxreq
......@@ -25,26 +25,23 @@ varnish v1 -vcl+backend {
sub vcl_backend_response {
if (end.match(beresp.http.bar)) {
set beresp.http.foo = "XXX";
set beresp.http.end = "XXX";
}
if (empty.match(beresp.http.foo)) {
set beresp.http.bar = "YYY";
if (empty.match(beresp.http.bar)) {
set beresp.http.empty = "YYY";
}
if (endset.match(beresp.http.bar)) {
set beresp.http.foos = "XXX";
set beresp.http.ends = "XXX";
}
if (emptyset.match(beresp.http.foo)) {
set beresp.http.bars = "YYY";
if (emptyset.match(beresp.http.bar)) {
set beresp.http.emptys = "YYY";
}
if (re2.match("$", beresp.http.bar)) {
set beresp.http.foof = "XXX";
set beresp.http.endf = "XXX";
}
if (re2.match("", beresp.http.foo)) {
set beresp.http.barf = "YYY";
if (re2.match("", beresp.http.bar)) {
set beresp.http.emptyf = "YYY";
}
# Tests for sub() with regex "$" are in sub.vtc
set beresp.http.barsub = empty.sub(beresp.http.foo, "YYY");
set beresp.http.barsubf = re2.sub("", beresp.http.foo, "YYY");
}
} -start
......@@ -52,12 +49,10 @@ client c1 {
txreq
rxresp
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"
expect resp.http.barsub == "YYYXXX"
expect resp.http.barsubf == "YYYXXX"
expect resp.http.end == "XXX"
expect resp.http.empty == "YYY"
expect resp.http.ends == "XXX"
expect resp.http.emptys == "YYY"
expect resp.http.endf == "XXX"
expect resp.http.emptyf == "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