move to github
[gitmo/MooseX-Storage.git] / t / 300_overloaded.t
1 use strict;
2 use warnings;
3 use Test::More;
4 use Test::Fatal;
5
6 use Test::Requires {
7     'JSON::Any' => 0.01, # skip all if not installed
8 };
9
10 {
11     package Thing;
12     use Moose;
13     use MooseX::Storage;
14
15     use overload
16         q{""}    => 'as_string',
17         fallback => 1;
18
19     with Storage('format' => 'JSON');
20
21     has foo => ( is => 'ro' );
22
23     sub as_string { shift->freeze }
24
25     no Moose;
26 }
27
28 my $i = Thing->new(foo => "bar");
29
30 is( exception {
31     $i . "";
32 }, undef, 'Can stringify without deep recursion');
33
34 done_testing;
35