Mailing List Archive

r3247 - trunk/varnish-cache/bin/varnishtest/tests
Author: phk
Date: 2008-10-05 12:31:50 +0200 (Sun, 05 Oct 2008)
New Revision: 3247

Added:
trunk/varnish-cache/bin/varnishtest/tests/v00016.vtc
Log:
VCC coverage case



Added: trunk/varnish-cache/bin/varnishtest/tests/v00016.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/v00016.vtc (rev 0)
+++ trunk/varnish-cache/bin/varnishtest/tests/v00016.vtc 2008-10-05 10:31:50 UTC (rev 3247)
@@ -0,0 +1,39 @@
+# $Id$
+
+test "Various VCL compiler coverage tests"
+
+varnish v1 -vcl {
+
+ backend b { .host = "127.0.0.1"; }
+
+ /* Test string regexp matching and "else if" */
+ sub vcl_recv {
+ if ((req.url ~ "foobar")) {
+ pass;
+ } else if (req.url ~ "snafu") {
+ pipe;
+ } else {
+ pass;
+ }
+ }
+}
+
+
+varnish v1 -vcl {
+
+ backend b { .host = "127.0.0.1"; }
+
+ /* test time and backend comparison */
+ sub vcl_fetch {
+ if (obj.ttl > 1d) {
+ set obj.ttl = 1d;
+ }
+ if (req.backend == b) {
+ set obj.ttl = 1d;
+ } else if (req.backend != b) {
+ set obj.ttl = 1h;
+ }
+ }
+
+}
+