comparison sub_filter.t @ 579:6d1b945c9c60

Tests: sub_filter caseless tests.
author Sergey Kandaurov <pluknet@nginx.com>
date Mon, 18 May 2015 13:30:56 +0300
parents 8504a62496df
children e6132dd8e341
comparison
equal deleted inserted replaced
578:8504a62496df 579:6d1b945c9c60
19 ############################################################################### 19 ###############################################################################
20 20
21 select STDERR; $| = 1; 21 select STDERR; $| = 1;
22 select STDOUT; $| = 1; 22 select STDOUT; $| = 1;
23 23
24 my $t = Test::Nginx->new()->has(qw/http rewrite sub/)->plan(28) 24 my $t = Test::Nginx->new()->has(qw/http rewrite sub/)->plan(30)
25 ->write_file_expand('nginx.conf', <<'EOF'); 25 ->write_file_expand('nginx.conf', <<'EOF');
26 26
27 %%TEST_GLOBALS%% 27 %%TEST_GLOBALS%%
28 28
29 daemon off; 29 daemon off;
102 } 102 }
103 103
104 EOF 104 EOF
105 105
106 $t->write_file('foo.html', 'foo'); 106 $t->write_file('foo.html', 'foo');
107 $t->write_file('foo_uc.html', 'FOO');
107 $t->write_file('foofoo.html', 'foofoo'); 108 $t->write_file('foofoo.html', 'foofoo');
108 $t->run(); 109 $t->run();
109 110
110 ############################################################################### 111 ###############################################################################
111 112
112 like(http_get('/foo.html'), qr/bar/, 'sub_filter'); 113 like(http_get('/foo.html'), qr/bar/, 'sub_filter');
114 like(http_get('/foo_uc.html'), qr/bar/, 'sub_filter caseless');
113 like(http_get('/foofoo.html'), qr/barfoo/, 'once default'); 115 like(http_get('/foofoo.html'), qr/barfoo/, 'once default');
114 116
115 like(http_get('/once?b=foofoo'), qr/barfoo/, 'once'); 117 like(http_get('/once?b=foofoo'), qr/barfoo/, 'once');
116 like(http_get('/many?b=foofoo'), qr/barbar/, 'many'); 118 like(http_get('/many?b=foofoo'), qr/barbar/, 'many');
117 like(http_get('/many?b=fo'), qr/fo/, 'incomplete'); 119 like(http_get('/many?b=fo'), qr/fo/, 'incomplete');
138 140
139 TODO: { 141 TODO: {
140 local $TODO = 'not yet'; 142 local $TODO = 'not yet';
141 143
142 like(http_get('/var/string?a=foo&b=Xfoo'), qr/_replaced/, 'complex string'); 144 like(http_get('/var/string?a=foo&b=Xfoo'), qr/_replaced/, 'complex string');
145 like(http_get('/var/string?a=foo&b=XFOO'), qr/_replaced/,
146 'complex string caseless');
143 like(http_get('/var/string?a=abcdefghijklmnopq&b=Xabcdefghijklmnopq'), 147 like(http_get('/var/string?a=abcdefghijklmnopq&b=Xabcdefghijklmnopq'),
144 qr/_replaced/, 'complex string long'); 148 qr/_replaced/, 'complex string long');
145 149
146 } 150 }
147 151