File: recreated_accessors.t

package info (click to toggle)
libmoosex-emulate-class-accessor-fast-perl 0.009032-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 172 kB
  • sloc: perl: 224; makefile: 2
file content (31 lines) | stat: -rw-r--r-- 570 bytes parent folder | download | duplicates (3)
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
use strict;
use warnings;
use Test::More tests => 5;
use Test::Exception;

# 1
use_ok('MooseX::Emulate::Class::Accessor::Fast');
{
  package My::Test::Package;
  use Moose;
  with 'MooseX::Emulate::Class::Accessor::Fast';
  for (0..1) {
    __PACKAGE__->mk_accessors(qw( foo ));
    __PACKAGE__->mk_ro_accessors(qw( bar ));
    __PACKAGE__->mk_wo_accessors(qw( baz ));
  }
}

my $i = My::Test::Package->new(bar => 'bar');

# 2
lives_ok {
  $i->foo('foo');
  $i->baz('baz');

  # 3-5
  is($i->foo, 'foo');
  is($i->bar, 'bar');
  is($i->{baz}, 'baz');
} 'No exception';