changeset 128:25047dc6ae9b

Tests: add test for memcached parsing problem as fixed in 0.6.14.
author Maxim Dounin <mdounin@mdounin.ru>
date Fri, 19 Feb 2010 22:26:38 +0300
parents 2bf0c4c80aa7
children adbf104668b6
files memcached-fake.t
diffstat 1 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/memcached-fake.t
+++ b/memcached-fake.t
@@ -22,7 +22,7 @@ use Test::Nginx;
 select STDERR; $| = 1;
 select STDOUT; $| = 1;
 
-my $t = Test::Nginx->new()->has(qw/http rewrite memcached/)->plan(2)
+my $t = Test::Nginx->new()->has(qw/http rewrite memcached ssi/)->plan(3)
 	->write_file_expand('nginx.conf', <<'EOF');
 
 %%TEST_GLOBALS%%
@@ -44,11 +44,17 @@ http {
             set $memcached_key $uri;
             memcached_pass 127.0.0.1:8081;
         }
+
+        location /ssi {
+            default_type text/html;
+            ssi on;
+        }
     }
 }
 
 EOF
 
+$t->write_file('ssi.html', '<!--#include virtual="/" set="blah" -->blah: <!--#echo var="blah" -->');
 $t->run_daemon(\&memcached_fake_daemon);
 $t->run();
 
@@ -56,6 +62,8 @@ EOF
 
 like(http_get('/'), qr/SEE-THIS/, 'memcached split trailer');
 
+like(http_get('/ssi.html'), qr/SEE-THIS/, 'memcached ssi var');
+
 TODO: {
 local $TODO = 'patch under review';
 
@@ -82,7 +90,9 @@ sub memcached_fake_daemon {
 		}
 
 		print $client 'VALUE / 0 8' . CRLF;
-		print $client 'SEE-THIS';
+		print $client 'SEE-TH';
+		select(undef, undef, undef, 0.1);
+		print $client 'IS';
 		select(undef, undef, undef, 0.1);
 		print $client CRLF . 'EN';
 		select(undef, undef, undef, 0.1);