aboutsummaryrefslogtreecommitdiff
path: root/tests/complex.at
diff options
context:
space:
mode:
Diffstat (limited to 'tests/complex.at')
-rw-r--r--tests/complex.at62
1 files changed, 30 insertions, 32 deletions
diff --git a/tests/complex.at b/tests/complex.at
index dada9a1..77a7903 100644
--- a/tests/complex.at
+++ b/tests/complex.at
@@ -14,43 +14,41 @@
# You should have received a copy of the GNU General Public License
# along with vmod-variable. If not, see <http://www.gnu.org/licenses/>.
AT_SETUP(complex)
AT_KEYWORDS(complex)
-AT_CHECK([
-AT_VCL([
-variable.set("foo", req.http.Host);
-variable.set("bar","two");
-variable.set_int("ten", 10);
-variable.set_int("five",5);
-variable.set_real("one-half", 0.5);
-variable.set_real("one-fourth",0.25);
-variable.set_duration("minute", 1m);
-variable.set_duration("hour",1h);
+AT_VARNISHTEST([
+sub vcl_recv {
+ variable.set("foo", req.http.Host);
+ variable.set("bar","two");
+ variable.set_int("ten", 10);
+ variable.set_int("five",5);
+ variable.set_real("one-half", 0.5);
+ variable.set_real("one-fourth",0.25);
+ variable.set_duration("minute", 1m);
+ variable.set_duration("hour",1h);
+}
+sub vcl_deliver {
+ set resp.http.X-Foo = variable.get("foo");
+ set resp.http.X-Bar = variable.get("bar");
+ set resp.http.X-Five = variable.get_int("five");
+ set resp.http.X-Ten = variable.get_int("ten");
+ set resp.http.X-One-Fourth = variable.get_real("one-fourth");
+ set resp.http.X-One-Half = variable.get_real("one-half");
+ set resp.http.X-Minute = variable.get_duration("minute");
+ set resp.http.X-Hour = variable.get_duration("hour");
+}
],
-[set resp.http.X-Foo = variable.get("foo");
- set resp.http.X-Bar = variable.get("bar");
- set resp.http.X-Five = variable.get_int("five");
- set resp.http.X-Ten = variable.get_int("ten");
- set resp.http.X-One-Fourth = variable.get_real("one-fourth");
- set resp.http.X-One-Half = variable.get_real("one-half");
- set resp.http.X-Minute = variable.get_duration("minute");
- set resp.http.X-Hour = variable.get_duration("hour");],
[txreq -url / -hdr "Host:en.example.net"
- rxresp
- expect resp.http.X-Foo == "en.example.net"
- expect resp.http.X-Bar == "two"
- expect resp.http.X-Five == "5"
- expect resp.http.X-Ten == "10"
- expect resp.http.X-One-Half == "0.500"
- expect resp.http.X-One-Fourth == "0.250"
- expect resp.http.X-Minute == "60.000"
- expect resp.http.X-Hour == "3600.000"
-])
-AT_VARNISHTEST
-],
-[0],
-[OK
+rxresp
+expect resp.http.X-Foo == "en.example.net"
+expect resp.http.X-Bar == "two"
+expect resp.http.X-Five == "5"
+expect resp.http.X-Ten == "10"
+expect resp.http.X-One-Half == "0.500"
+expect resp.http.X-One-Fourth == "0.250"
+expect resp.http.X-Minute == "60.000"
+expect resp.http.X-Hour == "3600.000"
])
AT_CLEANUP

Return to:

Send suggestions and report system problems to the System administrator.