Commit e0b0d233 by Geoff Simmons

Add tests for compile opt ungreedy

parent d183aed9
......@@ -13,7 +13,6 @@ varnishtest "compile options"
# no_auto_capture tested in backref_basic.vtc
# XXX
# - tests for ungreedy require backrefs
# - tests for alt_verbnames will require retrieving the mark
# - auto_callout not implemented yet
# - test for dupnames will require capturing named refs
......@@ -811,6 +810,63 @@ varnish v1 -errvcl {vmod pcre2 error: parens_nest_limit (4294967296) out of rang
}
}
# ungreedy
varnish v1 -vcl {
import pcre2 from "${vmod_topbuild}/src/.libs/libvmod_pcre2.so";
backend b { .host = "${bad_ip}"; }
sub vcl_init {
new r1 = pcre2.regex("<.*>");
new r2 = pcre2.regex("<.*?>");
new r3 = pcre2.regex("<.*>", ungreedy=true);
new r4 = pcre2.regex("(?U)<.*>");
new r5 = pcre2.regex("<.*?>", ungreedy=true);
new r6 = pcre2.regex("={3,}", ungreedy=true);
new r7 = pcre2.regex("(?U)={3,}?");
}
sub vcl_recv {
return(synth(200));
}
sub vcl_synth {
set resp.http.r1m = r1.match("abc<def>ghi<klm>nop");
set resp.http.r1b = r1.backref(0);
set resp.http.r2m = r2.match("abc<def>ghi<klm>nop");
set resp.http.r2b = r2.backref(0);
set resp.http.r3m = r3.match("abc<def>ghi<klm>nop");
set resp.http.r3b = r3.backref(0);
set resp.http.r4m = r4.match("abc<def>ghi<klm>nop");
set resp.http.r4b = r4.backref(0);
set resp.http.r5m = r5.match("abc<def>ghi<klm>nop");
set resp.http.r5b = r5.backref(0);
set resp.http.r6m = r6.match("abc========def");
set resp.http.r6b = r6.backref(0);
set resp.http.r7m = r7.match("abc========def");
set resp.http.r7b = r7.backref(0);
}
}
client c1 {
txreq
rxresp
expect resp.status == "200"
expect resp.http.r1m == "true"
expect resp.http.r1b == "<def>ghi<klm>"
expect resp.http.r2m == "true"
expect resp.http.r2b == "<def>"
expect resp.http.r3m == "true"
expect resp.http.r3b == "<def>"
expect resp.http.r4m == "true"
expect resp.http.r4b == "<def>"
expect resp.http.r5m == "true"
expect resp.http.r5b == "<def>ghi<klm>"
expect resp.http.r6m == "true"
expect resp.http.r6b == "==="
expect resp.http.r7m == "true"
expect resp.http.r7b == "========"
} -run
# use_offset_limit
varnish v1 -vcl {
import pcre2 from "${vmod_topbuild}/src/.libs/libvmod_pcre2.so";
......
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