Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-re2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
libvmod-re2
Commits
f7d19eb5
Commit
f7d19eb5
authored
Mar 16, 2016
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add tests for the posix_syntax option
parent
25f74ac7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
166 additions
and
1 deletion
+166
-1
compile_fail.vtc
src/tests/compile_fail.vtc
+166
-1
No files found.
src/tests/compile_fail.vtc
View file @
f7d19eb5
...
...
@@ -64,6 +64,171 @@ varnish v1 -errvcl {vmod re2 error: Cannot compile 'a\' in bad constructor: trai
backend b { .host = "${bad_ip}"; }
sub vcl_init {
new bad = re2.regex("a\");
new bad = re2.regex("a\"); #"
}
}
# Tests from re2 testing/parse_test.cc, first regexen that are valid in
# Perl syntax but not in POSIX.
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("[a-b-c]");
}
}
varnish v1 -errvcl {vmod re2 error: Cannot compile '[a-b-c]' in bad constructor: invalid character class range: -c} {
import re2 from "${vmod_topbuild}/src/.libs/libvmod_re2.so";
backend b { .host = "${bad_ip}"; }
sub vcl_init {
new bad = re2.regex("[a-b-c]", 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("\Qabc\E");
}
}
varnish v1 -errvcl {vmod re2 error: Cannot compile '\Qabc\E' in bad constructor: invalid escape sequence: \Q} {
import re2 from "${vmod_topbuild}/src/.libs/libvmod_re2.so";
backend b { .host = "${bad_ip}"; }
sub vcl_init {
new bad = re2.regex("\Qabc\E", 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("(?:a)");
}
}
varnish v1 -errvcl {vmod re2 error: Cannot compile '(?:a)' in bad constructor: no argument for repetition operator: ?} {
import re2 from "${vmod_topbuild}/src/.libs/libvmod_re2.so";
backend b { .host = "${bad_ip}"; }
sub vcl_init {
new bad = re2.regex("(?:a)", 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("(?P<name>a)");
}
}
varnish v1 -errvcl {vmod re2 error: Cannot compile '(?P<name>a)' in bad constructor: no argument for repetition operator: ?} {
import re2 from "${vmod_topbuild}/src/.libs/libvmod_re2.so";
backend b { .host = "${bad_ip}"; }
sub vcl_init {
new bad = re2.regex("(?P<name>a)", posix_syntax=true);
}
}
# Now regex that are valid in POSIX syntax but not in Perl.
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("(a++)", posix_syntax=true);
}
}
varnish v1 -errvcl {vmod re2 error: Cannot compile '(a++)' in bad constructor: bad repetition operator: ++} {
import re2 from "${vmod_topbuild}/src/.libs/libvmod_re2.so";
backend b { .host = "${bad_ip}"; }
sub vcl_init {
new bad = re2.regex("(a++)");
}
}
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("(a**)", posix_syntax=true);
}
}
varnish v1 -errvcl {vmod re2 error: Cannot compile '(a**)' in bad constructor: bad repetition operator: **} {
import re2 from "${vmod_topbuild}/src/.libs/libvmod_re2.so";
backend b { .host = "${bad_ip}"; }
sub vcl_init {
new bad = re2.regex("(a**)");
}
}
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("(a?*)", posix_syntax=true);
}
}
varnish v1 -errvcl {vmod re2 error: Cannot compile '(a?*)' in bad constructor: bad repetition operator: ?*} {
import re2 from "${vmod_topbuild}/src/.libs/libvmod_re2.so";
backend b { .host = "${bad_ip}"; }
sub vcl_init {
new bad = re2.regex("(a?*)");
}
}
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("(a+*)", posix_syntax=true);
}
}
varnish v1 -errvcl {vmod re2 error: Cannot compile '(a+*)' in bad constructor: bad repetition operator: +*} {
import re2 from "${vmod_topbuild}/src/.libs/libvmod_re2.so";
backend b { .host = "${bad_ip}"; }
sub vcl_init {
new bad = re2.regex("(a+*)");
}
}
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("(a{1}*)", posix_syntax=true);
}
}
varnish v1 -errvcl {vmod re2 error: Cannot compile '(a{1}*)' in bad constructor: bad repetition operator: {1}*} {
import re2 from "${vmod_topbuild}/src/.libs/libvmod_re2.so";
backend b { .host = "${bad_ip}"; }
sub vcl_init {
new bad = re2.regex("(a{1}*)");
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment