comparison lib/Test/Nginx.pm @ 28:8f1519472ece

Tests: unbreak and extend has() functionality.
author Maxim Dounin <mdounin@mdounin.ru>
date Fri, 10 Oct 2008 20:23:39 +0400
parents fb94a224fef2
children 71ea39729fa0
comparison
equal deleted inserted replaced
27:fb94a224fef2 28:8f1519472ece
42 my ($self) = @_; 42 my ($self) = @_;
43 $self->stop(); 43 $self->stop();
44 } 44 }
45 45
46 sub has { 46 sub has {
47 my ($self, $feature, %options) = @_; 47 my ($self, $feature) = @_;
48
49 my %regex = (
50 mail => '--with-mail',
51 rewrite => '(?s)^(?!.*--without-http_rewrite_module)',
52 static => '(?s)^(?!.*--without-http_static_module)',
53 );
54
48 Test::More::plan(skip_all => "$feature not compiled in") 55 Test::More::plan(skip_all => "$feature not compiled in")
49 unless `$NGINX -V 2>&1` =~ $feature; 56 unless `$NGINX -V 2>&1` =~ $regex{$feature};
50 Test::More::plan($options{plan}) if defined $options{plan}; 57
58 return $self;
59 }
60
61 sub plan {
62 my ($self, $plan) = @_;
63
64 Test::More::plan(tests => $plan);
65
66 return $self;
51 } 67 }
52 68
53 sub run { 69 sub run {
54 my ($self, $conf) = @_; 70 my ($self, $conf) = @_;
55 71