summaryrefslogtreecommitdiffstats
path: root/t/extending/file.t
blob: c6868cd38fc86bd93116ce23f9a160de83befb09 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
use Test::Exception;
use lib 't/lib';

{
    package Foo;
    use Moose;
    use FileAttributes;

    has_file 'foo';
    has_dir  'bar' => (required => 1);
}

my $foo = Foo->new(bar => '.');
isa_ok($foo->bar, 'Path::Class::Dir');

throws_ok { Foo->new(foo => 'test.pl') } qr/required/, "bar is required";

done_testing;