comparison ssi_if.t @ 199:241b522ce7a5

Tests: ssi captures and fixes are in 1.1.12/1.0.12, remove TODO.
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 06 Feb 2012 19:18:19 +0400
parents 1d66a6a509d0
children 62114a0c1389
comparison
equal deleted inserted replaced
198:d17bd21a0378 199:241b522ce7a5
115 115
116 like(http_get('/if_varvar.html?v=varHERE&v2=HERE'), qr/^xOKx$/m, 116 like(http_get('/if_varvar.html?v=varHERE&v2=HERE'), qr/^xOKx$/m,
117 'if var = complex'); 117 'if var = complex');
118 118
119 119
120 TODO: {
121 local $TODO = 'support for captures in regexps';
122
123 $t->write_file('if_cap_re.html', 120 $t->write_file('if_cap_re.html',
124 'x<!--#if expr="$arg_v = /(CAP\d).*(CAP\d)/" -->' 121 'x<!--#if expr="$arg_v = /(CAP\d).*(CAP\d)/" -->'
125 . '<!--#echo var="1" -->x<!--#echo var="2" -->' 122 . '<!--#echo var="1" -->x<!--#echo var="2" -->'
126 . '<!--#endif -->x'); 123 . '<!--#endif -->x');
127 124
134 . '<!--#echo var="ncap" -->' 131 . '<!--#echo var="ncap" -->'
135 . '<!--#endif -->x'); 132 . '<!--#endif -->x');
136 133
137 like(http_get('/if_ncap_re.html?v=captureHEREeee'), qr/^xHEREx$/m, 134 like(http_get('/if_ncap_re.html?v=captureHEREeee'), qr/^xHEREx$/m,
138 'if regex with named capture'); 135 'if regex with named capture');
139
140 }
141 136
142 137
143 $t->write_file('if.html', 'x' . $if_elif_else . 'x'); 138 $t->write_file('if.html', 'x' . $if_elif_else . 'x');
144 139
145 like(http_get('/if.html?if=1'), qr/^xIFx$/m, 'if'); 140 like(http_get('/if.html?if=1'), qr/^xIFx$/m, 'if');
161 'multiple if (interlaced)'); 156 'multiple if (interlaced)');
162 like(http_get('/if_multi.html?2=t&4=t'), qr/^xELSE1xIF2xELSE3xIF4xELSE5x$/m, 157 like(http_get('/if_multi.html?2=t&4=t'), qr/^xELSE1xIF2xELSE3xIF4xELSE5x$/m,
163 'multiple if (interlaced reversed)'); 158 'multiple if (interlaced reversed)');
164 159
165 160
166 TODO: {
167 local $TODO = 'fix "if" conditions inside the "block" command';
168
169 $t->write_file('if_in_block.html', 161 $t->write_file('if_in_block.html',
170 '<!--#block name="one" -->' . $if_elif_else . '<!--#endblock -->' 162 '<!--#block name="one" -->' . $if_elif_else . '<!--#endblock -->'
171 . 'x<!--#include virtual="/404?$args" stub="one" -->x'); 163 . 'x<!--#include virtual="/404?$args" stub="one" -->x');
172 164
173 like(http_get('/if_in_block.html?if=1'), qr/^xIFx$/m, 'if (in block)'); 165 like(http_get('/if_in_block.html?if=1'), qr/^xIFx$/m, 'if (in block)');
174 like(http_get('/if_in_block.html?if=1&elif=1'), qr/^xIFx$/m, 166 like(http_get('/if_in_block.html?if=1&elif=1'), qr/^xIFx$/m,
175 'if suppresses elif (in block)'); 167 'if suppresses elif (in block)');
176 like(http_get('/if_in_block.html?elif=1'), qr/^xELIFx$/m, 'elif (in block)'); 168 like(http_get('/if_in_block.html?elif=1'), qr/^xELIFx$/m, 'elif (in block)');
177 like(http_get('/if_in_block.html'), qr/^xELSEx$/m, 'else (in block)'); 169 like(http_get('/if_in_block.html'), qr/^xELSEx$/m, 'else (in block)');
178
179 }
180 170
181 171
182 $t->write_file('if_config_set_echo.html', 172 $t->write_file('if_config_set_echo.html',
183 'x<!--#if expr="$arg_if" -->' 173 'x<!--#if expr="$arg_if" -->'
184 . '<!--#config timefmt="IF" -->' 174 . '<!--#config timefmt="IF" -->'