tests for deferred and param roles
[gitmo/MooseX-Storage.git] / t / 300_overloaded.t
CommitLineData
049541bd 1use strict;
2use warnings;
3use Test::More;
4use Test::Exception;
5
6BEGIN {
7 eval { require JSON::Any } or do {
8 plan skip_all => "JSON::Any is required for this test";
9 exit 0;
10 }
11}
12
13{
14 package Thing;
15 use Moose;
16 use MooseX::Storage;
17
18 use overload
19 q{""} => 'as_string',
20 fallback => 1;
21
22 with Storage('format' => 'JSON');
23
24 has foo => ( is => 'ro' );
25
26 sub as_string { shift->freeze }
27
28 no Moose;
29}
30
31my $i = Thing->new(foo => "bar");
32
33lives_ok {
34 $i . "";
35} 'Can stringify without deep recursion';
36
37done_testing;
38