summaryrefslogtreecommitdiff
path: root/t/bugs/coerce_without_coercion.t
blob: 63b74d340b56596697e2341cf934fc06a21ca69e (plain)
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 strict;
use warnings;

use Test::More;
use Test::Fatal;
use Test::Moose;

{
    package Foo;

    use Moose;

    ::like(
        ::exception {
            has x => (
                is     => 'rw',
                isa    => 'HashRef',
                coerce => 1,
            )
        },
        qr/You cannot coerce an attribute \(x\) unless its type \(HashRef\) has a coercion/,
        "can't set coerce on an attribute whose type constraint has no coercion"
    );
}

done_testing;