From: phk Date: Sun, 5 Oct 2008 10:31:50 +0000 (+0000) Subject: VCC coverage case X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1ded4e2d10db6d3a028b7c7804fd62554b5d2382;p=varnish VCC coverage case git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3247 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishtest/tests/v00016.vtc b/varnish-cache/bin/varnishtest/tests/v00016.vtc new file mode 100644 index 00000000..23dc978d --- /dev/null +++ b/varnish-cache/bin/varnishtest/tests/v00016.vtc @@ -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; + } + } + +} +