Commit afc3167a authored by Geoff Simmons's avatar Geoff Simmons

More tests for failed backrefs

parent 0b775774
......@@ -72,11 +72,18 @@ varnish v1 -vcl {
sub vcl_synth {
# Call to backref() before match()
set resp.http.nomatch = barbaz.backref(0, "fallback");
# Also tests the default fallback.
set resp.http.nomatch = barbaz.backref(0);
# match() and backref() now re-use the object's task scope
if (barbaz.match("barbaz")) {
set resp.http.bar0 = barbaz.backref(0, "error0");
# backref out of range
set resp.http.bar3 = barbaz.backref(3, "error3");
set resp.http.bar-1 = barbaz.backref(-1, "error-1");
set resp.http.barinf
= barbaz.backref(4294967296, "errorinf");
}
# match fails
......@@ -107,8 +114,10 @@ client c1 -repeat 2 {
txreq
rxresp
expect resp.status == "200"
expect resp.http.nomatch == "fallback"
expect resp.http.nomatch == "**BACKREF METHOD FAILED**"
expect resp.http.bar0 == "barbaz"
expect resp.http.bar3 == "error3"
expect resp.http.barinf == "errorinf"
expect resp.http.frob1 == "false"
expect resp.http.frob1-0 == "error0"
expect resp.http.frob1-1 == "error1"
......@@ -128,6 +137,9 @@ client c1 -repeat 2 {
logexpect l1 -v v1 -d 1 -g vxid -q "VCL_Error" {
expect 0 * Begin req
expect * = VCL_Error "^vmod pcre2 error: barbaz.backref.0. called without prior match$"
expect * = VCL_Error "^vmod pcre2 error: in barbaz.backref.3.: unknown substring$"
expect * = VCL_Error "^vmod pcre2 error: ref .-1. out of range in barbaz.backref.. .must be >= 0 and <= 4294967295.$"
expect * = VCL_Error "^vmod pcre2 error: ref .4294967296. out of range in barbaz.backref.. .must be >= 0 and <= 4294967295.$"
expect * = VCL_Error "^vmod pcre2 error: in frobnitz.backref.0.: no match$"
expect * = VCL_Error "^vmod pcre2 error: in frobnitz.backref.1.: no match$"
expect * = VCL_Error "^vmod pcre2 error: in frobnitz.backref.2.: no match$"
......
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