Help for this page

Select Code to Download


  1. or download this
    use Test::Refute;
    is 42, 42, "this holds";
    like "foo", qr/bar/, "this fails";
    done_testing; # this is mandatory, even if plan declared
    
  2. or download this
    use Test::Refute::Contract;
    my $c = Test::Refute::Contract->new;
    $c->is($user_input, 42);
    $c->like($another_input, qr/f?o?r?m?a?t/);
    if ($c->is_valid) ...
    
  3. or download this
    use Test::Refute qw(no_init);
    my $c = contract {
        is $user_input, 42;
        like $another_input, qr/f?o?r?m?a?t/;
    };
    # analyze $c here ...
    
  4. or download this
    build_refute my_is => sub {
        $_[0] ne $_[1] && "$_[0] != $_[1]";
    }, args => 2, export => 1; 
        # take 2 to 3 args; export by default
    
  5. or download this
    use Test::Refute;
    use My::Test::Module;
    ...
    note $c->get_tap;
    
    done_testing;