]> err.no Git - varnish/commitdiff
VCC coverage case
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Sun, 5 Oct 2008 10:31:50 +0000 (10:31 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Sun, 5 Oct 2008 10:31:50 +0000 (10:31 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3247 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishtest/tests/v00016.vtc [new file with mode: 0644]

diff --git a/varnish-cache/bin/varnishtest/tests/v00016.vtc b/varnish-cache/bin/varnishtest/tests/v00016.vtc
new file mode 100644 (file)
index 0000000..23dc978
--- /dev/null
@@ -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;
+               }
+       }
+       
+}
+