[master] 881ebc7 Add more test-coverage for VCL expressions
Poul-Henning Kamp
phk at varnish-cache.org
Wed Oct 17 12:12:28 CEST 2012
commit 881ebc72f2810506ea0c415b816b80c0135d3534
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Wed Oct 17 10:12:09 2012 +0000
Add more test-coverage for VCL expressions
diff --git a/bin/varnishtest/tests/v00020.vtc b/bin/varnishtest/tests/v00020.vtc
index 1e36b43..62a7cbc 100644
--- a/bin/varnishtest/tests/v00020.vtc
+++ b/bin/varnishtest/tests/v00020.vtc
@@ -26,7 +26,7 @@ varnish v1 -vcl {
varnish v1 -badvcl {
sub vcl_recv {
if (!req.restarts != req.url) {
- set req.http.foo = "foo" + 3;
+ set req.http.foo = "foo";
}
}
@@ -79,3 +79,111 @@ varnish v1 -badvcl {
}
}
}
+
+varnish v1 -vcl {
+ backend b { .host = "127.0.0.1"; }
+ sub vcl_recv {
+ set req.http.foo = "foo" + "bar";
+ set req.http.foo = "foo" + 1;
+ set req.http.foo = "foo" + now;
+
+ set req.http.foo = now + 1s;
+ set req.http.foo = now - 1s;
+ set req.http.foo = now - now;
+
+ set req.http.foo = 1 + 1;
+ set req.http.foo = 1 - 1;
+
+ set req.ttl = 1s;
+ }
+}
+
+varnish v1 -badvcl {
+ sub vcl_recv {
+ set req.http.foo = "foo" - "bar";
+ }
+}
+
+varnish v1 -badvcl {
+ sub vcl_recv {
+ set req.http.foo = now + "foo";
+ }
+}
+
+varnish v1 -badvcl {
+ sub vcl_recv {
+ set req.http.foo = now + now;
+ }
+}
+
+varnish v1 -badvcl {
+ sub vcl_recv {
+ set req.http.foo = now + 1;
+ }
+}
+
+varnish v1 -badvcl {
+ sub vcl_recv {
+ set req.http.foo = 1 + "foo";
+ }
+}
+
+varnish v1 -badvcl {
+ sub vcl_recv {
+ set req.http.foo = 1 + now;
+ }
+}
+
+varnish v1 -badvcl {
+ sub vcl_recv {
+ set req.http.foo = 1 + 1s;
+ }
+}
+
+varnish v1 -badvcl {
+ sub vcl_recv {
+ set req.http.foo = 1s;
+ }
+}
+
+varnish v1 -badvcl {
+ sub vcl_recv {
+ set req.http.foo = 1s + 1;
+ }
+}
+
+varnish v1 -badvcl {
+ sub vcl_recv {
+ set req.http.foo = 1s + now;
+ }
+}
+
+varnish v1 -badvcl {
+ sub vcl_recv {
+ set req.http.foo = 1s + "foo";
+ }
+}
+
+varnish v1 -badvcl {
+ sub vcl_recv {
+ set req.http.foo = "foo" + 1s;
+ }
+}
+
+varnish v1 -badvcl {
+ sub vcl_recv {
+ set req.ttl = 1s + 1;
+ }
+}
+
+varnish v1 -badvcl {
+ sub vcl_recv {
+ set req.ttl = 1s + now;
+ }
+}
+
+varnish v1 -badvcl {
+ sub vcl_recv {
+ set req.ttl = 1s + "foo";
+ }
+}
More information about the varnish-commit
mailing list