File: role-basic-basic.t

package info (click to toggle)
librole-tiny-perl 2.002004-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 292 kB
  • sloc: perl: 454; makefile: 2
file content (38 lines) | stat: -rw-r--r-- 621 bytes parent folder | download
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
use strict;
use warnings;
use Test::More;

BEGIN {
  package My::Does::Basic;
  $INC{'My/Does/Basic.pm'} = 1;

  use Role::Tiny;

  requires 'turbo_charger';

  sub no_conflict {
    return "My::Does::Basic::no_conflict";
  }
}

BEGIN {
  package My::Example;
  $INC{'My/Example.pm'} = 1;

  use Role::Tiny 'with';

  with 'My::Does::Basic';

  sub new { bless {} => shift }

  sub turbo_charger {}
  $My::Example::foo = 1;
  sub foo() {}
}

use My::Example;
can_ok 'My::Example', 'no_conflict';
is +My::Example->no_conflict, 'My::Does::Basic::no_conflict',
  '... and it should return the correct value';

done_testing;