comparison ssi.t @ 574:2cd00179f4b2

Tests: has_feature() introduced in Test::Nginx. It is used to check in a platform-aware way for a non-standard capability. Use it for shared memory ('shmem') and symlink. Notably, this enables corresponding tests on win32 where/when appropriate.
author Sergey Kandaurov <pluknet@nginx.com>
date Thu, 14 May 2015 14:46:13 +0300
parents 517cde5075d8
children 6c0a5903d0ae
comparison
equal deleted inserted replaced
573:517cde5075d8 574:2cd00179f4b2
19 ############################################################################### 19 ###############################################################################
20 20
21 select STDERR; $| = 1; 21 select STDERR; $| = 1;
22 select STDOUT; $| = 1; 22 select STDOUT; $| = 1;
23 23
24 plan(skip_all => 'win32') if $^O eq 'MSWin32'; 24 my $t = Test::Nginx->new()->has(qw/http ssi cache proxy rewrite shmem/)
25 25 ->plan(28);
26 my $t = Test::Nginx->new()->has(qw/http ssi cache proxy rewrite/)->plan(28);
27 26
28 $t->write_file_expand('nginx.conf', <<'EOF'); 27 $t->write_file_expand('nginx.conf', <<'EOF');
29 28
30 %%TEST_GLOBALS%% 29 %%TEST_GLOBALS%%
31 30
100 'X<!--#include virtual="/cache/empty.html" -->X'); 99 'X<!--#include virtual="/cache/empty.html" -->X');
101 $t->write_file('test-empty-postpone.html', 100 $t->write_file('test-empty-postpone.html',
102 'X<!--#include virtual="/proxy/empty.html" -->X'); 101 'X<!--#include virtual="/proxy/empty.html" -->X');
103 $t->write_file('empty.html', ''); 102 $t->write_file('empty.html', '');
104 103
105 $t->write_file('unescape.html?', 'SEE-THIS'); 104 $t->write_file('unescape.html?', 'SEE-THIS') unless $^O eq 'MSWin32';
106 $t->write_file('unescape1.html', 105 $t->write_file('unescape1.html',
107 'X<!--#include virtual="/tes%741.html?test=test" -->X'); 106 'X<!--#include virtual="/tes%741.html?test=test" -->X');
108 $t->write_file('unescape2.html', 107 $t->write_file('unescape2.html',
109 'X<!--#include virtual="/unescape.html%3f" -->X'); 108 'X<!--#include virtual="/unescape.html%3f" -->X');
110 $t->write_file('unescape3.html', 109 $t->write_file('unescape3.html',
163 'empty with postpone_output 0'); 162 'empty with postpone_output 0');
164 163
165 # handling of escaped URIs 164 # handling of escaped URIs
166 165
167 like(http_get('/unescape1.html'), qr/^XXtestXX$/m, 'escaped in path'); 166 like(http_get('/unescape1.html'), qr/^XXtestXX$/m, 'escaped in path');
167
168 SKIP: {
169 skip 'incorrect filename on win32', 2 if $^O eq 'MSWin32';
170
168 like(http_get('/unescape2.html'), qr/^XSEE-THISX$/m, 171 like(http_get('/unescape2.html'), qr/^XSEE-THISX$/m,
169 'escaped question in path'); 172 'escaped question in path');
170 like(http_get('/unescape3.html'), qr/404 Not Found/, 173 like(http_get('/unescape3.html'), qr/404 Not Found/,
171 'escaped query separator'); 174 'escaped query separator');
175
176 }
172 177
173 # handling of embedded date variables 178 # handling of embedded date variables
174 179
175 my $re_date_gmt = qr/X-Var: x\w+, \d\d-\w{3}-\d{4} \d\d:\d\d:\d\d [\w ]+x/; 180 my $re_date_gmt = qr/X-Var: x\w+, \d\d-\w{3}-\d{4} \d\d:\d\d:\d\d [\w ]+x/;
176 181