|
Lines 17-23
Link Here
|
| 17 |
|
17 |
|
| 18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
| 19 |
|
19 |
|
| 20 |
use Test::More tests => 39; |
20 |
use Test::More tests => 40; |
| 21 |
|
21 |
|
| 22 |
my $destructorcount = 0; |
22 |
my $destructorcount = 0; |
| 23 |
|
23 |
|
|
Lines 196-203
SKIP: {
Link Here
|
| 196 |
$item_from_cache = $cache->get_from_cache('test_deep_copy_hash'); |
196 |
$item_from_cache = $cache->get_from_cache('test_deep_copy_hash'); |
| 197 |
%$item_from_cache = ( another => 'hashref' ); |
197 |
%$item_from_cache = ( another => 'hashref' ); |
| 198 |
is_deeply( $cache->get_from_cache('test_deep_copy_hash'), { a => 'hashref' }, 'A hash will be deep copied'); |
198 |
is_deeply( $cache->get_from_cache('test_deep_copy_hash'), { a => 'hashref' }, 'A hash will be deep copied'); |
|
|
199 |
|
| 199 |
%item = ( a_modified => 'hashref' ); |
200 |
%item = ( a_modified => 'hashref' ); |
| 200 |
is_deeply( $cache->get_from_cache('test_deep_copy_hash'), { a => 'hashref' }, 'A hash will be deep copied when set in cache'); |
201 |
is_deeply( $cache->get_from_cache('test_deep_copy_hash'), { a => 'hashref' }, 'A hash will be deep copied when set in cache'); |
|
|
202 |
|
| 203 |
%item = ( a => 'hashref' ); |
| 204 |
$cache->set_in_cache('test_deep_copy_hash', \%item, { unsafe => 1}); |
| 205 |
%item = ( a_modified => 'hashref' ); |
| 206 |
is_deeply( $cache->get_from_cache('test_deep_copy_hash'), { a_modified => 'hashref' }, 'A hash will not be deep copied when set in cache if the unsafe flag is set'); |
| 207 |
|
| 201 |
$item_from_cache = $cache->get_from_cache('test_deep_copy_hash', { unsafe => 1}); |
208 |
$item_from_cache = $cache->get_from_cache('test_deep_copy_hash', { unsafe => 1}); |
| 202 |
%$item_from_cache = ( another => 'hashref' ); |
209 |
%$item_from_cache = ( another => 'hashref' ); |
| 203 |
is_deeply( $cache->get_from_cache('test_deep_copy_hash'), { another => 'hashref' }, 'A hash will not be deep copied if the unsafe flag is set'); |
210 |
is_deeply( $cache->get_from_cache('test_deep_copy_hash'), { another => 'hashref' }, 'A hash will not be deep copied if the unsafe flag is set'); |
| 204 |
- |
|
|