Assert-Refute

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

        - TST Upgrade tests to work on perl 5.6.2

0.05    Mon Dec 25 2017
        - API BREAK Importing is, ok, like & co REQUIRES :all or :basic keyword
        - API Add refute_these for runtime assertions
        - API Add configure for per-caller configuration of refute_these
        - MOD T::Hash: keys_are(), values_are()
        - MOD T::Array: is_sorted(), list_of()
        - TST Add a use_ok test, finally
        - API Add get_fail_count to get number of failed tests
        - API BREAK done_testing(0) now means don't die if locked

0.04    Tue Dec 19 2017
        - API BREAK rename contract's own methods into get_*/set_*/do_*
            The new names are:
            is_done is_passing get_count get_tests get_result get_error
            get_tap get_sign do_log get_log set_result

0.0304  Sun Dec 17 2017
        - BUG Fix tests again - splitting t/602 in two didn't work

lib/Assert/Refute/Contract.pm  view on Meta::CPAN

        $opt{driver} = delete $opt{backend};
    };

    return (ref $self)->new( %$self, %opt );
};

=head2 apply( @parameters )

Spawn a new execution log object and run contract against it.

Returns a locked L<Assert::Refute::Report> instance.

=cut

sub apply {
    my ($self, @args) = @_;

    my $c = $self->{driver};
    $c = $c->new unless ref $c;
    # TODO plan tests, argument check etc

lib/Assert/Refute/Report.pm  view on Meta::CPAN

When extending this module,
please try to stick to C<do_*>, C<get_*>, and C<set_*>
to avoid clash with test names.

This is weird and probably has to be fixed at some point.

=head3 do_run( $code, @list )

Run given CODEREF, passing self as both first argument I<and>
current_contract().
Report object is locked afterwards via L</done_testing> call.

Returns self.

Example usage is

    Assert::Refute::Report->new->run( sub {
        like $this, qr/.../;
        can_ok $that, qw(foo bar frobnicate);
    } );

t/105-Report-readonly.t  view on Meta::CPAN

use warnings;
BEGIN{ delete @ENV{qw(NDEBUG PERL_NDEBUG)} };
use Test::More;

use Assert::Refute::Report;

my $c = Assert::Refute::Report->new;
$c->done_testing;

foreach my $method (qw( refute note diag done_testing )) {
    is eval { $c->$method(undef); "$method shall not pass" }, undef, "$method locked";
    like $@, qr/done_testing.*no more/, "Error message as expected";
};

done_testing;



( run in 0.482 second using v1.01-cache-2.11-cpan-49f99fa48dc )