Commit d183aed9 authored by Geoff Simmons's avatar Geoff Simmons

Add tests for compile option no_auto_capture

parent 38d53132
......@@ -64,6 +64,7 @@ varnish v1 -vcl {
new frobnitz = pcre2.regex("(frob)(nitz)");
new barbaz = pcre2.regex("(bar)(baz)");
new azbc = pcre2.regex("(a|(z))(bc)");
new foo = pcre2.regex("(f)(o)(o)", no_auto_capture=true);
}
sub vcl_recv {
......@@ -107,6 +108,12 @@ varnish v1 -vcl {
set resp.http.azbc-1 = azbc.backref(1, "error1");
set resp.http.azbc-2 = azbc.backref(2, "error2");
set resp.http.azbc-3 = azbc.backref(3, "error3");
set resp.http.foo = foo.match("foo");
set resp.http.foo-0 = foo.backref(0, "error0");
set resp.http.foo-1 = foo.backref(1, "error1");
set resp.http.foo-2 = foo.backref(2, "error2");
set resp.http.foo-3 = foo.backref(3, "error3");
}
}
......@@ -132,6 +139,11 @@ client c1 -repeat 2 {
expect resp.http.azbc-1 == "a"
expect resp.http.azbc-2 == "error2"
expect resp.http.azbc-3 == "bc"
expect resp.http.foo == "true"
expect resp.http.foo-0 == "foo"
expect resp.http.foo-1 == "error1"
expect resp.http.foo-2 == "error2"
expect resp.http.foo-3 == "error3"
} -run
logexpect l1 -v v1 -d 1 -g vxid -q "VCL_Error" {
......@@ -147,5 +159,8 @@ logexpect l1 -v v1 -d 1 -g vxid -q "VCL_Error" {
expect * = VCL_Error "^vmod pcre2 error: in frobnitz.backref.1.: no match$"
expect * = VCL_Error "^vmod pcre2 error: in frobnitz.backref.2.: no match$"
expect * = VCL_Error "^vmod pcre2 error: in azbc.backref.2.: requested value is not set$"
expect * = VCL_Error "^vmod pcre2 error: in foo.backref.1.: unknown substring$"
expect * = VCL_Error "^vmod pcre2 error: in foo.backref.2.: unknown substring$"
expect * = VCL_Error "^vmod pcre2 error: in foo.backref.3.: unknown substring$"
expect * = End
} -run
......@@ -10,9 +10,10 @@ varnishtest "compile options"
# Most of the examples in this test are adapted from pcre2 testdata.
# extended option is tested in compile.vtc and match.vtc
# no_auto_capture tested in backref_basic.vtc
# XXX
# - tests for no_auto_capture and ungreedy require backrefs
# - 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
......
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