Commit 5b126dae authored by Geoff Simmons's avatar Geoff Simmons

add tests for the perl_classes and word_boundary options

parent 9bce45cc
......@@ -232,3 +232,44 @@ varnish v1 -errvcl {vmod re2 error: Cannot compile '(a{1}*)' in bad constructor:
new bad = re2.regex("(a{1}*)");
}
}
# Now verify the combination of posix_syntax with perl_classes and
# word_boundary
varnish v1 -errvcl {vmod re2 error: Cannot compile '\d \s \w \D \S \W' in bad constructor: invalid escape sequence: \d} {
import re2 from "${vmod_topbuild}/src/.libs/libvmod_re2.so";
backend b { .host = "${bad_ip}"; }
sub vcl_init {
new bad = re2.regex("\d \s \w \D \S \W", posix_syntax=true);
}
}
varnish v1 -vcl {
import re2 from "${vmod_topbuild}/src/.libs/libvmod_re2.so";
backend b { .host = "${bad_ip}"; }
sub vcl_init {
new good = re2.regex("\d \s \w \D \S \W", posix_syntax=true,
perl_classes=true);
}
}
varnish v1 -errvcl {vmod re2 error: Cannot compile '\b \B' in bad constructor: invalid escape sequence: \b} {
import re2 from "${vmod_topbuild}/src/.libs/libvmod_re2.so";
backend b { .host = "${bad_ip}"; }
sub vcl_init {
new bad = re2.regex("\b \B", posix_syntax=true);
}
}
varnish v1 -vcl {
import re2 from "${vmod_topbuild}/src/.libs/libvmod_re2.so";
backend b { .host = "${bad_ip}"; }
sub vcl_init {
new good = re2.regex("\b \B", posix_syntax=true,
word_boundary=true);
}
}
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