[master] 75c8014 Test the return value more closely

Federico G. Schwindt fgsch at lodoss.net
Wed Oct 22 03:02:42 CEST 2014


commit 75c8014566e5773a6eb370eda9b4a03c225076cf
Author: Federico G. Schwindt <fgsch at lodoss.net>
Date:   Tue Oct 21 23:08:02 2014 +0100

    Test the return value more closely

diff --git a/bin/varnishtest/tests/m00018.vtc b/bin/varnishtest/tests/m00018.vtc
index e2b501d..35000ce 100644
--- a/bin/varnishtest/tests/m00018.vtc
+++ b/bin/varnishtest/tests/m00018.vtc
@@ -1,34 +1,24 @@
-varnishtest "Test substring matching in std"
+varnishtest "Test std.substr"
 
-server s1 {
-       rxreq
-       txresp
-
-       rxreq
-       txresp
+server s1 -repeat 2 {
+	rxreq
+	txresp
 } -start
 
 varnish v1 -vcl+backend {
 	import ${vmod_std};
 
 	sub vcl_deliver {
-	    if (std.strstr(req.url, "foo")) {
-		set resp.http.sub = "found";
-	    } else {
-		set resp.http.sub = "not found";
-	    }
-
+		set resp.http.sub = std.strstr(req.url, "b");
 	}
 } -start
 
 client c1 {
 	txreq -url "/foobar"
 	rxresp
-	expect resp.http.sub == "found"
-
+	expect resp.http.sub == "bar"
 
 	txreq -url "/quux"
 	rxresp
-	expect resp.http.sub == "not found"
+	expect resp.http.sub == ""
 } -run
-



More information about the varnish-commit mailing list