File: moo-sification-meta.t

package info (click to toggle)
libmoo-perl 2.002005-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 856 kB
  • ctags: 192
  • sloc: perl: 2,561; makefile: 6
file content (40 lines) | stat: -rw-r--r-- 1,204 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
32
33
34
35
36
37
38
39
40
use Moo::_strictures;
use Test::More;
use Test::Fatal;

BEGIN {
  package Foo;
  use Moo;
  has one => (is => 'ro');
}

no Moo::sification;
is exception { Foo->meta->make_immutable }, undef,
  'make_immutable allowed under no Moo::sification';

like exception { Foo->meta->get_methods_list },
  qr/^Can't inflate Moose metaclass with Moo::sification disabled/,
  'meta methods blocked under no Moo::sification';

is exception {
  is +Foo->meta->can('can'), \&Moo::HandleMoose::FakeMetaClass::can,
    '->meta->can falls back to default under no Moo::sification';
}, undef,
  '->meta->can works under no Moo::sification';

is exception {
  ok +Foo->meta->isa('Moo::HandleMoose::FakeMetaClass'),
    '->meta->isa falls back to default under no Moo::sification';
}, undef,
  '->meta->isa works under no Moo::sification';

like exception { Foo->meta->get_methods_list },
  qr/^Can't inflate Moose metaclass with Moo::sification disabled/,
  'meta methods blocked under no Moo::sification';

require Moo::HandleMoose;
like exception { Moo::HandleMoose->import },
  qr/^Can't inflate Moose metaclass with Moo::sification disabled/,
  'Moo::HandleMoose->import blocked under no Moo::sification';

done_testing;