diff ssi.t @ 573:517cde5075d8

Tests: improved time zone name checks for $date_gmt in ssi.t. Time zone name format is implementation defined, and, e.g., on win32 it may contain spaces, such as "Pacific Standard Time" for PST. While here, catch this in headers as well.
author Sergey Kandaurov <pluknet@nginx.com>
date Wed, 13 May 2015 16:57:45 +0300
parents 907e89fba9c3
children 2cd00179f4b2
line wrap: on
line diff
--- a/ssi.t
+++ b/ssi.t
@@ -70,15 +70,15 @@ http {
         }
         location /var {
             ssi on;
-            add_header X-Var $date_gmt;
+            add_header X-Var x${date_gmt}x;
         }
         location /var_noformat {
             ssi on;
-            add_header X-Var $date_gmt;
+            add_header X-Var x${date_gmt}x;
             return 200;
         }
         location /var_nossi {
-            add_header X-Var $date_gmt;
+            add_header X-Var x${date_gmt}x;
             return 200;
         }
     }
@@ -172,20 +172,18 @@ like(http_get('/unescape3.html'), qr/404
 
 # handling of embedded date variables
 
-like(http_get('/var_nossi.html'),
-	qr/X-Var: \w+, \d\d-\w{3}-\d{4} \d\d:\d\d:\d\d \w+/, 'no ssi');
-like(http_get('/var_noformat.html'),
-	qr/X-Var: \w+, \d\d-\w{3}-\d{4} \d\d:\d\d:\d\d \w+/, 'no format');
+my $re_date_gmt = qr/X-Var: x\w+, \d\d-\w{3}-\d{4} \d\d:\d\d:\d\d [\w ]+x/;
 
-like(http_get('/var_format.html?custom=1'),
-	qr/X-Var: \w+, \d\d-\w{3}-\d{4} \d\d:\d\d:\d\d \w+/, 'custom header');
-like(http_get('/var_format.html'),
-	qr/X-Var: \w+, \d\d-\w{3}-\d{4} \d\d:\d\d:\d\d \w+/, 'default header');
+like(http_get('/var_nossi.html'), $re_date_gmt, 'no ssi');
+like(http_get('/var_noformat.html'), $re_date_gmt, 'no format');
+
+like(http_get('/var_format.html?custom=1'), $re_date_gmt, 'custom header');
+like(http_get('/var_format.html'), $re_date_gmt, 'default header');
 
 like(http_get('/var_format.html?custom=1'),
 	qr/x\w+, \d\d:\d\d:\d\dx/, 'custom ssi');
 like(http_get('/var_format.html'),
-	qr/x\w+, \d\d-\w{3}-\d{4} \d\d:\d\d:\d\d \w+x/, 'default ssi');
+	qr/x\w+, \d\d-\w{3}-\d{4} \d\d:\d\d:\d\d [\w ]+x/, 'default ssi');
 
 like(`grep -F '[alert]' ${\($t->testdir())}/error.log`, qr/^$/s, 'no alerts');