comparison http_variables.t @ 192:f2a48c528b3b

Tests: fixed http variables test, log entries order may differ.
author Valentin Bartenev <ne@vbart.ru>
date Thu, 29 Dec 2011 18:31:14 +0300
parents 43fe964de06a
children 0ab1f0e978b5
comparison
equal deleted inserted replaced
191:bc6ecf23cc9c 192:f2a48c528b3b
34 } 34 }
35 35
36 http { 36 http {
37 %%TEST_GLOBALS_HTTP%% 37 %%TEST_GLOBALS_HTTP%%
38 38
39 log_format cc "CC: $sent_http_cache_control"; 39 log_format cc "$uri: $sent_http_cache_control";
40 40
41 server { 41 server {
42 listen 127.0.0.1:8080; 42 listen 127.0.0.1:8080;
43 server_name localhost; 43 server_name localhost;
44 44
71 http_get('/'); 71 http_get('/');
72 http_get('/redefine'); 72 http_get('/redefine');
73 73
74 $t->stop(); 74 $t->stop();
75 75
76 my @log; 76 my $log;
77 77
78 open LOG, $t->testdir() . '/cc.log' 78 {
79 or die("Can't open nginx access log file.\n"); 79 open LOG, $t->testdir() . '/cc.log'
80 80 or die("Can't open nginx access log file.\n");
81 foreach my $line (<LOG>) { 81 local $/;
82 chomp $line; 82 $log = <LOG>;
83 push @log, $line; 83 close LOG;
84 } 84 }
85 85
86 close LOG; 86 like($log, qr!^/: -$!m, 'no header');
87 87 like($log, qr!^/set: max-age=3600; private; must-revalidate$!m,
88 is(shift @log, 'CC: -', 'no header'); 88 'multi headers');
89 is(shift @log, 'CC: max-age=3600; private; must-revalidate', 'multi headers');
90 89
91 TODO:{ 90 TODO:{
92 local $TODO = 'add hash checks'; 91 local $TODO = 'add hash checks';
93 92
94 is(shift @log, 'CC: no-cache', 'ignoring headers with (hash == 0)'); 93 like($log, qr!^/redefine: no-cache$!m, 'ignoring headers with (hash == 0)');
95 } 94 }
96 95
97 ############################################################################### 96 ###############################################################################