# HG changeset patch # User Maxim Dounin # Date 1261874737 -10800 # Node ID 2698bf0181675b281e23c6c910f47cf6f2e7722e # Parent 7170c171150c002924c87dedb5d88818df49d58c Gunzip: add tests for replies from gzip_static always. diff --git a/t/gunzip.t b/t/gunzip-static.t copy from t/gunzip.t copy to t/gunzip-static.t --- a/t/gunzip.t +++ b/t/gunzip-static.t @@ -2,7 +2,8 @@ # (C) Maxim Dounin -# Tests for gunzip filter module. +# Tests for gunzip filter module with gzip_static always. It is basically +# the copy of gunzip.t with minor modifications. ############################################################################### @@ -20,7 +21,7 @@ select STDOUT; $| = 1; eval { require IO::Compress::Gzip; }; Test::More::plan(skip_all => "IO::Compress::Gzip not found") if $@; -my $t = Test::Nginx->new()->has(qw/http proxy gzip_static/)->plan(12); +my $t = Test::Nginx->new()->has(qw/http proxy gzip_static/); $t->write_file_expand('nginx.conf', <<'EOF'); @@ -44,26 +45,13 @@ http { location / { gunzip on; gzip_vary on; - proxy_pass http://127.0.0.1:8081/; - proxy_set_header Accept-Encoding gzip; + gzip_static always; } location /error { error_page 500 /t1; return 500; } } - - server { - listen 127.0.0.1:8081; - server_name localhost; - - location / { - default_type text/plain; - gzip_static on; - gzip_http_version 1.0; - gzip_types text/plain; - } - } } EOF @@ -77,7 +65,14 @@ IO::Compress::Gzip::gzip(\$in => \$out); $t->write_file('t2.gz', $out . $out); $t->write_file('t3', 'not compressed'); -$t->run(); +eval { + open OLDERR, ">&", \*STDERR; close STDERR; + $t->run(); + open STDERR, ">&", \*OLDERR; +}; +plan(skip_all => 'no gzip_static always') if $@; + +$t->plan(12); ###############################################################################