Mercurial > hg > nginx-tests
changeset 242:8f280348d76f
Tests: add has_version() method and use it as appropriate.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 26 Nov 2012 03:47:31 +0400 |
parents | a01a53bcbf11 |
children | de7338227832 |
files | body_chunked.t dav_chunked.t fastcgi_body.t lib/Test/Nginx.pm range_if_range.t scgi_body.t |
diffstat | 6 files changed, 24 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/body_chunked.t Mon Nov 26 03:47:25 2012 +0400 +++ b/body_chunked.t Mon Nov 26 03:47:31 2012 +0400 @@ -83,7 +83,7 @@ ############################################################################### TODO: { -local $TODO = 'not yet'; +local $TODO = 'not yet' unless $t->has_version('1.3.9'); like(http_get_body('/', '0123456789'), qr/X-Body: 0123456789\x0d?$/ms, 'body');
--- a/dav_chunked.t Mon Nov 26 03:47:25 2012 +0400 +++ b/dav_chunked.t Mon Nov 26 03:47:31 2012 +0400 @@ -56,7 +56,7 @@ ############################################################################### TODO: { -local $TODO = 'not yet'; +local $TODO = 'not yet' unless $t->has_version('1.3.9'); my $r;
--- a/fastcgi_body.t Mon Nov 26 03:47:25 2012 +0400 +++ b/fastcgi_body.t Mon Nov 26 03:47:31 2012 +0400 @@ -63,7 +63,7 @@ like(http_get_length('/', 'foobar'), qr/X-Body: foobar/, 'fastcgi body'); TODO: { -local $TODO = 'not yet'; +local $TODO = 'not yet' unless $t->has_version('1.3.9'); like(http(<<EOF), qr/X-Body: foobar/, 'fastcgi chunked'); GET / HTTP/1.1
--- a/lib/Test/Nginx.pm Mon Nov 26 03:47:25 2012 +0400 +++ b/lib/Test/Nginx.pm Mon Nov 26 03:47:31 2012 +0400 @@ -117,6 +117,24 @@ return ($self->{_configure_args} =~ $re) ? 1 : 0; } +sub has_version($) { + my ($self, $need) = @_; + + $self->{_configure_args} = `$NGINX -V 2>&1` + if !defined $self->{_configure_args}; + + $self->{_configure_args} =~ m!nginx version: nginx/([0-9.]+)!; + + my @v = split(/\./, $1); + my $n; + + for $n (split(/\./, $need)) { + return 0 if $n > (shift @v || 0); + } + + return 1; +} + sub has_daemon($) { my ($self, $daemon) = @_;
--- a/range_if_range.t Mon Nov 26 03:47:25 2012 +0400 +++ b/range_if_range.t Mon Nov 26 03:47:31 2012 +0400 @@ -80,7 +80,7 @@ $t1 = http_get_range('/t2.html', "Range: bytes=0-9\nIf-Range: wrong"); TODO: { -local $TODO = 'not yet'; +local $TODO = 'not yet' unless $t->has_version('1.3.3'); like($t1, qr/200 OK/, 'if-range notime'); @@ -93,7 +93,7 @@ $t1 = http_get_range('/t3.html', "Range: bytes=0-9\nIf-Range: wrong"); TODO: { -local $TODO = 'not yet'; +local $TODO = 'not yet' unless $t->has_version('1.3.3'); like($t1, qr/200 OK/, 'if-range time wrong');
--- a/scgi_body.t Mon Nov 26 03:47:25 2012 +0400 +++ b/scgi_body.t Mon Nov 26 03:47:31 2012 +0400 @@ -63,7 +63,7 @@ like(http_get_length('/', 'foobar'), qr/X-Body: foobar/, 'scgi body'); TODO: { -local $TODO = 'not yet'; +local $TODO = 'not yet' unless $t->has_version('1.3.9'); like(http(<<EOF), qr/X-Body: foobar/, 'scgi chunked'); GET / HTTP/1.1