File: 58_cache.t

package info (click to toggle)
libdbm-deep-perl 2.0008-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 884 kB
  • sloc: perl: 7,383; sql: 36
file content (21 lines) | stat: -rw-r--r-- 412 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use strict;
use warnings FATAL => 'all';

use Test::More;
use t::common qw( new_dbm );
use utf8;

use DBM::Deep;

my $dbm_factory = new_dbm();
while ( my $dbm_maker = $dbm_factory->() ) {
    my $db = $dbm_maker->();

    $db->{h} = {1,2};
    my $h = $db->{h};
    undef $h;  # now no longer cached
    $h = $db->{h};  # cached again
    ok $h, 'stale cache entries are not mistakenly reused';
}

done_testing;