diff options
Diffstat (limited to 'tests/regset.at')
-rw-r--r-- | tests/regset.at | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/regset.at b/tests/regset.at new file mode 100644 index 0000000..cc92578 --- /dev/null +++ b/tests/regset.at | |||
@@ -0,0 +1,39 @@ | |||
1 | # This file is part of vmod-variable -*- autotest -*- | ||
2 | # Copyright (C) 2015 Sergey Poznyakoff | ||
3 | # | ||
4 | # Vmod-variable is free software; you can redistribute it and/or modify | ||
5 | # it under the terms of the GNU General Public License as published by | ||
6 | # the Free Software Foundation; either version 3, or (at your option) | ||
7 | # any later version. | ||
8 | # | ||
9 | # Vmod-variable is distributed in the hope that it will be useful, | ||
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | # GNU General Public License for more details. | ||
13 | # | ||
14 | # You should have received a copy of the GNU General Public License | ||
15 | # along with vmod-variable. If not, see <http://www.gnu.org/licenses/>. | ||
16 | |||
17 | AT_SETUP(regset) | ||
18 | AT_KEYWORDS(regset) | ||
19 | |||
20 | AT_VARNISHTEST([ | ||
21 | sub vcl_recv { | ||
22 | variable.regset("y:i,x,time:d=\3s", "^/(\d+)/(.+)/(\d+)", req.url); | ||
23 | } | ||
24 | sub vcl_deliver { | ||
25 | set resp.http.X-X = variable.get("x"); | ||
26 | set resp.http.X-Y = variable.get_int("y"); | ||
27 | set resp.http.X-Time = variable.get_duration("time"); | ||
28 | } | ||
29 | ],[ | ||
30 | txreq -url /10/test/60 | ||
31 | rxresp | ||
32 | expect resp.http.X-X == "test" | ||
33 | expect resp.http.X-Y == "10" | ||
34 | expect resp.http.X-Time == "60.000" | ||
35 | ]) | ||
36 | AT_CLEANUP | ||
37 | |||
38 | |||
39 | \ No newline at end of file | ||