comparison proxy-cache.t @ 99:f92852da34aa

Tests: add test for empty cached response.
author Maxim Dounin <mdounin@mdounin.ru>
date Wed, 30 Sep 2009 22:41:59 +0400
parents 14cf2658592d
children 6303927c18d2
comparison
equal deleted inserted replaced
98:b8b901f86518 99:f92852da34aa
7 ############################################################################### 7 ###############################################################################
8 8
9 use warnings; 9 use warnings;
10 use strict; 10 use strict;
11 11
12 use Test::More tests => 5; 12 use Test::More tests => 7;
13 13
14 BEGIN { use FindBin; chdir($FindBin::Bin); } 14 BEGIN { use FindBin; chdir($FindBin::Bin); }
15 15
16 use lib 'lib'; 16 use lib 'lib';
17 use Test::Nginx; 17 use Test::Nginx;
71 71
72 EOF 72 EOF
73 73
74 $t->write_file('t.html', 'SEE-THIS'); 74 $t->write_file('t.html', 'SEE-THIS');
75 $t->write_file('t2.html', 'SEE-THIS'); 75 $t->write_file('t2.html', 'SEE-THIS');
76 $t->write_file('empty.html', '');
76 $t->run(); 77 $t->run();
77 78
78 ############################################################################### 79 ###############################################################################
79 80
80 like(http_get('/t.html'), qr/SEE-THIS/, 'proxy request'); 81 like(http_get('/t.html'), qr/SEE-THIS/, 'proxy request');
84 85
85 unlike(http_head('/t2.html'), qr/SEE-THIS/, 'head request'); 86 unlike(http_head('/t2.html'), qr/SEE-THIS/, 'head request');
86 like(http_get('/t2.html'), qr/SEE-THIS/, 'get after head'); 87 like(http_get('/t2.html'), qr/SEE-THIS/, 'get after head');
87 unlike(http_head('/t2.html'), qr/SEE-THIS/, 'head after get'); 88 unlike(http_head('/t2.html'), qr/SEE-THIS/, 'head after get');
88 89
90 like(http_get('/empty.html'), qr/HTTP/, 'empty get first');
91 {
92 local $TODO = 'not fixed yet';
93 like(http_get('/empty.html'), qr/HTTP/, 'empty get second');
94 }
95
89 ############################################################################### 96 ###############################################################################