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
Nils Goroll
libvmod-re2
Commits
9bce45cc
Commit
9bce45cc
authored
Mar 16, 2016
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add tests for the literal, never_nl, dot_nl and case_sensitive options
parent
edced643
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
96 additions
and
0 deletions
+96
-0
options.vtc
src/tests/options.vtc
+96
-0
No files found.
src/tests/options.vtc
0 → 100644
View file @
9bce45cc
# looks like -*- vcl -*-
varnishtest "literal, never_nl, dot_nl and case_sensitive options"
# Tests from re2 testing/parse_test.cc and testing/re2_test.cc
varnish v1 -vcl {
import re2 from "${vmod_topbuild}/src/.libs/libvmod_re2.so";
backend b { .host = "${bad_ip}"; }
sub vcl_init {
new literal = re2.regex("(|)^$.[*+?]{5,10},\\", literal=true);
new never1 = re2.regex("(.*)", never_nl=true);
new never2 = re2.regex("(?s)(abc.*def)", never_nl=true);
new never3 = re2.regex({"(abc(.|
)def)"},
never_nl=true);
new never4 = re2.regex("(abc[^x]*def)", never_nl=true);
new dot1 = re2.regex(".", dot_nl=true);
new dot2 = re2.regex("(?-s).", dot_nl=true);
new dot3 = re2.regex(".", dot_nl=true, never_nl=true);
new case = re2.regex("(?i)([wand]{5})", case_sensitive=true);
}
sub vcl_recv {
return(synth(200));
}
sub vcl_synth {
if (literal.match("(|)^$.[*+?]{5,10},\\")) {
set resp.http.literal = "match";
}
if (never1.match({"abc
def
ghi
"} )) {
set resp.http.never1 = "match";
set resp.http.never11 = never1.backref(1);
}
if (never2.match({"abc
def
"} )) {
set resp.http.never2 = "match";
}
if (never3.match({"abc
def
"} )) {
set resp.http.never3 = "match";
}
if (never4.match({"abc
def
"} )) {
set resp.http.never4 = "match";
}
if (never4.match({"abczzzdef
def
"} )) {
set resp.http.never5 = "match";
set resp.http.never51 = never4.backref(1);
}
if (dot1.match({"
"} )) {
set resp.http.dot1 = "match";
}
if (dot2.match({"
"} )) {
set resp.http.dot2 = "match";
}
if (dot3.match({"
"} )) {
set resp.http.dot3 = "match";
}
if (case.match("A fish named *Wanda*")) {
set resp.http.case = "match";
set resp.http.case1 = case.backref(1);
}
}
} -start
client c1 {
txreq
rxresp
expect resp.http.literal == "match"
expect resp.http.never1 == "match"
expect resp.http.never11 == "abc"
expect resp.http.never2 == <undef>
expect resp.http.never3 == <undef>
expect resp.http.never4 == <undef>
expect resp.http.never5 == "match"
expect resp.http.never51 == "abczzzdef"
expect resp.http.dot1 == "match"
expect resp.http.dot2 == <undef>
expect resp.http.dot3 == <undef>
expect resp.http.case == "match"
expect resp.http.case1 == "Wanda"
} -run
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