1#!perl -w
2use strict;
3use Test::More;
4use Scalar::Util qw(dualvar);
5{
6    package Foo;
7    use Mouse;
8    has intval => (
9        is  => 'rw',
10        isa => 'Int',
11    );
12    has numval => (
13        is  => 'rw',
14        isa => 'Num',
15    );
16}
17
18my $foo = Foo->new();
19
20my $dv = dualvar(42, 'foo');
21eval { $foo->intval($dv) };
22like $@, qr/Validation failed for 'Int'/, 'Int for dualvar';
23
24eval { $foo->numval($dv) };
25like $@, qr/Validation failed for 'Num'/, 'Num for dualvar';
26
27cmp_ok $dv, 'eq', 'foo';
28cmp_ok $dv, '==', 42, 'keeps dualvar-ness';
29
30done_testing;
31
32