Test-Kantan

 view release on metacpan or  search on metacpan

lib/Test/Kantan.pm  view on Meta::CPAN

our $FINISHED;
our $RAN_TEST;

sub skip_all {
    my ($reason) = @_;
    $reason //= '';
    print "1..0 # SKIP ${reason}\n";
    exit 0;
}

sub setup(&) {
    my ($code) = @_;
    $CURRENT->add_trigger('setup' => $code);
}
sub before_each { goto \&setup }

sub teardown(&) {
    my ($code) = @_;
    $CURRENT->add_trigger('teardown' => $code);
}
sub after_each { goto \&teardown }

sub _step {
    my ($tag, $title) = @_;
    @_==2 or Carp::confess "Invalid arguments";

    my $last_state = $CURRENT->{last_state};

lib/Test/Kantan.pm  view on Meta::CPAN

sub it       { _suite(     undef, undef, @_) }

sub expect {
    my $stuff = shift;
    Test::Kantan::Expect->new(
        stuff   => $stuff,
        builder => Test::Kantan->builder
    );
}

sub ok(&) {
    my $code = shift;

    if ($HAS_DEVEL_CODEOBSERVER) {
        state $observer = Devel::CodeObserver->new();
        my ($retval, $result) = $observer->call($code);

        my $builder = Test::Kantan->builder;
        $builder->ok(
            value       => $retval,
            caller      => Test::Kantan::Caller->new(



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