Tests: add has_version() method and use it as appropriate.
diff --git a/body_chunked.t b/body_chunked.t index 1f50701..80f9be8 100644 --- a/body_chunked.t +++ b/body_chunked.t
@@ -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');
diff --git a/dav_chunked.t b/dav_chunked.t index 66770ca..2857c32 100644 --- a/dav_chunked.t +++ b/dav_chunked.t
@@ -56,7 +56,7 @@ ############################################################################### TODO: { -local $TODO = 'not yet'; +local $TODO = 'not yet' unless $t->has_version('1.3.9'); my $r;
diff --git a/fastcgi_body.t b/fastcgi_body.t index 9d688e0..2714d31 100644 --- a/fastcgi_body.t +++ b/fastcgi_body.t
@@ -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
diff --git a/lib/Test/Nginx.pm b/lib/Test/Nginx.pm index 74ce268..052a8cc 100644 --- a/lib/Test/Nginx.pm +++ b/lib/Test/Nginx.pm
@@ -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) = @_;
diff --git a/range_if_range.t b/range_if_range.t index e65efb2..4b15620 100644 --- a/range_if_range.t +++ b/range_if_range.t
@@ -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');
diff --git a/scgi_body.t b/scgi_body.t index 41cf60e..6c09533 100644 --- a/scgi_body.t +++ b/scgi_body.t
@@ -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