Commit 6982889d authored by Geoff Simmons's avatar Geoff Simmons

Verify 'called without prior match' error handling for a few methods.

.nmatches(), .matched() and .which().
parent da790e74
......@@ -1485,3 +1485,44 @@ client c1 {
} -run
logexpect l1 -wait
varnish v1 -vcl {
import ${vmod_selector};
import std;
backend b { .host = "${bad_ip}"; }
sub vcl_init {
new s = selector.set();
s.add("foo");
}
sub vcl_recv {
return (synth(200));
}
sub vcl_synth {
set resp.http.N = s.nmatches();
set resp.http.Which = s.which();
set resp.http.Matched = s.matched(1);
return (deliver);
}
}
logexpect l1 -v v1 -d 0 -g vxid -q "VCL_Error" {
expect 0 * Begin req
expect * = VCL_Error {^vmod selector error: s\.nmatches\(\) called without prior match$}
expect * = VCL_Error {^vmod selector error: s\.which\(\) called without prior match$}
expect * = VCL_Error {^vmod selector error: s\.matched\(\) called without prior match$}
expect * = End
} -start
client c1 {
txreq
rxresp
expect resp.status == 200
expect resp.http.N == "0"
expect resp.http.Which == "0"
expect resp.http.Matched == "false"
} -run
logexpect l1 -wait
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