File: buildargs-error.t

package info (click to toggle)
libmoo-perl 2.003004-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 808 kB
  • sloc: perl: 2,284; makefile: 6
file content (25 lines) | stat: -rw-r--r-- 379 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
use Moo::_strictures;
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;