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
67216fc2
Commit
67216fc2
authored
Mar 27, 2016
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add tests for the sub() method and function to vtc's adapted from
Varnish regression tests
parent
5698333d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
0 deletions
+12
-0
r00896.vtc
src/tests/r00896.vtc
+7
-0
r00913.vtc
src/tests/r00913.vtc
+5
-0
No files found.
src/tests/r00896.vtc
View file @
67216fc2
...
...
@@ -30,10 +30,17 @@ varnish v1 -vcl+backend {
return(synth(500, "not ok"));
}
}
sub vcl_deliver {
set resp.http.long
= re2.sub("^(abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij)",
req.http.host, "z", "fallback");
}
} -start
client c1 {
txreq
rxresp
expect resp.status == 200
expect resp.http.long == "fallback"
} -run
src/tests/r00913.vtc
View file @
67216fc2
...
...
@@ -42,6 +42,9 @@ varnish v1 -vcl+backend {
if (re2.match("", beresp.http.foo)) {
set beresp.http.barf = "YYY";
}
# Tests for sub() with regex "$" are in sub.vtc
set beresp.http.barsub = empty.sub(beresp.http.foo, "YYY");
set beresp.http.barsubf = re2.sub("", beresp.http.foo, "YYY");
}
} -start
...
...
@@ -55,4 +58,6 @@ client c1 {
expect resp.http.bars == "YYY"
expect resp.http.foof == "XXX"
expect resp.http.barf == "YYY"
expect resp.http.barsub == "YYYXXX"
expect resp.http.barsubf == "YYYXXX"
} -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