X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FTest%2FLeaner.pm;h=b07fbcac25b8e29e9418b09f32bbcaaa3c465a6c;hb=bc94fb7770772cf212e7d3d4f6ef8a2cd69a290d;hp=f1ee6ee4ac04d85d009628e8a86aa141d81bc67f;hpb=dd0d33dd962cdfb8699dd4f79ee314342e1b1b9f;p=perl%2Fmodules%2FTest-Leaner.git diff --git a/lib/Test/Leaner.pm b/lib/Test/Leaner.pm index f1ee6ee..b07fbca 100644 --- a/lib/Test/Leaner.pm +++ b/lib/Test/Leaner.pm @@ -37,7 +37,7 @@ Its functions behave the same as their L counterparts, except for th =item * Stringification isn't forced on the test operands. -However, L honors C<'bool'> overloading, L and L honor C<'eq'> overloading (and just that one) and L honors whichever overloading category corresponds to the specified operator. +However, L honors C<'bool'> overloading, L and L honor C<'eq'> overloading (and just that one), L honors C<'ne'> overloading, and L honors whichever overloading category corresponds to the specified operator. =item * @@ -121,7 +121,7 @@ our @EXPORT = qw< =head2 C If this environment variable is set, L will replace its functions by those from L. -Moreover, the symbols that are imported you C will be those from L, but you can still only import the symbols originally defined in L (hence the functions from L that are not implemented in L will not be imported). +Moreover, the symbols that are imported when you C will be those from L, but you can still only import the symbols originally defined in L (hence the functions from L that are not implemented in L will not be imported). If your version of L is too old and doesn't have some symbols (like L or L), they will be replaced in L by croaking stubs. This may be useful if your L-based test script fails and you want extra diagnostics. @@ -180,6 +180,7 @@ if ($ENV{PERL_TEST_LEANER_USES_TEST_MORE}) { my $import = sub { shift; + my @imports = &_handle_import_args; @imports = @EXPORT unless @imports; my @test_more_imports; @@ -192,7 +193,10 @@ if ($ENV{PERL_TEST_LEANER_USES_TEST_MORE}) { *{$pkg."::$_"} = $leaner_stash->{$_}; } } + my $test_more_import = 'Test::More'->can('import'); + return unless $test_more_import; + @_ = ( 'Test::More', @_, @@ -202,6 +206,7 @@ if ($ENV{PERL_TEST_LEANER_USES_TEST_MORE}) { lock $plan if THREADSAFE; push @_, 'no_diag' if $no_diag; } + goto $test_more_import; }; @@ -403,10 +408,10 @@ sub ok ($;$) { ++$test; my $test_str = "ok $test"; - unless ($ok) { + $ok or do { $test_str = "not $test_str"; ++$failed; - } + }; if (defined $desc) { _sanitize_comment($desc); $test_str .= " - $desc" if length $desc;