Unverified Commit 9fcf78b9 authored by Geoff Simmons's avatar Geoff Simmons Committed by Nils Goroll

Fix tests that fail for recent linre2 versions.

Since 2020-06-01, backrefs fail if numbered higher than the highest
backref actually captured- Previously, re2 returned the empty string.

I believe that these tests will now pass for both current and earlier
versions.
parent 75b24f13
...@@ -29,17 +29,17 @@ varnish v1 -vcl+backend { ...@@ -29,17 +29,17 @@ varnish v1 -vcl+backend {
} else { } else {
set beresp.status = 999; set beresp.status = 999;
} }
set beresp.http.sub = barbaz.sub(beresp.http.foo, "\0\1\2"); set beresp.http.sub = barbaz.sub(beresp.http.foo, "\0\1");
set beresp.http.subf = re2.sub("(?:bar)(baz)", beresp.http.foo, set beresp.http.subf = re2.sub("(?:bar)(baz)", beresp.http.foo,
"\0\1\2"); "\0\1");
set beresp.http.suball set beresp.http.suball
= barbaz.suball(beresp.http.foo, "\0\1\2"); = barbaz.suball(beresp.http.foo, "\0\1");
set beresp.http.suballf set beresp.http.suballf
= re2.suball("(?:bar)(baz)", beresp.http.foo, "\0\1\2"); = re2.suball("(?:bar)(baz)", beresp.http.foo, "\0\1");
set beresp.http.extract set beresp.http.extract
= barbaz.extract(beresp.http.foo, "\0\1\2"); = barbaz.extract(beresp.http.foo, "\0\1");
set beresp.http.extractf set beresp.http.extractf
= re2.extract("(?:bar)(baz)", beresp.http.foo, "\0\1\2"); = re2.extract("(?:bar)(baz)", beresp.http.foo, "\0\1");
} }
} -start } -start
......
...@@ -9,12 +9,12 @@ varnish v1 -vcl { ...@@ -9,12 +9,12 @@ varnish v1 -vcl {
sub vcl_init { sub vcl_init {
new s = re2.set(); new s = re2.set();
s.add("(.*)@([^.]*)", save=true); s.add("(.*)@([^.]*)", save=true);
s.add(".*", save=true); s.add("(.)(.).*", save=true);
s.compile(); s.compile();
new n = re2.set(); new n = re2.set();
n.add("(.*)@([^.]*)"); n.add("(.*)@([^.]*)");
n.add(".*", save=true); n.add("(.)(.).*", save=true);
n.compile(); n.compile();
} }
...@@ -72,13 +72,13 @@ client c1 { ...@@ -72,13 +72,13 @@ client c1 {
expect resp.http.s-nmatches == "2" expect resp.http.s-nmatches == "2"
expect resp.http.s-extract == "" expect resp.http.s-extract == ""
expect resp.http.s-first == "kremvax!boris" expect resp.http.s-first == "kremvax!boris"
expect resp.http.s-last == "!" expect resp.http.s-last == "o!b"
expect resp.http.n-match == "true" expect resp.http.n-match == "true"
expect resp.http.n-n == "2" expect resp.http.n-n == "2"
expect resp.http.n-extract == "" expect resp.http.n-extract == ""
expect resp.http.n-first == "" expect resp.http.n-first == ""
expect resp.http.n-last == "!" expect resp.http.n-last == "o!b"
} -run } -run
logexpect l1 -v v1 -d 1 -g vxid -q "VCL_Error" { logexpect l1 -v v1 -d 1 -g vxid -q "VCL_Error" {
......
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