File: type-inflate-type-tiny.t

package info (click to toggle)
libmoo-perl 1.006001-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 772 kB
  • ctags: 202
  • sloc: perl: 2,348; sh: 18; makefile: 6
file content (41 lines) | stat: -rw-r--r-- 704 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
39
40
41
use strictures 1;
use Test::More;

{
  package TypeOMatic;

  use Moo::Role;
  use Sub::Quote;
  use Moo::HandleMoose ();
  use Types::Standard qw(Str);

  has consumed_type => (
    is => 'ro',
    isa => Str,
  );

  package TypeOMatic::Consumer;

  # do this as late as possible to simulate "real" behaviour
  use Moo::HandleMoose;
  use Moose;
  use Types::Standard qw(Str);

  with 'TypeOMatic';

  has direct_type => (
    is => 'ro',
    isa => Str,
  );
}

my $meta = Class::MOP::class_of('TypeOMatic::Consumer');

for my $attr (qw(consumed_type direct_type)) {
  my $type = $meta->get_attribute($attr)->type_constraint;

  isa_ok($type, 'Type::Tiny');
  is($type->name, 'Str');
}

done_testing;