diff lib/Test/Nginx.pm @ 574:2cd00179f4b2

Tests: has_feature() introduced in Test::Nginx. It is used to check in a platform-aware way for a non-standard capability. Use it for shared memory ('shmem') and symlink. Notably, this enables corresponding tests on win32 where/when appropriate.
author Sergey Kandaurov <pluknet@nginx.com>
date Thu, 14 May 2015 14:46:13 +0300
parents 5c3946ebd867
children 355f2d5ff60f
line wrap: on
line diff
--- a/lib/Test/Nginx.pm	Wed May 13 16:57:45 2015 +0300
+++ b/lib/Test/Nginx.pm	Thu May 14 14:46:13 2015 +0300
@@ -73,8 +73,9 @@
 	my ($self, @features) = @_;
 
 	foreach my $feature (@features) {
-		Test::More::plan(skip_all => "$feature not compiled in")
-			unless $self->has_module($feature);
+		Test::More::plan(skip_all => "no $feature available")
+			unless $self->has_module($feature)
+			or $self->has_feature($feature);
 	}
 
 	return $self;
@@ -152,6 +153,20 @@
 	return ($self->{_configure_args} =~ $re) ? 1 : 0;
 }
 
+sub has_feature($) {
+	my ($self, $feature) = @_;
+
+	if ($feature eq 'symlink') {
+		return $^O ne 'MSWin32';
+	}
+
+	if ($feature eq 'shmem') {
+		return $^O ne 'MSWin32' || $self->has_version('1.9.0');
+	}
+
+	return 0;
+}
+
 sub has_version($) {
 	my ($self, $need) = @_;