Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

updated Test::Nginx.

  • Loading branch information...
commit bd7fc5dc2c4079337d0b4acf18d417d74f69185a 1 parent 556f6ae
@agentzh agentzh authored
View
10 test/inc/Module/Install.pm
@@ -31,7 +31,7 @@ BEGIN {
# This is not enforced yet, but will be some time in the next few
# releases once we can make sure it won't clash with custom
# Module::Install extensions.
- $VERSION = '0.99';
+ $VERSION = '1.00';
# Storage for the pseudo-singleton
$MAIN = undef;
@@ -230,8 +230,12 @@ sub preload {
sub new {
my ($class, %args) = @_;
- delete $INC{'FindBin.pm'};
- require FindBin;
+ delete $INC{'FindBin.pm'};
+ {
+ # to suppress the redefine warning
+ local $SIG{__WARN__} = sub {};
+ require FindBin;
+ }
# ignore the prefix on extension modules built from top level.
my $base_path = Cwd::abs_path($FindBin::Bin);
View
10 test/inc/Module/Install/AutoInstall.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.99';
+ $VERSION = '1.00';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -48,6 +48,14 @@ sub auto_install {
while (my ($mod, $ver) = splice(@requires, 0, 2)) {
$seen{$mod}{$ver}++;
}
+ my @build_requires = map @$_, map @$_, grep ref, $self->build_requires;
+ while (my ($mod, $ver) = splice(@build_requires, 0, 2)) {
+ $seen{$mod}{$ver}++;
+ }
+ my @configure_requires = map @$_, map @$_, grep ref, $self->configure_requires;
+ while (my ($mod, $ver) = splice(@configure_requires, 0, 2)) {
+ $seen{$mod}{$ver}++;
+ }
my @deduped;
while (my ($mod, $ver) = splice(@features_require, 0, 2)) {
View
2  test/inc/Module/Install/Base.pm
@@ -4,7 +4,7 @@ package Module::Install::Base;
use strict 'vars';
use vars qw{$VERSION};
BEGIN {
- $VERSION = '0.99';
+ $VERSION = '1.00';
}
# Suspend handler for "redefined" warnings
View
2  test/inc/Module/Install/Can.pm
@@ -9,7 +9,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.99';
+ $VERSION = '1.00';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
View
2  test/inc/Module/Install/Fetch.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.99';
+ $VERSION = '1.00';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
View
2  test/inc/Module/Install/Include.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.99';
+ $VERSION = '1.00';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
View
2  test/inc/Module/Install/Makefile.pm
@@ -8,7 +8,7 @@ use Fcntl qw/:flock :seek/;
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.99';
+ $VERSION = '1.00';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
View
2  test/inc/Module/Install/Metadata.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.99';
+ $VERSION = '1.00';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
View
2  test/inc/Module/Install/Win32.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.99';
+ $VERSION = '1.00';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
View
2  test/inc/Module/Install/WriteAll.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.99';
+ $VERSION = '1.00';
@ISA = qw{Module::Install::Base};
$ISCORE = 1;
}
View
300 test/inc/Test/Builder.pm
@@ -5,7 +5,7 @@ use 5.006;
use strict;
use warnings;
-our $VERSION = '0.92';
+our $VERSION = '0.94';
$VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval)
BEGIN {
@@ -71,7 +71,7 @@ BEGIN {
#line 117
-my $Test = Test::Builder->new;
+our $Test = Test::Builder->new;
sub new {
my($class) = shift;
@@ -90,7 +90,127 @@ sub create {
return $self;
}
-#line 158
+#line 168
+
+sub child {
+ my( $self, $name ) = @_;
+
+ if( $self->{Child_Name} ) {
+ $self->croak("You already have a child named ($self->{Child_Name}) running");
+ }
+
+ my $child = bless {}, ref $self;
+ $child->reset;
+
+ # Add to our indentation
+ $child->_indent( $self->_indent . ' ' );
+ $child->{$_} = $self->{$_} foreach qw{Out_FH Todo_FH Fail_FH};
+
+ # This will be reset in finalize. We do this here lest one child failure
+ # cause all children to fail.
+ $child->{Child_Error} = $?;
+ $? = 0;
+ $child->{Parent} = $self;
+ $child->{Name} = $name || "Child of " . $self->name;
+ $self->{Child_Name} = $child->name;
+ return $child;
+}
+
+
+#line 201
+
+sub subtest {
+ my $self = shift;
+ my($name, $subtests) = @_;
+
+ if ('CODE' ne ref $subtests) {
+ $self->croak("subtest()'s second argument must be a code ref");
+ }
+
+ # Turn the child into the parent so anyone who has stored a copy of
+ # the Test::Builder singleton will get the child.
+ my $child = $self->child($name);
+ my %parent = %$self;
+ %$self = %$child;
+
+ my $error;
+ if( !eval { $subtests->(); 1 } ) {
+ $error = $@;
+ }
+
+ # Restore the parent and the copied child.
+ %$child = %$self;
+ %$self = %parent;
+
+ # Die *after* we restore the parent.
+ die $error if $error and !eval { $error->isa('Test::Builder::Exception') };
+
+ return $child->finalize;
+}
+
+
+#line 250
+
+sub finalize {
+ my $self = shift;
+
+ return unless $self->parent;
+ if( $self->{Child_Name} ) {
+ $self->croak("Can't call finalize() with child ($self->{Child_Name}) active");
+ }
+ $self->_ending;
+
+ # XXX This will only be necessary for TAP envelopes (we think)
+ #$self->_print( $self->is_passing ? "PASS\n" : "FAIL\n" );
+
+ my $ok = 1;
+ $self->parent->{Child_Name} = undef;
+ if ( $self->{Skip_All} ) {
+ $self->parent->skip($self->{Skip_All});
+ }
+ elsif ( not @{ $self->{Test_Results} } ) {
+ $self->parent->ok( 0, sprintf q[No tests run for subtest "%s"], $self->name );
+ }
+ else {
+ $self->parent->ok( $self->is_passing, $self->name );
+ }
+ $? = $self->{Child_Error};
+ delete $self->{Parent};
+
+ return $self->is_passing;
+}
+
+sub _indent {
+ my $self = shift;
+
+ if( @_ ) {
+ $self->{Indent} = shift;
+ }
+
+ return $self->{Indent};
+}
+
+#line 300
+
+sub parent { shift->{Parent} }
+
+#line 312
+
+sub name { shift->{Name} }
+
+sub DESTROY {
+ my $self = shift;
+ if ( $self->parent ) {
+ my $name = $self->name;
+ $self->diag(<<"FAIL");
+Child ($name) exited without calling finalize()
+FAIL
+ $self->parent->{In_Destroy} = 1;
+ $self->parent->ok(0, $name);
+ }
+}
+
+#line 336
our $Level;
@@ -101,11 +221,16 @@ sub reset { ## no critic (Subroutines::ProhibitBuiltinHomonyms)
# hash keys is just asking for pain. Also, it was documented.
$Level = 1;
+ $self->{Name} = $0;
+ $self->is_passing(1);
+ $self->{Ending} = 0;
$self->{Have_Plan} = 0;
$self->{No_Plan} = 0;
$self->{Have_Output_Plan} = 0;
$self->{Original_Pid} = $$;
+ $self->{Child_Name} = undef;
+ $self->{Indent} ||= '';
share( $self->{Curr_Test} );
$self->{Curr_Test} = 0;
@@ -131,7 +256,7 @@ sub reset { ## no critic (Subroutines::ProhibitBuiltinHomonyms)
return;
}
-#line 219
+#line 414
my %plan_cmds = (
no_plan => \&no_plan,
@@ -179,7 +304,7 @@ sub _plan_tests {
}
-#line 275
+#line 470
sub expected_tests {
my $self = shift;
@@ -197,7 +322,7 @@ sub expected_tests {
return $self->{Expected_Tests};
}
-#line 299
+#line 494
sub no_plan {
my($self, $arg) = @_;
@@ -211,7 +336,7 @@ sub no_plan {
}
-#line 333
+#line 528
sub _output_plan {
my($self, $max, $directive, $reason) = @_;
@@ -229,7 +354,7 @@ sub _output_plan {
return;
}
-#line 384
+#line 579
sub done_testing {
my($self, $num_tests) = @_;
@@ -262,11 +387,17 @@ sub done_testing {
$self->{Have_Plan} = 1;
+ # The wrong number of tests were run
+ $self->is_passing(0) if $self->{Expected_Tests} != $self->{Curr_Test};
+
+ # No tests were run
+ $self->is_passing(0) if $self->{Curr_Test} == 0;
+
return 1;
}
-#line 429
+#line 630
sub has_plan {
my $self = shift;
@@ -276,18 +407,21 @@ sub has_plan {
return(undef);
}
-#line 446
+#line 647
sub skip_all {
my( $self, $reason ) = @_;
- $self->{Skip_All} = 1;
+ $self->{Skip_All} = $self->parent ? $reason : 1;
$self->_output_plan(0, "SKIP", $reason) unless $self->no_header;
+ if ( $self->parent ) {
+ die bless {} => 'Test::Builder::Exception';
+ }
exit(0);
}
-#line 468
+#line 672
sub exported_to {
my( $self, $pack ) = @_;
@@ -298,11 +432,16 @@ sub exported_to {
return $self->{Exported_To};
}
-#line 498
+#line 702
sub ok {
my( $self, $test, $name ) = @_;
+ if ( $self->{Child_Name} and not $self->{In_Destroy} ) {
+ $name = 'unnamed test' unless defined $name;
+ $self->is_passing(0);
+ $self->croak("Cannot run test ($name) with active children");
+ }
# $test might contain an object which we don't want to accidentally
# store, so we turn it into a boolean.
$test = $test ? 1 : 0;
@@ -378,9 +517,27 @@ ERR
}
}
+ $self->is_passing(0) unless $test || $self->in_todo;
+
+ # Check that we haven't violated the plan
+ $self->_check_is_passing_plan();
+
return $test ? 1 : 0;
}
+
+# Check that we haven't yet violated the plan and set
+# is_passing() accordingly
+sub _check_is_passing_plan {
+ my $self = shift;
+
+ my $plan = $self->has_plan;
+ return unless defined $plan; # no plan yet defined
+ return unless $plan !~ /\D/; # no numeric plan
+ $self->is_passing(0) if $plan < $self->{Curr_Test};
+}
+
+
sub _unoverload {
my $self = shift;
my $type = shift;
@@ -435,7 +592,7 @@ sub _is_dualvar {
return $numval != 0 and $numval ne $val ? 1 : 0;
}
-#line 649
+#line 876
sub is_eq {
my( $self, $got, $expect, $name ) = @_;
@@ -518,7 +675,7 @@ sub _isnt_diag {
DIAGNOSTIC
}
-#line 746
+#line 973
sub isnt_eq {
my( $self, $got, $dont_expect, $name ) = @_;
@@ -552,7 +709,7 @@ sub isnt_num {
return $self->cmp_ok( $got, '!=', $dont_expect, $name );
}
-#line 797
+#line 1022
sub like {
my( $self, $this, $regex, $name ) = @_;
@@ -568,7 +725,7 @@ sub unlike {
return $self->_regex_ok( $this, $regex, '!~', $name );
}
-#line 821
+#line 1046
my %numeric_cmps = map { ( $_, 1 ) } ( "<", "<=", ">", ">=", "==", "!=", "<=>" );
@@ -648,7 +805,7 @@ sub _caller_context {
return $code;
}
-#line 920
+#line 1145
sub BAIL_OUT {
my( $self, $reason ) = @_;
@@ -658,11 +815,14 @@ sub BAIL_OUT {
exit 255;
}
-#line 933
+#line 1158
-*BAILOUT = \&BAIL_OUT;
+{
+ no warnings 'once';
+ *BAILOUT = \&BAIL_OUT;
+}
-#line 944
+#line 1172
sub skip {
my( $self, $why ) = @_;
@@ -693,7 +853,7 @@ sub skip {
return 1;
}
-#line 985
+#line 1213
sub todo_skip {
my( $self, $why ) = @_;
@@ -721,7 +881,7 @@ sub todo_skip {
return 1;
}
-#line 1062
+#line 1293
sub maybe_regex {
my( $self, $regex ) = @_;
@@ -771,15 +931,11 @@ sub _regex_ok {
## no critic (BuiltinFunctions::ProhibitStringyEval)
my $test;
- my $code = $self->_caller_context;
+ my $context = $self->_caller_context;
local( $@, $!, $SIG{__DIE__} ); # isolate eval
- # Yes, it has to look like this or 5.4.5 won't see the #line
- # directive.
- # Don't ask me, man, I just work here.
- $test = eval "
-$code" . q{$test = $this =~ /$usable_regex/ ? 1 : 0};
+ $test = eval $context . q{$test = $this =~ /$usable_regex/ ? 1 : 0};
$test = !$test if $cmp eq '!~';
@@ -805,7 +961,7 @@ DIAGNOSTIC
# I'm not ready to publish this. It doesn't deal with array return
# values from the code or context.
-#line 1162
+#line 1389
sub _try {
my( $self, $code, %opts ) = @_;
@@ -825,7 +981,7 @@ sub _try {
return wantarray ? ( $return, $error ) : $return;
}
-#line 1191
+#line 1418
sub is_fh {
my $self = shift;
@@ -836,11 +992,10 @@ sub is_fh {
return 1 if ref \$maybe_fh eq 'GLOB'; # its a glob
return eval { $maybe_fh->isa("IO::Handle") } ||
- # 5.5.4's tied() and can() doesn't like getting undef
- eval { ( tied($maybe_fh) || '' )->can('TIEHANDLE') };
+ eval { tied($maybe_fh)->can('TIEHANDLE') };
}
-#line 1235
+#line 1461
sub level {
my( $self, $level ) = @_;
@@ -851,7 +1006,7 @@ sub level {
return $Level;
}
-#line 1267
+#line 1493
sub use_numbers {
my( $self, $use_nums ) = @_;
@@ -862,7 +1017,7 @@ sub use_numbers {
return $self->{Use_Nums};
}
-#line 1300
+#line 1526
foreach my $attribute (qw(No_Header No_Ending No_Diag)) {
my $method = lc $attribute;
@@ -880,7 +1035,7 @@ foreach my $attribute (qw(No_Header No_Ending No_Diag)) {
*{ __PACKAGE__ . '::' . $method } = $code;
}
-#line 1353
+#line 1579
sub diag {
my $self = shift;
@@ -888,7 +1043,7 @@ sub diag {
$self->_print_comment( $self->_diag_fh, @_ );
}
-#line 1368
+#line 1594
sub note {
my $self = shift;
@@ -925,7 +1080,7 @@ sub _print_comment {
return 0;
}
-#line 1418
+#line 1644
sub explain {
my $self = shift;
@@ -944,7 +1099,7 @@ sub explain {
} @_;
}
-#line 1447
+#line 1673
sub _print {
my $self = shift;
@@ -969,10 +1124,10 @@ sub _print_to_fh {
# Stick a newline on the end if it needs it.
$msg .= "\n" unless $msg =~ /\n\z/;
- return print $fh $msg;
+ return print $fh $self->_indent, $msg;
}
-#line 1506
+#line 1732
sub output {
my( $self, $fh ) = @_;
@@ -1091,7 +1246,7 @@ sub _copy_io_layers {
return;
}
-#line 1631
+#line 1857
sub reset_outputs {
my $self = shift;
@@ -1103,7 +1258,7 @@ sub reset_outputs {
return;
}
-#line 1657
+#line 1883
sub _message_at_caller {
my $self = shift;
@@ -1124,7 +1279,7 @@ sub croak {
}
-#line 1697
+#line 1923
sub current_test {
my( $self, $num ) = @_;
@@ -1157,7 +1312,20 @@ sub current_test {
return $self->{Curr_Test};
}
-#line 1739
+#line 1971
+
+sub is_passing {
+ my $self = shift;
+
+ if( @_ ) {
+ $self->{Is_Passing} = shift;
+ }
+
+ return $self->{Is_Passing};
+}
+
+
+#line 1993
sub summary {
my($self) = shift;
@@ -1165,14 +1333,14 @@ sub summary {
return map { $_->{'ok'} } @{ $self->{Test_Results} };
}
-#line 1794
+#line 2048
sub details {
my $self = shift;
return @{ $self->{Test_Results} };
}
-#line 1823
+#line 2077
sub todo {
my( $self, $pack ) = @_;
@@ -1186,7 +1354,7 @@ sub todo {
return '';
}
-#line 1845
+#line 2099
sub find_TODO {
my( $self, $pack ) = @_;
@@ -1198,7 +1366,7 @@ sub find_TODO {
return ${ $pack . '::TODO' };
}
-#line 1863
+#line 2117
sub in_todo {
my $self = shift;
@@ -1207,7 +1375,7 @@ sub in_todo {
return( defined $self->{Todo} || $self->find_TODO ) ? 1 : 0;
}
-#line 1913
+#line 2167
sub todo_start {
my $self = shift;
@@ -1222,7 +1390,7 @@ sub todo_start {
return;
}
-#line 1935
+#line 2189
sub todo_end {
my $self = shift;
@@ -1243,7 +1411,7 @@ sub todo_end {
return;
}
-#line 1968
+#line 2222
sub caller { ## no critic (Subroutines::ProhibitBuiltinHomonyms)
my( $self, $height ) = @_;
@@ -1258,9 +1426,9 @@ sub caller { ## no critic (Subroutines::ProhibitBuiltinHomonyms)
return wantarray ? @caller : $caller[0];
}
-#line 1985
+#line 2239
-#line 1999
+#line 2253
#'#
sub _sanity_check {
@@ -1273,7 +1441,7 @@ sub _sanity_check {
return;
}
-#line 2020
+#line 2274
sub _whoa {
my( $self, $check, $desc ) = @_;
@@ -1288,7 +1456,7 @@ WHOA
return;
}
-#line 2044
+#line 2298
sub _my_exit {
$? = $_[0]; ## no critic (Variables::RequireLocalizedPunctuationVars)
@@ -1296,10 +1464,12 @@ sub _my_exit {
return 1;
}
-#line 2056
+#line 2310
sub _ending {
my $self = shift;
+ return if $self->no_ending;
+ return if $self->{Ending}++;
my $real_exit_code = $?;
@@ -1311,6 +1481,7 @@ sub _ending {
# Ran tests but never declared a plan or hit done_testing
if( !$self->{Have_Plan} and $self->{Curr_Test} ) {
+ $self->is_passing(0);
$self->diag("Tests were run but no plan was declared and done_testing() was not seen.");
}
@@ -1322,9 +1493,9 @@ sub _ending {
# Don't do an ending if we bailed out.
if( $self->{Bailed_Out} ) {
+ $self->is_passing(0);
return;
}
-
# Figure out if we passed or failed and print helpful messages.
my $test_results = $self->{Test_Results};
if(@$test_results) {
@@ -1352,6 +1523,7 @@ sub _ending {
$self->diag(<<"FAIL");
Looks like you planned $self->{Expected_Tests} test$s but ran $self->{Curr_Test}.
FAIL
+ $self->is_passing(0);
}
if($num_failed) {
@@ -1363,13 +1535,14 @@ FAIL
$self->diag(<<"FAIL");
Looks like you failed $num_failed test$s of $num_tests$qualifier.
FAIL
+ $self->is_passing(0);
}
if($real_exit_code) {
$self->diag(<<"FAIL");
Looks like your test exited with $real_exit_code just after $self->{Curr_Test}.
FAIL
-
+ $self->is_passing(0);
_my_exit($real_exit_code) && return;
}
@@ -1393,21 +1566,24 @@ FAIL
$self->diag(<<"FAIL");
Looks like your test exited with $real_exit_code before it could output anything.
FAIL
+ $self->is_passing(0);
_my_exit($real_exit_code) && return;
}
else {
$self->diag("No tests run!\n");
+ $self->is_passing(0);
_my_exit(255) && return;
}
+ $self->is_passing(0);
$self->_whoa( 1, "We fell off the end of _ending()" );
}
END {
- $Test->_ending if defined $Test and !$Test->no_ending;
+ $Test->_ending if defined $Test;
}
-#line 2236
+#line 2498
1;
View
18 test/inc/Test/Builder/Module.pm
@@ -8,19 +8,11 @@ use Test::Builder;
require Exporter;
our @ISA = qw(Exporter);
-our $VERSION = '0.92';
+our $VERSION = '0.94';
$VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval)
-# 5.004's Exporter doesn't have export_to_level.
-my $_export_to_level = sub {
- my $pkg = shift;
- my $level = shift;
- (undef) = shift; # redundant arg
- my $callpkg = caller($level);
- $pkg->export( $callpkg, @_ );
-};
-#line 82
+#line 74
sub import {
my($class) = shift;
@@ -39,7 +31,7 @@ sub import {
$test->plan(@_);
- $class->$_export_to_level( 1, $class, @imports );
+ $class->export_to_level( 1, $class, @imports );
}
sub _strip_imports {
@@ -68,11 +60,11 @@ sub _strip_imports {
return @imports;
}
-#line 145
+#line 137
sub import_extra { }
-#line 175
+#line 167
sub builder {
return Test::Builder->new;
View
45 test/inc/Test/More.pm
@@ -18,7 +18,7 @@ sub _carp {
return warn @_, " at $file line $line\n";
}
-our $VERSION = '0.92';
+our $VERSION = '0.94';
$VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval)
use Test::Builder::Module;
@@ -34,10 +34,11 @@ our @EXPORT = qw(ok use_ok require_ok
done_testing
can_ok isa_ok new_ok
diag note explain
+ subtest
BAIL_OUT
);
-#line 163
+#line 164
sub plan {
my $tb = Test::More->builder;
@@ -71,7 +72,7 @@ sub import_extra {
return;
}
-#line 216
+#line 217
sub done_testing {
my $tb = Test::More->builder;
@@ -188,6 +189,7 @@ sub isa_ok ($$;$) {
}
elsif( $error =~ /Can't call method "isa" without a package/ ) {
# It's something that can't even be a class
+ $obj_name = 'The thing' unless defined $obj_name;
$diag = "$obj_name isn't a class or reference";
}
else {
@@ -220,7 +222,7 @@ WHOA
return $ok;
}
-#line 650
+#line 651
sub new_ok {
my $tb = Test::More->builder;
@@ -245,7 +247,16 @@ sub new_ok {
return $obj;
}
-#line 690
+#line 719
+
+sub subtest($&) {
+ my ($name, $subtests) = @_;
+
+ my $tb = Test::More->builder;
+ return $tb->subtest(@_);
+}
+
+#line 743
sub pass (;$) {
my $tb = Test::More->builder;
@@ -259,7 +270,7 @@ sub fail (;$) {
return $tb->ok( 0, @_ );
}
-#line 753
+#line 806
sub use_ok ($;@) {
my( $module, @imports ) = @_;
@@ -321,7 +332,7 @@ sub _eval {
return( $eval_result, $eval_error );
}
-#line 822
+#line 875
sub require_ok ($) {
my($module) = shift;
@@ -365,7 +376,7 @@ sub _is_module_name {
return $module =~ /^[a-zA-Z]\w*$/ ? 1 : 0;
}
-#line 899
+#line 952
our( @Data_Stack, %Refs_Seen );
my $DNE = bless [], 'Does::Not::Exist';
@@ -472,7 +483,7 @@ sub _type {
return '';
}
-#line 1059
+#line 1112
sub diag {
return Test::More->builder->diag(@_);
@@ -482,13 +493,13 @@ sub note {
return Test::More->builder->note(@_);
}
-#line 1085
+#line 1138
sub explain {
return Test::More->builder->explain(@_);
}
-#line 1151
+#line 1204
## no critic (Subroutines::RequireFinalReturn)
sub skip {
@@ -516,7 +527,7 @@ sub skip {
last SKIP;
}
-#line 1238
+#line 1288
sub todo_skip {
my( $why, $how_many ) = @_;
@@ -537,7 +548,7 @@ sub todo_skip {
last TODO;
}
-#line 1293
+#line 1343
sub BAIL_OUT {
my $reason = shift;
@@ -546,7 +557,7 @@ sub BAIL_OUT {
$tb->BAIL_OUT($reason);
}
-#line 1332
+#line 1382
#'#
sub eq_array {
@@ -672,7 +683,7 @@ WHOA
}
}
-#line 1465
+#line 1515
sub eq_hash {
local @Data_Stack = ();
@@ -705,7 +716,7 @@ sub _eq_hash {
return $ok;
}
-#line 1522
+#line 1572
sub eq_set {
my( $a1, $a2 ) = @_;
@@ -730,6 +741,6 @@ sub eq_set {
);
}
-#line 1735
+#line 1774
1;
View
2  test/lib/Test/Nginx.pm
@@ -3,7 +3,7 @@ package Test::Nginx;
use strict;
use warnings;
-our $VERSION = '0.10';
+our $VERSION = '0.11';
__END__
View
2  test/lib/Test/Nginx/LWP.pm
@@ -4,7 +4,7 @@ use lib 'lib';
use lib 'inc';
use Test::Base -Base;
-our $VERSION = '0.10';
+our $VERSION = '0.11';
our $NoLongString;
View
15 test/lib/Test/Nginx/Socket.pm
@@ -5,7 +5,7 @@ use lib 'inc';
use Test::Base -Base;
-our $VERSION = '0.10';
+our $VERSION = '0.11';
use Encode;
use Data::Dumper;
@@ -45,6 +45,7 @@ use Test::Nginx::Util qw(
server_root
html_dir
server_port
+ no_nginx_manager
);
#use Smart::Comments::JSON '###';
@@ -62,7 +63,7 @@ our @EXPORT = qw( plan run_tests run_test
no_long_string workers master_on
log_level no_shuffle no_root_location
server_addr server_root html_dir server_port
- timeout
+ timeout no_nginx_manager
);
sub send_request ($$$$);
@@ -303,6 +304,16 @@ $parsed_req->{content}";
}
}
+ if (defined $block->raw_response_headers_like) {
+ if ($dry_run) {
+ Test::More::skip("$name - tests skipped due to the lack of directive $dry_run", 1);
+
+ } else {
+ my $expected = $block->raw_response_headers_like;
+ like $raw_headers, qr/$expected/s, "$name - raw resp headers like";
+ }
+ }
+
if (defined $block->response_headers) {
my $headers = parse_headers($block->response_headers);
while (my ($key, $val) = each %$headers) {
View
20 test/lib/Test/Nginx/Util.pm
@@ -3,7 +3,7 @@ package Test::Nginx::Util;
use strict;
use warnings;
-our $VERSION = '0.10';
+our $VERSION = '0.11';
use base 'Exporter';
@@ -31,6 +31,10 @@ sub no_shuffle () {
$NoShuffle = 1;
}
+sub no_nginx_manager () {
+ $NoNginxManager = 1;
+}
+
our $ForkManager;
if ($Profiling || $UseValgrind) {
@@ -140,6 +144,7 @@ our @EXPORT_OK = qw(
html_dir
server_root
server_port
+ no_nginx_manager
);
@@ -162,7 +167,7 @@ our $TODO;
#our ($PrevRequest, $PrevConfig);
-our $ServRoot = $ENV{TEST_NGINX_SERVROOT} || File::Spec->catfile(cwd(), 't/servroot');
+our $ServRoot = $ENV{TEST_NGINX_SERVROOT} || File::Spec->catfile(cwd() || '.', 't/servroot');
our $LogDir = File::Spec->catfile($ServRoot, 'logs');
our $ErrLogFile = File::Spec->catfile($LogDir, 'error.log');
our $AccLogFile = File::Spec->catfile($LogDir, 'access.log');
@@ -423,7 +428,7 @@ sub expand_env_in_config ($) {
return;
}
- $config =~ s/\$(TEST_NGINX_[_A-Z]+)/
+ $config =~ s/\$(TEST_NGINX_[_A-Z0-9]+)/
if (!defined $ENV{$1}) {
bail_out "No environment $1 defined.\n";
}
@@ -439,10 +444,7 @@ sub check_if_missing_directives () {
while (<$in>) {
#warn $_;
if (/\[emerg\] \S+?: unknown directive "([^"]+)"/) {
- return $1;
- }
- if (/\[error\] .*? [dD]irective "(\S+)" not found/) {
- warn "MATCHED!!! $1";
+ #warn "MATCHED!!! $1";
return $1;
}
}
@@ -619,6 +621,7 @@ start_nginx:
setup_server_root();
write_user_files($block);
write_config_file($config, $block->http_config, $block->main_config);
+ #warn "nginx binary: $NginxBinary";
if ( ! can_run($NginxBinary) ) {
bail_out("$name - Cannot find the nginx executable in the PATH environment");
die;
@@ -793,12 +796,13 @@ END {
sub can_run {
my ($cmd) = @_;
+ #warn "can run: @_\n";
my $_cmd = $cmd;
return $_cmd if (-x $_cmd or $_cmd = MM->maybe_command($_cmd));
for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') {
next if $dir eq '';
- my $abs = File::Spec->catfile($dir, $_[1]);
+ my $abs = File::Spec->catfile($dir, $_[0]);
return $abs if (-x $abs or $abs = MM->maybe_command($abs));
}
View
2  test/t/sanity.t
@@ -294,7 +294,7 @@ bob-marry-nomas
GET /foo?names=bob,marry,nomas
--- response_body
'bob'+'marry'+'nomas'
---- ONLY
+
=== TEST 20: map op (copy)
View
2  util/build.sh
@@ -41,9 +41,9 @@ if [[ "$BUILD_CLEAN" -eq 1 || ! -f Makefile || "$root/config" -nt Makefile || "$
./configure --prefix=/opt/nginx \
--add-module=$root/../echo-nginx-module \
--add-module=$root/../ndk-nginx-module \
+ --add-module=$root/../set-misc-nginx-module \
--add-module=$root $opts \
--with-debug
- #--add-module=$root/../set-misc-nginx-module \
#--add-module=$home/work/ndk \
#--without-http_ssi_module # we cannot disable ssi because echo_location_async depends on it (i dunno why?!)
Please sign in to comment.
Something went wrong with that request. Please try again.