Skip to content

Commit

Permalink
tests for method_not_from_pkg_ok()
Browse files Browse the repository at this point in the history
  • Loading branch information
rsrchboy committed Apr 24, 2017
1 parent 2c8a92d commit 337270e
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions t/method_not_from_pkg_ok.t
@@ -0,0 +1,48 @@
use strict;
use warnings;

use Test::More;
use Test::Moose::More;

use Test::Builder::Tester;
use TAP::SimpleOutput;

{ package A; use Moose::Role; sub a {} }
{ package B; use Moose; sub b {} }
{ package C; use Moose; extends 'B'; with 'A'; sub c {} }


subtest standalone => sub {

method_not_from_pkg_ok C => 'a', 'B';
method_not_from_pkg_ok C => 'b', 'C';
method_not_from_pkg_ok C => 'c', 'A';
};

note 'pass (TBT)';
{
my ($_ok, $_nok) = counters;
test_out $_ok->(q{C's method b is not from A});
method_not_from_pkg_ok C => 'b', 'A';
test_test;
}

note 'fails - DNE method (TBT)';
{
my ($_ok, $_nok) = counters;
test_out $_nok->('C has no method dne');
test_fail 1;
method_not_from_pkg_ok C => 'dne', 'A';
test_test;
}

note 'fails (TBT)';
{
my ($_ok, $_nok) = counters;
test_out $_nok->(q{C's method a is not from A});
test_fail 1;
method_not_from_pkg_ok C => 'a', 'A';
test_test;
}

done_testing;

0 comments on commit 337270e

Please sign in to comment.