Commit | Line | Data |
049541bd |
1 | use strict; |
2 | use warnings; |
3 | use Test::More; |
4 | use Test::Exception; |
5 | |
0b173188 |
6 | use Test::Requires { |
7 | 'JSON::Any' => 0.01, # skip all if not installed |
8 | }; |
049541bd |
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 | lives_ok { |
31 | $i . ""; |
32 | } 'Can stringify without deep recursion'; |
33 | |
34 | done_testing; |
35 | |