]> err.no Git - varnish/commitdiff
Add regsub test case so I don't break it again.
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 20 Jun 2008 10:20:30 +0000 (10:20 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 20 Jun 2008 10:20:30 +0000 (10:20 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2740 d4fa192b-c00b-0410-8231-f00ffab90ce4

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

diff --git a/varnish-cache/bin/varnishtest/tests/c00001.vtc b/varnish-cache/bin/varnishtest/tests/c00001.vtc
new file mode 100644 (file)
index 0000000..fa634a9
--- /dev/null
@@ -0,0 +1,42 @@
+# $Id$
+
+test "Test VCL regsub()"
+
+server s1 {
+       rxreq 
+       txresp \
+               -hdr "Foobar: barf" \
+               -hdr "Connection: close" \
+               -body "012345\n"
+}
+
+varnish v1 -vcl+backend { 
+       sub vcl_fetch {
+               set obj.http.Snafu1 = regsub(obj.http.Foobar, "ar", "&&");
+               set obj.http.Snafu2 =
+                   regsub(obj.http.Foobar, "(b)(a)(r)(f)", "$4$3$2p");
+               set obj.http.Snafu3 =
+                   regsub(obj.http.Foobar, "(b)(a)(r)(f)", "$4\$$3$2p");
+               set obj.http.Snafu4 =
+                   regsub(obj.http.Foobar, "(b)(a)(r)(f)", "$4\&$3$2p");
+               set obj.http.Snafu5 =
+                   regsub(obj.http.Foobar, "(b)(a)(r)(f)", "$$$4$3$2\$p");
+       }
+} -start 
+
+server s1 -start 
+
+client c1 {
+       txreq -url "/"
+       rxresp
+       expect resp.status == 200
+       expect resp.http.X-Varnish == "1001"
+       expect resp.http.foobar == "barf"
+       expect resp.http.snafu1 == "bararf"
+       expect resp.http.snafu2 == "frap"
+       expect resp.http.snafu3 == "f$rap"
+       expect resp.http.snafu4 == "f&rap"
+       expect resp.http.snafu5 == "barffra$p"
+}
+
+client c1 -run