File: method_not_from_pkg_ok.t

package info (click to toggle)
libtest-moose-more-perl 0.050-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 512 kB
  • sloc: perl: 755; makefile: 2
file content (48 lines) | stat: -rw-r--r-- 976 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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;