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
6271111b
Commit
6271111b
authored
Mar 27, 2016
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add tests for the sub() method to vcl_regex.vtc
parent
67216fc2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
2 deletions
+28
-2
vcl_regex.vtc
src/tests/vcl_regex.vtc
+28
-2
No files found.
src/tests/vcl_regex.vtc
View file @
6271111b
# looks like -*- vcl -*-
varnishtest "
re2.backref
not affected by standard VCL regex code"
varnishtest "
backrefs
not affected by standard VCL regex code"
varnish v1 -vcl+backend {
import re2 from "${vmod_topbuild}/src/.libs/libvmod_re2.so";
...
...
@@ -23,6 +23,8 @@ varnish v1 -vcl+backend {
if (resp.http.foo ~ "bar(baz)") {
set resp.http.tilde0 = barbaz.backref(0, "tilde0");
set resp.http.tilde1 = barbaz.backref(1, "tilde1");
set resp.http.tildesub =
barbaz.sub(resp.http.foo, "\0\1", "tildesub");
} else {
set resp.status = 999;
}
...
...
@@ -30,6 +32,8 @@ varnish v1 -vcl+backend {
if (resp.http.foo !~ "bar(quux)") {
set resp.http.neg0 = barbaz.backref(0, "neg0");
set resp.http.neg1 = barbaz.backref(1, "neg1");
set resp.http.negsub =
barbaz.sub(resp.http.foo, "\0\1", "negsub");
} else {
set resp.status = 999;
}
...
...
@@ -38,11 +42,15 @@ varnish v1 -vcl+backend {
= regsub(resp.http.foo, "bar(baz)", "\1");
set resp.http.regsub0 = barbaz.backref(0, "regsub0");
set resp.http.regsub1 = barbaz.backref(1, "regsub1");
set resp.http.regsubsub = barbaz.sub(resp.http.foo, "\0\1",
"regsubsub");
set resp.http.regsuball
= regsuball(resp.http.foo, "(.)", "x");
set resp.http.regsuball0 = barbaz.backref(0, "regsuball0");
set resp.http.regsuball1 = barbaz.backref(1, "regsuball1");
set resp.http.regsuballsub = barbaz.sub(resp.http.foo, "\0\1",
"regsuballsub");
}
} -start
...
...
@@ -53,14 +61,18 @@ client c1 {
expect resp.status == 200
expect resp.http.tilde0 == "barbaz"
expect resp.http.tilde1 == "bar"
expect resp.http.tildesub == "barbazbar"
expect resp.http.neg0 == "barbaz"
expect resp.http.neg1 == "bar"
expect resp.http.negsub == "barbazbar"
expect resp.http.regsub == "baz"
expect resp.http.regsub0 == "barbaz"
expect resp.http.regsub1 == "bar"
expect resp.http.regsubsub == "barbazbar"
expect resp.http.regsuball == "xxxxxx"
expect resp.http.regsuball0 == "barbaz"
expect resp.http.regsuball1 == "bar"
expect resp.http.regsuballsub == "barbazbar"
} -run
# Function interface
...
...
@@ -106,4 +118,18 @@ varnish v1 -vcl+backend {
}
client c1 -run
client c1 {
txreq
rxresp
expect resp.status == 200
expect resp.http.tilde0 == "barbaz"
expect resp.http.tilde1 == "bar"
expect resp.http.neg0 == "barbaz"
expect resp.http.neg1 == "bar"
expect resp.http.regsub == "baz"
expect resp.http.regsub0 == "barbaz"
expect resp.http.regsub1 == "bar"
expect resp.http.regsuball == "xxxxxx"
expect resp.http.regsuball0 == "barbaz"
expect resp.http.regsuball1 == "bar"
} -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