File: buildargs-error.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 (26 lines) | stat: -rw-r--r-- 376 bytes parent folder | download | duplicates (2)
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
use strictures 1;
use Test::More;
use Test::Fatal;

{
    package Foo;
    use Moo;

    has bar => ( is => "rw" );
    has baz => ( is => "rw" );

    sub BUILDARGS {
        my ($self, $args) = @_;

        return %$args
    }
}

like(
  exception { Foo->new({ bar => 1, baz => 1 }) },
  qr/BUILDARGS did not return a hashref/,
  'Sensible error message'
);

done_testing;